Commit 29444a6f authored by liuna's avatar liuna

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

--数据质量核查下过滤规则页面联动
parent ea1d1e22
This diff is collapsed.
......@@ -34,7 +34,7 @@ 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")String scopeMaxValue,@Param("scopeMinValue")String 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("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);
//根据准确性规则ID删除一条准确性规则信息
@Modifying
......
......@@ -5,7 +5,9 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import sun.security.krb5.internal.Ticket;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
......@@ -16,5 +18,5 @@ public interface QualityRuleInfoDao extends JpaSpecificationExecutor<QualityRule
List<QualityRuleInfo> findQualityRuleInfo();
//根据筛选项查找
List<QualityRuleInfo> findByBusinessTimeBetweenAndChannelIdInAndBusinessIdInAndProvinceIdInAndIfFilterInAndDataSourceIdInOrderByBusinessTimeDesc(Date time1, Date time2,List<Long> dataSource,List<Long> chnnal,List<Long> busines,List<Long> province,List<Long> ifFilter);
List<QualityRuleInfo> findByBusinessTimeBetweenAndDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInAndIfFilterInOrderByBusinessTimeDesc(Timestamp time1, Timestamp time2, List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long> province, List<Long> ifFilter);
}
......@@ -29,7 +29,7 @@ public class AccuracyRuleService {
//根据准确性规则ID更新准确性规则
@Transactional(readOnly=false)
public void updateAccuracyRuleByAccuracyRuleId(String ruleType,String scopeMaxValue,String scopeMinValue,String repeatedCheckGranularity,Date repeatedCheckStartTime,Date repeatedCheckEndTime,String ifRepeatedCheckSeries,Long repeatedCheckMaxTime,String ifRepeatedCheckSummation,Long accuracyRuleId){
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);
}
......
package com.hp.cmsz.service.analysissupport;
import com.hp.cmsz.entity.QualityRuleInfo;
import com.hp.cmsz.entity.Time;
import com.hp.cmsz.repository.QualityRuleInfoDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
......@@ -21,7 +23,7 @@ public class QualityRuleInfoService {
}
//根据筛选项获取质量规则
public List<QualityRuleInfo> getQualityRuleInfoBy(Date time1, Date time2,List<Long> dataSource,List<Long> chnnal,List<Long> busines,List<Long>province,List<Long> ifFilter){
return qualityRuleInfoDao.findByBusinessTimeBetweenAndChannelIdInAndBusinessIdInAndProvinceIdInAndIfFilterInAndDataSourceIdInOrderByBusinessTimeDesc(time1, time2,dataSource,chnnal,busines,province,ifFilter);
public List<QualityRuleInfo> getQualityRuleInfoBy(Timestamp time1 , Timestamp time2, List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long>province, List<Long> ifFilter){
return qualityRuleInfoDao.findByBusinessTimeBetweenAndDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInAndIfFilterInOrderByBusinessTimeDesc(time1, time2,dataSource,chnnal,busines,province,ifFilter);
}
}
package com.hp.cmsz.web.analysissupport;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.*;
import com.hp.cmsz.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -18,9 +24,51 @@ import com.hp.cmsz.web.PageURLController;
@RequestMapping(value="AnalysisSupport/FilterRuleMaintain")
public class FilterRuleMaintainController {
@Autowired
private ProvinceDao provinceDao;
@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;
@RequestMapping(value = "")
public String filterMaintainHome(Map model){
//查询出所有的省份
List<Province> provinceList=(List<Province>)provinceDao.findProvince();
//查询出所有的渠道信息
List<Channel> channelList=(List<Channel>)channelDao.findChannel();
//查询出所有的指标
List<Kpi> kpiList=(List<Kpi>)kpiDao.findAll();
//查询出所有的业务
List<Object[]> businessList=(List<Object[]>)businessDao.findAllBusinessIdAndBusinessName();
//查询出所有的数据类型
List<DataType> dataTypeList= (List<DataType>)dataTypeDao.findAll();
//查询出所有的数据来源
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.FilterMaintain;
}
}
......@@ -18,10 +18,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -97,7 +99,7 @@ public class QualityRuleOperationController {
}
//根据筛选项搜索
@RequestMapping(value = "/changeTable*", method = RequestMethod.POST)
@RequestMapping(value = "/operationChangeTable*", method = RequestMethod.GET)
@ResponseBody
public void changeTable(@RequestParam(value = "period") String period,// 时间
@RequestParam(value = "dataSource") String dataSource,// 数据来源
......@@ -106,23 +108,24 @@ public class QualityRuleOperationController {
@RequestParam(value = "province") String province,//省份
@RequestParam(value = "ifFilter") String ifFilter,//是否过滤
HttpServletResponse response) throws ParseException, UnsupportedEncodingException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
cmszOperationLogService.createLog("查询","质量规则运营查询","质量规则运营页面查询");
List<QualityRuleInfo> qualityRuleInfoList;
String[] time=period.split("~");
String[] dates=period.split("~");
String[] dataSourceS=dataSource.split(",");
String[] chnnalS=chnnal.split(",");
String[] bussinesS =bussines.split(",");
String[] provinceS=province.split(",");
String[] ifFilterS=province.split(",");
Date time1=sdf.parse(time[0]);
Date time2=sdf.parse(time[1]);
String[] ifFilterS=ifFilter.split(",");
Timestamp time1=new Timestamp(format.parse(dates[0]).getTime());
Timestamp time2=new Timestamp(format.parse(dates[1]).getTime());
List<Long> dataSourceList=changeStrToList(dataSourceS);
List<Long> chnnalList=changeStrToList(chnnalS);
List<Long> bussinesList=changeStrToList(bussinesS);
List<Long> provinceList=changeStrToList(provinceS);
List<Long> ifFilterList=changeStrToList(ifFilterS);
System.out.println("qualityRule:"+time1+time2+"data"+dataSourceList+"busin"+bussinesList+"procin"+provinceList+"if"+ifFilterList);
qualityRuleInfoList = qualityRuleInfoService.getQualityRuleInfoBy(time1,time2,dataSourceList,chnnalList,bussinesList,provinceList,ifFilterList);
Gson gson = new Gson();
response.setContentType("text/Xml;charset=gbk");
......
......@@ -7,14 +7,14 @@
<div id="ws" class="slide-menu-option">
<label>是否过滤</label>
<select class="slide-menu-select" id="ifFilter" name="ifFilter">
<option value="'1'" title="是"><a href="#">是</a></option>
<option value="'0'" title="否"><a href="#">否</a></option>
<option value="0,1" title="全部"selected><a href="#">全部</a></option>
<option value="1" title="是"><a href="#">是</a></option>
<option value="0" title="否"><a href="#">否</a></option>
</select>
</div>
<script type="text/javascript">
//获取其被选中的value,若是0则代表不是关键配置,若是1则代表是关键配置
function getIfFilter(){
return $("#ifFilter").val();
}
......@@ -25,6 +25,6 @@
}
function RelFilterRest() {
$("#ifFilter").val("1");
$("#ifFilter").val("0,1");
}
</script>
\ No newline at end of file
......@@ -53,16 +53,48 @@
<form action="#" class="form-horizontal" id="filterMaintainForm" method="post" enctype="multipart/form-data">
<table id="filterMaintainTable" class="table-null">
<tr><td>省份(<font color="red">必填</font>):</td>
<td><tags:ProvinceTag /></td>
<td>
<c:forEach var="province" items="${provinceList}">
<input type="checkbox" name="province" id="province" value="${province.provinceId}" checked>${province.provinceName}
</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 >
</c:forEach>
</select></td>
</tr>
<tr><td>渠道(<font color="red">必填</font>):</td>
<td><tags:ChannelTag /></td>
<td><select class="form-control" name="channel" id="channel" >
<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:forEach>
</select></td>
</tr>
<tr><td>业务(<font color="red">必填</font>):</td>
<td><tags:BusinessTag /></td>
<td >
<div id="businesstd"></div>
</td>
</tr>
<tr><td>数据来源(<font color="red">必填</font>):</td>
<td><tags:DataSourceTag /></td>
<tr><td>指标(<font color="red">必填</font>):</td>
<td>
<div id="kpitd"></div>
</td>
</tr>
<!--<tr><td>影响开始时间(<font color="red">必填</font>):</td><td><input type="text" class="form-control" id="ruleCrtTime" name="ruleCrtTime" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'ruleCrtTime\')}'})" /></td></tr>
<tr><td>影响结束时间(<font color="red">必填</font>):</td><td><input id="ruleUpdateTime" name="ruleUpdateTime" class="form-control" type="text" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'ruleUpdateTime\')}'})"> </td></tr> -->
......@@ -96,5 +128,139 @@ $(".ifRepeate").change(function (){
$(".period").show();
}
})
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){
$.ajax({
type : "GET",
contentType : "application/json",
url: "${ctx}/AnalysisSupport/QualityRuleMaintain/findKpiId?businessIds="+businessIds,
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' name='kpiinput' class='kpiItem' value='"+t[0]+"' checked >"+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]+"' checked >"+t[1]+"</input>")
businessIds+=t[0]+",";
});
updateKpi(businessIds);
}
});
$(".businessItem").click(function(){
businessIds="";
$("[name='businessinput']:checked").each(function (){
businessIds += $(this).val()+",";
});
updateKpi(businessIds);
});
}
updateBusiness($("#dataSource").val(),$("#channel").val());
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]+",";
}
}
return kpiStr;
}
</script>
\ No newline at end of file
......@@ -102,7 +102,7 @@
ruleOperationDetailTable();
function operResultSubmit(){
var period=getPeriodStr();
var period=getPeriodStr()
var dataSource=getStatsDataSourceCheckedValuesString();
var chnnal=getStatsChannelCheckedValuesString();
var bussines=getStatsBusinessCheckedValuesString();
......@@ -142,7 +142,7 @@
$.ajax({
type : 'GET',
contentType : 'application/json',
url: "${ctx}/AnalysisSupport/QualityRuleOperation/changeTable?period="+period+"&province="+province+"&dataSource="+dataSource+"&chnnal="+chnnal+"&bussines="+bussines+"&ifFilter="+ifFilter,
url: "${ctx}/AnalysisSupport/QualityRuleOperation/operationChangeTable?period="+period+"&province="+province+"&dataSource="+dataSource+"&chnnal="+chnnal+"&bussines="+bussines+"&ifFilter="+ifFilter,
dataType : 'text',
async: false,
beforeSend: function(data) {
......
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