Commit cb77997a authored by liuna's avatar liuna

2017年12月21日 智能分析平台提交内容

--修改
parent c341df48
......@@ -18,4 +18,6 @@ public interface QualityRuleReportDao extends JpaSpecificationExecutor<QualityRu
//根据筛选项筛选出质量规则报告
List<QualityRuleReport> findByDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInAndReportTypeInAndReportSumEndTimeBetweenOrderByReportSumEndTimeDesc(List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long> province,List<String> reportType, Timestamp startTime, Timestamp endTime);
//根据ID查询质量规则报告
QualityRuleReport findByQualityVerificationReportId(Long qualityVerificationReportId);
}
......@@ -184,7 +184,6 @@ public class QualityRuleMaintainController {
@RequestParam(value="repeatedCheckMaxTime") String repeatedCheckMaxTime,
@RequestParam(value="ifRepeatedCheckSummation") String ifRepeatedCheckSummation,
HttpServletResponse response,HttpServletRequest request) {
System.out.println("ruleType" + ruleType);
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
AccuracyRule accuracyRule = new AccuracyRule();
if (!ruleType.trim().equals("")) {
......@@ -257,7 +256,7 @@ public class QualityRuleMaintainController {
for(int i=0;i<kpi.split(",").length;i++){
kpiIdList.add(Long.parseLong(kpi.split(",")[i]));
}
List<QualityRule> qualityRuleList = new ArrayList<QualityRule>();
for(int j=0; j<provinceIdList.size(); j++) {
for(int l=0; l<kpiIdList.size(); l++){
QualityRule qualityRule = new QualityRule();
......@@ -278,33 +277,32 @@ public class QualityRuleMaintainController {
qualityRule.setKpiMonitorTime("ADD_MONTH("+frequencyValue+")");
}
}
if(!businessTime.trim().equals("")){ qualityRule.setBusinessTime(Timestamp.valueOf(businessTime)); }
if(!businessTime.trim().equals("")){ qualityRule.setBusinessTime(Timestamp.valueOf(businessTime+" 00:00:00")); }
if(!frequencyValue.trim().equals("")){
if(frequencyType.equals("0")){
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getTime()+Integer.parseInt(frequencyValue)*60*1000)));
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime+" 00:00:00").getTime()+Integer.parseInt(frequencyValue)*60*1000)));
} else if(frequencyType.equals("1")){
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getTime()+Integer.parseInt(frequencyValue)*60*60*1000)));
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime+" 00:00:00").getTime()+Integer.parseInt(frequencyValue)*60*60*1000)));
} else if(frequencyType.equals("2")){
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getTime()+Integer.parseInt(frequencyValue)*24*60*60*1000)));
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime+" 00:00:00").getTime()+Integer.parseInt(frequencyValue)*24*60*60*1000)));
} else if(frequencyType.equals("3")){
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getMonth()+Integer.parseInt(frequencyValue))));
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime+" 00:00:00").getMonth()+Integer.parseInt(frequencyValue))));
}
}
qualityRule.setRuleCrtTime(Timestamp.valueOf(sd.format(new Date())));
qualityRule.setRuleUpdateTime(Timestamp.valueOf(sd.format(new Date())));
qualityRule.setRuleValidFlag("1");
qualityRule.setIfSystemValue("1");
qualityRuleDao.save(qualityRule);
cmszOperationLogService.createLog("增加", "新建质量模型","");
Long qualityRuleId = qualityRule.getQualityRuleId();
if(!qualityRuleIdList.isEmpty()){
accuracyRuleService.updateAccuracyRuleByAccuracyRuleIds(qualityRuleId, qualityRuleIdList);
qualityRuleIdList.clear();
}
qualityRuleList.add(qualityRule);
}
}
qualityRuleService.insertIntoRule(qualityRuleList);
return "redirect:/AnalysisSupport/QualityRuleResult";
}
......
......@@ -3,10 +3,7 @@ package com.hp.cmsz.web.analysissupport;
import com.google.gson.Gson;
import com.hp.cmsz.commons.utils.ExportExcelUtil;
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.QualityRuleReportInfoDao;
import com.hp.cmsz.repository.*;
import com.hp.cmsz.service.BusinessService;
import com.hp.cmsz.service.ChannelService;
import com.hp.cmsz.service.CmszOperationLogService;
......@@ -63,6 +60,9 @@ public class QualityRuleReportController {
private QualityRuleReportService qualityRuleReportService;
@Autowired
private QualityRuleReportDao qualityRuleReportDao;
@Autowired
private QualityRuleInfoService qualityRuleInfoService;
@Autowired
......@@ -168,6 +168,26 @@ public class QualityRuleReportController {
return list;
}
//查看表格
@RequestMapping(value="/findReport",method = RequestMethod.GET)
@ResponseBody
public void findQuality(
@RequestParam(value = "qualityVerificationReportId") String qualityVerificationReportId,
HttpServletResponse response){
QualityRuleReport qualityRuleReport = qualityRuleReportDao.findByQualityVerificationReportId(Long.parseLong(qualityVerificationReportId));
Gson gson = new Gson();
response.setContentType("text/Xml;charset=gbk");
PrintWriter out = null;
try {
out = response.getWriter();
out.println(gson.toJson(qualityRuleReport));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//查看数据质量运营内容
@RequestMapping(value = "/findOperationFrame")
public ModelAndView findQuality(
......
......@@ -155,8 +155,7 @@ public class QualityRuleResultController {
//删掉质量规则
@RequestMapping(value = "/deleteOneRule*",method = RequestMethod.GET)
@ResponseBody
public void deleteRule(
public String deleteRule(
@RequestParam(value = "qualityRuleId") String qualityRuleId,
HttpServletResponse response){
List<Long> qualityRuleIdList = new ArrayList<Long>();
......@@ -168,21 +167,8 @@ public class QualityRuleResultController {
qualityRuleService.deleteByQualityRuleId(qualityRuleIdList);
accuracyRuleService.deleteAccuracyRuleByQualityRuleId(qualityRuleIdList);
cmszOperationLogService.createLog("删除","更新质量规则","quality_rule_warehouse_info_t. QUALITY_RULE_ID="+qualityRuleId);
//刷新模型表格
List<QualityRule> qualityRuleList = (List<QualityRule>) qualityRuleDao.findAll();
staticQualityRuleList = qualityRuleList;
Gson gson = new Gson();
response.setContentType("text/Xml;charset=gbk");
PrintWriter out = null;
try {
out = response.getWriter();
out.println(gson.toJson(qualityRuleList));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return PageURLController.RuleResult;
}
//查看准确性规则内容
......
......@@ -62,9 +62,6 @@
<c:if test="${dataSource.dataSourceId == '5'}">
<option value="${dataSource.dataSourceId}" selected>${dataSource.dataSourceName}</option>
</c:if >
<c:if test="${dataSource.dataSourceId != '5'}">
<option value="${dataSource.dataSourceId}" >${dataSource.dataSourceName}</option>
</c:if >
</c:forEach>
</select></td>
</tr>
......@@ -487,16 +484,20 @@ $("#calCycle").change(function () {
updateBusiness($("#dataSource").val(),$("#channel").val());
$("#frequencyValue").val("30");
function updateBusinessTime(calCycleValue) {
if(calCycleValue == "30MI"){
$("#monitorTime");
$("#frequencyValue").val("30");
$("#frequencyType").val(0);
}else if(calCycleValue == "01HR"){
$("#monitorTime");
$("#frequencyValue").val("1");
$("#frequencyType").val(1);
}else if(calCycleValue == "01DY"){
$("#monitorTime");
$("#frequencyValue").val("1");
$("#frequencyType").val(2);
}else if(calCycleValue == "01MO"){
$("#monitorTime");
$("#frequencyValue").val("1");
$("#frequencyType").val(3);
}
}
......
......@@ -11,7 +11,7 @@
<table class="table table-hover table-striped">
<thead>
<tr>
<th width="6.4%">质量规则ID</th>
<%--<th width="6.4%">质量规则ID</th>--%>
<th width="6.4%">省份</th>
<th width="6.4%">数据来源</th>
<th width="6.4%">渠道</th>
......@@ -22,6 +22,7 @@
<th width="6.4%">告警原因</th>
<th width="6.4%">数据时间</th>
<th width="6.4%">告警时间</th>
<th width="6.4%">查看规则</th>
<%--<th width="6.4%">是否过滤</th>--%>
</tr>
</thead>
......@@ -29,7 +30,7 @@
<c:forEach items="${qualityRuleInfoPage.content}" var="qualityRuleInfo">
<tr>
<td><a href='javascript:;' onclick='selectRule(${qualityRuleInfo.qualityRuleId})'>${qualityRuleInfo.qualityRuleId}</a></td>
<td>${qualityRuleInfo.provinceName} </td>
<td>${qualityRuleInfo.dataSourceName}</td>
<td>${qualityRuleInfo.channelName}</td>
......@@ -40,6 +41,7 @@
<td>${qualityRuleInfo.warningReason}</td>
<td><fmt:formatDate value="${qualityRuleInfo.kpiMonitorRunTime}" pattern="yyyy-MM-dd hh:mm" /></td>
<td><fmt:formatDate value="${qualityRuleInfo.businessTime}" pattern="yyyy-MM-dd hh:mm" /></td>
<td><a href='javascript:;' onclick='selectRule(${qualityRuleInfo.qualityRuleId})'>查看规则</a></td>
<%--<td>--%>
<%--<c:if test="${qualityRuleInfo.ifFilter == '1'}">无过滤规则</c:if>--%>
<%--<c:if test="${qualityRuleInfo.ifFilter == '0'}">过滤</c:if>--%>
......
......@@ -331,7 +331,7 @@ table_pagging.prototype = {
}
if(k==1){
tdContext = "<a href='javascript:;' onclick=\"selectOperation("+i+")\" alt='\"+i+\"'>"+this.getData(this.objectlist[i],this.header[k][1])+"</a>";
tdContext = "<a href='javascript:;' onclick='selectOperation(\""+this.getData(this.objectlist[i],"qualityVerificationReportId")+"\")'>"+this.getData(this.objectlist[i],this.header[k][1])+"</a>";
}
}
......@@ -555,73 +555,81 @@ function queryResult(page) {
}
//查看数据质量运营
function selectOperation(i){
console.log(jsonData[i])
if(jsonData[i].integralityNum==undefined){
jsonData[i].integralityNum="";
function selectOperation(qualityVerificationReportId) {
$.ajax({
type: 'GET',
contentType: 'application/json',
url: "/AnalysisSupport/QualityRuleReport/findReport?qualityVerificationReportId=" + qualityVerificationReportId,
dataType: 'text',
beforeSend: function (data) {
},
success: function (data) {
data = JSON.parse(data)
if (data.integralityNum == undefined) {
data.integralityNum = "";
}
if(jsonData[i].integralityPro==undefined){
jsonData[i].integralityPro="";
}else{
jsonData[i].integralityPro=(jsonData[i].integralityPro*100).toFixed(0)+"%";
if (data.integralityPro == undefined) {
data.integralityPro = "";
} else {
data.integralityPro = (data.integralityPro * 100).toFixed(0) + "%";
}
if(jsonData[i].timelyNum==undefined){
jsonData[i].timelyNum="";
if (data.timelyNum == undefined) {
data.timelyNum = "";
}
if(jsonData[i].timelyPro==undefined){
jsonData[i].timelyPro="";
}else {
jsonData[i].timelyPro=(jsonData[i].timelyPro*100).toFixed(0)+"%";
if (data.timelyPro == undefined) {
data.timelyPro = "";
} else {
data.timelyPro = (data.timelyPro * 100).toFixed(0) + "%";
}
if(jsonData[i].accuracyNum==undefined){
jsonData[i].accuracyNum="";
if (data.accuracyNum == undefined) {
data.accuracyNum = "";
}
if(jsonData[i].accuracyPro==undefined){
jsonData[i].accuracyPro="";
}else {
jsonData[i].accuracyPro=(jsonData[i].accuracyPro*100).toFixed(0)+"%";
if (data.accuracyPro == undefined) {
data.accuracyPro = "";
} else {
data.accuracyPro = (data.accuracyPro * 100).toFixed(0) + "%";
}
$.dialog({
title:"数据质量运营明细",
content:"<div class='dialog-p' style='max-height: 560px; overflow-y: scroll; overflow-x: auto;'>" +
title: "数据质量运营明细",
content: "<div class='dialog-p' style='max-height: 560px; overflow-y: scroll; overflow-x: auto;'>" +
" <div class='col-xs-12'>" +
" <div class='panel panel-default'>" +
" <div class='panel-heading'>质量规则报告预览</div>" +
" <div class='panel-body'>"+
" <table class='table table-vertical'>"+
" <tr><td>"+
" <div class='panel-body'>" +
" <table class='table table-vertical'>" +
" <tr><td>" +
" <table class='table table-vertical'>" +
" <tr>" +
" <td width='10%'>省份</td>" +
" <td>"+jsonData[i].provinceName+"</td>" +
" <td>" + data.provinceName + "</td>" +
" <td width='10%'>数据来源</td>" +
" <td>"+jsonData[i].dataSourceName+"</td>" +
" <td>" + data.dataSourceName + "</td>" +
" <td width='10%'>业务</td>" +
" <td>"+jsonData[i].businessName+"</td>" +
" <td>" + data.businessName + "</td>" +
" </tr>" +
" <tr>" +
" <td width='10%'>渠道</td>" +
" <td>"+jsonData[i].channelName+"</td>" +
" <td>" + data.channelName + "</td>" +
" <td>指标名称</td>" +
" <td>"+jsonData[i].kpiName+"</td>" +
" <td>" + data.kpiName + "</td>" +
" <td>指标编码</td>" +
" <td>"+jsonData[i].kpiCode+"</td>" +
" <td>" + data.kpiCode + "</td>" +
" </tr>" +
" <tr>" +
" <td>完整性数量</td>" +
" <td>"+jsonData[i].integralityNum+"</td>" +
" <td>" + data.integralityNum + "</td>" +
" <td>完整性占比</td>" +
" <td>"+jsonData[i].integralityPro+"</td>" +
" <td>" + data.integralityPro + "</td>" +
" <td>及时性数量</td>" +
" <td>"+jsonData[i].timelyNum+"</td>" +
" <td>" + data.timelyNum + "</td>" +
" </tr>" +
" <tr>" +
" <td>及时性占比</td>" +
" <td>"+jsonData[i].timelyPro+"</td>" +
" <td>" + data.timelyPro + "</td>" +
" <td>准确性数量</td>" +
" <td>"+jsonData[i].accuracyNum+"</td>" +
" <td>" + data.accuracyNum + "</td>" +
" <td>准确性占比</td>" +
" <td>"+jsonData[i].accuracyPro+"</td>" +
" <td>" + data.accuracyPro + "</td>" +
" </tr>" +
" <tr>" +
" <td colspan='8' align='center'>质量异常明细展示</td>" +
......@@ -629,15 +637,17 @@ function selectOperation(i){
" <tr>" +
" <td colspan='8'>" +
" <div class='panel-body'>" +
" <div style='width: 800px; height: 500px;overflow-y: scroll' id='dataForm' ></div>"+
" <div style='width: 800px; height: 500px;overflow-y: scroll' id='dataForm' ></div>" +
" </div>" +
" </td>" +
" </tr>" +
"</table>",
lock:true,
width:800,
initialize:function() {
queryOperation(1,jsonData[i].provinceId,jsonData[i].kpiId,jsonData[i].reportSumStartTime,jsonData[i].reportSumEndTime);
lock: true,
width: 800,
initialize: function () {
queryOperation(1, data.provinceId, data.kpiId, data.reportSumStartTime, data.reportSumEndTime);
}
});
}
});
}
\ No newline at end of file
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