Commit c30ebd21 authored by liuna's avatar liuna

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

--数据质量核查下质量规则新增页面完成
parent 29444a6f
This diff is collapsed.
......@@ -26,4 +26,5 @@ 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);
}
}
......@@ -2,6 +2,7 @@ package com.hp.cmsz.web.analysissupport;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -118,6 +119,8 @@ public class QualityRuleConfigurationController {
model.put("businessList", gson.toJson(businessList));
model.put("dataTypeList", dataTypeList);
model.put("dataSourceList", dataSourceList);
model.put("qualityRule",qualityRule);
model.put("accuracyRuleList",accuracyRuleList);
return PageURLController.RuleConfiguration;
}
......@@ -246,18 +249,22 @@ public class QualityRuleConfigurationController {
}
@RequestMapping(value = "/updateQualityRuleForm",method=RequestMethod.POST)
public String updateQualityRuleForm(@RequestParam(value="businessid") String businessId,
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="kpiMonitorTime") String kpiMonitorTime,
@RequestParam(value="kpiMonitorTimeValue") String kpiMonitorTimeValue,
@RequestParam(value="kpiUnit") String kpiUnit,
@RequestParam(value="businessTime") String businessTime,
HttpServletResponse response, HttpServletRequest request) throws ParseException {
System.out.println("businessId"+businessId+"provinceid"+provinceId+"channelId"+channelId+"dataSourceId"+dataSourceId+"kpi"+kpiId+"kpiMonitorTime"+kpiMonitorTime+"businessTime"+businessTime);
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
QualityRule qualityRule = new QualityRule();
qualityRule.setRuleUpdateTime(Timestamp.valueOf(sd.format(new Date())));
qualityRule.setBusinessTime(Timestamp.valueOf(businessTime));
return PageURLController.RuleConfiguration;
......
......@@ -13,6 +13,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hp.cmsz.service.analysissupport.AccuracyRuleService;
import com.hp.cmsz.service.analysissupport.QualityRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
......@@ -84,6 +85,9 @@ public class QualityRuleMaintainController {
private AccuracyRuleDao accuracyRuleDao;
@Autowired
private AccuracyRuleService accuracyRuleService;
@Autowired
private CmszOperationLogService cmszOperationLogService;
@RequestMapping(value = "")
......@@ -194,13 +198,14 @@ public class QualityRuleMaintainController {
@RequestParam(value="repeatedCheckMaxTime") String repeatedCheckMaxTime,
@RequestParam(value="ifRepeatedCheckSummation") String ifRepeatedCheckSummation,
HttpServletResponse response,HttpServletRequest request) {
System.out.println("ruleType"+ruleType);
System.out.println("ruleType" + ruleType);
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
AccuracyRule accuracyRule = new AccuracyRule();
if (!ruleType.trim().equals("")) {
if (ruleType == "1") {
if (ruleType.equals("1")) {
accuracyRule.setRuleType("范围");
} else if (ruleType == "2") {
System.out.println("rule" + accuracyRule.getRuleType());
} else if (ruleType.equals("2")) {
accuracyRule.setRuleType("重复");
}
if (!scopeMaxValue.trim().equals("")) {
......@@ -244,7 +249,6 @@ public class QualityRuleMaintainController {
qualityRuleIdList.add(qualityRuleId);
}
}
//新增质量模型
@RequestMapping(value = "/saveRuleDataForm", method = RequestMethod.POST)
public String saveRuleDataForm (@RequestParam(value="businessinput") String business,
......@@ -253,11 +257,11 @@ public class QualityRuleMaintainController {
@RequestParam(value="dataSource") String dataSourceId,
@RequestParam(value="kpiinput") String kpi,
@RequestParam(value="kpiUnit") String kpiUnit,
@RequestParam(value="kpiMonitorTime") String kpiMonitorTime,
@RequestParam(value="kpiMonitorTimeValue") String kpiMonitorTimeValue,
@RequestParam(value="businessTime") String businessTime,
HttpServletResponse response, HttpServletRequest request) throws ParseException {
System.out.println("0000"+kpiUnit);
System.out.println("kpiUnit:"+kpiUnit+"kpiMonitorTimeValue:"+kpiMonitorTimeValue);
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<Long> provinceIdList = new ArrayList<Long>();
......@@ -279,9 +283,33 @@ 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(!kpiMonitorTime.trim().equals("")){ qualityRule.setKpiMonitorTime(kpiMonitorTime); }
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(new Date())));
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(!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))));
}
}
qualityRule.setRuleCrtTime(Timestamp.valueOf(sd.format(new Date())));
qualityRule.setRuleUpdateTime(Timestamp.valueOf(sd.format(new Date())));
qualityRule.setRuleValidFlag("0");
......@@ -289,6 +317,11 @@ public class QualityRuleMaintainController {
qualityRuleDao.save(qualityRule);
cmszOperationLogService.createLog("增加", "新建质量模型", "quality_rule_warehouse_info_t. QUALITY_RULE_ID=" + qualityRule.getQualityRuleId().toString());
Long qualityRuleId = qualityRule.getQualityRuleId();
if(!qualityRuleIdList.isEmpty()){
accuracyRuleService.updateAccuracyRuleByAccuracyRuleIds(qualityRuleId, qualityRuleIdList);
qualityRuleIdList.clear();
}
}
}
......
......@@ -125,7 +125,7 @@ public class QualityRuleOperationController {
List<Long> bussinesList=changeStrToList(bussinesS);
List<Long> provinceList=changeStrToList(provinceS);
List<Long> ifFilterList=changeStrToList(ifFilterS);
System.out.println("qualityRule:"+time1+time2+"data"+dataSourceList+"busin"+bussinesList+"procin"+provinceList+"if"+ifFilterList);
System.out.println("time:"+time1+time2+"data"+dataSourceList+"busin"+bussinesList+"procin"+provinceList+"if"+ifFilterList);
qualityRuleInfoList = qualityRuleInfoService.getQualityRuleInfoBy(time1,time2,dataSourceList,chnnalList,bussinesList,provinceList,ifFilterList);
Gson gson = new Gson();
response.setContentType("text/Xml;charset=gbk");
......
......@@ -106,7 +106,7 @@
</tr>
<tr><td>指标监控时间(<font color="red">必填</font>):</td>
<td>
<input type="text" style="width:200px" name="kpiMonitorTime" id="kpiMonitorTime" style="display: inline;" />
<input type="text" style="width:200px" name="kpiMonitorTimeValue" id="kpiMonitorTimeValue" />
<select style="width:200px" name="kpiUnit" id="kpiUnit" style="display: inline;">
<option value="0">分钟</option>
<option value="1">小时</option>
......@@ -171,7 +171,29 @@
</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();
......
......@@ -99,7 +99,7 @@
</tr>
<tr><td>指标监控时间(<font color="red">必填</font>):</td>
<td>
<input type="text" style="width:200px" name="kpiMonitorTime" id="kpiMonitorTime" style="display: inline;" />
<input type="text" name="kpiMonitorTimeValue" id="kpiMonitorTimeValue" style="display: inline;" />
<select name="kpiUnit" id="kpiUnit">
<option value="0">分钟</option>
<option value="1">小时</option>
......@@ -261,7 +261,7 @@ $("#addParam").click(function(){
//form表单提交
$("#ruleSubmit").click(function(){
if($.trim($("#kpiMonitorTime").val())==""){
if($.trim($("#kpiMonitorTimeValue").val())==""){
$.alert("指标监控时间不能为空");
}else if($("#businessTime").val()==""){
$.alert("指标业务时间不能为空");
......
......@@ -124,7 +124,7 @@ $("#createRule").click(function(){
$.dialog({
title: "提醒",
content:"确定修改质量规则?",
ok: function(){location.href="${ctx}/AnalysisSupport/RuleConfiguration?qualityRuleId="+qualityRuleId;},
ok: function(){location.href="${ctx}/AnalysisSupport/QualityRuleConfiguration?qualityRuleId="+qualityRuleId;},
okValue:"确定",
cancel: function(){},
cancelValue:"取消",
......
......@@ -302,11 +302,23 @@ table_pagging.prototype = {
}
if(k==10){
if(tdContext!="&nbsp;"){
tdContext = df.format(new Date(tdContext));
if(tdContext.indexOf("/")!=-1){
var a = new Array();
a = tdContext.split("/");
if(a[1] == "1440") {
tdContext = a[0] + "分钟";
}else if(a[1] == "24"){
tdContext = a[0] + "小时";
}
} else {
if (tdContext.indexOf("ADD") != -1) {
tdContext = tdContext.substring(tdContext.indexOf("(") + 1, tdContext.length - 1) + "个月"
} else {
tdContext = tdContext + "天";
}
}
}
if(k==11){
if(tdContext!="&nbsp;"){
......
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