Commit 90a378e9 authored by 胡斌's avatar 胡斌

Merge remote-tracking branch 'origin/liuna'

# Conflicts: # src/main/webapp/static/js/ruleResultDetailTable.js
parents f896fa24 6107fd18
...@@ -125,4 +125,23 @@ public class AccuracyRule implements Serializable { ...@@ -125,4 +125,23 @@ public class AccuracyRule implements Serializable {
this.validFlag = 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,8 +33,13 @@ public interface AccuracyRuleDao extends JpaSpecificationExecutor<AccuracyRule>, ...@@ -33,8 +33,13 @@ public interface AccuracyRuleDao extends JpaSpecificationExecutor<AccuracyRule>,
//根据准确性规则ID更新准确性规则信息 //根据准确性规则ID更新准确性规则信息
@Modifying @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") @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("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); 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删除一条准确性规则信息 //根据准确性规则ID删除一条准确性规则信息
@Modifying @Modifying
......
...@@ -37,7 +37,9 @@ public interface KpiDao extends JpaSpecificationExecutor<Kpi>,PagingAndSortingRe ...@@ -37,7 +37,9 @@ public interface KpiDao extends JpaSpecificationExecutor<Kpi>,PagingAndSortingRe
@Query("select kpi.kpiId, kpi.kpiName from Kpi kpi where kpi.kpiId >=0") @Query("select kpi.kpiId, kpi.kpiName from Kpi kpi where kpi.kpiId >=0")
List<Object[]> findAllKpiIdAndKpiName(); List<Object[]> findAllKpiIdAndKpiName();
//由数据来源得到指标 //由指标得到业务ID
@Query("select businessId from Kpi kpi where kpiId=:kpiId")
Long findBusinessIdByKpiId(@Param("kpiId") Long kpiId);
//由指标名得到指标周期类型 //由指标名得到指标周期类型
......
...@@ -27,6 +27,10 @@ public interface QualityRuleDao extends JpaSpecificationExecutor<QualityRule>, ...@@ -27,6 +27,10 @@ public interface QualityRuleDao extends JpaSpecificationExecutor<QualityRule>,
//根据质量规则ID查找质量规则 //根据质量规则ID查找质量规则
List<QualityRule> findByQualityRuleIdIn(List<Long> qualityRuleId); 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删除质量规则 //根据质量规则ID删除质量规则
@Modifying @Modifying
@Query("delete from QualityRule qr where qr.qualityRuleId in (:qualityRuleId)") @Query("delete from QualityRule qr where qr.qualityRuleId in (:qualityRuleId)")
...@@ -34,8 +38,8 @@ public interface QualityRuleDao extends JpaSpecificationExecutor<QualityRule>, ...@@ -34,8 +38,8 @@ public interface QualityRuleDao extends JpaSpecificationExecutor<QualityRule>,
//根据质量规则ID修改质量规则 //根据质量规则ID修改质量规则
@Modifying @Modifying
@Query("update from QualityRule qr set qr.kpiMonitorTime=:kpiMonitorTime, qr.kpiMonitorRunTime=:kpiMonitorRunTime, qr.businessTime=:businessTime, qr.ruleUpdateTime=:ruleUpdateTime where qr.qualityRuleId=: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("qualityRuleId")Long 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得到数据条数 //根据质量规则ID得到数据条数
@Query("select count(*) from QualityRule qualityRule where qualityRule.qualityRuleId=:qualityRuleId") @Query("select count(*) from QualityRule qualityRule where qualityRule.qualityRuleId=:qualityRuleId")
......
...@@ -29,10 +29,16 @@ public class AccuracyRuleService { ...@@ -29,10 +29,16 @@ public class AccuracyRuleService {
//根据准确性规则ID更新准确性规则 //根据准确性规则ID更新准确性规则
@Transactional(readOnly=false) @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){ public void updateAccuracyRuleByAccuracyRuleId(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); accuracyRuleDao.updateAccuracyRuleByAccuracyRuleId(repeatedCheckGranularity, repeatedCheckStartTime, repeatedCheckEndTime, ifRepeatedCheckSeries, repeatedCheckMaxTime, ifRepeatedCheckSummation,accuracyRuleId);
} }
@Transactional(readOnly = false)
public void updateByAccuracyRuleId(Double scopeMaxValue, Double scopeMinValue) {
accuracyRuleDao.updateByAccuracyRuleId(scopeMaxValue,scopeMinValue);
}
//根据准确性规则ID删除一条准确性规则信息 //根据准确性规则ID删除一条准确性规则信息
@Transactional(readOnly=false) @Transactional(readOnly=false)
public void deleteAccuracyRuleByAccuracyRuleId(Long accuracyRuleId){ public void deleteAccuracyRuleByAccuracyRuleId(Long accuracyRuleId){
......
...@@ -46,7 +46,7 @@ public class QualityRuleService { ...@@ -46,7 +46,7 @@ public class QualityRuleService {
//根据质量规则ID修改质量规则 //根据质量规则ID修改质量规则
@Transactional(readOnly=false) @Transactional(readOnly=false)
public void updateByQualityRuleId(String kpiMonitorTime,Timestamp kpiMonitorRunTime,Timestamp businessTime,Timestamp ruleUpdateTime,Long qualityRuleId){ public void updateByQualityRuleId(String kpiMonitorTime,Timestamp kpiMonitorRunTime,Timestamp businessTime,Timestamp ruleUpdateTime,Long frequencyValue,Long frequencyType,Long qualityRuleId){
qualityRuleDao.updateQualityRuleByQualityRuleId(kpiMonitorTime,kpiMonitorRunTime,businessTime,ruleUpdateTime,qualityRuleId); qualityRuleDao.updateQualityRuleByQualityRuleId(kpiMonitorTime,kpiMonitorRunTime,businessTime,ruleUpdateTime,frequencyValue,frequencyType,qualityRuleId);
} }
} }
...@@ -13,6 +13,8 @@ import java.util.Map; ...@@ -13,6 +13,8 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; 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.repository.*;
import com.hp.cmsz.service.BusinessService; import com.hp.cmsz.service.BusinessService;
import com.hp.cmsz.service.CmszOperationLogService; import com.hp.cmsz.service.CmszOperationLogService;
...@@ -25,14 +27,6 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -25,14 +27,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.google.gson.Gson; 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.service.analysissupport.AccuracyRuleService;
import com.hp.cmsz.web.PageURLController; import com.hp.cmsz.web.PageURLController;
...@@ -48,7 +42,7 @@ import com.hp.cmsz.web.PageURLController; ...@@ -48,7 +42,7 @@ import com.hp.cmsz.web.PageURLController;
public class QualityRuleConfigurationController { public class QualityRuleConfigurationController {
@Autowired @Autowired
private ProvinceDao provinceDao; private ProvinceAllDao provinceAllDao;
@Autowired @Autowired
private ChannelDao channelDao; private ChannelDao channelDao;
...@@ -87,111 +81,53 @@ public class QualityRuleConfigurationController { ...@@ -87,111 +81,53 @@ public class QualityRuleConfigurationController {
private CmszOperationLogService cmszOperationLogService; private CmszOperationLogService cmszOperationLogService;
private String staticQualityRuleId = ""; private String staticQualityRuleId = "";
private Double staticScopeMaxValue = 0.00;
private Double staticScopeMinValue = 0.00;
@RequestMapping(value = "") @RequestMapping(value = "")
public String ruleMaintainHome(@RequestParam(value = "qualityRuleId", defaultValue ="") String qualityRuleId, public String ruleMaintainHome(@RequestParam(value = "qualityRuleId", defaultValue ="") String qualityRuleId,
Map model){ Map model){
staticQualityRuleId = qualityRuleId;
QualityRule qualityRule = null; QualityRule qualityRule = null;
List<AccuracyRule> accuracyRuleList = null; List<AccuracyRule> accuracyRuleList = null;
if(!qualityRuleId.trim().equals("")){ if(!qualityRuleId.trim().equals("")){
qualityRule = qualityRuleDao.findByQualityRuleId(Long.parseLong(qualityRuleId)); qualityRule = qualityRuleDao.findByQualityRuleId(Long.parseLong(qualityRuleId));
accuracyRuleList = accuracyRuleDao.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<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<DataType> dataTypeList= (List<DataType>)dataTypeDao.findAll();
//查询出所有的数据来源 //查询出所有的数据来源
List<DataSource> dataSourceList=(List<DataSource>)dataSourceDao.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(); Gson gson = new Gson();
model.put("provinceList", provinceList); model.put("provinceList", provinceList);
model.put("channelList", channelList); model.put("channelList", channelList);
model.put("kpiList", kpiList); model.put("kpiList", kpiList);
model.put("businessList", gson.toJson(businessList)); model.put("businessList", businessList);
model.put("dataTypeList", dataTypeList); model.put("dataTypeList", dataTypeList);
model.put("dataSourceList", dataSourceList); model.put("dataSourceList", dataSourceList);
model.put("qualityRule",qualityRule);
model.put("accuracyRuleList",accuracyRuleList); 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; 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) @RequestMapping(value = "/deleteAccuracyRule*",method=RequestMethod.GET)
@ResponseBody @ResponseBody
...@@ -211,70 +147,53 @@ public class QualityRuleConfigurationController { ...@@ -211,70 +147,53 @@ public class QualityRuleConfigurationController {
@ResponseBody @ResponseBody
public void updateParameter( public void updateParameter(
@RequestParam(value="ruleType") String ruleType, @RequestParam(value="ruleType") String ruleType,
@RequestParam(value="scopeMaxValue") double scopeMaxValue, @RequestParam(value="scopeMaxValue") String scopeMaxValue,
@RequestParam(value="scopeMinValue") double scopeMinValue, @RequestParam(value="scopeMinValue") String scopeMinValue,
@RequestParam(value="repeatedCheckGranularity") String repeatedCheckGranularity, @RequestParam(value="repeatedCheckGranularity") String repeatedCheckGranularity,
@RequestParam(value="repeatedCheckStartTime") Date repeatedCheckStartTime, @RequestParam(value="repeatedCheckStartTime") String repeatedCheckStartTime,
@RequestParam(value="repeatedCheckEndTime") Date repeatedCheckEndTime, @RequestParam(value="repeatedCheckEndTime") String repeatedCheckEndTime,
@RequestParam(value="ifRepeatedCheckSeries") String ifRepeatedCheckSeries, @RequestParam(value="ifRepeatedCheckSeries") String ifRepeatedCheckSeries,
@RequestParam(value="repeatedCheckMaxTime") Long repeatedCheckMaxTime, @RequestParam(value="repeatedCheckMaxTime") String repeatedCheckMaxTime,
@RequestParam(value="ifRepeatedCheckSummation") String ifRepeatedCheckSummation, @RequestParam(value="ifRepeatedCheckSummation") String ifRepeatedCheckSummation,
@RequestParam(value="qualityRuleId")String qualityRuleId, @RequestParam(value="qualityRuleId")String qualityRuleId,
@RequestParam(value="accuracyRuleId")String accuracyRuleId){ @RequestParam(value="accuracyRuleId")String accuracyRuleId) throws ParseException{
System.out.println();
if(qualityRuleId.trim().equals("")){ SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if(accuracyRuleId.trim().equals("")){
AccuracyRule accuracyRule = new AccuracyRule(); AccuracyRule accuracyRule = new AccuracyRule();
accuracyRule.setAccuracyRuleId(Long.parseLong(qualityRuleId)); accuracyRule.setQualityRuleId(Long.parseLong(qualityRuleId));
if (ruleType == "1") { accuracyRule.setRuleType(ruleType);
accuracyRule.setRuleType("范围"); if (!scopeMaxValue.trim().equals("")) {accuracyRule.setScopeMaxValue(scopeMaxValue);}
} else if (ruleType == "2") { if (!scopeMinValue.trim().equals("")){accuracyRule.setScopeMinValue(scopeMinValue);}
accuracyRule.setRuleType("重复"); if (!repeatedCheckGranularity.trim().equals("")){accuracyRule.setRepeatedCheckGranularity(repeatedCheckGranularity);}
} if (!repeatedCheckStartTime.trim().equals("")){accuracyRule.setRepeatedCheckStartTime(sd.parse(repeatedCheckStartTime));}
accuracyRule.setScopeMinValue(String.valueOf(scopeMaxValue)); if (!repeatedCheckEndTime.trim().equals("")){accuracyRule.setRepeatedCheckEndTime(sd.parse(repeatedCheckEndTime));}
accuracyRule.setScopeMinValue(String.valueOf(scopeMinValue)); if (!ifRepeatedCheckSeries.trim().equals("")){accuracyRule.setIfRepeatedCheckSeries(ifRepeatedCheckSeries);}
accuracyRule.setRepeatedCheckGranularity(repeatedCheckGranularity); if (!repeatedCheckMaxTime.trim().equals("")){accuracyRule.setRepeatedCheckMaxTime(Long.parseLong(repeatedCheckMaxTime));}
accuracyRule.setRepeatedCheckStartTime(repeatedCheckStartTime); if (!ifRepeatedCheckSummation.trim().equals("")){accuracyRule.setIfRepeatedCheckSummation(ifRepeatedCheckSummation);}
accuracyRule.setRepeatedCheckEndTime(repeatedCheckEndTime); accuracyRule.setValidFlag("1");
accuracyRule.setIfRepeatedCheckSeries(ifRepeatedCheckSeries);
accuracyRule.setRepeatedCheckMaxTime(repeatedCheckMaxTime);
accuracyRule.setIfRepeatedCheckSummation(ifRepeatedCheckSummation);
accuracyRuleDao.save(accuracyRule); 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) @RequestMapping(value = "/updateQualityRuleForm",method=RequestMethod.POST)
public String updateQualityRuleForm(@RequestParam(value="qualityRuleId") String qualityRuleId, 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="frequencyValue") String frequencyValue,
@RequestParam(value="frequencyType") String frequencyType, @RequestParam(value="frequencyType") String frequencyType,
@RequestParam(value ="ruleCrtTime") String ruleCrtTime,
@RequestParam(value="businessTime") String businessTime, @RequestParam(value="businessTime") String businessTime,
HttpServletResponse response, HttpServletRequest request) throws ParseException { HttpServletResponse response, HttpServletRequest request) throws ParseException {
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
QualityRule qualityRule = new QualityRule(); QualityRule qualityRule = qualityRuleDao.findByQualityRuleId(Long.parseLong(qualityRuleId));
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("")) { if (!frequencyValue.trim().equals("")) {
qualityRule.setFrequencyValue(Long.parseLong(frequencyValue)); qualityRule.setFrequencyValue(Long.parseLong(frequencyValue));
qualityRule.setFrequencyType(Long.parseLong(frequencyType)); qualityRule.setFrequencyType(Long.parseLong(frequencyType));
...@@ -302,11 +221,7 @@ public class QualityRuleConfigurationController { ...@@ -302,11 +221,7 @@ public class QualityRuleConfigurationController {
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getMonth() + Integer.parseInt(frequencyValue)))); 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.setRuleUpdateTime(Timestamp.valueOf(sd.format(new Date())));
qualityRule.setRuleValidFlag("1");
qualityRule.setIfSystemValue("1");
qualityRuleDao.save(qualityRule); qualityRuleDao.save(qualityRule);
cmszOperationLogService.createLog("修改", "更新数据质量规则", "quality_rule_warehouse_info_t. QUALITY_RULE_ID=" + qualityRule.getQualityRuleId().toString()); cmszOperationLogService.createLog("修改", "更新数据质量规则", "quality_rule_warehouse_info_t. QUALITY_RULE_ID=" + qualityRule.getQualityRuleId().toString());
......
...@@ -77,20 +77,20 @@ public class QualityRuleMaintainController { ...@@ -77,20 +77,20 @@ public class QualityRuleMaintainController {
private CmszOperationLogService cmszOperationLogService; private CmszOperationLogService cmszOperationLogService;
@RequestMapping(value = "") @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(); List<DataSource> dataSourceList = (List<DataSource>) dataSourceDao.findAll();
Gson gson = new Gson(); Gson gson = new Gson();
model.put("provinceList", provinceList); model.put("provinceList", provinceList);
model.put("channelList", channelList); model.put("channelList", channelList);
...@@ -104,22 +104,23 @@ public class QualityRuleMaintainController { ...@@ -104,22 +104,23 @@ public class QualityRuleMaintainController {
@RequestMapping(value = "/findBusinessId*") @RequestMapping(value = "/findBusinessId*")
@ResponseBody @ResponseBody
public void datasource_select(@RequestParam(value = "dataSource", defaultValue ="" ) String dataSource, public void datasource_select(@RequestParam(value = "dataSource", defaultValue = "") String dataSource,
@RequestParam(value = "channel", defaultValue ="" ) String channel, @RequestParam(value = "channel", defaultValue = "") String channel,
HttpServletResponse response) { HttpServletResponse response) {
System.out.println(dataSource); System.out.println(dataSource);
List<Object []> resultList = new ArrayList<Object []>(); List<Object[]> resultList = new ArrayList<Object[]>();
List<Object[]> list = (List<Object[]>)businessDao.findBusinessIdAndBusinessNameByDataSourceIdAndChannelIdWithIsActive(Long.parseLong(channel),Long.parseLong(dataSource)); List<Object[]> list = (List<Object[]>) businessDao.findBusinessIdAndBusinessNameByDataSourceIdAndChannelIdWithIsActive(Long.parseLong(channel), Long.parseLong(dataSource));
for(int i=0;i<list.size();i++){ for (int i = 0; i < list.size(); i++) {
Object[] objs = list.get(i); Object[] objs = list.get(i);
//将重复的业务名的Id写在同一个对象中 //将重复的业务名的Id写在同一个对象中
for(int j=0;j<list.size();j++){ for (int j = 0; j < list.size(); j++) {
if(i == j){}else{ if (i == j) {
} else {
Object[] objs1 = list.get(j); Object[] objs1 = list.get(j);
if(objs[1].equals(objs1[1])){ if (objs[1].equals(objs1[1])) {
objs[0] = objs[0] +","+ objs1[0]; objs[0] = objs[0] + "," + objs1[0];
list.remove(j); list.remove(j);
j--; j--;
} }
...@@ -131,30 +132,28 @@ public class QualityRuleMaintainController { ...@@ -131,30 +132,28 @@ public class QualityRuleMaintainController {
Gson gson = new Gson(); Gson gson = new Gson();
response.setContentType("text/Xml;chartset=gbk"); response.setContentType("text/Xml;chartset=gbk");
PrintWriter out = null; PrintWriter out = null;
try{ try {
out = response.getWriter(); out = response.getWriter();
out.println(gson.toJson(resultList)); out.println(gson.toJson(resultList));
} } catch (IOException ex) {
catch(IOException ex){
ex.printStackTrace(); ex.printStackTrace();
} } finally {
finally{
out.close(); out.close();
} }
} }
@RequestMapping(value="/findKpiId*") @RequestMapping(value = "/findKpiId*")
@ResponseBody @ResponseBody
public void findKpiId(@RequestParam(value = "businessIds", defaultValue ="" ) String businessIds, public void findKpiId(@RequestParam(value = "businessIds", defaultValue = "") String businessIds,
@RequestParam(value = "calCycleValue", defaultValue = "30MI") String calCycleValue, @RequestParam(value = "calCycleValue", defaultValue = "30MI") String calCycleValue,
HttpServletResponse response){ HttpServletResponse response) {
String[] strs = businessIds.split(","); String[] strs = businessIds.split(",");
List<Long> businessIdlist = new ArrayList<Long>(); 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])); businessIdlist.add(Long.valueOf(strs[i]));
} }
List<Object[]> businessKpiList = kpiDao.findKpiIdAndKpiNameAndKpiCodeByBusinessIds(calCycleValue,businessIdlist); List<Object[]> businessKpiList = kpiDao.findKpiIdAndKpiNameAndKpiCodeByBusinessIds(calCycleValue, businessIdlist);
Gson gson = new Gson(); Gson gson = new Gson();
response.setContentType("text/Xml;charset=gbk"); response.setContentType("text/Xml;charset=gbk");
...@@ -162,34 +161,36 @@ public class QualityRuleMaintainController { ...@@ -162,34 +161,36 @@ public class QualityRuleMaintainController {
try { try {
out = response.getWriter(); out = response.getWriter();
out.println(gson.toJson(businessKpiList)); out.println(gson.toJson(businessKpiList));
} } catch (IOException ex1) {
catch (IOException ex1) {
ex1.printStackTrace(); ex1.printStackTrace();
}finally{ out.close(); } } finally {
out.close();
}
} }
private List<Long> qualityRuleIdList = new ArrayList<Long>(); private List<Long> qualityRuleIdList = new ArrayList<Long>();
//新增准确性规则 //新增准确性规则
@RequestMapping(value = "/createAccuracyRule*", method = RequestMethod.GET) @RequestMapping(value = "/createAccuracyRule*", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public void createAccuracyRule( public void createAccuracyRule(
@RequestParam(value="ruleType") String ruleType, @RequestParam(value = "ruleType") String ruleType,
@RequestParam(value="scopeMaxValue") String scopeMaxValue, @RequestParam(value = "scopeMaxValue") String scopeMaxValue,
@RequestParam(value="scopeMinValue") String scopeMinValue, @RequestParam(value = "scopeMinValue") String scopeMinValue,
@RequestParam(value="repeatedCheckGranularity") String repeatedCheckGranularity, @RequestParam(value = "repeatedCheckGranularity") String repeatedCheckGranularity,
@RequestParam(value="repeatedCheckStartTime") String repeatedCheckStartTime, @RequestParam(value = "repeatedCheckStartTime") String repeatedCheckStartTime,
@RequestParam(value="repeatedCheckEndTime") String repeatedCheckEndTime, @RequestParam(value = "repeatedCheckEndTime") String repeatedCheckEndTime,
@RequestParam(value="ifRepeatedCheckSeries") String ifRepeatedCheckSeries, @RequestParam(value = "ifRepeatedCheckSeries") String ifRepeatedCheckSeries,
@RequestParam(value="repeatedCheckMaxTime") String repeatedCheckMaxTime, @RequestParam(value = "repeatedCheckMaxTime") String repeatedCheckMaxTime,
@RequestParam(value="ifRepeatedCheckSummation") String ifRepeatedCheckSummation, @RequestParam(value = "ifRepeatedCheckSummation") String ifRepeatedCheckSummation,
HttpServletResponse response,HttpServletRequest request) { HttpServletResponse response, HttpServletRequest request) {
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
AccuracyRule accuracyRule = new AccuracyRule(); AccuracyRule accuracyRule = new AccuracyRule();
if (!ruleType.trim().equals("")) { if (!ruleType.trim().equals("")) {
if (ruleType.equals("1")) { if (ruleType.equals("1")) {
accuracyRule.setRuleType("范围"); accuracyRule.setRuleType("范围");
System.out.println("rule" + accuracyRule.getRuleType());
} else if (ruleType.equals("2")) { } else if (ruleType.equals("2")) {
accuracyRule.setRuleType("重复"); accuracyRule.setRuleType("重复");
} }
...@@ -227,66 +228,79 @@ public class QualityRuleMaintainController { ...@@ -227,66 +228,79 @@ public class QualityRuleMaintainController {
} }
accuracyRule.setRuleCrtTime(new Date()); accuracyRule.setRuleCrtTime(new Date());
accuracyRule.setRuleUpdateTime(new Date()); accuracyRule.setRuleUpdateTime(new Date());
accuracyRule.setValidFlag("1");
accuracyRuleDao.save(accuracyRule); accuracyRuleDao.save(accuracyRule);
Long qualityRuleId = accuracyRule.getAccuracyRuleId(); Long qualityRuleId = accuracyRule.getAccuracyRuleId();
qualityRuleIdList.add(qualityRuleId); qualityRuleIdList.add(qualityRuleId);
} }
} }
//新增质量模型 //新增质量模型
@RequestMapping(value = "/saveRuleDataForm", method = RequestMethod.POST) @RequestMapping(value = "/saveRuleDataForm", method = RequestMethod.POST)
public String saveRuleDataForm (@RequestParam(value="businessinput") String business, public String saveRuleDataForm(@RequestParam(value = "businessinput") String business,
@RequestParam(value="province") String province, @RequestParam(value = "province") String province,
@RequestParam(value="channel") String channel, @RequestParam(value = "channel") String channel,
@RequestParam(value="dataSource") String dataSourceId, @RequestParam(value = "dataSource") String dataSourceId,
@RequestParam(value="kpiinput") String kpi, @RequestParam(value = "kpiinput") String kpi,
@RequestParam(value="frequencyType") String frequencyType, @RequestParam(value = "frequencyType") String frequencyType,
@RequestParam(value="frequencyValue") String frequencyValue, @RequestParam(value = "frequencyValue") String frequencyValue,
@RequestParam(value="businessTime") String businessTime, @RequestParam(value = "businessTime") String businessTime,
HttpServletResponse response, HttpServletRequest request) throws ParseException { HttpServletResponse response, HttpServletRequest request) throws ParseException {
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<Long> provinceIdList = new ArrayList<Long>(); 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])); provinceIdList.add(Long.parseLong(province.split(",")[i]));
} }
List<Long> kpiIdList = new ArrayList<Long>(); 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])); kpiIdList.add(Long.parseLong(kpi.split(",")[i]));
} }
for(int j=0; j<provinceIdList.size(); j++) { List<Long> kList = qualityRuleDao.findByKpiIds(kpiIdList);
for(int l=0; l<kpiIdList.size(); l++){ 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 qualityRule = new QualityRule();
qualityRule.setProvinceId(provinceIdList.get(j)); qualityRule.setProvinceId(provinceIdList.get(j));
qualityRule.setKpiId(kpiIdList.get(l)); qualityRule.setKpiId(kpiIdList.get(l));
if(!channel.trim().equals("")){ qualityRule.setChannelId(Long.parseLong(channel)); } Long businessId = kpiDao.findBusinessIdByKpiId(kpiIdList.get(l));
if(!dataSourceId.trim().equals("")){ qualityRule.setDataSourceId(Long.parseLong(dataSourceId)); } qualityRule.setBusinessId(businessId);
if(!frequencyValue.trim().equals("")){ 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.setFrequencyValue(Long.parseLong(frequencyValue));
qualityRule.setFrequencyType(Long.parseLong(frequencyType)); qualityRule.setFrequencyType(Long.parseLong(frequencyType));
if(frequencyType.equals("0")){ if (frequencyType.equals("0")) {
qualityRule.setKpiMonitorTime(frequencyValue+"/1440"); qualityRule.setKpiMonitorTime(frequencyValue + "/1440");
} else if(frequencyType.equals("1")){ } else if (frequencyType.equals("1")) {
qualityRule.setKpiMonitorTime(frequencyValue+"/24"); qualityRule.setKpiMonitorTime(frequencyValue + "/24");
} else if(frequencyType.equals("2")){ } else if (frequencyType.equals("2")) {
qualityRule.setKpiMonitorTime(frequencyValue); qualityRule.setKpiMonitorTime(frequencyValue);
} else if(frequencyType.equals("3")){ } else if (frequencyType.equals("3")) {
qualityRule.setKpiMonitorTime("ADD_MONTH("+frequencyValue+")"); qualityRule.setKpiMonitorTime("ADD_MONTH(" + frequencyValue + ")");
}
} }
if (!businessTime.trim().equals("")) {
qualityRule.setBusinessTime(Timestamp.valueOf(businessTime));
} }
if(!businessTime.trim().equals("")){ qualityRule.setBusinessTime(Timestamp.valueOf(businessTime)); } if (!frequencyValue.trim().equals("")) {
if(!frequencyValue.trim().equals("")){ if (frequencyType.equals("0")) {
if(frequencyType.equals("0")){ qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getTime() + Integer.parseInt(frequencyValue) * 60 * 1000)));
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getTime()+Integer.parseInt(frequencyValue)*60*1000))); } else if (frequencyType.equals("1")) {
} else if(frequencyType.equals("1")){ qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getTime() + Integer.parseInt(frequencyValue) * 60 * 60 * 1000)));
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getTime()+Integer.parseInt(frequencyValue)*60*60*1000))); } else if (frequencyType.equals("2")) {
} else if(frequencyType.equals("2")){ qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getTime() + Integer.parseInt(frequencyValue) * 24 * 60 * 60 * 1000)));
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getTime()+Integer.parseInt(frequencyValue)*24*60*60*1000))); } else if (frequencyType.equals("3")) {
} else if(frequencyType.equals("3")){ qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getMonth() + Integer.parseInt(frequencyValue))));
qualityRule.setKpiMonitorRunTime(Timestamp.valueOf(sd.format(sd.parse(businessTime).getMonth()+Integer.parseInt(frequencyValue))));
} }
} }
qualityRule.setRuleCrtTime(Timestamp.valueOf(sd.format(new Date()))); qualityRule.setRuleCrtTime(Timestamp.valueOf(sd.format(new Date())));
...@@ -294,16 +308,19 @@ public class QualityRuleMaintainController { ...@@ -294,16 +308,19 @@ public class QualityRuleMaintainController {
qualityRule.setRuleValidFlag("1"); qualityRule.setRuleValidFlag("1");
qualityRule.setIfSystemValue("1"); qualityRule.setIfSystemValue("1");
qualityRuleDao.save(qualityRule); qualityRuleDao.save(qualityRule);
cmszOperationLogService.createLog("增加", "新建质量模型",""); cmszOperationLogService.createLog("增加", "新建质量模型", "");
Long qualityRuleId = qualityRule.getQualityRuleId(); Long qualityRuleId = qualityRule.getQualityRuleId();
if(!qualityRuleIdList.isEmpty()){ if (!qualityRuleIdList.isEmpty()) {
accuracyRuleService.updateAccuracyRuleByAccuracyRuleIds(qualityRuleId, qualityRuleIdList); accuracyRuleService.updateAccuracyRuleByAccuracyRuleIds(qualityRuleId, qualityRuleIdList);
qualityRuleIdList.clear(); qualityRuleIdList.clear();
} }
} }
} }
sr="1";
} else {
return "redirect:/AnalysisSupport/QualityRuleResult"; sr= "2";
}
return "redirect:/AnalysisSupport/QualityRuleResult?sr="+sr;
} }
} }
...@@ -52,62 +52,63 @@ ...@@ -52,62 +52,63 @@
<div class="table-header">数据质量规则更新</div> <div class="table-header">数据质量规则更新</div>
<form action="#" class="form-horizontal" id="ruleUpdateForm" method="post"> <form action="#" class="form-horizontal" id="ruleUpdateForm" method="post">
<table id="ruleMaintainTable" class="table-null"> <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> <tr><td>省份(<font color="red">必填</font>):</td>
<td> <td>
<c:forEach var="province" items="${provinceList}"> <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> </c:forEach>
</td> </td>
</tr> </tr>
<tr><td>数据来源(<font color="red">必填</font>):</td> <tr><td>数据来源(<font color="red">必填</font>):</td>
<td> <td>
<select class="form-control" name="dataSource" id="dataSource" >
<c:forEach var="dataSource" items="${dataSourceList}"> <c:forEach var="dataSource" items="${dataSourceList}">
<c:if test="${dataSource.dataSourceId == '5'}"> <c:if test="${dataSource.dataSourceId == DataSource.dataSourceId}">
<option value="${dataSource.dataSourceId}" selected>${dataSource.dataSourceName}</option> <span>${dataSource.dataSourceName}</span>
</c:if >
<c:if test="${dataSource.dataSourceId != '5'}">
<option value="${dataSource.dataSourceId}" >${dataSource.dataSourceName}</option>
</c:if > </c:if >
</c:forEach> </c:forEach>
</select></td> </select></td>
</tr> </tr>
<tr><td>渠道(<font color="red">必填</font>):</td> <tr><td>渠道(<font color="red">必填</font>):</td>
<td><select class="form-control" name="channel" id="channel" > <td>
<c:forEach var="channel" items="${channelList}"> <c:forEach var="channel" items="${channelList}">
<c:if test="${channel.channelId == '7'}"> <c:if test="${channel.channelId == Channel.channelId}">
<option value="${channel.channelId}" selected>${channel.channelName}</option> <span>${channel.channelName}</span>
</c:if> </c:if >
<c:if test="${channel.channelId != '7'}">
<option value="${channel.channelId}">${channel.channelName}</option>
</c:if>
</c:forEach> </c:forEach>
</select></td> </select></td>
</tr> </tr>
<tr><td>业务(<font color="red">必填</font>):</td> <tr><td>业务(<font color="red">必填</font>):</td>
<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> </td>
</tr> </tr>
<tr><td>数据采集频率(<font color="red">必填</font>):</td> <%--<tr><td>数据采集频率(<font color="red">必填</font>):</td>--%>
<td><select class="form-control" name="calCycle" id="calCycle" style="display: inline;"> <%--<td><select class="form-control" name="calCycle" id="calCycle" style="display: inline;">--%>
<option value="30MI">30分钟</option> <%--<option value="30MI">30分钟</option>--%>
<option value="01HR">1小时</option> <%--<option value="01HR">1小时</option>--%>
<option value="01DY">1天</option> <%--<option value="01DY">1天</option>--%>
<option value="01MO">1月</option> <%--<option value="01MO">1月</option>--%>
</select> <%--</select>--%>
</td></tr> <%--</td></tr>--%>
<tr><td>指标(<font color="red">必填</font>):</td> <tr><td>指标(<font color="red">必填</font>):</td>
<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> </td>
</tr> </tr>
<tr><td>监控延迟时间(<font color="red">必填</font>):</td> <tr><td>监控延迟时间(<font color="red">必填</font>):</td>
<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"> <select style="width:200px" name="frequencyType" id="frequencyType">
<option value="0">分钟</option> <option value="0">分钟</option>
<option value="1">小时</option> <option value="1">小时</option>
...@@ -115,7 +116,7 @@ ...@@ -115,7 +116,7 @@
<option value="3"></option> <option value="3"></option>
</select></td> </select></td>
</tr> </tr>
<tr><td>指标采集时间(<font color="red">必填</font>):</td> <tr><td>核查时间(<font color="red">必填</font>):</td>
<td id="businessTimetd"> <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 ]}})'/> <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> </td>
...@@ -125,13 +126,30 @@ ...@@ -125,13 +126,30 @@
<thead> <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> <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> </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> </table></td></tr>
<tr><td>准确性规则类型:</td> <tr><td>准确性规则类型:</td>
<td><select class="form-control" name="ruleType" id="ruleType" > <td><select class="form-control" name="ruleType" id="ruleType" >
<option value=""></option> <option value=""></option>
<option value="1">范围类</option> <option value="范围">范围类</option>
<option value="2">重复类</option> <option value="重复">重复类</option>
</select></td></tr> </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="scopeMaxValue" id="scopeMaxValue" /></td></tr>
<tr class="range"><td>范围最小值:</td><td><input type="text" class="form-control" name="scopeMinValue" id="scopeMinValue" /></td></tr> <tr class="range"><td>范围最小值:</td><td><input type="text" class="form-control" name="scopeMinValue" id="scopeMinValue" /></td></tr>
...@@ -172,8 +190,29 @@ ...@@ -172,8 +190,29 @@
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> <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(); $(".range").hide();
$(".repeate").hide(); $(".repeate").hide();
$("#addParam").hide(); $("#addParam").hide();
...@@ -184,30 +223,52 @@ ...@@ -184,30 +223,52 @@
$(".repeate").hide(); $(".repeate").hide();
$("#addParam").hide(); $("#addParam").hide();
} }
if (selectValue == 1){ if (selectValue == "范围"){
$(".repeate").hide(); $(".repeate").hide();
$(".range").show(); $(".range").show();
$("#addParam").show(); $("#addParam").show();
} }
if (selectValue == 2){ if (selectValue == "重复"){
$(".range").hide(); $(".range").hide();
$(".repeate").show(); $(".repeate").show();
$("#addParam").show(); $("#addParam").show();
} }
}); });
//删除所有准确性规则 //删除所有参数
function deleteAllTr(){ function deleteAllTr(){
$.ajax({
type : "GET",
contentType : "application/json",
url:"${ctx}/AnalysisSupport/QualityRuleConfiguration/deleteAccuracyRule?qualityRuleId="+getQualityRuleId,
dataType : "text",
beforeSend: function(data){},
success:function(){
$("#addTr").empty(); $("#addTr").empty();
} }
});
};
//删除一条准确性规则 //删除一条参数
function deleteRow(elementTag){ 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(); $(elementTag).parent().parent().remove();
} }
});
}
}
//添加/修改准确性规则 //添加准确性规则
$("#addParam").click(function(){ $("#addParam").click(function(){
var ruleType= $("#ruleType").val(); var ruleType= $("#ruleType").val();
var scopeMaxValue = $.trim($("#scopeMaxValue").val()); var scopeMaxValue = $.trim($("#scopeMaxValue").val());
...@@ -218,25 +279,25 @@ ...@@ -218,25 +279,25 @@
var ifRepeatedCheckSeries = $.trim($("#ifRepeatedCheckSeries").val()); var ifRepeatedCheckSeries = $.trim($("#ifRepeatedCheckSeries").val());
var repeatedCheckMaxTime = $.trim($("#repeatedCheckMaxTime").val()); var repeatedCheckMaxTime = $.trim($("#repeatedCheckMaxTime").val());
var ifRepeatedCheckSummation = $.trim($("#ifRepeatedCheckSummation").val()); var ifRepeatedCheckSummation = $.trim($("#ifRepeatedCheckSummation").val());
if(ruleType == "1" || ruleType == "2"){ if(ruleType == "范围" || ruleType == "重复"){
if(ruleType == "1"){ if(ruleType == "范围"){
if(scopeMaxValue==""){$.alert("范围最大值不能为空");} if(scopeMaxValue==""){$.alert("范围最大值不能为空");}
if(scopeMinValue==""){$.alert("范围最小值不能为空");} if(scopeMinValue==""){$.alert("范围最小值不能为空");}
repeatedCheckGranularity =""; repeatedCheckGranularity ="";
repeatedCheckStartTime =""; repeatedCheckStartTime ="";
repeatedCheckEndTime =""; repeatedCheckEndTime ="";
ifRepeatedCheckSeries =""; ifRepeatedCheckSeries ="";
repeatedCheckMaxTime =""; repeatedCheckMaxTime ="";
ifRepeatedCheckSummation =""; ifRepeatedCheckSummation ="";
} else if(ruleType == "2"){ } else if(ruleType == "重复"){
if(repeatedCheckGranularity==""){$.alert("重复考核粒度不能为空");} if(repeatedCheckGranularity==""){$.alert("重复考核粒度不能为空");}
if(repeatedCheckStartTime==""){$.alert("重复考核开始时间不能为空");} if(repeatedCheckStartTime==""){$.alert("重复考核开始时间不能为空");}
if(repeatedCheckEndTime==""){$.alert("重复考核结束时间不能为空");} if(repeatedCheckEndTime==""){$.alert("重复考核结束时间不能为空");}
if(ifRepeatedCheckSeries==""){$.alert("重复是否连续不能为空");} if(ifRepeatedCheckSeries==""){$.alert("重复是否连续不能为空");}
if(repeatedCheckMaxTime==""){$.alert("重复最大次数不能为空");} if(repeatedCheckMaxTime==""){$.alert("重复最大次数不能为空");}
if(ifRepeatedCheckSummation==""){$.alert("数据是否累计不能为空");} if(ifRepeatedCheckSummation==""){$.alert("数据是否累计不能为空");}
scopeMaxValue =""; scopeMaxValue ="";
scopeMinValue =""; scopeMinValue ="";
} }
if($("#addTr").find("tr.orange-tr").html()==null){ 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>"); 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,34 +329,32 @@ ...@@ -268,34 +329,32 @@
}); });
//form表单提交 //form表单提交
$("#ruleSubmit").click(function(){ $("#ruleSubmit").click(function() {
$.dialog({
title: "提醒",
content:"确定修改该规则吗?",
ok: function(){
if($.trim($("#frequencyValue").val())==""){ if($.trim($("#frequencyValue").val())==""){
$.alert("监控延迟时间不能为空"); $.alert("监控延迟时间的值不能为空");
}else if($("#businessTime").val()==""){ }else if($("#businessTime").val()==""){
$.alert("指标业务时间不能为空"); $.alert("核查时间不能为空");
}else if($("#ruleCrtTime").val()==""){
$.alert("规则创建时间不能为空");
}else if($("#ruleUpdateTime").val()==""){
$.alert("规则更新时间不能为空");
}else{ }else{
if($.trim($("#ruleType").val())=="1" || $.trim($("#ruleType").val())=="2"){ if($.trim($("#ruleType").val())!=""){
$.dialog({ $.dialog({
title: "提醒", title: "提醒",
content: "有准确性规则参数尚未添加,确定提交", content: "有准确性规则添加,确定提交",
ok: function(){ ok: function(){
$("#ruleSubmit").attr("disabled",true);
var i = $("#addTr").find("tr").size(); var i = $("#addTr").find("tr").size();
if(0==i){
if(i==0){ var form = $("#ruleUpdateForm");
var createForm=$("#ruleMaintainForm"); form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm"); form.submit();
createForm.submit(); form.attr("action","#");
createForm.attr("action","#");
}else{ }else{
$("#addTr").find("tr").each(function(){ $("#addTr").find("tr").each(function(){
var accuracyRuleId = $(this).find("td").find("a").attr("title");
var ruleType = $(this).find("td").eq(0).html(); var ruleType = $(this).find("td").eq(0).html();
var scopeMaxValue = $(this).find("td").eq(1).html(); var scopeMaxValue= $(this).find("td").eq(1).html();
var scopeMinValue = $(this).find("td").eq(2).html(); var scopeMinValue = $(this).find("td").eq(2).html();
var repeatedCheckGranularity = $(this).find("td").eq(3).html(); var repeatedCheckGranularity = $(this).find("td").eq(3).html();
var repeatedCheckStartTime = $(this).find("td").eq(4).html(); var repeatedCheckStartTime = $(this).find("td").eq(4).html();
...@@ -303,51 +362,63 @@ ...@@ -303,51 +362,63 @@
var ifRepeatedCheckSeries = $(this).find("td").eq(6).html(); var ifRepeatedCheckSeries = $(this).find("td").eq(6).html();
var repeatedCheckMaxTime = $(this).find("td").eq(7).html(); var repeatedCheckMaxTime = $(this).find("td").eq(7).html();
var ifRepeatedCheckSummation = $(this).find("td").eq(8).html(); var ifRepeatedCheckSummation = $(this).find("td").eq(8).html();
if(scopeMaxValue =="无"){scopeMaxValue ="";}
if(scopeMinValue =="无"){scopeMinValue ="";} if(accuracyRuleId!=""){//不是新增参数
if(repeatedCheckGranularity =="无"){repeatedCheckGranularity ="";}
if(repeatedCheckStartTime =="无"){repeatedCheckStartTime ="";}
if(repeatedCheckEndTime ="无"){repeatedCheckEndTime ="";}
if(ifRepeatedCheckSeries =="无"){ifRepeatedCheckSeries ="";}
if(repeatedCheckMaxTime =="无"){repeatedCheckMaxTime ="";}
if(ifRepeatedCheckSummation =="无"){ifRepeatedCheckSummation ="";}
$.ajax({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", contentType : "application/json",
url: "${ctx}/AnalysisSupport/QualityRuleMaintain/createAccuracyRule?ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&scopeMinValue="+ifRepeatedCheckSeries+"&ifRepeatedCheckSeries="+repeatedCheckMaxTime+"&repeatedCheckMaxTime="+ifRepeatedCheckSummation+"&ifRepeatedCheckSummation=", url:"${ctx}/AnalysisSupport/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", dataType : "text",
async: false, async: false,
beforeSend: function(data) {}, beforeSend: function(data){},
success: function(){ success:function(){
i--; i--;
if(i==0){ if(i==0){
var createForm=$("#ruleMaintainForm"); var form = $("#ruleUpdateForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm"); form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm");
createForm.submit(); form.submit();
createForm.attr("action","#"); 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: "确定", okValue: "确定",
cancel: function(){}, cancel:function(){},
cancelValue: "取消", cancelValue: "取消"
}); });
}else{ }else{//如果 参数填写框 不存在未填写的 数据
$("#ruleSubmit").attr("disabled",true);
var i = $("#addTr").find("tr").size(); var i = $("#addTr").find("tr").size();
if(0==i){
if(i==0){ var form = $("#ruleUpdateForm");
var createForm=$("#ruleMaintainForm"); form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm"); form.submit();
createForm.submit(); form.attr("action","#");
createForm.attr("action","#");
}else{ }else{
$("#addTr").find("tr").each(function(){ $("#addTr").find("tr").each(function(){
var accuracyRuleId = $(this).find("td").find("a").attr("title");
var ruleType = $(this).find("td").eq(0).html(); var ruleType = $(this).find("td").eq(0).html();
var scopeMaxValue = $(this).find("td").eq(1).html(); var scopeMaxValue= $(this).find("td").eq(1).html();
var scopeMinValue = $(this).find("td").eq(2).html(); var scopeMinValue = $(this).find("td").eq(2).html();
var repeatedCheckGranularity = $(this).find("td").eq(3).html(); var repeatedCheckGranularity = $(this).find("td").eq(3).html();
var repeatedCheckStartTime = $(this).find("td").eq(4).html(); var repeatedCheckStartTime = $(this).find("td").eq(4).html();
...@@ -355,140 +426,67 @@ ...@@ -355,140 +426,67 @@
var ifRepeatedCheckSeries = $(this).find("td").eq(6).html(); var ifRepeatedCheckSeries = $(this).find("td").eq(6).html();
var repeatedCheckMaxTime = $(this).find("td").eq(7).html(); var repeatedCheckMaxTime = $(this).find("td").eq(7).html();
var ifRepeatedCheckSummation = $(this).find("td").eq(8).html(); var ifRepeatedCheckSummation = $(this).find("td").eq(8).html();
if(scopeMaxValue =="无"){scopeMaxValue ="";} if(accuracyRuleId!=""){//不是新增参数
if(scopeMinValue =="无"){scopeMinValue ="";}
if(repeatedCheckGranularity =="无"){repeatedCheckGranularity ="";}
if(repeatedCheckStartTime =="无"){repeatedCheckStartTime ="";}
if(repeatedCheckEndTime ="无"){repeatedCheckEndTime ="";}
if(ifRepeatedCheckSeries =="无"){ifRepeatedCheckSeries ="";}
if(repeatedCheckMaxTime =="无"){repeatedCheckMaxTime ="";}
if(ifRepeatedCheckSummation =="无"){ifRepeatedCheckSummation ="";}
$.ajax({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", 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, 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", dataType : "text",
async: false, async: false,
beforeSend: function(data) {}, beforeSend: function(data){},
success: function(){ success:function(){
i--; i--;
if(i==0){ if(i==0){
var createForm=$("#ruleMaintainForm"); var form = $("#ruleUpdateForm");
createForm.attr("action","${ctx}/AnalysisSupport/QualityRuleMaintain/saveRuleDataForm"); form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm");
createForm.submit(); form.submit();
createForm.attr("action","#"); form.attr("action","#");
} }
} }
}); });
}); }else{//是新增参数
}
}
}
});
$("#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({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", contentType : "application/json",
url: "${ctx}/AnalysisSupport/QualityRuleMaintain/findKpiId?businessIds="+businessIds+"&calCycleValue="+calCycleValue, 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,
async: false, dataType : "text",
beforeSend: function(data) {}, beforeSend: function(data){ },
success: function(data){ success:function(){
var td = $("#kpitd"); i--;
td.empty(); if(i==0){
data = JSON.parse(data) var form = $("#ruleUpdateForm");
data.forEach(function(t){ form.attr("action","${ctx}/AnalysisSupport/QualityRuleConfiguration/updateQualityRuleForm");
td.append("<input type='checkbox' title='"+t[2]+"' name='kpiinput' class='kpiItem' value='"+t[0]+"' >"+t[1]+"</input>") form.submit();
form.attr("action","#");
}
}
}); });
} }
}); });
} }
}
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);
} }
},
okValue:"确定",
cancel: function(){},
cancelValue:"返回",
lock:true
}); });
})
$(".businessItem").click(function(){ $("#ruleBack").click(function(){
businessIds=""; location.href="${ctx}/AnalysisSupport/QualityRuleResult";
$("[name='businessinput']:checked").each(function (){
businessIds += $(this).val()+",";
});
updateKpi(businessIds,calCycleValue);
}); });
} var calCycleValue =$("#calCycle").val();
$("#calCycle").change(function () { $("#calCycle").change(function () {
calCycleValue=$("#calCycle").val(); calCycleValue=$("#calCycle").val();
$("[name='businessinput']:checked").each(function (){
businessIds += $(this).val()+",";
});
updateKpi(businessIds,calCycleValue)
updateBusinessTime(calCycleValue) updateBusinessTime(calCycleValue)
updateMonitorTimeTime(calCycleValue)
}); });
updateBusiness($("#dataSource").val(),$("#channel").val());
function updateBusinessTime(calCycleValue) { function updateBusinessTime(calCycleValue) {
$("#businessTimetd").empty() $("#businessTimetd").empty()
if(calCycleValue == "30MI"){ if(calCycleValue == "30MI"){
...@@ -502,91 +500,23 @@ ...@@ -502,91 +500,23 @@
} }
} }
function getBusinessCheckedValues(){ function updateMonitorTimeTime(calCycleValue) {
var businessArray = new Array(); if (calCycleValue == "30MI") {
var i=0; $("#frequencyValue").val("30");
$("[name='businessinput']:checked").each(function(){ $("#frequencyType").val(0);
businessArray[i]=$(this).val(); } else if (calCycleValue == "01HR") {
i++; $("#frequencyValue").val("1");
}); $("#frequencyType").val(1);
return businessArray; } else if (calCycleValue == "01DY") {
} $("#frequencyValue").val("1");
$("#frequencyType").val(2);
function getBusinessCheckedValuesString(){ } else if (calCycleValue == "01MO") {
var businessStr=""; $("#frequencyValue").val("1");
var businessArray=getBusinessCheckedValues(); $("#frequencyType").val(3);
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]+",";
}
} }
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> </script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
<option value="3"></option> <option value="3"></option>
</select></td> </select></td>
</tr> </tr>
<tr><td>监控时间(<font color="red">必填</font>):</td> <tr><td>核查时间(<font color="red">必填</font>):</td>
<td id="businessTimetd"> <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})'/> <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> </td>
...@@ -263,6 +263,10 @@ $("#addParam").click(function(){ ...@@ -263,6 +263,10 @@ $("#addParam").click(function(){
//form表单提交 //form表单提交
$("#ruleSubmit").click(function(){ $("#ruleSubmit").click(function(){
$.dialog({
title: "提醒",
content:"确定新增该规则吗?",
ok: function(){
if($.trim($("#frequencyValue").val())==""){ if($.trim($("#frequencyValue").val())==""){
$.alert("监控延迟时间不能为空"); $.alert("监控延迟时间不能为空");
}else if($("#businessTime").val()==""){ }else if($("#businessTime").val()==""){
...@@ -309,7 +313,7 @@ $("#addParam").click(function(){ ...@@ -309,7 +313,7 @@ $("#addParam").click(function(){
$.ajax({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", contentType : "application/json",
url: "${ctx}/AnalysisSupport/QualityRuleMaintain/createAccuracyRule?ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&scopeMinValue="+ifRepeatedCheckSeries+"&ifRepeatedCheckSeries="+repeatedCheckMaxTime+"&repeatedCheckMaxTime="+ifRepeatedCheckSummation+"&ifRepeatedCheckSummation=", url: "${ctx}/AnalysisSupport/QualityRuleMaintain/createAccuracyRule?ruleType="+ruleType+"&scopeMaxValue="+scopeMaxValue+"&scopeMinValue="+scopeMinValue+"&repeatedCheckGranularity="+repeatedCheckGranularity+"&repeatedCheckStartTime="+repeatedCheckStartTime+"&repeatedCheckEndTime="+repeatedCheckEndTime+"&ifRepeatedCheckSeries="+ifRepeatedCheckSeries+"&repeatedCheckMaxTime="+repeatedCheckMaxTime+"&ifRepeatedCheckSummation="+ifRepeatedCheckSummation,
dataType : "text", dataType : "text",
async: false, async: false,
beforeSend: function(data) {}, beforeSend: function(data) {},
...@@ -381,6 +385,13 @@ $("#addParam").click(function(){ ...@@ -381,6 +385,13 @@ $("#addParam").click(function(){
} }
} }
},
okValue:"确定",
cancel: function(){},
cancelValue:"返回",
lock:true
});
}); });
$("#ruleBack").click(function(){ $("#ruleBack").click(function(){
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
质量规则查询结果 质量规则查询结果
<shiro:hasAnyRoles name="admin,dataAnalysis,businessAnalysis"> <shiro:hasAnyRoles name="admin,dataAnalysis,businessAnalysis">
<div id="time_div" style="top: -6px;float: right;height: 0px;position: relative;"> <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="updateRule" disabled>修改规则</button>
<button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="createRule">新建规则</button> <button class="btn-sm btn btn-primary btn-sm btn-group btn-group-cog" id="createRule">新建规则</button>
</div> </div>
...@@ -95,6 +95,21 @@ ...@@ -95,6 +95,21 @@
</div> </div>
<script type="text/javascript" src="${ctx}/static/js/ruleResultDetailTable.js"></script> <script type="text/javascript" src="${ctx}/static/js/ruleResultDetailTable.js"></script>
<script type="text/javascript"> <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}"; var receiveRulePageNum = "${rulePageNum}";
ruleResultDetailTable(); ruleResultDetailTable();
......
...@@ -134,11 +134,11 @@ function ruleResultDetailTable(){ ...@@ -134,11 +134,11 @@ function ruleResultDetailTable(){
header[2] = ["业务","businessName","7%","15"]; header[2] = ["业务","businessName","7%","15"];
header[3] = ["指标名称","kpiName","7%","15"]; header[3] = ["指标名称","kpiName","7%","15"];
header[4] = ["指标编码","kpiCode","7%","15"]; header[4] = ["指标编码","kpiCode","7%","15"];
// header[5] = ["数据类型","kpiTypeName","7%","15"]; header[5] = ["数据类型","kpiTypeName","7%","15"];
header[5] = ["数据采集频率","calCycle","7%","15"]; header[6] = ["数据采集频率","calCycle","7%","15"];
header[6] = ["监控延迟时间","kpiMonitorTime","7%","15"]; header[7] = ["监控延迟时间","kpiMonitorTime","7%","15"];
// headr[11] = ["指标采集时间","businessTime","7%","15"]; header[8] = ["核查时间","businessTime","7%","15"];
header[7] = ["准确性规则","accuracyRuleId","7%","15"]; header[9] = ["准确性规则","accuracyRuleId","7%","15"];
window.pagging = new table_pagging({limit:12,tableId:'ruleResultTable',header:header}); window.pagging = new table_pagging({limit:12,tableId:'ruleResultTable',header:header});
pagging.pagging(jsonData); pagging.pagging(jsonData);
...@@ -301,7 +301,7 @@ table_pagging.prototype = { ...@@ -301,7 +301,7 @@ table_pagging.prototype = {
tdContext = "&nbsp;"; tdContext = "&nbsp;";
} }
if(k==6){ if(k==7){
if(tdContext.indexOf("/")!=-1){ if(tdContext.indexOf("/")!=-1){
var a = new Array(); var a = new Array();
a = tdContext.split("/"); a = tdContext.split("/");
...@@ -319,13 +319,13 @@ table_pagging.prototype = { ...@@ -319,13 +319,13 @@ table_pagging.prototype = {
} }
} }
// if(k==11){ if(k==8){
//
// if(tdContext!="&nbsp;"){ if(tdContext!="&nbsp;"){
// tdContext = df.format(new Date(tdContext)); tdContext = df.format(new Date(tdContext));
// } }
// } }
if(k==7){ if(k==9){
tdContext = "<a href='javascript:;' onclick='selectRule(\""+this.getData(this.objectlist[i],"qualityRuleId")+"\")'>查看规则</a>"; 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