Commit 9286ac9c authored by 胡斌's avatar 胡斌

Merge remote-tracking branch 'origin/liuna'

# Conflicts: # .idea/workspace.xml
parents 109d4a64 8c943857
......@@ -17,6 +17,9 @@ public interface QualityRuleInfoDao extends JpaSpecificationExecutor<QualityRule
@Query("from QualityRuleInfo qualityRuleInfo where qualityRuleInfo.businessTime between timestampadd(M,-1,getdate()) and getdate() order by qualityRuleInfo.businessTime Desc")
List<QualityRuleInfo> findQualityRuleInfo();
//根据质量规则ID查找质量规则
QualityRuleInfo findByQualityRuleId(Long qualityRuleId);
//根据筛选项查找
List<QualityRuleInfo> findByBusinessTimeBetweenAndDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInAndIfFilterInOrderByBusinessTimeDesc(Timestamp time1, Timestamp time2, List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long> province, List<Long> ifFilter);
List<QualityRuleInfo> findByDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInAndIfFilterInAndBusinessTimeBetweenOrderByBusinessTimeDesc(List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long> province, List<Long> ifFilter,Timestamp startTime, Timestamp endTime);
}
......@@ -10,6 +10,9 @@ public interface QualityRuleViewDao extends JpaSpecificationExecutor<QualityRule
PagingAndSortingRepository<QualityRuleView, Long> {
//根据质量规则ID查找一条记录
QualityRuleView findByQualityRuleId(Long qualityRuleId);
//根据筛选项得到质量规则
List<QualityRuleView> findByDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInOrderByQualityRuleIdAscBusinessTimeDesc(List<Long> dataSource,List<Long> chnnal,List<Long> busines,List<Long>province);
}
......@@ -23,8 +23,8 @@ public class QualityRuleInfoService {
}
//根据筛选项获取质量规则
public List<QualityRuleInfo> getQualityRuleInfoBy(Timestamp time1 , Timestamp time2, List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long>province, List<Long> ifFilter){
return qualityRuleInfoDao.findByBusinessTimeBetweenAndDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInAndIfFilterInOrderByBusinessTimeDesc(time1, time2,dataSource,chnnal,busines,province,ifFilter);
public List<QualityRuleInfo> getQualityRuleInfoBy(List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long>province, List<Long> ifFilter,Timestamp startTime, Timestamp endTime){
return qualityRuleInfoDao.findByDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInAndIfFilterInAndBusinessTimeBetweenOrderByBusinessTimeDesc(dataSource,chnnal,busines,province,ifFilter,startTime, endTime);
}
}
......@@ -3,9 +3,7 @@ package com.hp.cmsz.web.analysissupport;
import com.google.gson.Gson;
import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.DataSourceDao;
import com.hp.cmsz.repository.KpiDao;
import com.hp.cmsz.repository.ProvinceDao;
import com.hp.cmsz.repository.*;
import com.hp.cmsz.service.BusinessService;
import com.hp.cmsz.service.ChannelService;
import com.hp.cmsz.service.CmszOperationLogService;
......@@ -58,6 +56,9 @@ public class QualityRuleOperationController {
private DataSourceDao dataSourceDao;
@Autowired
private QualityRuleViewDao qualityRuleViewDao;
@Autowired
private QualityRuleInfoService qualityRuleInfoService;
@Autowired
......@@ -118,15 +119,14 @@ public class QualityRuleOperationController {
String[] bussinesS =bussines.split(",");
String[] provinceS=province.split(",");
String[] ifFilterS=ifFilter.split(",");
Timestamp time1=new Timestamp(format.parse(dates[0]).getTime());
Timestamp time2=new Timestamp(format.parse(dates[1]).getTime());
Timestamp startTime= Timestamp.valueOf(dates[0]);
Timestamp endTime=Timestamp.valueOf(dates[1]);
List<Long> dataSourceList=changeStrToList(dataSourceS);
List<Long> chnnalList=changeStrToList(chnnalS);
List<Long> bussinesList=changeStrToList(bussinesS);
List<Long> provinceList=changeStrToList(provinceS);
List<Long> ifFilterList=changeStrToList(ifFilterS);
System.out.println("time:"+time1+time2+"data"+dataSourceList+"busin"+bussinesList+"procin"+provinceList+"if"+ifFilterList);
qualityRuleInfoList = qualityRuleInfoService.getQualityRuleInfoBy(time1,time2,dataSourceList,chnnalList,bussinesList,provinceList,ifFilterList);
qualityRuleInfoList = qualityRuleInfoService.getQualityRuleInfoBy(dataSourceList,chnnalList,bussinesList,provinceList,ifFilterList,startTime,endTime);
Gson gson = new Gson();
response.setContentType("text/Xml;charset=gbk");
PrintWriter out = null;
......@@ -148,4 +148,27 @@ public class QualityRuleOperationController {
return list;
}
//查看数据质量规则内容
@RequestMapping(value = "/findQuality*",method = RequestMethod.GET)
@ResponseBody
public void findQuality(
@RequestParam(value = "qualityRuleId") String qualityRuleId,
HttpServletResponse response){
QualityRuleView qualityRuleView = qualityRuleViewDao.findByQualityRuleId(Long.parseLong(qualityRuleId));
System.out.println(qualityRuleView);
cmszOperationLogService.createLog("查询","数据质量规则","查询数据质量规则");
Gson gson = new Gson();
response.setContentType("text/Xml;charset=gbk");
PrintWriter out = null;
try {
out = response.getWriter();
out.println(gson.toJson(qualityRuleView));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
......@@ -520,12 +520,12 @@ table_pagging.prototype = {
}
//查看准确性规则
//查看数据质量规则规则
function selectRule(qualityRuleId){
$.dialog({
title:"准确性规则",
title:"数据质量规则",
content:"<div id='ruleList'>"+
"<div class='col-xs-12'><div class='panel panel-default'><div class='panel-heading'>规则参数列表</div><div class='panel-body'> <table class='table table-hover table-striped'> <thead> <tr> <th width=''>规则类型</th> <th width=''>范围最大值</th> <th width=''>范围最小值</th> <th width=''>重复考核粒度</th> <th width=''>重复考核开始时间</th> <th width=''>重复考核结束时间</th> <th width=''>重复是否连续</th> <th width=''>重复最大次数</th> <th width=''>数据是否累计</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div>"+
"<div class='col-xs-12'><div class='panel panel-default'><div class='panel-heading'>规则参数列表</div><div class='panel-body'> <table class='table table-hover table-striped'> <thead> <tr> <th width=''>省份</th> <th width=''>数据来源</th> <th width=''>渠道</th> <th width=''>业务</th> <th width=''>指标名称</th> <th width=''>指标编码</th> <th width=''>数据类型</th> <th width=''>数据采集频率</th> <th width=''>指标监控范围</th> <th width=''>指标采集时间</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div>"+
"</div>",
lock:true,
width:800,
......@@ -533,62 +533,40 @@ function selectRule(qualityRuleId){
$.ajax({
type : 'GET',
contentType : 'application/json',
url: "/AnalysisSupport/QualityRuleResult/findAccuracy?qualityRuleId="+qualityRuleId,
url: "/AnalysisSupport/QualityRuleOperation/findQuality?qualityRuleId="+qualityRuleId,
dataType : 'text',
beforeSend: function(data) {
},
success: function(data) {
for (var i = 0; i < data.length; i++) {
if (data[i] == '\"') {
data = data.replace('\"', '\'');
var ruleTbody = $('#ruleList tbody');
data = JSON.parse(data)
if(data.kpiMonitorTime.indexOf("/")!=-1){
var a = new Array();
a = data.kpiMonitorTime.split("/");
if(a[1] == "1440") {
data.kpiMonitorTime = a[0] + "分钟";
}else if(a[1] == "24"){
data.kpiMonitorTime = a[0] + "小时";
}
}
data = eval("(" + data + ")");
if (data != null && data != "") {
var ruleTbody = $('#ruleList tbody');
for (var i = 0; i < data.length; i++) {
if(data[i].ifRepeatedCheckSeries == "0"){
data[i].ifRepeatedCheckSeries = "否";
} else if(data[i].ifRepeatedCheckSeries =="1") {
data[i].ifRepeatedCheckSeries ="是";
}
if(data[i].ifRepeatedCheckSummation == "0"){
data[i].ifRepeatedCheckSummation = "否";
} else if(data[i].ifRepeatedCheckSummation =="1"){
data[i].ifRepeatedCheckSummation ="是";
}
if(data[i].repeatedCheckStartTime != null){
data[i].repeatedCheckStartTime = df.format(new Date(data[i].repeatedCheckStartTime));
}
if(data[i].repeatedCheckEndTime != null){
data[i].repeatedCheckEndTime = df.format(new Date(data[i].repeatedCheckEndTime));
}
if(data[i].scopeMaxValue != null){
data[i].scopeMaxValue =parseFloat(data[i].scopeMaxValue);
}
if(data[i].scopeMinValue != null){
data[i].scopeMinValue =parseFloat(data[i].scopeMinValue);
}
if(data[i].repeatedCheckGranularity =="day"){
data[i].repeatedCheckGranularity ="日";
}else if(data[i].repeatedCheckGranularity =="mon"){
data[i].repeatedCheckGranularity ="月";
}
ruleTbody.append($("<tr></tr>").append("<td>" + data[i].ruleType + "</td>")
.append("<td>" + (data[i].scopeMaxValue == null ? "无" : data[i].scopeMaxValue) + "</td>")
.append("<td>" + (data[i].scopeMinValue == null ? "无" : data[i].scopeMinValue) + "</td>")
.append("<td>" + (data[i].repeatedCheckGranularity == null ? "无" : data[i].repeatedCheckGranularity) + "</td>")
.append("<td>" + (data[i].repeatedCheckStartTime == null ? "无" : data[i].repeatedCheckStartTime) + "</td>")
.append("<td>" + (data[i].repeatedCheckEndTime == null ? "无" : data[i].repeatedCheckEndTime) + "</td>")
.append("<td>" + (data[i].ifRepeatedCheckSeries == null ? "无" : data[i].ifRepeatedCheckSeries) + "</td>")
.append("<td>" + (data[i].repeatedCheckMaxTime == null ? "无" : data[i].repeatedCheckMaxTime) + "</td>")
.append("<td>" + (data[i].ifRepeatedCheckSummation == null ? "无" : data[i].ifRepeatedCheckSummation) + "</td>"));
} else {
if (data.kpiMonitorTime.indexOf("ADD") != -1) {
data.kpiMonitorTime = data.kpiMonitorTime.substring(data.kpiMonitorTime.indexOf("(") + 1, data.kpiMonitorTime.length - 1) + "个月"
} else {
data.kpiMonitorTime = data.kpiMonitorTime + "天";
}
}
}
ruleTbody.append($("<tr></tr>")
.append("<td>" + data.provinceName + "</td>")
.append("<td>" + data.dataSourceName + "</td>")
.append("<td>" + data.channelName + "</td>")
.append("<td>" + data.businessName + "</td>")
.append("<td>" + data.kpiName + "</td>")
.append("<td>" + data.kpiCode + "</td>")
.append("<td>" + data.kpiTypeName + "</td>")
.append("<td>" + data.calCycle + "</td>")
.append("<td>" + data.kpiMonitorTime + "</td>")
.append("<td>" + data.businessTime + "</td>"));
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment