Commit 6107fd18 authored by liuna's avatar liuna

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

--解决数据质量规则新增和修改规则问题
parent 700c6ca7
......@@ -124,5 +124,24 @@ public class AccuracyRule implements Serializable {
public void setValidFlag(String validFlag) {
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,9 +33,14 @@ 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
@Query("delete from AccuracyRule ar where ar.accuracyRuleId=:accuracyRuleId")
......
......@@ -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);
//由指标名得到指标周期类型
......
......@@ -26,6 +26,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
......@@ -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,9 +29,15 @@ 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)
......
......@@ -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);
}
}
......@@ -13,6 +13,8 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ctc.wstx.util.StringUtil;
import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.*;
import com.hp.cmsz.service.BusinessService;
import com.hp.cmsz.service.CmszOperationLogService;
......@@ -25,14 +27,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.google.gson.Gson;
import com.hp.cmsz.entity.AccuracyRule;
import com.hp.cmsz.entity.Business;
import com.hp.cmsz.entity.Channel;
import com.hp.cmsz.entity.DataSource;
import com.hp.cmsz.entity.DataType;
import com.hp.cmsz.entity.Kpi;
import com.hp.cmsz.entity.Province;
import com.hp.cmsz.entity.QualityRule;
import com.hp.cmsz.service.analysissupport.AccuracyRuleService;
import com.hp.cmsz.web.PageURLController;
......@@ -48,7 +42,7 @@ import com.hp.cmsz.web.PageURLController;
public class QualityRuleConfigurationController {
@Autowired
private ProvinceDao provinceDao;
private ProvinceAllDao provinceAllDao;
@Autowired
private ChannelDao channelDao;
......@@ -87,111 +81,53 @@ public class QualityRuleConfigurationController {
private CmszOperationLogService cmszOperationLogService;
private String staticQualityRuleId = "";
private Double staticScopeMaxValue = 0.00;
private Double staticScopeMinValue = 0.00;
@RequestMapping(value = "")
public String ruleMaintainHome(@RequestParam(value = "qualityRuleId", defaultValue ="") String qualityRuleId,
Map model){
staticQualityRuleId = qualityRuleId;
QualityRule qualityRule = null;
List<AccuracyRule> accuracyRuleList = null;
if(!qualityRuleId.trim().equals("")){
qualityRule = qualityRuleDao.findByQualityRuleId(Long.parseLong(qualityRuleId));
accuracyRuleList = accuracyRuleDao.findByQualityRuleId(Long.parseLong(qualityRuleId));
System.out.println(accuracyRuleList);
}
//查询出所有的省份
List<Province> provinceList=provinceDao.findProvince();
List<ProvinceAll> provinceList=provinceAllDao.findProvince();
//查询出所有的渠道信息
List<Channel> channelList=channelDao.findChannel();
//查询出所有的指标
List<Kpi> kpiList=(List<Kpi>)kpiDao.findAll();
List<Kpi> kpiList=kpiDao.findAllByIsActive("Y");
//查询出所有的业务
List<Object[]> businessList=businessDao.findAllBusinessIdAndBusinessName();
List<Business> businessList=businessDao.findAllBusiness();
//查询出所有的数据类型
List<DataType> dataTypeList= (List<DataType>)dataTypeDao.findAll();
//查询出所有的数据来源
List<DataSource> dataSourceList=(List<DataSource>)dataSourceDao.findAll();
List<Long> kid = new ArrayList<Long>();
kid.add(qualityRule.getKpiId());
List<Business> blist = kpiDao.getBusinessByRuleId(kid);
List<DataSource> dlist = kpiDao.getDataSourceByRuleId(kid);
List<Channel> clist = kpiDao.getChannelByRuleId(kid);
Gson gson = new Gson();
model.put("provinceList", provinceList);
model.put("channelList", channelList);
model.put("kpiList", kpiList);
model.put("businessList", gson.toJson(businessList));
model.put("businessList", businessList);
model.put("dataTypeList", dataTypeList);
model.put("dataSourceList", dataSourceList);
model.put("qualityRule",qualityRule);
model.put("accuracyRuleList",accuracyRuleList);
model.put("qualityRule", qualityRule);
model.put("Business", blist.get(0));
model.put("DataSource", dlist.get(0));
model.put("Channel", clist.get(0));
return PageURLController.RuleConfiguration;
}
@RequestMapping(value = "/findBusinessId*")
@ResponseBody
public void datasource_select(@RequestParam(value = "dataSource", defaultValue ="" ) String dataSource,
@RequestParam(value = "channel", defaultValue ="" ) String channel,
HttpServletResponse response) {
System.out.println(dataSource);
List<Object []> resultList = new ArrayList<Object []>();
List<Object[]> list = (List<Object[]>)businessDao.findBusinessIdAndBusinessNameByDataSourceIdAndChannelIdWithIsActive(Long.parseLong(channel),Long.parseLong(dataSource));
for(int i=0;i<list.size();i++){
Object[] objs = list.get(i);
//将重复的业务名的Id写在同一个对象中
for(int j=0;j<list.size();j++){
if(i == j){}else{
Object[] objs1 = list.get(j);
if(objs[1].equals(objs1[1])){
objs[0] = objs[0] +","+ objs1[0];
list.remove(j);
j--;
}
}
}
resultList.add(objs);
}
Gson gson = new Gson();
response.setContentType("text/Xml;chartset=gbk");
PrintWriter out = null;
try{
out = response.getWriter();
out.println(gson.toJson(resultList));
}
catch(IOException ex){
ex.printStackTrace();
}
finally{
out.close();
}
}
@RequestMapping(value="/findKpiId*")
@ResponseBody
public void findKpiId(@RequestParam(value = "businessIds", defaultValue ="" ) String businessIds,
@RequestParam(value = "calCycleValue", defaultValue = "30MI") String calCycleValue,
HttpServletResponse response){
String[] strs = businessIds.split(",");
List<Long> businessIdlist = new ArrayList<Long>();
for(int i=0;i<strs.length;i++) {
businessIdlist.add(Long.valueOf(strs[i]));
}
List<Object[]> businessKpiList = kpiDao.findKpiIdAndKpiNameAndKpiCodeByBusinessIds(calCycleValue,businessIdlist);
Gson gson = new Gson();
response.setContentType("text/Xml;charset=gbk");
PrintWriter out = null;
try {
out = response.getWriter();
out.println(gson.toJson(businessKpiList));
}
catch (IOException ex1) {
ex1.printStackTrace();
}finally{ out.close(); }
}
//删除准确性规则信息
@RequestMapping(value = "/deleteAccuracyRule*",method=RequestMethod.GET)
@ResponseBody
......@@ -211,70 +147,53 @@ public class QualityRuleConfigurationController {
@ResponseBody
public void updateParameter(
@RequestParam(value="ruleType") String ruleType,
@RequestParam(value="scopeMaxValue") double scopeMaxValue,
@RequestParam(value="scopeMinValue") double scopeMinValue,
@RequestParam(value="scopeMaxValue") String scopeMaxValue,
@RequestParam(value="scopeMinValue") String scopeMinValue,
@RequestParam(value="repeatedCheckGranularity") String repeatedCheckGranularity,
@RequestParam(value="repeatedCheckStartTime") Date repeatedCheckStartTime,
@RequestParam(value="repeatedCheckEndTime") Date repeatedCheckEndTime,
@RequestParam(value="repeatedCheckStartTime") String repeatedCheckStartTime,
@RequestParam(value="repeatedCheckEndTime") String repeatedCheckEndTime,
@RequestParam(value="ifRepeatedCheckSeries") String ifRepeatedCheckSeries,
@RequestParam(value="repeatedCheckMaxTime") Long repeatedCheckMaxTime,
@RequestParam(value="repeatedCheckMaxTime") String repeatedCheckMaxTime,
@RequestParam(value="ifRepeatedCheckSummation") String ifRepeatedCheckSummation,
@RequestParam(value="qualityRuleId")String qualityRuleId,
@RequestParam(value="accuracyRuleId")String accuracyRuleId){
if(qualityRuleId.trim().equals("")){
@RequestParam(value="accuracyRuleId")String accuracyRuleId) throws ParseException{
System.out.println();
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if(accuracyRuleId.trim().equals("")){
AccuracyRule accuracyRule = new AccuracyRule();
accuracyRule.setAccuracyRuleId(Long.parseLong(qualityRuleId));
if (ruleType == "1") {
accuracyRule.setRuleType("范围");
} else if (ruleType == "2") {
accuracyRule.setRuleType("重复");
}
accuracyRule.setScopeMinValue(String.valueOf(scopeMaxValue));
accuracyRule.setScopeMinValue(String.valueOf(scopeMinValue));
accuracyRule.setRepeatedCheckGranularity(repeatedCheckGranularity);
accuracyRule.setRepeatedCheckStartTime(repeatedCheckStartTime);
accuracyRule.setRepeatedCheckEndTime(repeatedCheckEndTime);
accuracyRule.setIfRepeatedCheckSeries(ifRepeatedCheckSeries);
accuracyRule.setRepeatedCheckMaxTime(repeatedCheckMaxTime);
accuracyRule.setIfRepeatedCheckSummation(ifRepeatedCheckSummation);
accuracyRule.setQualityRuleId(Long.parseLong(qualityRuleId));
accuracyRule.setRuleType(ruleType);
if (!scopeMaxValue.trim().equals("")) {accuracyRule.setScopeMaxValue(scopeMaxValue);}
if (!scopeMinValue.trim().equals("")){accuracyRule.setScopeMinValue(scopeMinValue);}
if (!repeatedCheckGranularity.trim().equals("")){accuracyRule.setRepeatedCheckGranularity(repeatedCheckGranularity);}
if (!repeatedCheckStartTime.trim().equals("")){accuracyRule.setRepeatedCheckStartTime(sd.parse(repeatedCheckStartTime));}
if (!repeatedCheckEndTime.trim().equals("")){accuracyRule.setRepeatedCheckEndTime(sd.parse(repeatedCheckEndTime));}
if (!ifRepeatedCheckSeries.trim().equals("")){accuracyRule.setIfRepeatedCheckSeries(ifRepeatedCheckSeries);}
if (!repeatedCheckMaxTime.trim().equals("")){accuracyRule.setRepeatedCheckMaxTime(Long.parseLong(repeatedCheckMaxTime));}
if (!ifRepeatedCheckSummation.trim().equals("")){accuracyRule.setIfRepeatedCheckSummation(ifRepeatedCheckSummation);}
accuracyRule.setValidFlag("1");
accuracyRuleDao.save(accuracyRule);
}else{
staticScopeMaxValue= Double.parseDouble(String.valueOf(scopeMaxValue));
staticScopeMinValue= Double.parseDouble(String.valueOf(scopeMinValue));
accuracyRuleService.updateAccuracyRuleByAccuracyRuleId(ruleType, staticScopeMaxValue, staticScopeMinValue, repeatedCheckGranularity, repeatedCheckStartTime, repeatedCheckEndTime, ifRepeatedCheckSeries, repeatedCheckMaxTime, ifRepeatedCheckSummation, Long.parseLong(accuracyRuleId));;
}
// else{
// if(ruleType.equals("范围")){
// accuracyRuleService.updateByAccuracyRuleId(Double.parseDouble(scopeMaxValue), Double.parseDouble(scopeMinValue));
// }else if(ruleType.equals("重复")){
// accuracyRuleService.updateAccuracyRuleByAccuracyRuleId(repeatedCheckGranularity, sd.parse(repeatedCheckStartTime), sd.parse(repeatedCheckEndTime), ifRepeatedCheckSeries, Long.parseLong(repeatedCheckMaxTime), ifRepeatedCheckSummation, Long.parseLong(accuracyRuleId));
// }
// }
}
@RequestMapping(value = "/updateQualityRuleForm",method=RequestMethod.POST)
public String updateQualityRuleForm(@RequestParam(value="qualityRuleId") String qualityRuleId,
@RequestParam(value="businessid") String businessId,
@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.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));
QualityRule qualityRule = qualityRuleDao.findByQualityRuleId(Long.parseLong(qualityRuleId));
if (!frequencyValue.trim().equals("")) {
qualityRule.setFrequencyValue(Long.parseLong(frequencyValue));
qualityRule.setFrequencyType(Long.parseLong(frequencyType));
......@@ -302,13 +221,9 @@ public class QualityRuleConfigurationController {
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())));
qualityRule.setRuleValidFlag("1");
qualityRule.setIfSystemValue("1");
qualityRuleDao.save(qualityRule);
cmszOperationLogService.createLog("修改", "更新数据质量规则", "quality_rule_warehouse_info_t. QUALITY_RULE_ID=" + qualityRule.getQualityRuleId().toString());
qualityRuleDao.save(qualityRule);
cmszOperationLogService.createLog("修改", "更新数据质量规则", "quality_rule_warehouse_info_t. QUALITY_RULE_ID=" + qualityRule.getQualityRuleId().toString());
return "redirect:/AnalysisSupport/QualityRuleResult";
}
......
......@@ -39,28 +39,28 @@ public class QualityRuleMaintainController {
@Autowired
private ProvinceAllDao provinceAllDao;
@Autowired
private ChannelDao channelDao;
@Autowired
private ChannelDataSourceMapDao channelDataSourceMapDao;
@Autowired
private BusinessService businessService;
@Autowired
private BusinessDao businessDao;
@Autowired
private KpiDao kpiDao;
@Autowired
private DataTypeDao dataTypeDao;
@Autowired
private DataSourceDao dataSourceDao;
@Autowired
private QualityRuleDao qualityRuleDao;
......@@ -75,121 +75,122 @@ public class QualityRuleMaintainController {
@Autowired
private CmszOperationLogService cmszOperationLogService;
@RequestMapping(value = "")
public String ruleMaintainHome(Map model){
public String ruleMaintainHome(Map model) {
//查询出所有的省份
List<ProvinceAll> provinceList=(List<ProvinceAll>)provinceAllDao.findProvince();
List<ProvinceAll> provinceList = (List<ProvinceAll>) provinceAllDao.findProvince();
//查询出所有的渠道信息
List<Channel> channelList=(List<Channel>)channelDao.findChannel();
List<Channel> channelList = (List<Channel>) channelDao.findChannel();
//查询出所有的指标
List<Kpi> kpiList=(List<Kpi>)kpiDao.findAll();
List<Kpi> kpiList = (List<Kpi>) kpiDao.findAll();
//查询出所有的业务
List<Object[]> businessList=(List<Object[]>)businessDao.findAllBusinessIdAndBusinessName();
List<Object[]> businessList = (List<Object[]>) businessDao.findAllBusinessIdAndBusinessName();
//查询出所有的数据类型
List<DataType> dataTypeList= (List<DataType>)dataTypeDao.findAll();
List<DataType> dataTypeList = (List<DataType>) dataTypeDao.findAll();
//查询出所有的数据来源
List<DataSource> dataSourceList=(List<DataSource>)dataSourceDao.findAll();
Gson gson = new Gson();
List<DataSource> dataSourceList = (List<DataSource>) dataSourceDao.findAll();
Gson gson = new Gson();
model.put("provinceList", provinceList);
model.put("channelList", channelList);
model.put("kpiList", kpiList);
model.put("businessList", gson.toJson(businessList));
model.put("dataTypeList", dataTypeList);
model.put("dataSourceList", dataSourceList);
return PageURLController.RuleMaintain;
}
@RequestMapping(value = "/findBusinessId*")
@ResponseBody
public void datasource_select(@RequestParam(value = "dataSource", defaultValue ="" ) String dataSource,
@RequestParam(value = "channel", defaultValue ="" ) String channel,
HttpServletResponse response) {
@ResponseBody
public void datasource_select(@RequestParam(value = "dataSource", defaultValue = "") String dataSource,
@RequestParam(value = "channel", defaultValue = "") String channel,
HttpServletResponse response) {
System.out.println(dataSource);
List<Object []> resultList = new ArrayList<Object []>();
List<Object[]> list = (List<Object[]>)businessDao.findBusinessIdAndBusinessNameByDataSourceIdAndChannelIdWithIsActive(Long.parseLong(channel),Long.parseLong(dataSource));
for(int i=0;i<list.size();i++){
Object[] objs = list.get(i);
//将重复的业务名的Id写在同一个对象中
for(int j=0;j<list.size();j++){
if(i == j){}else{
Object[] objs1 = list.get(j);
if(objs[1].equals(objs1[1])){
objs[0] = objs[0] +","+ objs1[0];
list.remove(j);
j--;
}
}
}
resultList.add(objs);
List<Object[]> resultList = new ArrayList<Object[]>();
List<Object[]> list = (List<Object[]>) businessDao.findBusinessIdAndBusinessNameByDataSourceIdAndChannelIdWithIsActive(Long.parseLong(channel), Long.parseLong(dataSource));
for (int i = 0; i < list.size(); i++) {
Object[] objs = list.get(i);
//将重复的业务名的Id写在同一个对象中
for (int j = 0; j < list.size(); j++) {
if (i == j) {
} else {
Object[] objs1 = list.get(j);
if (objs[1].equals(objs1[1])) {
objs[0] = objs[0] + "," + objs1[0];
list.remove(j);
j--;
}
}
}
resultList.add(objs);
}
Gson gson = new Gson();
response.setContentType("text/Xml;chartset=gbk");
PrintWriter out = null;
try{
try {
out = response.getWriter();
out.println(gson.toJson(resultList));
}
catch(IOException ex){
} catch (IOException ex) {
ex.printStackTrace();
}
finally{
} finally {
out.close();
}
}
@RequestMapping(value="/findKpiId*")
@RequestMapping(value = "/findKpiId*")
@ResponseBody
public void findKpiId(@RequestParam(value = "businessIds", defaultValue ="" ) String businessIds,
@RequestParam(value = "calCycleValue", defaultValue = "30MI") String calCycleValue,
HttpServletResponse response){
public void findKpiId(@RequestParam(value = "businessIds", defaultValue = "") String businessIds,
@RequestParam(value = "calCycleValue", defaultValue = "30MI") String calCycleValue,
HttpServletResponse response) {
String[] strs = businessIds.split(",");
List<Long> businessIdlist = new ArrayList<Long>();
for(int i=0;i<strs.length;i++) {
for (int i = 0; i < strs.length; i++) {
businessIdlist.add(Long.valueOf(strs[i]));
}
List<Object[]> businessKpiList = kpiDao.findKpiIdAndKpiNameAndKpiCodeByBusinessIds(calCycleValue,businessIdlist);
Gson gson = new Gson();
response.setContentType("text/Xml;charset=gbk");
PrintWriter out = null;
try {
out = response.getWriter();
out.println(gson.toJson(businessKpiList));
}
catch (IOException ex1) {
ex1.printStackTrace();
}finally{ out.close(); }
List<Object[]> businessKpiList = kpiDao.findKpiIdAndKpiNameAndKpiCodeByBusinessIds(calCycleValue, businessIdlist);
Gson gson = new Gson();
response.setContentType("text/Xml;charset=gbk");
PrintWriter out = null;
try {
out = response.getWriter();
out.println(gson.toJson(businessKpiList));
} catch (IOException ex1) {
ex1.printStackTrace();
} finally {
out.close();
}
}
private List<Long> qualityRuleIdList = new ArrayList<Long>();
//新增准确性规则
@RequestMapping(value = "/createAccuracyRule*", method = RequestMethod.GET)
@ResponseBody
public void createAccuracyRule(
@RequestParam(value="ruleType") String ruleType,
@RequestParam(value="scopeMaxValue") String scopeMaxValue,
@RequestParam(value="scopeMinValue") String scopeMinValue,
@RequestParam(value="repeatedCheckGranularity") String repeatedCheckGranularity,
@RequestParam(value="repeatedCheckStartTime") String repeatedCheckStartTime,
@RequestParam(value="repeatedCheckEndTime") String repeatedCheckEndTime,
@RequestParam(value="ifRepeatedCheckSeries") String ifRepeatedCheckSeries,
@RequestParam(value="repeatedCheckMaxTime") String repeatedCheckMaxTime,
@RequestParam(value="ifRepeatedCheckSummation") String ifRepeatedCheckSummation,
HttpServletResponse response,HttpServletRequest request) {
@RequestParam(value = "ruleType") String ruleType,
@RequestParam(value = "scopeMaxValue") String scopeMaxValue,
@RequestParam(value = "scopeMinValue") String scopeMinValue,
@RequestParam(value = "repeatedCheckGranularity") String repeatedCheckGranularity,
@RequestParam(value = "repeatedCheckStartTime") String repeatedCheckStartTime,
@RequestParam(value = "repeatedCheckEndTime") String repeatedCheckEndTime,
@RequestParam(value = "ifRepeatedCheckSeries") String ifRepeatedCheckSeries,
@RequestParam(value = "repeatedCheckMaxTime") String repeatedCheckMaxTime,
@RequestParam(value = "ifRepeatedCheckSummation") String ifRepeatedCheckSummation,
HttpServletResponse response, HttpServletRequest request) {
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
AccuracyRule accuracyRule = new AccuracyRule();
if (!ruleType.trim().equals("")) {
if (ruleType.equals("1")) {
accuracyRule.setRuleType("范围");
System.out.println("rule" + accuracyRule.getRuleType());
} else if (ruleType.equals("2")) {
accuracyRule.setRuleType("重复");
}
......@@ -227,83 +228,99 @@ public class QualityRuleMaintainController {
}
accuracyRule.setRuleCrtTime(new Date());
accuracyRule.setRuleUpdateTime(new Date());
accuracyRule.setValidFlag("1");
accuracyRuleDao.save(accuracyRule);
Long qualityRuleId = accuracyRule.getAccuracyRuleId();
qualityRuleIdList.add(qualityRuleId);
}
}
//新增质量模型
@RequestMapping(value = "/saveRuleDataForm", method = RequestMethod.POST)
public String saveRuleDataForm (@RequestParam(value="businessinput") String business,
@RequestParam(value="province") String province,
@RequestParam(value="channel") String channel,
@RequestParam(value="dataSource") String dataSourceId,
@RequestParam(value="kpiinput") String kpi,
@RequestParam(value="frequencyType") String frequencyType,
@RequestParam(value="frequencyValue") String frequencyValue,
@RequestParam(value="businessTime") String businessTime,
HttpServletResponse response, HttpServletRequest request) throws ParseException {
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//新增质量模型
@RequestMapping(value = "/saveRuleDataForm", method = RequestMethod.POST)
public String saveRuleDataForm(@RequestParam(value = "businessinput") String business,
@RequestParam(value = "province") String province,
@RequestParam(value = "channel") String channel,
@RequestParam(value = "dataSource") String dataSourceId,
@RequestParam(value = "kpiinput") String kpi,
@RequestParam(value = "frequencyType") String frequencyType,
@RequestParam(value = "frequencyValue") String frequencyValue,
@RequestParam(value = "businessTime") String businessTime,
HttpServletResponse response, HttpServletRequest request) throws ParseException {
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<Long> provinceIdList = new ArrayList<Long>();
for(int i=0;i<province.split(",").length;i++){
for (int i = 0; i < province.split(",").length; i++) {
provinceIdList.add(Long.parseLong(province.split(",")[i]));
}
List<Long> kpiIdList = new ArrayList<Long>();
for(int i=0;i<kpi.split(",").length;i++){
for (int i = 0; i < kpi.split(",").length; i++) {
kpiIdList.add(Long.parseLong(kpi.split(",")[i]));
}
for(int j=0; j<provinceIdList.size(); j++) {
for(int l=0; l<kpiIdList.size(); l++){
QualityRule qualityRule = new QualityRule();
qualityRule.setProvinceId(provinceIdList.get(j));
qualityRule.setKpiId(kpiIdList.get(l));
if(!channel.trim().equals("")){ qualityRule.setChannelId(Long.parseLong(channel)); }
if(!dataSourceId.trim().equals("")){ qualityRule.setDataSourceId(Long.parseLong(dataSourceId)); }
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+")");
List<Long> kList = qualityRuleDao.findByKpiIds(kpiIdList);
System.out.println(kList);
String sr = null;
if (kList==null || kList.size()==0) {
for (int j = 0; j < provinceIdList.size(); j++) {
for (int l = 0; l < kpiIdList.size(); l++) {
QualityRule qualityRule = new QualityRule();
qualityRule.setProvinceId(provinceIdList.get(j));
qualityRule.setKpiId(kpiIdList.get(l));
Long businessId = kpiDao.findBusinessIdByKpiId(kpiIdList.get(l));
qualityRule.setBusinessId(businessId);
if (!channel.trim().equals("")) {
qualityRule.setChannelId(Long.parseLong(channel));
}
}
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))));
if (!dataSourceId.trim().equals("")) {
qualityRule.setDataSourceId(Long.parseLong(dataSourceId));
}
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(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();
}
}
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();
}
}
}
sr="1";
return "redirect:/AnalysisSupport/QualityRuleResult";
} else {
sr= "2";
}
return "redirect:/AnalysisSupport/QualityRuleResult?sr="+sr;
}
}
......@@ -52,62 +52,63 @@
<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><input type="hidden" name="qualityRuleId"id="qualityRuleId" value="${qualityRule.qualityRuleId}"/></td></tr>
<tr><td>省份(<font color="red">必填</font>):</td>
<td>
<c:forEach var="province" items="${provinceList}">
<input type="checkbox" name="province" value="${province.provinceId}" >${province.provinceName}
<c:if test="${qualityRule.provinceId == province.provinceId}">
<span>${province.provinceName}</span>
</c:if>
</c:forEach>
</td>
</tr>
<tr><td>数据来源(<font color="red">必填</font>):</td>
<td>
<select class="form-control" name="dataSource" id="dataSource" >
<c:forEach var="dataSource" items="${dataSourceList}">
<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 test="${dataSource.dataSourceId == DataSource.dataSourceId}">
<span>${dataSource.dataSourceName}</span>
</c:if >
</c:forEach>
</select></td>
</tr>
<tr><td>渠道(<font color="red">必填</font>):</td>
<td><select class="form-control" name="channel" id="channel" >
<td>
<c:forEach var="channel" items="${channelList}">
<c:if test="${channel.channelId == '7'}">
<option value="${channel.channelId}" selected>${channel.channelName}</option>
</c:if>
<c:if test="${channel.channelId != '7'}">
<option value="${channel.channelId}">${channel.channelName}</option>
</c:if>
<c:if test="${channel.channelId == Channel.channelId}">
<span>${channel.channelName}</span>
</c:if >
</c:forEach>
</select></td>
</tr>
<tr><td>业务(<font color="red">必填</font>):</td>
<td >
<div id="businesstd"></div>
<c:forEach var="business" items="${businessList}">
<c:if test="${business.businessId == Business.businessId}">
<span>${Business.businessName}</span>
</c:if >
</c:forEach>
</td>
</tr>
<tr><td>数据采集频率(<font color="red">必填</font>):</td>
<td><select class="form-control" name="calCycle" id="calCycle" style="display: inline;">
<option value="30MI">30分钟</option>
<option value="01HR">1小时</option>
<option value="01DY">1天</option>
<option value="01MO">1月</option>
</select>
</td></tr>
<%--<tr><td>数据采集频率(<font color="red">必填</font>):</td>--%>
<%--<td><select class="form-control" name="calCycle" id="calCycle" style="display: inline;">--%>
<%--<option value="30MI">30分钟</option>--%>
<%--<option value="01HR">1小时</option>--%>
<%--<option value="01DY">1天</option>--%>
<%--<option value="01MO">1月</option>--%>
<%--</select>--%>
<%--</td></tr>--%>
<tr><td>指标(<font color="red">必填</font>):</td>
<td>
<div id="kpitd"></div>
<c:forEach var="kpi" items="${kpiList}">
<c:if test="${kpi.kpiId == qualityRule.kpiId}">
<span>${kpi.kpiName}</span>
</c:if >
</c:forEach>
</td>
</tr>
<tr><td>监控延迟时间(<font color="red">必填</font>):</td>
<td>
<input type="text" style="width:200px" name="frequencyValue" id="frequencyValue" />
<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>
......@@ -115,7 +116,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",alwaysUseStartDate:true,readOnly:false,hmsMenuCfg : {H : [ 1, 6 ], m : [ 30, 2 ], s : [ 60, 0 ]}})'/>
</td>
......@@ -125,13 +126,30 @@
<thead>
<tr><th>规则类型</th><th>范围最大值</th><th>范围最小值</th><th>重复考核粒度</th><th>重复考核开始时间</th><th>重复考核结束时间</th><th>重复是否连续</th><th>重复最大次数</th><th>数据是否累计</th><th><a href="javascript:deleteAllTr()">删除所有规则</a></th></tr>
</thead>
<tbody id="addTr"></tbody>
<tbody id="addTr" class='col-md-15'>
<c:forEach var="accuracyRuleList" items="${accuracyRuleList}">
<tr>
<td>${accuracyRuleList.ruleType}</td>
<td>${accuracyRuleList.scopeMaxValue}</td>
<td>${accuracyRuleList.scopeMinValue}</td>
<td>${accuracyRuleList.repeatedCheckGranularity}</td>
<td>${accuracyRuleList.repeatedCheckStartTime}</td>
<td>${accuracyRuleList.repeatedCheckEndTime}</td>
<td>${accuracyRuleList.ifRepeatedCheckSeries}</td>
<td>${accuracyRuleList.repeatedCheckMaxTime}</td>
<td>${accuracyRuleList.ifRepeatedCheckSummation}</td>
<td>
<a href="javascript:;" title="${accuracyRuleList.accuracyRuleId}" onclick="deleteRow(this,'${accuracyRuleList.accuracyRuleId}')">删除</a><%--<a href="javascript:;" onclick="updateRow(this)">修改</a>--%>
</td>
</tr>
</c:forEach>
</tbody>
</table></td></tr>
<tr><td>准确性规则类型:</td>
<td><select class="form-control" name="ruleType" id="ruleType" >
<option value=""></option>
<option value="1">范围类</option>
<option value="2">重复类</option>
<option value="范围">范围类</option>
<option value="重复">重复类</option>
</select></td></tr>
<tr class="range"><td>范围最大值:</td><td><input type="text" class="form-control" name="scopeMaxValue" id="scopeMaxValue" /></td></tr>
<tr class="range"><td>范围最小值:</td><td><input type="text" class="form-control" name="scopeMinValue" id="scopeMinValue" /></td></tr>
......@@ -172,8 +190,29 @@
</div>
</div>
</div>
<script type="text/javascript">
//加载页面时显示
var getQualityRuleId = "${qualityRule.qualityRuleId}";
var getFrequencyValue = "${qualityRule.frequencyValue}";
var getFrequencyType = "${qualityRule.frequencyType}";
var getBusinessTime = "${qualityRule.businessTime}";
getBusinessTime = getBusinessTime.replace(".0","");
$("#frequencyValue").val(getFrequencyValue);
$("#frequencyType").val(getFrequencyType);
$("#businessTime").val(getBusinessTime);
</script>
<script type="text/javascript">
$(document).ready(function(){
if($("#frequencyType").val() == "0"){
$("#calCycle").val("30MI");
}else if($("#frequencyType").val() == "1"){
$("#calCycle").val("01HR");
}else if($("#frequencyType").val() == "2"){
$("#calCycle").val("01DY");
}else if($("#frequencyType").val() == "3"){
$("#calCycle").val("01MO");
}
});
$(".range").hide();
$(".repeate").hide();
$("#addParam").hide();
......@@ -184,30 +223,52 @@
$(".repeate").hide();
$("#addParam").hide();
}
if (selectValue == 1){
if (selectValue == "范围"){
$(".repeate").hide();
$(".range").show();
$("#addParam").show();
}
if (selectValue == 2){
if (selectValue == "重复"){
$(".range").hide();
$(".repeate").show();
$("#addParam").show();
}
});
//删除所有准确性规则
//删除所有参数
function deleteAllTr(){
$("#addTr").empty();
}
$.ajax({
type : "GET",
contentType : "application/json",
url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/deleteAccuracyRule?qualityRuleId="+getQualityRuleId,
dataType : "text",
beforeSend: function(data){},
success:function(){
$("#addTr").empty();
}
});
};
//删除一条准确性规则
function deleteRow(elementTag){
$(elementTag).parent().parent().remove();
}
//删除一条参数
function deleteRow(elementTag, accuracyRuleId){
if(accuracyRuleId==""){
$(elementTag).parent().parent().remove();
}else{
$.ajax({
type : "GET",
contentType : "application/json",
url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/deleteAccuracyRule?accuracyRuleId="+accuracyRuleId,
dataType : "text",
beforeSend: function(data){},
success:function(){
$(elementTag).parent().parent().remove();
}
});
}
}
//添加/修改准确性规则
//添加准确性规则
$("#addParam").click(function(){
var ruleType= $("#ruleType").val();
var scopeMaxValue = $.trim($("#scopeMaxValue").val());
......@@ -218,25 +279,25 @@
var ifRepeatedCheckSeries = $.trim($("#ifRepeatedCheckSeries").val());
var repeatedCheckMaxTime = $.trim($("#repeatedCheckMaxTime").val());
var ifRepeatedCheckSummation = $.trim($("#ifRepeatedCheckSummation").val());
if(ruleType == "1" || ruleType == "2"){
if(ruleType == "1"){
if(ruleType == "范围" || ruleType == "重复"){
if(ruleType == "范围"){
if(scopeMaxValue==""){$.alert("范围最大值不能为空");}
if(scopeMinValue==""){$.alert("范围最小值不能为空");}
repeatedCheckGranularity ="";
repeatedCheckStartTime ="";
repeatedCheckEndTime ="";
ifRepeatedCheckSeries ="";
repeatedCheckMaxTime ="";
ifRepeatedCheckSummation ="";
} else if(ruleType == "2"){
repeatedCheckGranularity ="";
repeatedCheckStartTime ="";
repeatedCheckEndTime ="";
ifRepeatedCheckSeries ="";
repeatedCheckMaxTime ="";
ifRepeatedCheckSummation ="";
} else if(ruleType == "重复"){
if(repeatedCheckGranularity==""){$.alert("重复考核粒度不能为空");}
if(repeatedCheckStartTime==""){$.alert("重复考核开始时间不能为空");}
if(repeatedCheckEndTime==""){$.alert("重复考核结束时间不能为空");}
if(ifRepeatedCheckSeries==""){$.alert("重复是否连续不能为空");}
if(repeatedCheckMaxTime==""){$.alert("重复最大次数不能为空");}
if(ifRepeatedCheckSummation==""){$.alert("数据是否累计不能为空");}
scopeMaxValue ="";
scopeMinValue ="";
scopeMaxValue ="";
scopeMinValue ="";
}
if($("#addTr").find("tr.orange-tr").html()==null){
var addRow = $("<tr><td>"+ruleType+"</td><td>"+scopeMaxValue+"</td><td>"+scopeMinValue+"</td><td>"+repeatedCheckGranularity+"</td><td>"+repeatedCheckStartTime+"</td><td>"+repeatedCheckEndTime+"</td><td>"+ifRepeatedCheckSeries+"</td><td>"+repeatedCheckMaxTime+"</td><td>"+ifRepeatedCheckSummation+"</td><td><a href='javascript:;' title='' onclick='deleteRow(this)'>删除</a></td></tr>");
......@@ -268,227 +329,164 @@
});
//form表单提交
$("#ruleSubmit").click(function(){
if($.trim($("#frequencyValue").val())==""){
$.alert("监控延迟时间不能为空");
}else if($("#businessTime").val()==""){
$.alert("指标业务时间不能为空");
}else if($("#ruleCrtTime").val()==""){
$.alert("规则创建时间不能为空");
}else if($("#ruleUpdateTime").val()==""){
$.alert("规则更新时间不能为空");
}else{
if($.trim($("#ruleType").val())=="1" || $.trim($("#ruleType").val())=="2"){
$.dialog({
title: "提醒",
content: "有准确性规则参数尚未添加,确定提交",
ok: function(){
$("#ruleSubmit").attr("disabled",true);
var i = $("#addTr").find("tr").size();
if(i==0){
var createForm=$("#ruleMaintainForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
createForm.submit();
createForm.attr("action","#");
}else{
$("#addTr").find("tr").each(function(){
var ruleType = $(this).find("td").eq(0).html();
var scopeMaxValue = $(this).find("td").eq(1).html();
var scopeMinValue = $(this).find("td").eq(2).html();
var repeatedCheckGranularity = $(this).find("td").eq(3).html();
var repeatedCheckStartTime = $(this).find("td").eq(4).html();
var repeatedCheckEndTime = $(this).find("td").eq(5).html();
var ifRepeatedCheckSeries = $(this).find("td").eq(6).html();
var repeatedCheckMaxTime = $(this).find("td").eq(7).html();
var ifRepeatedCheckSummation = $(this).find("td").eq(8).html();
if(scopeMaxValue =="无"){scopeMaxValue ="";}
if(scopeMinValue =="无"){scopeMinValue ="";}
if(repeatedCheckGranularity =="无"){repeatedCheckGranularity ="";}
if(repeatedCheckStartTime =="无"){repeatedCheckStartTime ="";}
if(repeatedCheckEndTime ="无"){repeatedCheckEndTime ="";}
if(ifRepeatedCheckSeries =="无"){ifRepeatedCheckSeries ="";}
if(repeatedCheckMaxTime =="无"){repeatedCheckMaxTime ="";}
if(ifRepeatedCheckSummation =="无"){ifRepeatedCheckSummation ="";}
$.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=",
dataType : "text",
async: false,
beforeSend: function(data) {},
success: function(){
i--;
if(i==0){
var createForm=$("#ruleMaintainForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
createForm.submit();
createForm.attr("action","#");
}
$("#ruleSubmit").click(function() {
$.dialog({
title: "提醒",
content:"确定修改该规则吗?",
ok: function(){
if($.trim($("#frequencyValue").val())==""){
$.alert("监控延迟时间的值不能为空");
}else if($("#businessTime").val()==""){
$.alert("核查时间不能为空");
}else{
if($.trim($("#ruleType").val())!=""){
$.dialog({
title: "提醒",
content: "有准确性规则添加,确定提交",
ok: function(){
var i = $("#addTr").find("tr").size();
if(0==i){
var form = $("#ruleUpdateForm");
form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm");
form.submit();
form.attr("action","#");
}else{
$("#addTr").find("tr").each(function(){
var accuracyRuleId = $(this).find("td").find("a").attr("title");
var ruleType = $(this).find("td").eq(0).html();
var scopeMaxValue= $(this).find("td").eq(1).html();
var scopeMinValue = $(this).find("td").eq(2).html();
var repeatedCheckGranularity = $(this).find("td").eq(3).html();
var repeatedCheckStartTime = $(this).find("td").eq(4).html();
var repeatedCheckEndTime = $(this).find("td").eq(5).html();
var ifRepeatedCheckSeries = $(this).find("td").eq(6).html();
var repeatedCheckMaxTime = $(this).find("td").eq(7).html();
var ifRepeatedCheckSummation = $(this).find("td").eq(8).html();
if(accuracyRuleId!=""){//不是新增参数
$.ajax({
type : "GET",
contentType : "application/json",
url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/updateAccuracyRule?qualityRuleId="+getQualityRuleId+"&ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation+"&accuracyRuleId="+accuracyRuleId,
dataType : "text",
async: false,
beforeSend: function(data){},
success:function(){
i--;
if(i==0){
var form = $("#ruleUpdateForm");
form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm");
form.submit();
form.attr("action","#");
}
}
});
}
else{//是新增参数
$.ajax({
type : "GET",
contentType : "application/json",
url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/updateAccuracyRule?qualityRuleId="+getQualityRuleId+"&ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation+"&accuracyRuleId="+accuracyRuleId,
dataType : "text",
beforeSend: function(data){ },
success:function(){
i--;
if(i==0){
var form = $("#ruleUpdateForm");
form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm");
form.submit();
form.attr("action","#");
}
}
});
}
});
}
});
},
okValue: "确定",
cancel:function(){},
cancelValue: "取消"
});
}
},
okValue: "确定",
cancel: function(){},
cancelValue: "取消",
});
}else{
$("#ruleSubmit").attr("disabled",true);
var i = $("#addTr").find("tr").size();
if(i==0){
var createForm=$("#ruleMaintainForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
createForm.submit();
createForm.attr("action","#");
}else{
$("#addTr").find("tr").each(function(){
var ruleType = $(this).find("td").eq(0).html();
var scopeMaxValue = $(this).find("td").eq(1).html();
var scopeMinValue = $(this).find("td").eq(2).html();
var repeatedCheckGranularity = $(this).find("td").eq(3).html();
var repeatedCheckStartTime = $(this).find("td").eq(4).html();
var repeatedCheckEndTime = $(this).find("td").eq(5).html();
var ifRepeatedCheckSeries = $(this).find("td").eq(6).html();
var repeatedCheckMaxTime = $(this).find("td").eq(7).html();
var ifRepeatedCheckSummation = $(this).find("td").eq(8).html();
if(scopeMaxValue =="无"){scopeMaxValue ="";}
if(scopeMinValue =="无"){scopeMinValue ="";}
if(repeatedCheckGranularity =="无"){repeatedCheckGranularity ="";}
if(repeatedCheckStartTime =="无"){repeatedCheckStartTime ="";}
if(repeatedCheckEndTime ="无"){repeatedCheckEndTime ="";}
if(ifRepeatedCheckSeries =="无"){ifRepeatedCheckSeries ="";}
if(repeatedCheckMaxTime =="无"){repeatedCheckMaxTime ="";}
if(ifRepeatedCheckSummation =="无"){ifRepeatedCheckSummation ="";}
$.ajax({
type : "GET",
contentType : "application/json",
url: "${ctx}/AnalysisSupport/QualityRuleMaintain/createAccuracyRule?ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+encodeURIComponent(repeatedCheckGranularity)+"&repeatedCheckStartTime="+encodeURIComponent(repeatedCheckStartTime)+"&repeatedCheckEndTime="+encodeURIComponent(repeatedCheckEndTime)+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation,
dataType : "text",
async: false,
beforeSend: function(data) {},
success: function(){
i--;
if(i==0){
var createForm=$("#ruleMaintainForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
createForm.submit();
createForm.attr("action","#");
}
}else{//如果 参数填写框 不存在未填写的 数据
var i = $("#addTr").find("tr").size();
if(0==i){
var form = $("#ruleUpdateForm");
form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm");
form.submit();
form.attr("action","#");
}else{
$("#addTr").find("tr").each(function(){
var accuracyRuleId = $(this).find("td").find("a").attr("title");
var ruleType = $(this).find("td").eq(0).html();
var scopeMaxValue= $(this).find("td").eq(1).html();
var scopeMinValue = $(this).find("td").eq(2).html();
var repeatedCheckGranularity = $(this).find("td").eq(3).html();
var repeatedCheckStartTime = $(this).find("td").eq(4).html();
var repeatedCheckEndTime = $(this).find("td").eq(5).html();
var ifRepeatedCheckSeries = $(this).find("td").eq(6).html();
var repeatedCheckMaxTime = $(this).find("td").eq(7).html();
var ifRepeatedCheckSummation = $(this).find("td").eq(8).html();
if(accuracyRuleId!=""){//不是新增参数
$.ajax({
type : "GET",
contentType : "application/json",
url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/updateAccuracyRule?qualityRuleId="+getQualityRuleId+"&ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation+"&accuracyRuleId="+accuracyRuleId,
dataType : "text",
async: false,
beforeSend: function(data){},
success:function(){
i--;
if(i==0){
var form = $("#ruleUpdateForm");
form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm");
form.submit();
form.attr("action","#");
}
}
});
}else{//是新增参数
$.ajax({
type : "GET",
contentType : "application/json",
url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/updateAccuracyRule?qualityRuleId="+getQualityRuleId+"&ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation+"&accuracyRuleId="+accuracyRuleId,
dataType : "text",
beforeSend: function(data){ },
success:function(){
i--;
if(i==0){
var form = $("#ruleUpdateForm");
form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm");
form.submit();
form.attr("action","#");
}
}
});
}
});
}
});
});
}
}
}
}
});
}
},
okValue:"确定",
cancel: function(){},
cancelValue:"返回",
lock:true
});
})
$("#ruleBack").click(function(){
location.href="${ctx}/AnalysisSupport/QualityRuleResult";
});
function getProvinceCheckedValues() {
var provinceArray = new Array();
var i=0;
$("#province:checked").each(function(){
provinceArray[i]=$(this).val();
i++;
});
return provinceArray;
}
function getProvinceCheckedValuesString(){
var provinceStr="";
var provinceArray=getProvinceCheckedValues();
for(var i=0;i<provinceArray.length;i++){
if(i==provinceArray.length-1){
provinceStr+=provinceArray[i];
}else{
provinceStr+=provinceArray[i]+",";
}
}
return provinceStr;
}
var dataSourceValue =$("#dataSource").val();
var channelValue = $("#channel").val();
var businessIds = getBusinessCheckedValues();
var calCycleValue =$("#calCycle").val();
$("#dataSource").change(function(){
dataSourceValue = $("#dataSource").val();
updateBusiness(dataSourceValue,channelValue);
});
$("#channel").change(function(){
channelValue = $("#channel").val();
updateBusiness(dataSourceValue,channelValue);
});
function updateKpi(businessIds,calCycleValue){
$.ajax({
type : "GET",
contentType : "application/json",
url: "${ctx}/AnalysisSupport/QualityRuleMaintain/findKpiId?businessIds="+businessIds+"&calCycleValue="+calCycleValue,
async: false,
beforeSend: function(data) {},
success: function(data){
var td = $("#kpitd");
td.empty();
data = JSON.parse(data)
data.forEach(function(t){
td.append("<input type='checkbox' title='"+t[2]+"' name='kpiinput' class='kpiItem' value='"+t[0]+"' >"+t[1]+"</input>")
});
}
});
}
function updateBusiness(dataSource,channel){
$.ajax({
type : "GET",
contentType : "application/json",
url: "${ctx}/AnalysisSupport/QualityRuleMaintain/findBusinessId?dataSource="+dataSource+"&channel="+channel,
async: false,
beforeSend: function(data) {},
success: function(data){
var td = $("#businesstd");
var businessIds = new Array();
td.empty();
data = JSON.parse(data)
data.forEach(function(t){
td.append("<input type='checkbox' name='businessinput' class='businessItem' value='"+t[0]+"' >"+t[1]+"</input>")
businessIds+=t[0]+",";
});
updateKpi(businessIds,calCycleValue);
}
});
$(".businessItem").click(function(){
businessIds="";
$("[name='businessinput']:checked").each(function (){
businessIds += $(this).val()+",";
});
updateKpi(businessIds,calCycleValue);
});
}
$("#calCycle").change(function () {
calCycleValue=$("#calCycle").val();
$("[name='businessinput']:checked").each(function (){
businessIds += $(this).val()+",";
});
updateKpi(businessIds,calCycleValue)
updateBusinessTime(calCycleValue)
updateMonitorTimeTime(calCycleValue)
});
updateBusiness($("#dataSource").val(),$("#channel").val());
function updateBusinessTime(calCycleValue) {
$("#businessTimetd").empty()
if(calCycleValue == "30MI"){
......@@ -502,91 +500,23 @@
}
}
function getBusinessCheckedValues(){
var businessArray = new Array();
var i=0;
$("[name='businessinput']:checked").each(function(){
businessArray[i]=$(this).val();
i++;
});
return businessArray;
}
function getBusinessCheckedValuesString(){
var businessStr="";
var businessArray=getBusinessCheckedValues();
for(var i=0;i<businessArray.length;i++){
if(i==businessArray.length-1){
businessStr+=businessArray[i];
}else{
businessStr+=businessArray[i]+",";
}
}
return businessStr;
}
function getKpiCheckedValues(){
var kpiArray = new Array();
var i=0;
$("[name='kpiinput']:checked").each(function(){
kpiArray[i]=$(this).val();
i++;
});
return kpiArray;
}
function getKpiCheckedValuesString(){
var kpiStr="";
var kpiArray=getKpiCheckedValues();
for(var i=0;i<kpiArray.length;i++){
if(i==kpiArray.length-1){
kpiStr+=kpiArray[i];
}else{
kpiStr+=kpiArray[i]+",";
}
function updateMonitorTimeTime(calCycleValue) {
if (calCycleValue == "30MI") {
$("#frequencyValue").val("30");
$("#frequencyType").val(0);
} else if (calCycleValue == "01HR") {
$("#frequencyValue").val("1");
$("#frequencyType").val(1);
} else if (calCycleValue == "01DY") {
$("#frequencyValue").val("1");
$("#frequencyType").val(2);
} else if (calCycleValue == "01MO") {
$("#frequencyValue").val("1");
$("#frequencyType").val(3);
}
return kpiStr;
}
var provinceValue = getProvinceCheckedValuesString();
var businessValue = getBusinessCheckedValuesString();
var kpiValue = getKpiCheckedValuesString();
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){
$(this).attr("checked",true);
}
});
$("input[name='kpiinput']").each(function(){
if($(this).val()==getKpiinput){
$(this).attr("checked",true);
}
});
$("#frequencyValue").val(getFrequencyValue);
$("#frequencyType").val(getFrequencyType);
$("#businessTime").val(getBusinessTime);
</script>
</body>
</html>
\ No newline at end of file
......@@ -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,124 +263,135 @@ $("#addParam").click(function(){
//form表单提交
$("#ruleSubmit").click(function(){
if($.trim($("#frequencyValue").val())==""){
$.alert("监控延迟时间不能为空");
}else if($("#businessTime").val()==""){
$.alert("指标业务时间不能为空");
}else if($("#ruleCrtTime").val()==""){
$.alert("规则创建时间不能为空");
}else if($("#ruleUpdateTime").val()==""){
$.alert("规则更新时间不能为空");
}else{
if($.trim($("#ruleType").val())=="1" || $.trim($("#ruleType").val())=="2"){
$.dialog({
title: "提醒",
content: "有准确性规则参数尚未添加,确定提交",
ok: function(){
$("#ruleSubmit").attr("disabled",true);
var i = $("#addTr").find("tr").size();
if(i==0){
var createForm=$("#ruleMaintainForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
createForm.submit();
createForm.attr("action","#");
}else{
$("#addTr").find("tr").each(function(){
var ruleType = $(this).find("td").eq(0).html();
var scopeMaxValue = $(this).find("td").eq(1).html();
var scopeMinValue = $(this).find("td").eq(2).html();
var repeatedCheckGranularity = $(this).find("td").eq(3).html();
var repeatedCheckStartTime = $(this).find("td").eq(4).html();
var repeatedCheckEndTime = $(this).find("td").eq(5).html();
var ifRepeatedCheckSeries = $(this).find("td").eq(6).html();
var repeatedCheckMaxTime = $(this).find("td").eq(7).html();
var ifRepeatedCheckSummation = $(this).find("td").eq(8).html();
if(scopeMaxValue =="无"){scopeMaxValue ="";}
if(scopeMinValue =="无"){scopeMinValue ="";}
if(repeatedCheckGranularity =="无"){repeatedCheckGranularity ="";}
if(repeatedCheckStartTime =="无"){repeatedCheckStartTime ="";}
if(repeatedCheckEndTime ="无"){repeatedCheckEndTime ="";}
if(ifRepeatedCheckSeries =="无"){ifRepeatedCheckSeries ="";}
if(repeatedCheckMaxTime =="无"){repeatedCheckMaxTime ="";}
if(ifRepeatedCheckSummation =="无"){ifRepeatedCheckSummation ="";}
$.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=",
dataType : "text",
async: false,
beforeSend: function(data) {},
success: function(){
i--;
if(i==0){
var createForm=$("#ruleMaintainForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
createForm.submit();
createForm.attr("action","#");
}
}
});
});
}
},
okValue: "确定",
cancel: function(){},
cancelValue: "取消",
});
}else{
$("#ruleSubmit").attr("disabled",true);
var i = $("#addTr").find("tr").size();
if(i==0){
var createForm=$("#ruleMaintainForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
createForm.submit();
createForm.attr("action","#");
}else{
$("#addTr").find("tr").each(function(){
var ruleType = $(this).find("td").eq(0).html();
var scopeMaxValue = $(this).find("td").eq(1).html();
var scopeMinValue = $(this).find("td").eq(2).html();
var repeatedCheckGranularity = $(this).find("td").eq(3).html();
var repeatedCheckStartTime = $(this).find("td").eq(4).html();
var repeatedCheckEndTime = $(this).find("td").eq(5).html();
var ifRepeatedCheckSeries = $(this).find("td").eq(6).html();
var repeatedCheckMaxTime = $(this).find("td").eq(7).html();
var ifRepeatedCheckSummation = $(this).find("td").eq(8).html();
if(scopeMaxValue =="无"){scopeMaxValue ="";}
if(scopeMinValue =="无"){scopeMinValue ="";}
if(repeatedCheckGranularity =="无"){repeatedCheckGranularity ="";}
if(repeatedCheckStartTime =="无"){repeatedCheckStartTime ="";}
if(repeatedCheckEndTime ="无"){repeatedCheckEndTime ="";}
if(ifRepeatedCheckSeries =="无"){ifRepeatedCheckSeries ="";}
if(repeatedCheckMaxTime =="无"){repeatedCheckMaxTime ="";}
if(ifRepeatedCheckSummation =="无"){ifRepeatedCheckSummation ="";}
$.ajax({
type : "GET",
contentType : "application/json",
url: "${ctx}/AnalysisSupport/QualityRuleMaintain/createAccuracyRule?ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+encodeURIComponent(repeatedCheckGranularity)+"&repeatedCheckStartTime="+encodeURIComponent(repeatedCheckStartTime)+"&repeatedCheckEndTime="+encodeURIComponent(repeatedCheckEndTime)+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation,
dataType : "text",
async: false,
beforeSend: function(data) {},
success: function(){
i--;
if(i==0){
var createForm=$("#ruleMaintainForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
createForm.submit();
createForm.attr("action","#");
}
}
$.dialog({
title: "提醒",
content:"确定新增该规则吗?",
ok: function(){
if($.trim($("#frequencyValue").val())==""){
$.alert("监控延迟时间不能为空");
}else if($("#businessTime").val()==""){
$.alert("指标业务时间不能为空");
}else if($("#ruleCrtTime").val()==""){
$.alert("规则创建时间不能为空");
}else if($("#ruleUpdateTime").val()==""){
$.alert("规则更新时间不能为空");
}else{
if($.trim($("#ruleType").val())=="1" || $.trim($("#ruleType").val())=="2"){
$.dialog({
title: "提醒",
content: "有准确性规则参数尚未添加,确定提交",
ok: function(){
$("#ruleSubmit").attr("disabled",true);
var i = $("#addTr").find("tr").size();
if(i==0){
var createForm=$("#ruleMaintainForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
createForm.submit();
createForm.attr("action","#");
}else{
$("#addTr").find("tr").each(function(){
var ruleType = $(this).find("td").eq(0).html();
var scopeMaxValue = $(this).find("td").eq(1).html();
var scopeMinValue = $(this).find("td").eq(2).html();
var repeatedCheckGranularity = $(this).find("td").eq(3).html();
var repeatedCheckStartTime = $(this).find("td").eq(4).html();
var repeatedCheckEndTime = $(this).find("td").eq(5).html();
var ifRepeatedCheckSeries = $(this).find("td").eq(6).html();
var repeatedCheckMaxTime = $(this).find("td").eq(7).html();
var ifRepeatedCheckSummation = $(this).find("td").eq(8).html();
if(scopeMaxValue =="无"){scopeMaxValue ="";}
if(scopeMinValue =="无"){scopeMinValue ="";}
if(repeatedCheckGranularity =="无"){repeatedCheckGranularity ="";}
if(repeatedCheckStartTime =="无"){repeatedCheckStartTime ="";}
if(repeatedCheckEndTime ="无"){repeatedCheckEndTime ="";}
if(ifRepeatedCheckSeries =="无"){ifRepeatedCheckSeries ="";}
if(repeatedCheckMaxTime =="无"){repeatedCheckMaxTime ="";}
if(ifRepeatedCheckSummation =="无"){ifRepeatedCheckSummation ="";}
$.ajax({
type : "GET",
contentType : "application/json",
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) {},
success: function(){
i--;
if(i==0){
var createForm=$("#ruleMaintainForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
createForm.submit();
createForm.attr("action","#");
}
}
});
});
}
},
okValue: "确定",
cancel: function(){},
cancelValue: "取消",
});
}else{
$("#ruleSubmit").attr("disabled",true);
var i = $("#addTr").find("tr").size();
if(i==0){
var createForm=$("#ruleMaintainForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
createForm.submit();
createForm.attr("action","#");
}else{
$("#addTr").find("tr").each(function(){
var ruleType = $(this).find("td").eq(0).html();
var scopeMaxValue = $(this).find("td").eq(1).html();
var scopeMinValue = $(this).find("td").eq(2).html();
var repeatedCheckGranularity = $(this).find("td").eq(3).html();
var repeatedCheckStartTime = $(this).find("td").eq(4).html();
var repeatedCheckEndTime = $(this).find("td").eq(5).html();
var ifRepeatedCheckSeries = $(this).find("td").eq(6).html();
var repeatedCheckMaxTime = $(this).find("td").eq(7).html();
var ifRepeatedCheckSummation = $(this).find("td").eq(8).html();
if(scopeMaxValue =="无"){scopeMaxValue ="";}
if(scopeMinValue =="无"){scopeMinValue ="";}
if(repeatedCheckGranularity =="无"){repeatedCheckGranularity ="";}
if(repeatedCheckStartTime =="无"){repeatedCheckStartTime ="";}
if(repeatedCheckEndTime ="无"){repeatedCheckEndTime ="";}
if(ifRepeatedCheckSeries =="无"){ifRepeatedCheckSeries ="";}
if(repeatedCheckMaxTime =="无"){repeatedCheckMaxTime ="";}
if(ifRepeatedCheckSummation =="无"){ifRepeatedCheckSummation ="";}
$.ajax({
type : "GET",
contentType : "application/json",
url: "${ctx}/AnalysisSupport/QualityRuleMaintain/createAccuracyRule?ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+encodeURIComponent(repeatedCheckGranularity)+"&repeatedCheckStartTime="+encodeURIComponent(repeatedCheckStartTime)+"&repeatedCheckEndTime="+encodeURIComponent(repeatedCheckEndTime)+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation,
dataType : "text",
async: false,
beforeSend: function(data) {},
success: function(){
i--;
if(i==0){
var createForm=$("#ruleMaintainForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm");
createForm.submit();
createForm.attr("action","#");
}
}
});
});
}
}
});
}
}
}
},
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