Commit 6107fd18 authored by liuna's avatar liuna

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

--解决数据质量规则新增和修改规则问题
parent 700c6ca7
......@@ -125,4 +125,23 @@ public class AccuracyRule implements Serializable {
this.validFlag = validFlag;
}
@Override
public String toString() {
return "AccuracyRule{" +
"accuracyRuleId=" + accuracyRuleId +
", qualityRuleId=" + qualityRuleId +
", ruleType='" + ruleType + '\'' +
", scopeMaxValue='" + scopeMaxValue + '\'' +
", scopeMinValue='" + scopeMinValue + '\'' +
", repeatedCheckGranularity='" + repeatedCheckGranularity + '\'' +
", repeatedCheckStartTime=" + repeatedCheckStartTime +
", repeatedCheckEndTime=" + repeatedCheckEndTime +
", ifRepeatedCheckSeries='" + ifRepeatedCheckSeries + '\'' +
", repeatedCheckMaxTime=" + repeatedCheckMaxTime +
", ifRepeatedCheckSummation='" + ifRepeatedCheckSummation + '\'' +
", ruleCrtTime=" + ruleCrtTime +
", ruleUpdateTime=" + ruleUpdateTime +
", validFlag='" + validFlag + '\'' +
'}';
}
}
......@@ -33,8 +33,13 @@ public interface AccuracyRuleDao extends JpaSpecificationExecutor<AccuracyRule>,
//根据准确性规则ID更新准确性规则信息
@Modifying
@Query("update AccuracyRule ar set ar.ruleType=:ruleType, ar.scopeMaxValue=:scopeMaxValue, ar.scopeMinValue=:scopeMinValue, ar.repeatedCheckGranularity=:repeatedCheckGranularity, ar.repeatedCheckStartTime=:repeatedCheckStartTime, ar.repeatedCheckEndTime=:repeatedCheckEndTime, ar.ifRepeatedCheckSeries=:ifRepeatedCheckSeries, ar.repeatedCheckMaxTime=:repeatedCheckMaxTime, ar.ifRepeatedCheckSummation=:ifRepeatedCheckSummation where ar.accuracyRuleId =:accuracyRuleId")
void updateAccuracyRuleByAccuracyRuleId(@Param("ruleType")String ruleType,@Param("scopeMaxValue")Double scopeMaxValue,@Param("scopeMinValue")Double scopeMinValue,@Param("repeatedCheckGranularity")String repeatedCheckGranularity,@Param("repeatedCheckStartTime")Date repeatedCheckStartTime,@Param("repeatedCheckEndTime")Date repeatedCheckEndTime,@Param("ifRepeatedCheckSeries")String ifRepeatedCheckSeries,@Param("repeatedCheckMaxTime")Long repeatedCheckMaxTime,@Param("ifRepeatedCheckSummation")String ifRepeatedCheckSummation,@Param("accuracyRuleId")Long accuracyRuleId);
@Query("update AccuracyRule ar set ar.repeatedCheckGranularity=:repeatedCheckGranularity, ar.repeatedCheckStartTime=:repeatedCheckStartTime, ar.repeatedCheckEndTime=:repeatedCheckEndTime, ar.ifRepeatedCheckSeries=:ifRepeatedCheckSeries, ar.repeatedCheckMaxTime=:repeatedCheckMaxTime, ar.ifRepeatedCheckSummation=:ifRepeatedCheckSummation where ar.accuracyRuleId =:accuracyRuleId")
void updateAccuracyRuleByAccuracyRuleId(@Param("repeatedCheckGranularity")String repeatedCheckGranularity,@Param("repeatedCheckStartTime")Date repeatedCheckStartTime,@Param("repeatedCheckEndTime")Date repeatedCheckEndTime,@Param("ifRepeatedCheckSeries")String ifRepeatedCheckSeries,@Param("repeatedCheckMaxTime")Long repeatedCheckMaxTime,@Param("ifRepeatedCheckSummation")String ifRepeatedCheckSummation,@Param("accuracyRuleId")Long accuracyRuleId);
//根据准确性ID更新范围类信息
@Modifying
@Query("update AccuracyRule ar set ar.scopeMaxValue=:scopeMaxValue, ar.scopeMinValue=:scopeMinValue where ar.accuracyRuleId =:accuracyRuleId")
void updateByAccuracyRuleId(@Param("scopeMaxValue")Double scopeMaxValue,@Param("scopeMinValue")Double scopeMinValue);
//根据准确性规则ID删除一条准确性规则信息
@Modifying
......
......@@ -37,7 +37,9 @@ public interface KpiDao extends JpaSpecificationExecutor<Kpi>,PagingAndSortingRe
@Query("select kpi.kpiId, kpi.kpiName from Kpi kpi where kpi.kpiId >=0")
List<Object[]> findAllKpiIdAndKpiName();
//由数据来源得到指标
//由指标得到业务ID
@Query("select businessId from Kpi kpi where kpiId=:kpiId")
Long findBusinessIdByKpiId(@Param("kpiId") Long kpiId);
//由指标名得到指标周期类型
......
......@@ -27,6 +27,10 @@ public interface QualityRuleDao extends JpaSpecificationExecutor<QualityRule>,
//根据质量规则ID查找质量规则
List<QualityRule> findByQualityRuleIdIn(List<Long> qualityRuleId);
//根据kpiId查看是否已经存在
@Query("select qr.kpiId from QualityRule qr where qr.kpiId in (:kpiIdList) ")
List<Long> findByKpiIds(@Param("kpiIdList") List<Long> kpiIdList);
//根据质量规则ID删除质量规则
@Modifying
@Query("delete from QualityRule qr where qr.qualityRuleId in (:qualityRuleId)")
......@@ -34,8 +38,8 @@ public interface QualityRuleDao extends JpaSpecificationExecutor<QualityRule>,
//根据质量规则ID修改质量规则
@Modifying
@Query("update from QualityRule qr set qr.kpiMonitorTime=:kpiMonitorTime, qr.kpiMonitorRunTime=:kpiMonitorRunTime, qr.businessTime=:businessTime, qr.ruleUpdateTime=:ruleUpdateTime where qr.qualityRuleId=:qualityRuleId")
void updateQualityRuleByQualityRuleId(@Param("kpiMonitorTime")String kpiMonitorTime,@Param("kpiMonitorRunTime")Timestamp kpiMonitorRunTime,@Param("businessTime")Timestamp businessTime,@Param("ruleUpdateTime")Timestamp ruleUpdateTime,@Param("qualityRuleId")Long qualityRuleId);
@Query("update from QualityRule qr set qr.kpiMonitorTime=:kpiMonitorTime, qr.kpiMonitorRunTime=:kpiMonitorRunTime, qr.businessTime=:businessTime, qr.ruleUpdateTime=:ruleUpdateTime, qr.frequencyValue=:frequencyValue,qr.frequencyType=:frequencyType where qr.qualityRuleId=:qualityRuleId")
void updateQualityRuleByQualityRuleId(@Param("kpiMonitorTime")String kpiMonitorTime,@Param("kpiMonitorRunTime")Timestamp kpiMonitorRunTime,@Param("businessTime")Timestamp businessTime,@Param("ruleUpdateTime")Timestamp ruleUpdateTime,@Param("frequencyValue")Long frequencyValue,@Param("frequencyType")Long frequencyType,@Param("qualityRuleId")Long qualityRuleId);
//根据质量规则ID得到数据条数
@Query("select count(*) from QualityRule qualityRule where qualityRule.qualityRuleId=:qualityRuleId")
......
......@@ -29,10 +29,16 @@ public class AccuracyRuleService {
//根据准确性规则ID更新准确性规则
@Transactional(readOnly=false)
public void updateAccuracyRuleByAccuracyRuleId(String ruleType,Double scopeMaxValue,Double scopeMinValue,String repeatedCheckGranularity,Date repeatedCheckStartTime,Date repeatedCheckEndTime,String ifRepeatedCheckSeries,Long repeatedCheckMaxTime,String ifRepeatedCheckSummation,Long accuracyRuleId){
accuracyRuleDao.updateAccuracyRuleByAccuracyRuleId(ruleType, scopeMaxValue, scopeMinValue, repeatedCheckGranularity, repeatedCheckStartTime, repeatedCheckEndTime, ifRepeatedCheckSeries, repeatedCheckMaxTime, ifRepeatedCheckSummation,accuracyRuleId);
public void updateAccuracyRuleByAccuracyRuleId(String repeatedCheckGranularity,Date repeatedCheckStartTime,Date repeatedCheckEndTime,String ifRepeatedCheckSeries,Long repeatedCheckMaxTime,String ifRepeatedCheckSummation,Long accuracyRuleId){
accuracyRuleDao.updateAccuracyRuleByAccuracyRuleId(repeatedCheckGranularity, repeatedCheckStartTime, repeatedCheckEndTime, ifRepeatedCheckSeries, repeatedCheckMaxTime, ifRepeatedCheckSummation,accuracyRuleId);
}
@Transactional(readOnly = false)
public void updateByAccuracyRuleId(Double scopeMaxValue, Double scopeMinValue) {
accuracyRuleDao.updateByAccuracyRuleId(scopeMaxValue,scopeMinValue);
}
//根据准确性规则ID删除一条准确性规则信息
@Transactional(readOnly=false)
public void deleteAccuracyRuleByAccuracyRuleId(Long accuracyRuleId){
......
......@@ -46,7 +46,7 @@ public class QualityRuleService {
//根据质量规则ID修改质量规则
@Transactional(readOnly=false)
public void updateByQualityRuleId(String kpiMonitorTime,Timestamp kpiMonitorRunTime,Timestamp businessTime,Timestamp ruleUpdateTime,Long qualityRuleId){
qualityRuleDao.updateQualityRuleByQualityRuleId(kpiMonitorTime,kpiMonitorRunTime,businessTime,ruleUpdateTime,qualityRuleId);
public void updateByQualityRuleId(String kpiMonitorTime,Timestamp kpiMonitorRunTime,Timestamp businessTime,Timestamp ruleUpdateTime,Long frequencyValue,Long frequencyType,Long qualityRuleId){
qualityRuleDao.updateQualityRuleByQualityRuleId(kpiMonitorTime,kpiMonitorRunTime,businessTime,ruleUpdateTime,frequencyValue,frequencyType,qualityRuleId);
}
}
......@@ -109,7 +109,7 @@
<option value="3"></option>
</select></td>
</tr>
<tr><td>监控时间(<font color="red">必填</font>):</td>
<tr><td>核查时间(<font color="red">必填</font>):</td>
<td id="businessTimetd">
<input type='text' class='form-control' id='businessTime' name='businessTime' onfocus='WdatePicker({dateFmt:"yyyy-MM-dd HH:mm:00",startDate:"%y-%M-%d 00:00:00",readOnly:false,hmsMenuCfg : {H : [ 1, 6 ], m : [ 30, 2 ], s : [ 60, 0 ]},alwaysUseStartDate:true})'/>
</td>
......@@ -263,6 +263,10 @@ $("#addParam").click(function(){
//form表单提交
$("#ruleSubmit").click(function(){
$.dialog({
title: "提醒",
content:"确定新增该规则吗?",
ok: function(){
if($.trim($("#frequencyValue").val())==""){
$.alert("监控延迟时间不能为空");
}else if($("#businessTime").val()==""){
......@@ -309,7 +313,7 @@ $("#addParam").click(function(){
$.ajax({
type : "GET",
contentType : "application/json",
url: "${ctx}/AnalysisSupport/QualityRuleMaintain/createAccuracyRule?ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&scopeMinValue="+ifRepeatedCheckSeries+"&ifRepeatedCheckSeries="+repeatedCheckMaxTime+"&repeatedCheckMaxTime="+ifRepeatedCheckSummation+"&ifRepeatedCheckSummation=",
url: "${ctx}/AnalysisSupport/QualityRuleMaintain/createAccuracyRule?ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation,
dataType : "text",
async: false,
beforeSend: function(data) {},
......@@ -381,6 +385,13 @@ $("#addParam").click(function(){
}
}
},
okValue:"确定",
cancel: function(){},
cancelValue:"返回",
lock:true
});
});
$("#ruleBack").click(function(){
......
......@@ -71,7 +71,7 @@
质量规则查询结果
<shiro:hasAnyRoles name="admin,dataAnalysis,businessAnalysis">
<div id="time_div" style="top: -6px;float: right;height: 0px;position: relative;">
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" style="color: red" id="deleteRule" disabled>删除规则</button>
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" style="background-color: red" id="deleteRule" disabled>删除规则</button>
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="updateRule" disabled>修改规则</button>
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="createRule">新建规则</button>
</div>
......@@ -95,6 +95,21 @@
</div>
<script type="text/javascript" src="${ctx}/static/js/ruleResultDetailTable.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var url = decodeURI(window.location.search);
var a = url.split("?")[1];
if (a =="sr=1"){
$.dialog({
content:"成功生成数据质量规则!"
})
}else if (a =="sr=2"){
$.dialog({
content:"已经存在此kpiId的数据质量规则!"
})
}
console.log(url.split("?")[1]);
});
var receiveRulePageNum = "${rulePageNum}";
ruleResultDetailTable();
......
......@@ -134,11 +134,11 @@ function ruleResultDetailTable(){
header[2] = ["业务","businessName","7%","15"];
header[3] = ["指标名称","kpiName","7%","15"];
header[4] = ["指标编码","kpiCode","7%","15"];
// header[5] = ["数据类型","kpiTypeName","7%","15"];
header[5] = ["数据采集频率","calCycle","7%","15"];
header[6] = ["监控延迟时间","kpiMonitorTime","7%","15"];
// header[11] = ["指标采集时间","businessTime","7%","15"];
header[7] = ["准确性规则","accuracyRuleId","7%","15"];
header[5] = ["数据类型","kpiTypeName","7%","15"];
header[6] = ["数据采集频率","calCycle","7%","15"];
header[7] = ["监控延迟时间","kpiMonitorTime","7%","15"];
header[8] = ["核查时间","businessTime","7%","15"];
header[9] = ["准确性规则","accuracyRuleId","7%","15"];
window.pagging = new table_pagging({limit:12,tableId:'ruleResultTable',header:header});
pagging.pagging(jsonData);
......@@ -301,7 +301,7 @@ table_pagging.prototype = {
tdContext = "&nbsp;";
}
if(k==6){
if(k==7){
if(tdContext.indexOf("/")!=-1){
var a = new Array();
a = tdContext.split("/");
......@@ -319,13 +319,13 @@ table_pagging.prototype = {
}
}
// if(k==11){
//
// if(tdContext!="&nbsp;"){
// tdContext = df.format(new Date(tdContext));
// }
// }
if(k==7){
if(k==8){
if(tdContext!="&nbsp;"){
tdContext = df.format(new Date(tdContext));
}
}
if(k==9){
tdContext = "<a href='javascript:;' onclick='selectRule(\""+this.getData(this.objectlist[i],"qualityRuleId")+"\")'>查看规则</a>";
}
......
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