Commit 1ba4a8ac authored by liuna's avatar liuna

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

--数据质量核查下质量规则修改页面完成
parent 8c943857
This diff is collapsed.
......@@ -34,6 +34,8 @@ public class QualityRule {
private Timestamp ruleUpdateTime;//规则更新时间
private String ruleValidFlag;//规则是否有效
private String ifSystemValue;
private Long frequencyValue;//kpiMonitorTime的值
private Long frequencyType;//kpiMonitorTime的单位
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="QualityRuleSequence")
......@@ -117,6 +119,22 @@ public class QualityRule {
this.ifSystemValue = ifSystemValue;
}
public Long getFrequencyValue() {
return frequencyValue;
}
public void setFrequencyValue(Long frequencyValue) {
this.frequencyValue = frequencyValue;
}
public Long getFrequencyType() {
return frequencyType;
}
public void setFrequencyType(Long frequencyType) {
this.frequencyType = frequencyType;
}
@Override
public String toString() {
return "QualityRule{" +
......@@ -127,12 +145,14 @@ public class QualityRule {
", provinceId=" + provinceId +
", dataSourceId=" + dataSourceId +
", kpiMonitorTime='" + kpiMonitorTime + '\'' +
", kpiMonitorRunTime='" + kpiMonitorRunTime + '\'' +
", kpiMonitorRunTime=" + kpiMonitorRunTime +
", businessTime=" + businessTime +
", ruleCrtTime=" + ruleCrtTime +
", ruleUpdateTime=" + ruleUpdateTime +
", ruleValidFlag='" + ruleValidFlag + '\'' +
", ifSystemValue='" + ifSystemValue + '\'' +
", frequencyValue=" + frequencyValue +
", frequencyType=" + frequencyType +
'}';
}
}
......@@ -34,8 +34,8 @@ public interface QualityRuleDao extends JpaSpecificationExecutor<QualityRule>,
//根据质量规则ID修改质量规则
@Modifying
@Query("update from QualityRule qr set qr.businessId=:businessId, qr.kpiId=:kpiId, qr.channelId=:channelId, qr.provinceId=:provinceId, qr.dataSourceId=:dataSourceId, qr.kpiMonitorTime=:kpiMonitorTime, qr.kpiMonitorRunTime=:kpiMonitorRunTime, qr.businessTime=:businessTime, qr.ruleCrtTime=:ruleCrtTime, qr.ruleUpdateTime=:ruleUpdateTime where qr.qualityRuleId=:qualityRuleId")
void updateQualityRuleByQualityRuleId(@Param("businessId")Long businessId,@Param("kpiId")Long kpiId,@Param("channelId")Long channelId,@Param("provinceId")Long provinceId,@Param("dataSourceId")Long dataSourceId,@Param("kpiMonitorTime")String kpiMonitorTime,@Param("kpiMonitorRunTime")Timestamp kpiMonitorRunTime,@Param("businessTime")Timestamp businessTime,@Param("ruleCrtTime")Timestamp ruleCrtTime,@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 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);
//根据质量规则ID得到数据条数
@Query("select count(*) from QualityRule qualityRule where qualityRule.qualityRuleId=:qualityRuleId")
......
......@@ -28,7 +28,7 @@ public class QualityRuleService {
//根据质量规则ID修改质量规则
@Transactional(readOnly=false)
public void updateByQualityRuleId(Long businessId,Long kpiId,Long channelId,Long provinceId,Long dataSourceId,String kpiMonitorTime,Timestamp kpiMonitorRunTime,Timestamp businessTime,Timestamp ruleCrtTime,Timestamp ruleUpdateTime,Long qualityRuleId){
qualityRuleDao.updateQualityRuleByQualityRuleId(businessId,kpiId,channelId,provinceId,dataSourceId,kpiMonitorTime,kpiMonitorRunTime,businessTime,ruleCrtTime,ruleUpdateTime,qualityRuleId);
public void updateByQualityRuleId(String kpiMonitorTime,Timestamp kpiMonitorRunTime,Timestamp businessTime,Timestamp ruleUpdateTime,Long qualityRuleId){
qualityRuleDao.updateQualityRuleByQualityRuleId(kpiMonitorTime,kpiMonitorRunTime,businessTime,ruleUpdateTime,qualityRuleId);
}
}
......@@ -93,6 +93,7 @@ public class QualityRuleConfigurationController {
@RequestMapping(value = "")
public String ruleMaintainHome(@RequestParam(value = "qualityRuleId", defaultValue ="") String qualityRuleId,
Map model){
System.out.println("qualityRuleId"+qualityRuleId);
staticQualityRuleId = qualityRuleId;
QualityRule qualityRule = null;
List<AccuracyRule> accuracyRuleList = null;
......@@ -251,22 +252,64 @@ public class QualityRuleConfigurationController {
@RequestMapping(value = "/updateQualityRuleForm",method=RequestMethod.POST)
public String updateQualityRuleForm(@RequestParam(value="qualityRuleId") String qualityRuleId,
@RequestParam(value="businessid") String businessId,
@RequestParam(value="provinceid") String provinceId,
@RequestParam(value="channelid") String channelId,
@RequestParam(value="dataSourceid") String dataSourceId,
@RequestParam(value="kpiid") String kpiId,
@RequestParam(value="kpiMonitorTimeValue") String kpiMonitorTimeValue,
@RequestParam(value="kpiUnit") String kpiUnit,
@RequestParam(value="province") String provinceId,
@RequestParam(value="channel") String channelId,
@RequestParam(value="dataSource") String dataSourceId,
@RequestParam(value="kpiinput") String kpiId,
@RequestParam(value="frequencyValue") String frequencyValue,
@RequestParam(value="frequencyType") String frequencyType,
@RequestParam(value ="ruleCrtTime") String ruleCrtTime,
@RequestParam(value="businessTime") String businessTime,
HttpServletResponse response, HttpServletRequest request) throws ParseException {
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
QualityRule qualityRule = new QualityRule();
qualityRule.setRuleUpdateTime(Timestamp.valueOf(sd.format(new Date())));
qualityRule.setQualityRuleId(Long.parseLong(qualityRuleId));
if (!provinceId.trim().equals("")) {
qualityRule.setProvinceId(Long.parseLong(provinceId));
}
if (!channelId.trim().equals("")) {
qualityRule.setChannelId(Long.parseLong(channelId));
}
if (!dataSourceId.trim().equals("")) {
qualityRule.setDataSourceId(Long.parseLong(dataSourceId));
}
if (!kpiId.trim().equals("")) {
qualityRule.setKpiId(Long.parseLong(kpiId));
if (!frequencyValue.trim().equals("")) {
qualityRule.setFrequencyValue(Long.parseLong(frequencyValue));
qualityRule.setFrequencyType(Long.parseLong(frequencyType));
if (frequencyType.equals("0")) {
qualityRule.setKpiMonitorTime(frequencyValue + "/1440");
} else if (frequencyType.equals("1")) {
qualityRule.setKpiMonitorTime(frequencyValue + "/24");
} else if (frequencyType.equals("2")) {
qualityRule.setKpiMonitorTime(frequencyValue);
} else if (frequencyType.equals("3")) {
qualityRule.setKpiMonitorTime("ADD_MONTH(" + frequencyValue + ")");
}
}
if (!businessTime.trim().equals("")) {
qualityRule.setBusinessTime(Timestamp.valueOf(businessTime));
}
if (!frequencyValue.trim().equals("")) {
if (frequencyType.equals("0")) {
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).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)));
} else if (frequencyType.equals("2")) {
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).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.setRuleCrtTime(Timestamp.valueOf(ruleCrtTime));
qualityRule.setRuleUpdateTime(Timestamp.valueOf(sd.format(new Date())));
qualityRuleDao.save(qualityRule);
cmszOperationLogService.createLog("修改", "更新数据质量规则", "quality_rule_warehouse_info_t. QUALITY_RULE_ID=" + qualityRule.getQualityRuleId().toString());
return PageURLController.RuleConfiguration;
return "redirect:/AnalysisSupport/QualityRuleResult";
}
}
......@@ -256,12 +256,12 @@ public class QualityRuleMaintainController {
@RequestParam(value="channel") String channel,
@RequestParam(value="dataSource") String dataSourceId,
@RequestParam(value="kpiinput") String kpi,
@RequestParam(value="kpiUnit") String kpiUnit,
@RequestParam(value="kpiMonitorTimeValue") String kpiMonitorTimeValue,
@RequestParam(value="frequencyType") String frequencyType,
@RequestParam(value="frequencyValue") String frequencyValue,
@RequestParam(value="businessTime") String businessTime,
HttpServletResponse response, HttpServletRequest request) throws ParseException {
System.out.println("kpiUnit:"+kpiUnit+"kpiMonitorTimeValue:"+kpiMonitorTimeValue);
System.out.println("frequencyType:"+frequencyType+"kpiMonitorTimeValue:"+frequencyValue);
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<Long> provinceIdList = new ArrayList<Long>();
......@@ -283,31 +283,29 @@ public class QualityRuleMaintainController {
qualityRule.setKpiId(kpiIdList.get(l));
if(!channel.trim().equals("")){ qualityRule.setChannelId(Long.parseLong(channel)); }
if(!dataSourceId.trim().equals("")){ qualityRule.setDataSourceId(Long.parseLong(dataSourceId)); }
if(!kpiMonitorTimeValue.trim().equals("")){
if(kpiUnit.equals("0")){
qualityRule.setKpiMonitorTime(kpiMonitorTimeValue+"/1440");
} else if(kpiUnit.equals("1")){
qualityRule.setKpiMonitorTime(kpiMonitorTimeValue+"/24");
} else if(kpiUnit.equals("2")){
qualityRule.setKpiMonitorTime(kpiMonitorTimeValue);
} else if(kpiUnit.equals("3")){
qualityRule.setKpiMonitorTime("ADD_MONTH("+kpiMonitorTimeValue+")");
if(!frequencyValue.trim().equals("")){
qualityRule.setFrequencyValue(Long.parseLong(frequencyValue));
qualityRule.setFrequencyType(Long.parseLong(frequencyType));
if(frequencyType.equals("0")){
qualityRule.setKpiMonitorTime(frequencyValue+"/1440");
} else if(frequencyType.equals("1")){
qualityRule.setKpiMonitorTime(frequencyValue+"/24");
} else if(frequencyType.equals("2")){
qualityRule.setKpiMonitorTime(frequencyValue);
} else if(frequencyType.equals("3")){
qualityRule.setKpiMonitorTime("ADD_MONTH("+frequencyValue+")");
}
}
if(!businessTime.trim().equals("")){ qualityRule.setBusinessTime(Timestamp.valueOf(businessTime)); }
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
System.out.println(businessTime);
System.out.println("sdf.parse(businessTime)"+sdf.parse(businessTime));
System.out.println("毫秒:"+sdf.parse(businessTime).getTime());
if(!kpiMonitorTimeValue.trim().equals("")){
if(kpiUnit.equals("0")){
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getTime()+Integer.parseInt(kpiMonitorTimeValue)*60*1000)));
} else if(kpiUnit.equals("1")){
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getTime()+Integer.parseInt(kpiMonitorTimeValue)*60*60*1000)));
} else if(kpiUnit.equals("2")){
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getTime()+Integer.parseInt(kpiMonitorTimeValue)*24*60*60*1000)));
} else if(kpiUnit.equals("3")){
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getMonth()+Integer.parseInt(kpiMonitorTimeValue))));
if(!frequencyValue.trim().equals("")){
if(frequencyType.equals("0")){
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).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)));
} else if(frequencyType.equals("2")){
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).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.setRuleCrtTime(Timestamp.valueOf(sd.format(new Date())));
......
......@@ -52,10 +52,11 @@
<div class="table-header">数据质量规则更新</div>
<form action="#" class="form-horizontal" id="ruleUpdateForm" method="post">
<table id="ruleMaintainTable" class="table-null">
<tr><td>数据质量规则ID:</td><td id="qualityRuleId"></td></tr>
<tr><td>省份(<font color="red">必填</font>):</td>
<td>
<c:forEach var="province" items="${provinceList}">
<input type="checkbox" name="province" id="province" value="${province.provinceId}" checked>${province.provinceName}
<input type="checkbox" name="province" value="${province.provinceId}" >${province.provinceName}
</c:forEach>
</td>
</tr>
......@@ -106,8 +107,8 @@
</tr>
<tr><td>指标监控时间(<font color="red">必填</font>):</td>
<td>
<input type="text" style="width:200px" name="kpiMonitorTimeValue" id="kpiMonitorTimeValue" />
<select style="width:200px" name="kpiUnit" id="kpiUnit" style="display: inline;">
<input type="text" style="width:200px" name="frequencyValue" id="frequencyValue" />
<select style="width:200px" name="frequencyType" id="frequencyType">
<option value="0">分钟</option>
<option value="1">小时</option>
<option value="2"></option>
......@@ -171,29 +172,7 @@
</div>
</div>
</div>
<script type="text/javascript">
//加载页面时显示
var getQualityRuleId = "${qualityRule.qualityRuleId}";
var getProvince = "${qualityRule.provinceId}";
var getDataSource = "${qualityRule.dataSourceId}";
var getChannel = "${qualityRule.channelId}";
var getBusinessinput = "${qualityRule.businessId}";
var getKpiinput = "${qualityRule.kpiId}";
var getCalCycle = "${qualityRule.calCycle}";
var getKpiMonitorTimeValue = "${qualityRule.kpiMonitorTimeValue}";
var getKpiUnit = "${qualityRule.kpiUnit}";
var getBusinessTime = "${qualityRule.businessTime}";
$("#qualityRuleId").text(getQualityRuleId);
$("#province").val(getProvince);
$("#dataSource").val(getDataSource);
$("#channel").val(getChannel);
$(".businessinput").val(getBusinessinput);
$(".kpiinput").val(getKpiinput);
$("#calCycle").val(getCalCycle);
$("#kpiMonitorTimeValue").val(getKpiMonitorTimeValue);
$("#kpiUnit").val(getKpiUnit);
$("#businessTime").val(getBusinessTime);
</script>
<script type="text/javascript">
$(".range").hide();
$(".repeate").hide();
......@@ -462,7 +441,7 @@
td.empty();
data = JSON.parse(data)
data.forEach(function(t){
td.append("<input type='checkbox' name='kpiinput' class='kpiItem' value='"+t[0]+"' checked >"+t[1]+"</input>")
td.append("<input type='checkbox' name='kpiinput' class='kpiItem' value='"+t[0]+"' >"+t[1]+"</input>")
});
}
});
......@@ -481,7 +460,7 @@
td.empty();
data = JSON.parse(data)
data.forEach(function(t){
td.append("<input type='checkbox' name='businessinput' class='businessItem' value='"+t[0]+"' checked >"+t[1]+"</input>")
td.append("<input type='checkbox' name='businessinput' class='businessItem' value='"+t[0]+"' >"+t[1]+"</input>")
businessIds+=t[0]+",";
});
updateKpi(businessIds,calCycleValue);
......@@ -575,6 +554,41 @@
console.log("provinceValue:"+provinceValue+"businessValue:"+businessValue+"kpiValue:"+kpiValue)
</script>
<script type="text/javascript">
//加载页面时显示
var getQualityRuleId = "${qualityRule.qualityRuleId}";
var getProvince = "${qualityRule.provinceId}";
var getDataSource = "${qualityRule.dataSourceId}";
var getChannel = "${qualityRule.channelId}";
var getBusinessinput = "${qualityRule.businessId}";
var getKpiinput = "${qualityRule.kpiId}";
var getFrequencyValue = "${qualityRule.frequencyValue}";
var getFrequencyType = "${qualityRule.frequencyType}";
var getBusinessTime = "${qualityRule.businessTime}";
$("#qualityRuleId").text(getQualityRuleId);
$("input[name='province']").each(function(){
if($(this).val()==getProvince){
console.log( $(this))
$(this).attr("checked",true);
}
});
$("#dataSource").val(getDataSource);
$("#channel").val(getChannel);
$("input[name='businessinput']").each(function(){
if($(this).val()==getBusinessinput){
console.log( $(this))
$(this).attr("checked",true);
}
});
$("input[name='kpiinput']").each(function(){
if($(this).val()==getKpiinput){
console.log( $(this))
$(this).attr("checked",true);
}
});
$("#frequencyValue").val(getFrequencyValue);
$("#frequencyType").val(getFrequencyType);
$("#businessTime").val(getBusinessTime);
</script>
</body>
</html>
\ No newline at end of file
......@@ -99,8 +99,8 @@
</tr>
<tr><td>指标监控时间(<font color="red">必填</font>):</td>
<td>
<input type="text" name="kpiMonitorTimeValue" id="kpiMonitorTimeValue" style="display: inline;" />
<select name="kpiUnit" id="kpiUnit">
<input type="text" name="frequencyValue" id="frequencyValue" style="display: inline;" />
<select name="frequencyType" id="frequencyType">
<option value="0">分钟</option>
<option value="1">小时</option>
<option value="2"></option>
......
......@@ -116,35 +116,6 @@ $("#createRule").click(function(){
});
});
$("#updateRule").click(function(){
var pageNum = $("#goPageNo").val();
$.dialog({
title: "提醒",
content:"确定修改质量规则?",
ok: function(){location.href="${ctx}/AnalysisSupport/QualityRuleConfiguration?qualityRuleId="+qualityRuleId;},
okValue:"确定",
cancel: function(){},
cancelValue:"取消",
lock:true
});
});
$("#deleteRule").click(function(){
var pageNum = $("#goPageNo").val();
$.dialog({
title: "提醒",
content:"确定删除质量规则?",
ok: function(){location.href="${ctx}/AnalysisSupport/RuleDelete?qualityRuleId="+qualityRuleId;},
okValue:"确定",
cancel: function(){},
cancelValue:"取消",
lock:true
});
});
function ruleResultSubmit(){
var dataSource=getStatsDataSourceCheckedValuesString();
var chnnal=getStatsChannelCheckedValuesString();
......@@ -183,7 +154,7 @@ $("#createRule").click(function(){
success: function(data) {
$("#qualityRuleView").val(data);
ruleResultDetailTable();
ruleId="";
qualityRuleId="";
$("#updateRule").attr("disabled", true);
toggleMenu('slidePushMenus2');//隐藏筛选项
updateTag(true);
......@@ -192,26 +163,37 @@ $("#createRule").click(function(){
}
}
function ruleResultReset(){
ProvinceReset();
statsDataSourceReset();//三级联动重置
}
//更新按钮点击
$("#updateModel").click(function(){
$("#updateRule").click(function(){
var pageNum = $("#goPageNo").val();
$.dialog({
title: "提醒",
content:"确定修改模型?",
ok: function(){location.href="${ctx}/AnalysisSupport/RuleConfiguration?qualityRuleId="+ruleId+"&rulePageNum="+pageNum;},
content:"确定修改质量规则?",
ok: function(){location.href="${ctx}/AnalysisSupport/QualityRuleConfiguration?qualityRuleId="+qualityRuleId;},
okValue:"确定",
cancel: function(){},
cancelValue:"取消",
lock:true
});
});
$("#deleteRule").click(function(){
var pageNum = $("#goPageNo").val();
$.dialog({
title: "提醒",
content:"确定删除质量规则?",
ok: function(){location.href="${ctx}/AnalysisSupport/RuleDelete?qualityRuleId="+qualityRuleId;},
okValue:"确定",
cancel: function(){},
cancelValue:"取消",
lock:true
});
});
</script>
</body>
</html>
\ No newline at end of file
......@@ -535,7 +535,7 @@ table_pagging.prototype = {
//alert(clickObj);
//alert(clickObj.nextSibling.innerHTML);
$("#updateRule").attr("disabled", false);
ruleId=parseInt(obj[parseInt(clickObj.nextSibling.innerHTML)].qualityRuleId);
qualityRuleId=parseInt(obj[parseInt(clickObj.nextSibling.innerHTML)].qualityRuleId);
}
......
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