Commit d16b3545 authored by 莫林毅's avatar 莫林毅

监控运营 /协查单管理 /定制分析

新增 '定制分析'界面
parent 53f3bc53
This diff is collapsed.
package com.hp.cmsz.service.monitoroperation;
import com.hp.cmsz.entity.Business;
import com.hp.cmsz.entity.DimKpi;
import com.hp.cmsz.repository.BusinessDao;
import com.hp.cmsz.repository.ChannelDataSourceMapDao;
import com.hp.cmsz.repository.DimKpiDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @编写人: m01
* @创建时间: 2018/5/10 0010 上午 9:21
* @描述:
* @备注:
**/
@Service(value ="workingOrderCustomAnalysisService" )
@Transactional
public class WorkingOrderCustomAnalysisService {
@Autowired
private ChannelDataSourceMapDao channelDataSourceMapDao;
@Autowired
private DimKpiDao dimKpiDao;
@Autowired
private BusinessDao businessDao;
public List<Long> findChannelDataSourceMapIdListByChannelIdListAndDataSourceIdList(List<Long> dataSourceList, List<Long> channelList) {
List<Long> longList = new ArrayList<Long>();
List<Object> objectList = channelDataSourceMapDao.findChannelDataSourceMapIdByChannelIdListAndDataSourceIdList(dataSourceList, channelList);
if (objectList == null || objectList.size() < 1) {
return longList;
} else {
for (Object o : objectList) {
longList.add((Long) o);
}
}
return longList;
}
public List<Business> findBusinessListBychannelDataSourceMapIdListAndIsActived(List<Long> channelDataSourceMapIdList, String isActived) {
List<Object[]>list=businessDao.findBusinessListBychannelDataSourceMapIdListAndIsActived2(channelDataSourceMapIdList, isActived);
List<Business>list1=new ArrayList<Business>();
for (Object[] objects : list) {
Business business=new Business();
System.out.println("=========");
System.out.println(objects[0]);
System.out.println("=========");
business.setBusinessId(new BigInteger(objects[0].toString()).longValue());
business.setBusinessName(objects[1].toString());
list1.add(business);
}
return list1;
}
public List<Map<String,Object>> findDimKpiListBybusnameIdList(List<Long> busnameIdList,String isActive) {
List<Object[]>list= dimKpiDao.findDimKpiListBybusnameIdList2(busnameIdList,isActive);
List<Map<String,Object>>list1=new ArrayList<Map<String, Object>>();
for (Object[] objects : list) {
Map<String,Object>map=new HashMap<String,Object>();
map.put("kpiName",objects[0]);
map.put("kpiId",objects[1]);
list1.add(map);
}
return list1;
}
}
<%@tag pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<%--************************************************分析报告 by m01 20180508***************************************** --%>
<div>
<label for="">分析报告</label>
<div id="reports_item_div">
<div class="checkbox-inline">
<input type="radio" name="report" class="report" title="有" value="1" >有
</div>
<div class="checkbox-inline">
<input type="radio" name="report" class="report" title="无" value="0" >无
</div>
</div>
</div>
<script type="text/javascript">
function reportsReset(){
/* $("input[name='reports']:checkbox").each(function () {
$(this).attr('checked',false);
});*/
$('input[name="report"]').attr('checked',false);
}
function getReportCheckedValues(){
/*var reportsArray = new Array();
$("input[name='reports']:checked").each(function () {
reportsArray.push($(this).val())
});
return reportsArray;*/
var val=$('input[name="report"]:checked').val();
val =val?val:"-";
return val;
}
</script>
\ No newline at end of file
<%@tag pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div id="business_div" class="slide-menu-option">
<label for="">业务</label>
<div id ="allBusiness_div" class="checkbox-inline">
<label>
<input type="checkbox" name="allBusiness" id="allBusiness" > 全选
</label>
</div>
<div id="businessList_div">
</div>
</div>
<script type="text/javascript">
//全选 复选框
$('input[name="allBusiness"]').on('click',function () {
$("#allKpi_div").prop("checked",false);//指标 取消全选
$("#kpiList_div").empty();//清空
if($(this).prop('checked')){//已勾选
$('input[name="businesss"]').prop('checked',true);
loadKpi();
}else{
$('input[name="businesss"]').prop('checked',false);
loadKpi();
}
});
//业务 复选框
function businessClick(e) {
$("#allKpi_div").prop("checked",false);//指标 取消全选
$("#kpiList_div").empty();//清空
var isAllSelected=true;
$('input[name="businesss"]').each(function () {
if(!$(this).prop('checked')){
isAllSelected=false;
}
});
if(isAllSelected){
$('input[name="allBusiness"]').prop('checked',true);
}else {
$('input[name="allBusiness"]').prop('checked',false);
}
loadKpi();
}
$("input[name='businesss']").on('click',function () {
$("#businessList_div").empty();//清空 业务
$("#allBusiness").prop("checked",false);//取消选择 ‘全选’
$("#kpiList_div").empty();//清空
$("#allKpi_div").prop("checked",false);//取消全选
if($(this).prop('checked')){//已勾选
$(this).prop('checked',true);
loadKpi();
}else{
$(this).prop('checked',false);
loadKpi();
}
var isAllSelected=true;
$('input[name="businesss"]').each(function () {
if(!$(this).prop('checked')){
isAllSelected=false;
}
});
if(isAllSelected){
$('input[name="allBusiness"]').prop('checked',true);
}else {
$('input[name="allBusiness"]').prop('checked',false);
}
});
//初始化
function initBusiness() {
$("#allBusiness_div").hide();
$("#businessList_div").empty();
}
//选择的业务
function getSelectedBusiness() {
var businessArray=new Array();
$('input[name="businesss"]').each(function () {
if($(this).prop('checked')){
businessArray.push($(this).val());
}
});
return businessArray;
}
</script>
<%@tag pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<div class="slide-menu-option">
<label id="labelChannel" for="">渠道</label>
<div class="checkbox-inline">
<label>
<input type="checkbox" name="allChannel" id="allChannel"> 全选
</label>
</div>
<div>
<c:forEach var="channel" items="${channelList}">
<div class="checkbox-inline">
<input type="checkbox" name="channel"
title="${channel.channelName}" value="${channel.channelId}">${channel.channelName}
</div>
</c:forEach>
</div>
</div>
<script type="text/javascript">
//全选 复选框
$('input[name="allChannel"]').on('click',function () {
cancelselectbusinessandkpi();
if($(this).prop('checked')){//已勾选
$('input[name="channel"]').prop('checked',true);
getBusinessByDatasource();
}else{
$('input[name="channel"]').prop('checked',false);
getBusinessByDatasource();
}
});
// 渠道 复选框
$('input[name="channel"]').on('click',function () {
cancelselectbusinessandkpi();
if($(this).prop('checked')){
$(this).prop('checked',true);
getBusinessByDatasource();
}else{
$(this).prop('checked',false);
getBusinessByDatasource();
}
var isAll=true;
$('input[name="channel"]').each(function () {
if(!$(this).prop('checked')){
isAll=false;
}
});
if (isAll){
$('input[name="allChannel"]').prop('checked',true);
}else{
$('input[name="allChannel"]').prop('checked',false);
}
});
function initChannel(){
$('input[name="allChannel"]').prop('checked',false);
$('input[name="channel"]').prop('checked',false);
}
function getSelectedChannels(){
var channelArray=new Array();
$('input[name="channel"]').each(function () {
if($(this).prop('checked')){
channelArray.push($(this).val());
}
});
return channelArray;
}
// 联合 数据来源查找 业务
function getBusinessByDatasource(){
// 清空 业务 和指标
initBusiness();
initKpi();
var selectedDataSourceArr=getSelectedDataSources();
if (selectedDataSourceArr.length ===0){return;}
var selectedDataSourceStr=selectedDataSourceArr.join('-');
var selectedChannelsArr=getSelectedChannels();
if (selectedChannelsArr.length ===0){return;}
var selectedChannelStr=selectedChannelsArr.join("-");
// alert("selectedDataSourceStr "+selectedDataSourceStr);
// alert("selectedChannelStr "+selectedChannelStr);
var url = "${ctx}/MonitorOperation/CustomAnalysis/getBusinessByChannelIdListAndDataSourceIdList/"+selectedDataSourceStr+"/"+selectedChannelStr;
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
timeout: 3000,
cache: false,
error: solveDataSourceError,
success: useDataSourceData
});
}
function solveDataSourceError() {
initChannel();//初始化 渠道
initBusiness();//初始化 业务
initKpi();//初始化 指标
}
function useDataSourceData(data){
// alert(data);
loadBusiness(data);
}
</script>
<%@tag pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<div class="slide-menu-option">
<label for="">数据来源</label>
<div class="checkbox-inline">
<label> <input type="checkbox" name="allDataSource" id="allDataSource"
> 全选
</label>
</div>
<div >
<c:forEach var="datasource" items="${datasourceList}">
<div class="checkbox-inline">
<label>
<input type="checkbox" name="datasource" class="datasource"
title="${datasource.dataSourceName}" value="${datasource.dataSourceId}"
>${datasource.dataSourceName}
</label>
</div>
</c:forEach>
</div>
</div>
<script type="text/javascript">
//全选 复选框
$('input[name="allDataSource"]').on('click', function () {
cancelselectbusinessandkpi();
if ($(this).prop("checked")) {
$("input[name='datasource']").prop("checked",true);
getBusinessByChannel();
} else {
$("input[name='datasource']").prop("checked",false);
// alert('getBusinessByChannel all 2');
getBusinessByChannel();
}
});
// 资源 复选框
$("input[name='datasource']").on('click', function () {
cancelselectbusinessandkpi();
if ($(this).prop("checked")) {
$(this).prop("checked",true);
getBusinessByChannel();
} else {
$(this).prop("checked",false);
getBusinessByChannel();
}
var clickFlag = true;//是否全部选中
$("input[name='datasource']").each(function () {
if (!$(this).prop('checked')) {
clickFlag = false;
}
});
if (clickFlag) {
$('input[name="allDataSource"]').prop("checked",true);
} else {
$('input[name="allDataSource"]').prop("checked",false);
}
});
// 初始化
function initDataSource(){
$('input[name="allDataSource"]').prop("checked",false);
$('input[name="datasource"]').prop("checked",false);
}
function getSelectedDataSources(){
var dataSourceArray=new Array();
$("input[name='datasource']").each(function(){
if($(this).prop('checked')){
dataSourceArray.push($(this).val());
}
});
return dataSourceArray;
}
// 联合 渠道查找 业务
function getBusinessByChannel(){
// 清空 业务 和指标
initBusiness();
initKpi();
var selectedChannelsArr=getSelectedChannels();
// alert("selectedChannelsArr.length ="+selectedChannelsArr.length );
if (selectedChannelsArr.length ===0){return;}
var selectedChannelStr=selectedChannelsArr.join("-");
var selectedDataSourceArr=getSelectedDataSources();
// alert("selectedDataSourceArr.length ="+selectedDataSourceArr.length);
if (selectedDataSourceArr.length ===0){return;}
var selectedDataSourceStr=selectedDataSourceArr.join('-');
// alert("selectedDataSourceStr "+selectedDataSourceStr);
// alert("selectedChannelStr "+selectedChannelStr);
var url = "${ctx}/MonitorOperation/CustomAnalysis/getBusinessByChannelIdListAndDataSourceIdList/"+selectedDataSourceStr+"/"+selectedChannelStr;
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
timeout: 3000,
cache: false,
error: solveDataSourceError,
success: useDataSourceData
});
}
function solveDataSourceError(){//若果请求 错误 就初始化 数据来源请求框
initDataSource();
}
function useDataSourceData(data){//将业务数据 显示到界面上
// alert(data);
loadBusiness(data);
}
function loadBusiness(data){
$("#businessList_div").empty();//清除 已显示的业务
var content="";
for (var key in data){
var businessId=data[key].businessId;
var businessName=data[key].businessName;
var contentChild="<div class='checkbox-inline'>" +
"<label><input type='checkbox' class='businessStats' title='"+businessName+"' value='"+businessId+"' name='businesss' onclick='businessClick(this)'>"+businessName+ "</label></div>";
content=content+contentChild;
}
if(content !==''){
$("#allBusiness_div").show();
}
$("#businessList_div").append(content);
}
</script>
\ No newline at end of file
<%@tag pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div>
<label for="">分析报告</label>
<div id="report_div">
<div class="checkbox-inline">
<input type="radio" name="report" class="report" title="有" value="1" >有
</div>
<div class="checkbox-inline">
<input type="radio" name="report" class="report" title="无" value="0" >无
</div>
</div>
</div>
<script type="text/javascript">
function getSelectedReport(){
var selectedReport=$('input[name="report"]:checked').val();
return selectedReport;
}
function initReport(){
$('input[name="report"]').removeAttr('checked',false);
}
</script>
\ No newline at end of file
<%@tag pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div id="business_div" class="slide-menu-option">
<label for="">指标</label>
<div id="allKpi_div" class="checkbox-inline" >
<label>
<input type="checkbox" name="allKpi" id="allKpi" > 全选
</label>
</div>
<div id="kpiList_div">
</div>
</div>
<script type="text/javascript">
function initKpi() {
$("#allKpi_div").prop("checked",false);//取消全选
$("#allKpi_div").hide();//隐藏全选
$("#kpiList_div").empty();//清空
}
function getSelectedKpi() {//获取已选择的指标
var kpiArray = new Array();
$("input[name='kpi']").each(function () {
if ($(this).prop('checked')) {
kpiArray.push($(this).val());
}
});
return kpiArray;
}
function getSelectedKpiName() {//获取已选择的指标
var kpiArray = new Array();
$("input[name='kpi']").each(function () {
if ($(this).prop('checked')) {
kpiArray.push($(this).prop('title'));
}
});
return kpiArray;
}
$("input[name='allKpi']").on('click', function () {//全选按钮
if ($(this).prop('checked')) {
$("input[name='kpi']").prop('checked', true);
} else {
$("input[name='kpi']").prop('checked', false);
}
});
function kpiClick(e){
var clickFlag = true;//是否全部选中
$("input[name='kpi']").each(function () {
if (!$(this).prop('checked')) {
clickFlag = false;
}
});
if (clickFlag) {
$("input[name='allKpi']").prop('checked', true);
} else {
$("input[name='allKpi']").prop('checked', false);
}
}
function loadKpi() {
// 初始化指标
initKpi();
//获取已选择的业务
var selectedBusinessArr = getSelectedBusiness();
// alert("selectedBusinessArr.length = "+selectedBusinessArr.length);
if (selectedBusinessArr.length === 0) {
return;
}
var selectedBusinessStr = selectedBusinessArr.join('-');
// alert("selectedBusinessStr = "+selectedBusinessStr);
var url = "${ctx}/MonitorOperation/CustomAnalysis/getDimKpiListByBusinessIdList/" + selectedBusinessStr;
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
timeout: 3000,
cache: false,
error: solveChannelError,
success: useChannelData
});
}
function solveChannelError() {
$("#allKpi_div").hide();//隐藏全选
}
function useChannelData(data) {
$("#kpiList_div").empty();
var content = "";
for (var key in data) {
var kpiName = data[key].kpiName;
var kpiId = data[key].kpiId;
var contentChild = "<div class='checkbox-inline'>" +
"<label><input type='checkbox' class='businessStats' title='"+kpiName+"' value='"+kpiId+"' name='kpi' onclick='kpiClick(this)'>"+kpiName+"</label></div>";
content = content + contentChild;
}
// alert(content);
if(content !==''){
$("#allKpi_div").show();//显示全选
}
$("#kpiList_div").append(content);
}
</script>
<%@tag pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div class="slide-menu-option">
<label for="">省份</label>
<%--<div class="checkbox-inline">
<label>
<input type="checkbox" name="allProvince" id="allProvince"
title="allSelect" checked/>全选
</label>
</div>--%>
<div>
<c:forEach items="${provinceList}" var="province">
<div class="checkbox-inline">
<label>
<input type="radio" name="province" class="province" title="${province.provinceName}"
value="${province.provinceId}" />${province.provinceName}
</label>
</div>
</c:forEach>
</div>
</div>
<script type="text/javascript">
//全选和不全选所有的省
$('input[name="allProvince"]').on('click', function () {
if ($("#allProvince").prop("checked")) {//已全选
alert("1");
$('input[name="province"]').prop("checked", true);
} else {
alert("122");
$('input[name="province"]').prop("checked", false);
}
});
//选中勾选了的省
$('input[name="province"]').on('click', function () {
if ($(this).prop("checked")) {
// $(this).prop("checked", false);
} else {
$//(this).prop("checked", true);
}
});/*var clickFlag = true;//是否全部选中
$('input[name="province"]').each(function () {
if (!$(this).prop("checked")) {
clickFlag = false;
}
});
if (clickFlag) {
$('input[name="allProvince"]').prop("checked",true);
} else {
$('input[name="allProvince"]').prop("checked",false);
}*/
function initProvince() {
// $('input[name="allProvince"]').prop("checked", true);
$("input[name='province']").prop("checked", false);
}
function getSelectedProvinces() {
/*var provinceArray = new Array();
$("input[name='province']:checked").each(function () {
provinceArray.push($(this).val())
});
return provinceArray;*/
return $("input[name='province']:checked").val();
}
function getSelectedProvinceName() {
return $("input[name='province']:checked").prop('title');
}
</script>
<%@tag pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--时间范围筛选项 ,最大跨度为三个月,只能取到截止到目前的最近三个月--%>
<%--要引入此tag需要在要引入的页面中添加
<script language="javascript" type="text/javascript" src="${ctx}/static/My97DatePicker/WdatePicker.js"></script>
--%>
<div class="date">
<label for="">时间范围</label><!-- 默认的时间范围为最近 1个月-->
<input id="d1Stats" class="Wdate" type="text" value=""
onFocus="var d2Stats=$dp.$('d2Stats');WdatePicker({onpicked:function(){d2Stats.focus();},minDate:'{%y-3}-%M-%d %H:%m:%s',maxDate:'#F{$dp.$D(\'d2Stats\')||\'%y-%M-%d %H:%m:%s\'}'})">
--
<input id="d2Stats" class="Wdate" type="text" value=""
onFocus="WdatePicker({minDate:'#F{$dp.$D(\'d1Stats\')||\'{%y-3}-%M-%d %H:%m:%s\'}',maxDate:'%y-%M-%d %H:%m:%s'})">
</div>
<script type="text/javascript">
function initStartTimeStats() {
var now = new Date();
var year = now.getFullYear(); //年
var month = now.getMonth() + 1; //月
var day = now.getDate(); //日
var hh = now.getHours(); //时
var mm = now.getMinutes(); //分
var clock = year + "-";
if (month < 10)
clock += "0";
clock += month + "-";
if (day < 10)
clock += "0";
clock += day + " ";
if (hh < 10)
clock += "0";
clock += hh + ":";
if (mm < 10) clock += '0';
clock += mm;
clock += ":" + "00";
return (clock);
}
function initEndTimeStats() {
var date = new Date();
var daysInMonth = new Array([0], [31], [28], [31], [30], [31], [30], [31], [31], [30], [31], [30], [31]);
var strYear = date.getFullYear();
var strDay = date.getDate();
var strMonth = date.getMonth() + 1;
var hh = date.getHours(); //时
var mm = date.getMinutes(); //分
if (strYear % 4 == 0 && strYear % 100 != 0) {
daysInMonth[2] = 29;
}
if (strMonth - 1 == 0) {
strYear -= 1;
strMonth = 12;
}
else {
strMonth -= 1;
}
strDay = daysInMonth[strMonth] >= strDay ? strDay : daysInMonth[strMonth];
if (strMonth < 10) {
strMonth = "0" + strMonth;
}
if (strDay < 10) {
strDay = "0" + strDay;
}
var clock = strYear + "-" + strMonth + "-" + strDay;
clock += " ";
if (hh < 10)
clock += "0";
clock += hh + ":";
if (mm < 10) clock += '0';
clock += mm;
clock += ":" + "00";
return (clock);
}
//初始化时间控件的默认值,需要在页面加载时调用此初始化方法
function initDateStats() {
$("#timeStats #d1Stats").val(initEndTimeStats());
$("#timeStats #d2Stats").val(initStartTimeStats());
}
//获取选取的时间段,返回结果为字符串数组
function getPeriodStats() {
var period = new Array();
period[0] = $("#d1Stats").val();
period[1] = $("#d2Stats").val();
return period;
}
//返回结果为以逗号分隔的字符串类型
function getStatsPeriodString() {
var StatStr = "";
var period = getPeriodStats();
var regu = "^[ ]+$";
var re = new RegExp(regu);
if( re.test(period[0])||re.test(period[1])){
StatStr="";
// console.log('is kong')
}else{
StatStr = StatStr + period[0] + "," + period[1];
}
if($.trim(period) ===","){
StatStr="";
}else{
StatStr = StatStr + period[0] + "," + period[1];
}
return StatStr;
}
//返回结果为以~分隔的字符串,若全为空则返回空|Add by Charmy 02-17|Last modified by Charmy 02-18
function getStatsPeriodStr() {
var StatStr = "";
var period = getPeriodStats();
if (period[1] == "" && period[0] == "") {
str = "";
} else {
StatStr = StatStr + period[0] + "~" + period[1];
}
return StatStr;
}
</script>
......@@ -10,12 +10,12 @@
--
<input id="d2Stats" class="Wdate" type="text" value="" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'d1Stats\')||\'{%y-3}-%M-%d %H:%m:%s\'}',maxDate:'%y-%M-%d %H:%m:%s'})">
<!--
<input id="d1" class="Wdate" type="text" width="36px" onFocus="var d2=$dp.$('d2');WdatePicker({onpicked:function(){d2.focus();},minDate:'%y-{%M-3}-%d %H:%m:%s',maxDate:'#F{$dp.$D(\'d2\')||\'%y-%M-%d %H:%m:%s\'}'})">
<!--
<input id="d1" class="Wdate" type="text" width="36px" onFocus="var d2=$dp.$('d2');WdatePicker({onpicked:function(){d2.focus();},minDate:'%y-{%M-3}-%d %H:%m:%s',maxDate:'#F{$dp.$D(\'d2\')||\'%y-%M-%d %H:%m:%s\'}'})">
--
<input id="d2" class="Wdate" type="text" width="36px" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'d1\')||\'%y-{%M-3}-%d %H:%m:%s\'}',maxDate:'%y-%M-%d %H:%m:%s'})">
-->
</div>
<script type="text/javascript">
......
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