Commit ea1d1e22 authored by liuna's avatar liuna

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

--数据质量核查
parent a061e9dd
This diff is collapsed.
package com.hp.cmsz.entity;
import org.elasticsearch.cluster.metadata.MappingMetaData;
import javax.persistence.*;
import java.sql.Timestamp;
/**
* ccolap.quality_operation_detail_v视图对应的实体类
*
* @author Liu Na
*
*/
@Entity
@Table(name = "quality_operation_detail_v")
public class QualityRuleInfo {
private Long qualityRuleId;
private Long kpiId;
private Long businessId;
private Long channelId;
private Long dataSourceId;
private Long provinceId;
private Long qualityVerificationResultId;
private Timestamp kpiMonitorRunTime;
private Timestamp businessTime;
private String kpiName;
private String kpiCode;
private String businessName;
private String channelName;
private String dataSourceName;
private String provinceName;
private String warningType;
private Long ifFilter;
public Long getQualityRuleId() {
return qualityRuleId;
}
public void setQualityRuleId(Long qualityRuleId) {
this.qualityRuleId = qualityRuleId;
}
public Long getKpiId() {
return kpiId;
}
public void setKpiId(Long kpiId) {
this.kpiId = kpiId;
}
public Long getBusinessId() {
return businessId;
}
public void setBusinessId(Long businessId) {
this.businessId = businessId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getDataSourceId() {
return dataSourceId;
}
public void setDataSourceId(Long dataSourceId) {
this.dataSourceId = dataSourceId;
}
public Long getProvinceId() {
return provinceId;
}
public void setProvinceId(Long provinceId) {
this.provinceId = provinceId;
}
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
public Long getQualityVerificationResultId() {
return qualityVerificationResultId;
}
public void setQualityVerificationResultId(Long qualityVerificationResultId) {
this.qualityVerificationResultId = qualityVerificationResultId;
}
public Timestamp getKpiMonitorRunTime() {
return kpiMonitorRunTime;
}
public void setKpiMonitorRunTime(Timestamp kpiMonitorRunTime) {
this.kpiMonitorRunTime = kpiMonitorRunTime;
}
public Timestamp getBusinessTime() {
return businessTime;
}
public void setBusinessTime(Timestamp businessTime) {
this.businessTime = businessTime;
}
public String getKpiName() {
return kpiName;
}
public void setKpiName(String kpiName) {
this.kpiName = kpiName;
}
public String getKpiCode() {
return kpiCode;
}
public void setKpiCode(String kpiCode) {
this.kpiCode = kpiCode;
}
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getChannelName() {
return channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
public String getDataSourceName() {
return dataSourceName;
}
public void setDataSourceName(String dataSourceName) {
this.dataSourceName = dataSourceName;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public String getWarningType() {
return warningType;
}
public void setWarningType(String warningType) {
this.warningType = warningType;
}
public Long getIfFilter() {
return ifFilter;
}
public void setIfFilter(Long ifFilter) {
this.ifFilter = ifFilter;
}
@Override
public String toString() {
return "QualityRuleInfo{" +
"kpiId=" + kpiId +
", businessId=" + businessId +
", channelId=" + channelId +
", dataSourceId=" + dataSourceId +
", provinceId=" + provinceId +
", qualityVerificationResultId=" + qualityVerificationResultId +
", qualityRuleId=" + qualityRuleId +
", kpiMonitorRunTime=" + kpiMonitorRunTime +
", businessTime=" + businessTime +
", kpiName='" + kpiName + '\'' +
", kpiCode='" + kpiCode + '\'' +
", businessName='" + businessName + '\'' +
", channelName='" + channelName + '\'' +
", dataSourceName='" + dataSourceName + '\'' +
", provinceName='" + provinceName + '\'' +
", warningType='" + warningType + '\'' +
", ifFilter='" + ifFilter + '\'' +
'}';
}
}
package com.hp.cmsz.entity;
import javax.persistence.*;
import java.sql.Timestamp;
/**
* ccolap.quality_rule_detail_v视图对应的实体类
*
* @author Liu Na
*
*/
@Entity
@Table(name = "quality_rule_detail_v")
public class QualityRuleView {
private Long qualityRuleId;
private Long kpiId;
private Long businessId;
private Long channelId;
private Long dataSourceId;
private Long provinceId;
private String kpiMonitorTime;
private Timestamp businessTime;
private String kpiName;
private String kpiCode;
private String businessName;
private String channelName;
private String dataSourceName;
private String provinceName;
private String calCycle;
private String kpiTypeName;
public Long getKpiId() {
return kpiId;
}
public void setKpiId(Long kpiId) {
this.kpiId = kpiId;
}
public Long getBusinessId() {
return businessId;
}
public void setBusinessId(Long businessId) {
this.businessId = businessId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getDataSourceId() {
return dataSourceId;
}
public void setDataSourceId(Long dataSourceId) {
this.dataSourceId = dataSourceId;
}
public Long getProvinceId() {
return provinceId;
}
public void setProvinceId(Long provinceId) {
this.provinceId = provinceId;
}
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
public Long getQualityRuleId() {
return qualityRuleId;
}
public void setQualityRuleId(Long qualityRuleId) {
this.qualityRuleId = qualityRuleId;
}
public String getKpiMonitorTime() {
return kpiMonitorTime;
}
public void setKpiMonitorTime(String kpiMonitorTime) {
this.kpiMonitorTime = kpiMonitorTime;
}
public Timestamp getBusinessTime() {
return businessTime;
}
public void setBusinessTime(Timestamp businessTime) {
this.businessTime = businessTime;
}
public String getKpiName() {
return kpiName;
}
public void setKpiName(String kpiName) {
this.kpiName = kpiName;
}
public String getKpiCode() {
return kpiCode;
}
public void setKpiCode(String kpiCode) {
this.kpiCode = kpiCode;
}
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getChannelName() {
return channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
public String getDataSourceName() {
return dataSourceName;
}
public void setDataSourceName(String dataSourceName) {
this.dataSourceName = dataSourceName;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public String getCalCycle() {
return calCycle;
}
public void setCalCycle(String calCycle) {
this.calCycle = calCycle;
}
public String getKpiTypeName() {
return kpiTypeName;
}
public void setKpiTypeName(String kpiTypeName) {
this.kpiTypeName = kpiTypeName;
}
@Override
public String toString() {
return "QualityRuleView{" +
"kpiId=" + kpiId +
", businessId=" + businessId +
", channelId=" + channelId +
", dataSourceId=" + dataSourceId +
", provinceId=" + provinceId +
", qualityRuleId=" + qualityRuleId +
", kpiMonitorTime='" + kpiMonitorTime + '\'' +
", businessTime=" + businessTime +
", kpiName='" + kpiName + '\'' +
", kpiCode='" + kpiCode + '\'' +
", businessName='" + businessName + '\'' +
", channelName='" + channelName + '\'' +
", dataSourceName='" + dataSourceName + '\'' +
", provinceName='" + provinceName + '\'' +
", calCycle='" + calCycle + '\'' +
", kpiTypeName='" + kpiTypeName + '\'' +
'}';
}
}
package com.hp.cmsz.repository;
import com.hp.cmsz.entity.QualityRuleInfo;
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 java.util.Date;
import java.util.List;
public interface QualityRuleInfoDao extends JpaSpecificationExecutor<QualityRuleInfo>,
PagingAndSortingRepository<QualityRuleInfo, Long> {
@Query("from QualityRuleInfo qualityRuleInfo where qualityRuleInfo.businessTime between timestampadd(M,-1,getdate()) and getdate() order by qualityRuleInfo.businessTime Desc")
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);
}
package com.hp.cmsz.repository;
import com.hp.cmsz.entity.QualityRuleView;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface QualityRuleViewDao extends JpaSpecificationExecutor<QualityRuleView>,
PagingAndSortingRepository<QualityRuleView, Long> {
//根据筛选项得到质量规则
List<QualityRuleView> findByDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInOrderByQualityRuleIdAscBusinessTimeDesc(List<Long> dataSource,List<Long> chnnal,List<Long> busines,List<Long>province);
}
package com.hp.cmsz.service.analysissupport;
import com.hp.cmsz.entity.QualityRuleInfo;
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.util.Date;
import java.util.List;
@Service
@Transactional
public class QualityRuleInfoService {
@Autowired
private QualityRuleInfoDao qualityRuleInfoDao;
public List<QualityRuleInfo> getQualityRuleInfoByLastMonth(){
return qualityRuleInfoDao.findQualityRuleInfo();
}
//根据筛选项获取质量规则
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);
}
}
package com.hp.cmsz.service.analysissupport;
import com.hp.cmsz.entity.QualityRuleView;
import com.hp.cmsz.repository.QualityRuleViewDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional
public class QualityRuleViewService {
@Autowired
private QualityRuleViewDao qualityRuleViewDao;
//根据筛选项得到质量规则
public List<QualityRuleView> getQualityRuleViewBy(List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long>province){
return qualityRuleViewDao.findByDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInOrderByQualityRuleIdAscBusinessTimeDesc(dataSource,chnnal,busines,province);
}
}
package com.hp.cmsz.web.analysissupport;
import com.google.gson.Gson;
import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.DataSourceDao;
import com.hp.cmsz.repository.KpiDao;
import com.hp.cmsz.repository.ProvinceDao;
import com.hp.cmsz.service.BusinessService;
import com.hp.cmsz.service.ChannelService;
import com.hp.cmsz.service.CmszOperationLogService;
import com.hp.cmsz.service.analysissupport.QualityRuleInfoService;
import com.hp.cmsz.web.PageURLController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 数据质量核查中的质量规则运营结果控制类
*
* @author Liu Na
*
*/
@Controller
@RequestMapping(value="AnalysisSupport/QualityRuleOperation")
public class QualityRuleOperationController {
@Autowired
private ProvinceDao provinceDao;
@Autowired
private ChannelService channelService;
@Autowired
private BusinessService businessService;
@Autowired
private KpiDao kpiDao;
@Autowired
private DataSourceDao dataSourceDao;
@Autowired
private QualityRuleInfoService qualityRuleInfoService;
@Autowired
private CmszOperationLogService cmszOperationLogService;
@RequestMapping(value = "")
public String ruleResultHome(
@RequestParam(value = "rulePageNum", defaultValue="1") String rulePageNum,
Map model){
List<QualityRuleInfo> qualityRuleInfoList = new ArrayList<QualityRuleInfo>();
//查询出所有省份的信息
List<Province> provinceList=(List<Province>)provinceDao.findAll();
//查询出所有的渠道信息
//List<Channel> channelList=(List<Channel>)channelDao.findChannel();
List<Channel> channelList = channelService.getAllChannels();
//查询出所有的指标
List<Kpi> kpiList=(List<Kpi>)kpiDao.findAll();
//查询出所有的业务
List<String> businessList=businessService.getAllBusinessIdAndBusinessName();
//查询出所有的数据来源信息
List<DataSource> datasourceList=dataSourceDao.findDataSource();
//查询出所有的运营质量规则
qualityRuleInfoList = qualityRuleInfoService.getQualityRuleInfoByLastMonth();
Gson gson = new Gson();
model.put("provinceList", provinceList);
model.put("channelList", channelList);
model.put("kpiList", kpiList);
model.put("businessList",businessList);
model.put("datasourceList", datasourceList);
model.put("qualityRuleInfoList", gson.toJson(qualityRuleInfoList));
model.put("rulePageNum", rulePageNum);
cmszOperationLogService.createLog("查询","质量规则运营","质量规则运营首页");
return PageURLController.RuleOperation;
}
//根据筛选项搜索
@RequestMapping(value = "/changeTable*", method = RequestMethod.POST)
@ResponseBody
public void changeTable(@RequestParam(value = "period") String period,// 时间
@RequestParam(value = "dataSource") String dataSource,// 数据来源
@RequestParam(value = "chnnal") String chnnal,//渠道
@RequestParam(value = "bussines") String bussines,//业务
@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");
cmszOperationLogService.createLog("查询","质量规则运营查询","质量规则运营页面查询");
List<QualityRuleInfo> qualityRuleInfoList;
String[] time=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]);
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);
qualityRuleInfoList = qualityRuleInfoService.getQualityRuleInfoBy(time1,time2,dataSourceList,chnnalList,bussinesList,provinceList,ifFilterList);
Gson gson = new Gson();
response.setContentType("text/Xml;charset=gbk");
PrintWriter out = null;
try {
out = response.getWriter();
out.println(gson.toJson(qualityRuleInfoList));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//将string数据类型转换成List<Long>类型
public List<Long> changeStrToList(String[] str){
List<Long> list = new ArrayList<Long>();
for(int i=0;i<str.length;i++){
list.add(Long.parseLong(str[i]));
}
return list;
}
}
<%@tag pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!-- 质量规则是否过滤 -->
<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>
</select>
</div>
<script type="text/javascript">
//获取其被选中的value,若是0则代表不是关键配置,若是1则代表是关键配置
function getIfFilter(){
return $("#ifFilter").val();
}
function getIfFilterTitle(){
return $("#ifFilter").find("option:selected").attr("title");
}
function RelFilterRest() {
$("#ifFilter").val("1");
}
</script>
\ No newline at end of file
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>全网监控智能分析平台</title>
</head>
<body>
<div id="sticky-wrap"></div>
<div>
<div class="container">
<ol class="breadcrumb">
<li><a href="${ctx}/index">首页</a></li>
<li>数据质量核查</li>
<li class="active">质量规则运营</li>
</ol>
</div>
</div>
<div id="main-container main-tab-container">
<div id="content" class="container">
<div class="tab-bar-bt">
<ul class="nav nav-tabs">
<li><a href="${ctx}/AnalysisSupport/QualityRuleResult">数据质量规则维护</a></li>
<li class="active"><a href="#home" data-toggle="tab">数据质量运营</a></li>
<li><a href="${ctx}/AnalysisSupport/FilterRuleResult">过滤规则维护</a></li>
</ul>
</div>
<div class="section">
<div class="tab-content">
<div class="tab-pane fade in active" id="home">
<div class="row me-row">
<div id="slidePushMenus2" class="cbp-spmenu-push">
<div class="slideMenu" id="cbp-spmenu-s2" style="">
<div class="form">
<tags:PeriodTag />
<tags:Public_ProvinceTag />
<tags:GJFX_datasource_channle_business/>
<tags:QualityRule_IfFilter />
<button id="submit" class="btn btn-primary" onclick="operResultSubmit()">提交</button>
<button id="disable" class="btn btn-warning" onclick="operResultReset()">重置</button>
</div>
</div>
<div class="main col-xs-12">
<div id="mainm2" class="mainm" ></div>
<div class="content clearfix">
<div class="block clearfix">
<button id="showLeftPush2" class="menu-trigger btn btn-default" onclick="toggleMenu('slidePushMenus2')">
<span class="glyphicon glyphicon-list"></span>
</button>
<div class="slide-menu-tags">
<span id="PeriodTag" class="label label-info" data-placement="bottom" >最近一个月</span>
<span id="ProvinceTag" class="label label-info" data-placement="bottom"></span>
<span id="DataSourceTag" class="label label-info" data-placement="bottom" ></span>
<span id="ChannelTag3" class="label label-info" data-placement="bottom"></span>
<span id="BusinessTag" class="label label-info" data-placement="bottom" ></span>
<span id="ifFilterTag" class="label label-info" data-placement="bottom" ></span>
</div>
<div class="bt-list-import">
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="table-header">
质量规则运营结果
<shiro:hasAnyRoles name="admin,dataAnalysis,businessAnalysis">
<div id="time_div" style="top: -6px;float: right;height: 0px;position: relative;">
</div>
</shiro:hasAnyRoles>
</div>
<table id="ruleOperationTable" class="table table-hover table-striped">
</table>
<input type="hidden" id="qualityRuleInfo" name="qualityRuleInfo" value='${qualityRuleInfoList}' />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<form action="#" method="get" id="listForm"></form>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="${ctx}/static/js/ruleOperationDetailTable.js"></script>
<script type="text/javascript">
initDate();
ruleOperationDetailTable();
function operResultSubmit(){
var period=getPeriodStr();
var dataSource=getStatsDataSourceCheckedValuesString();
var chnnal=getStatsChannelCheckedValuesString();
var bussines=getStatsBusinessCheckedValuesString();
var province=getProvinceCheckedValuesString();
var ifFilter=getIfFilter();
if(dataSource==""){
$.alert("数据来源的选择不能为空");
}else if(chnnal===""){
$.alert("渠道的选择不能为空");
}else if(bussines===""){
$.alert("业务的选择不能为空");
}else if(province===""){
$.alert("省份的选择不能为空");
}else if(ifFilter==="") {
$.alert("是否过滤的选择不能为空");
}else{
toggleMenu('slidePushMenus');//隐藏筛选项
//时间标签
$('#PeriodTag').text("时间范围").attr('data-original-title',getPeriodStr()).tooltip();
//数据来源标签
$('#DataSourceTag').text("数据来源").append($("<span class='badge'></span>").text(getStatsDataSourceCheckedValues().length)).attr('data-original-title',getStatsDataSourceCheckedTitles()).tooltip();
//渠道标签
$('#ChannelTag').text("渠道").append($("<span class='badge'></span>").text(getStatsChannelCheckedValues().length)).attr('data-original-title',getStatsChannelCheckedTitles()).tooltip();
//业务标签
$('#BusinessTag').text("业务").append($("<span class='badge'></span>").text(getStatsBusinessCheckedValues().length)).attr('data-original-title',getStatsBusinessCheckedTitlesString()).tooltip();
//省份标签
$('#ProvinceTag').text("省份").append($("<span class='badge'></span>").text(getProvinceCheckedValues().length)).attr('data-original-title',getProvinceCheckedTitles()).tooltip();
//是否过滤
$('#ifFilterTag').text("是否过滤").attr('data-original-title', getIfFilterTitle()).tooltip();
if(period==""){
$.alert("时间选择不能为空");
}
$.ajax({
type : 'GET',
contentType : 'application/json',
url: "${ctx}/AnalysisSupport/QualityRuleOperation/changeTable?period="+period+"&province="+province+"&dataSource="+dataSource+"&chnnal="+chnnal+"&bussines="+bussines+"&ifFilter="+ifFilter,
dataType : 'text',
async: false,
beforeSend: function(data) {
},
success: function(data) {
$("#qualityRuleInfo").val(data);
ruleOperationDetailTable();
ruleId="";
toggleMenu('slidePushMenus2');//隐藏筛选项
updateTag(true);
}
});
}
}
function operResultReset(){
initDate();
ProvinceReset();
statsDataSourceReset();//三级联动重置
RelFilterRest();
}
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
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