境内ip报表提交

This commit is contained in:
wangxin
2018-07-10 11:11:35 +08:00
parent ba9d3644de
commit 78313edf7d
6 changed files with 285 additions and 52 deletions

View File

@@ -0,0 +1,58 @@
/**
*@Title: NtcServiceReportLog.java
*@Package com.nis.domain.log
*@Description TODO
*@author dell
*@date 2018年7月9日 上午8:57:01
*@version 版本号
*/
package com.nis.domain.report;
/**
* @ClassName: NtcServiceReportLog.java
* @Description: TODO
* @author (dell)
* @date 2018年7月9日 上午8:57:01
* @version V1.0
*/
public class NtcSrcipDomesticReport extends BaseReport<NtcSrcipDomesticReport> {
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
* @since 1.0.0
*/
private static final long serialVersionUID = 2245672277797057001L;
private String srcProvince;
private String srcCity;
/**
* srcProvince
* @return srcProvince
*/
public String getSrcProvince() {
return srcProvince;
}
/**
* @param srcProvince the srcProvince to set
*/
public void setSrcProvince(String srcProvince) {
this.srcProvince = srcProvince;
}
/**
* srcCity
* @return srcCity
*/
public String getSrcCity() {
return srcCity;
}
/**
* @param srcCity the srcCity to set
*/
public void setSrcCity(String srcCity) {
this.srcCity = srcCity;
}
}

View File

@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -117,7 +118,7 @@ public class NtcLwhhReportController extends BaseController {
// trimData.put(trimStr, report.getSum().longValue()); // trimData.put(trimStr, report.getSum().longValue());
// } // }
// } // }
// HashMap<String,List<Long>> showData=new HashMap<>();//构造数据展示集合 // HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
// for(RequestInfo requestInfo:requestInfos){ // for(RequestInfo requestInfo:requestInfos){
// List<Long> line= new ArrayList<Long>(); // List<Long> line= new ArrayList<Long>();
// long total=0; // long total=0;
@@ -139,7 +140,7 @@ public class NtcLwhhReportController extends BaseController {
// // TODO: handle exception // // TODO: handle exception
// e.printStackTrace(); // e.printStackTrace();
// } // }
HashMap<String,List<Long>> showData=new HashMap<>();//构造数据展示集合 HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
for(RequestInfo requestInfo:requestInfos){ for(RequestInfo requestInfo:requestInfos){
List<Long> line= new ArrayList<Long>(); List<Long> line= new ArrayList<Long>();
long total=0l; long total=0l;

View File

@@ -0,0 +1,165 @@
package com.nis.web.controller.report;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.log.SearchReport;
import com.nis.domain.report.NtcSrcipDomesticReport;
import com.nis.domain.report.ReportResult;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.web.controller.BaseController;
@Controller
@RequestMapping("${adminPath}/report")
public class NtcSrcipDomesticReportController extends BaseController {
@RequestMapping("/ajaxNtcSrcipDomesticReport")
public String list(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(bean.getFunctionId());
if(bean.getAction()!=null){
for(FunctionServiceDict service:serviceList){
if(service.getAction().intValue()==bean.getAction().intValue()){
bean.setSearchService(service.getServiceId().toString());
}
}
}else{
StringBuffer serviceId=new StringBuffer();
for(int i=0;i<serviceList.size();i++){
if(i==0){
serviceId.append(serviceList.get(i).getServiceId().toString());
}else{
serviceId.append(","+serviceList.get(i).getServiceId().toString());
}
}
bean.setSearchService(serviceId.toString());
}
String reportTime=bean.getReportTime();
bean.setSearchBusinessType("1");
ReportResult<NtcSrcipDomesticReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_SERVICE_REPORT+"?");
bean.setPageSize(-1);
bean.setFields("srcProvince,srcCity,sum,reportTime");
String format=Constants.SEARCH_DATEFORMAT;
SimpleDateFormat sdf=new SimpleDateFormat(format);
Date date=new Date();
bean.setSearchReportEndTime(sdf.format(date));
Calendar cal=Calendar.getInstance();
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
cal.set(Calendar.HOUR_OF_DAY, 0);
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.DAY_OF_MONTH, 1);
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.DAY_OF_MONTH, 1);
cal.set(Calendar.MONTH, 0);
}
logger.info("search start time "+sdf.format(cal.getTime()));
logger.info("search end time "+sdf.format(date));
bean.setSearchReportStartTime(sdf.format(cal.getTime()));
List<String> titles=new ArrayList<String>();
while(cal.getTime().getTime()<date.getTime()){//构造标题
//报表时间单位加一
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
titles.add(sdf.format(cal.getTime()).substring(0,13));
cal.add(Calendar.HOUR_OF_DAY, 1);
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
titles.add(sdf.format(cal.getTime()).substring(0,10));
cal.add(Calendar.DAY_OF_MONTH, 1);
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
titles.add(sdf.format(cal.getTime()).substring(0,7));
cal.add(Calendar.MONTH, 1);
}
}
model.addAttribute("titles", titles);
// try {
// result=result.getReport(url.toString(), bean);
// Page<NtcSrcipDomesticReport> page=result.getData();
// List<NtcSrcipDomesticReport> list=page.getList();
// HashMap<String,Long> trimData=new HashMap<>();//数据累加去重
// for(NtcSrcipDomesticReport report:list){
// String trimStr="";
// if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
// trimStr=report.getSrcProvince()+Constants.REPORT_TRIM_CONNECTOR+
// report.getSrcCity()+Constants.REPORT_TRIM_CONNECTOR+
// sdf.format(cal.getTime()).substring(0,13);
//
// }else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
// trimStr=report.getSrcProvince()+Constants.REPORT_TRIM_CONNECTOR+
// report.getSrcCity()+Constants.REPORT_TRIM_CONNECTOR+
// sdf.format(cal.getTime()).substring(0,10);
//
// }else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
// trimStr=report.getSrcProvince()+Constants.REPORT_TRIM_CONNECTOR+
// report.getSrcCity()+Constants.REPORT_TRIM_CONNECTOR+
// sdf.format(cal.getTime()).substring(0,7);
// }
// if(trimData.containsKey(trimStr)){
// trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue());
// }else{
// trimData.put(trimStr, report.getSum().longValue());
// }
// }
// HashMap<String,List<Long>> showData=new HashMap<>();//构造数据展示集合
//
// for(String key:trimData.keySet()){
// List<Long> line= new ArrayList<Long>();
// long total=0;
// String[] keyArr=key.split(Constants.REPORT_TRIM_CONNECTOR);
// String location=keyArr[0]+Constants.REPORT_TRIM_CONNECTOR+keyArr[1];
// for(String title:titles){
// if(trimData.containsKey(location+Constants.REPORT_TRIM_CONNECTOR+title)){
// line.add(trimData.get(location+Constants.REPORT_TRIM_CONNECTOR+title));
// total+=trimData.get(location+Constants.REPORT_TRIM_CONNECTOR+title).longValue();
// }else{
// line.add(0l);
// }
// }
// List<Long> _line= new ArrayList<Long>();
// _line.add(total);
// _line.addAll(line);
// showData.put(location, _line);
// }
// model.addAttribute("datas", showData);
// } catch (Exception e) {
// // TODO: handle exception
// e.printStackTrace();
// }
HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
long total=0;
List<Long> line= new ArrayList<Long>();
for(String title:titles){
line.add(10000l);
total+=10000l;
}
List<Long> _line= new ArrayList<Long>();
_line.add(total);
_line.addAll(line);
for(int i=0;i<1000;i++){
showData.put("河北"+Constants.REPORT_TRIM_CONNECTOR+"廊坊"+i, _line);
}
model.addAttribute("splitor", Constants.REPORT_TRIM_CONNECTOR);
model.addAttribute("datas", showData);
return "/report/srcIp";
}
}

View File

@@ -32,9 +32,9 @@ import com.nis.web.controller.BaseController;
public class NtcTagReportController extends BaseController { public class NtcTagReportController extends BaseController {
@RequestMapping("/ajaxNtcTagReport") @RequestMapping("/ajaxNtcTagReport")
public String list(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) { public String list(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
if (bean.getReportType() == null) { // if (bean.getReportType() == null) {
bean.setReportType(1); // bean.setReportType(1);
} // }
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(bean.getFunctionId()); List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(bean.getFunctionId());
List<ServiceDictInfo> labels=serviceDictInfoService.findAllLableDict(); List<ServiceDictInfo> labels=serviceDictInfoService.findAllLableDict();
model.addAttribute("labels", labels); model.addAttribute("labels", labels);
@@ -121,7 +121,7 @@ public class NtcTagReportController extends BaseController {
// trimData.put(trimStr, report.getSum().longValue()); // trimData.put(trimStr, report.getSum().longValue());
// } // }
// } // }
// HashMap<String,List<Long>> showData=new HashMap<>();//构造数据展示集合 // HashMap<String,List<Long>> showData=new LinkedHashMap<>();//构造数据展示集合
// for(ServiceDictInfo label:lables){ // for(ServiceDictInfo label:lables){
// List<Long> line= new ArrayList<Long>(); // List<Long> line= new ArrayList<Long>();
// long total=0; // long total=0;

View File

@@ -28,8 +28,10 @@
ajaxGetLabelReport(); ajaxGetLabelReport();
}else if("${bean.reportBusinessType}"=="lwhh_report"){ }else if("${bean.reportBusinessType}"=="lwhh_report"){
ajaxGetLwhhReport(); ajaxGetLwhhReport();
}else if("${bean.reportBusinessType}"=="src_ip_report"){
ajaxGetSrcIpReport();
} }
$("input[name='reportType']").each(function(){ $("[name='reportType']").each(function(){
var type='${bean.reportType}'; var type='${bean.reportType}';
if(type && type==$(this).val()){ if(type && type==$(this).val()){
$(this).parent(".btn").button("toggle"); $(this).parent(".btn").button("toggle");
@@ -38,13 +40,12 @@
$("a[data-toggle='tab']").on("click",function(){ $("a[data-toggle='tab']").on("click",function(){
$("#reportBusinessType").val($(this).data("bussiness")); $("#reportBusinessType").val($(this).data("bussiness"));
if(!$(this).parent("li").hasClass("active")){ if(!$(this).parent("li").hasClass("active")){
//var action=$('select[name="action"]').val();
//var reportBusinessType=$("#reportBusinessType").val();
//var reportType=$('input[name="reportType"]:checked').val();
if($(this).data("bussiness")=="label_report"){ if($(this).data("bussiness")=="label_report"){
ajaxGetLabelReport(); ajaxGetLabelReport();
}else if($(this).data("bussiness")=="lwhh_report"){ }else if($(this).data("bussiness")=="lwhh_report"){
ajaxGetLwhhReport(); ajaxGetLwhhReport();
}else if($(this).data("bussiness")=="src_ip_report"){
ajaxGetSrcIpReport();
} }
} }
}); });
@@ -72,8 +73,8 @@ var ajaxGetLabelReport=function(){
async:false, async:false,
url:'${ctx}/report/ajaxNtcTagReport', url:'${ctx}/report/ajaxNtcTagReport',
data:{ data:{
"action":$('select[name="action"]').val(), "action":$('[name="action"]').val(),
"reportType":$('input[name="reportType"]:checked').val() "reportType":$('[name="reportType"]').val()
}, },
dataType:"html", dataType:"html",
success:function(data){ success:function(data){
@@ -89,8 +90,8 @@ var ajaxGetLwhhReport=function(){
async:false, async:false,
url:'${ctx}/report/ajaxNtcLwhhReport', url:'${ctx}/report/ajaxNtcLwhhReport',
data:{ data:{
"action":$('select[name="action"]').val(), "action":$('[name="action"]').val(),
"reportType":$('input[name="reportType"]:checked').val() "reportType":$('[name="reportType"]').val()
}, },
dataType:"html", dataType:"html",
success:function(data){ success:function(data){
@@ -99,6 +100,23 @@ var ajaxGetLwhhReport=function(){
} }
}); });
} }
var ajaxGetSrcIpReport=function(){
loading('<spring:message code="onloading"/>');
$.ajax({
type:'post',
async:false,
url:'${ctx}/report/ajaxNtcSrcipDomesticReport',
data:{
"action":$('[name="action"]').val(),
"reportType":$('[name="reportType"]').val()
},
dataType:"html",
success:function(data){
$("#srcIp").html(data);
closeTip();
}
});
}
</script> </script>
</head> </head>
<body> <body>
@@ -239,7 +257,10 @@ var ajaxGetLwhhReport=function(){
<c:if test="${bean.reportBusinessType eq 'lwhh_report'}"> <c:if test="${bean.reportBusinessType eq 'lwhh_report'}">
in active in active
</c:if>"></div> </c:if>"></div>
<%@include file="/WEB-INF/views/report/srcIp.jsp" %> <div id="srcIp" class="tab-pane fade
<c:if test="${bean.reportBusinessType eq 'src_ip_report'}">
in active
</c:if>"></div>
<%@include file="/WEB-INF/views/report/destIp.jsp" %> <%@include file="/WEB-INF/views/report/destIp.jsp" %>
<%@include file="/WEB-INF/views/report/entranceId.jsp" %> <%@include file="/WEB-INF/views/report/entranceId.jsp" %>
</div> </div>

View File

@@ -4,40 +4,28 @@
$(function(){ $(function(){
}); });
</script> </script>
<div id="srcIp" class="tab-pane fade">
<table id="contentTable1" class="table table-striped table-bordered table-condensed text-nowrap"> <table id="contentTable1" class="table table-striped table-bordered table-condensed text-nowrap">
<thead> <thead>
<tr> <tr>
<th>所属省</th> <th><spring:message code="src_province"/></th>
<th>所属市</th> <th><spring:message code="src_city"/></th>
<th>总量</th> <th><spring:message code="log_total"/></th>
<th>0点</th> <c:forEach items="${titles}" var="title">
<th>1点</th> <th>${title}</th>
<th>2点</th> </c:forEach>
<th>3点</th>
<th>4点</th>
<th>5点</th>
<th>6点</th>
<th>7点</th>
<th>8点</th>
<th>9点</th>
<th>10点</th>
<th>11点</th>
<th>12点</th>
<th>14点</th>
<th>15点</th>
<th>16点</th>
<th>17点</th>
<th>18点</th>
<th>19点</th>
<th>20点</th>
<th>21点</th>
<th>22点</th>
<th>23点</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<c:forEach items="${datas}" var="data">
<tr>
<c:forEach items="${fn:split(data.key,splitor)}" var="location">
<td>${location}</td>
</c:forEach>
<c:forEach items="${data.value}" var="cloumn" varStatus="status">
<td>${cloumn}</td>
</c:forEach>
</tr>
</c:forEach>
</tbody> </tbody>
</table> </table>
<div class="page">${page}</div> <div class="page">${page}</div>
</div>