From 78313edf7d24f59368f1e45dd142a98a5fb24bf6 Mon Sep 17 00:00:00 2001 From: wangxin Date: Tue, 10 Jul 2018 11:11:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=83=E5=86=85ip=E6=8A=A5=E8=A1=A8=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/report/NtcSrcipDomesticReport.java | 58 ++++++ .../report/NtcLwhhReportController.java | 5 +- .../NtcSrcipDomesticReportController.java | 165 ++++++++++++++++++ .../report/NtcTagReportController.java | 8 +- src/main/webapp/WEB-INF/views/report/list.jsp | 39 ++++- .../webapp/WEB-INF/views/report/srcIp.jsp | 62 +++---- 6 files changed, 285 insertions(+), 52 deletions(-) create mode 100644 src/main/java/com/nis/domain/report/NtcSrcipDomesticReport.java create mode 100644 src/main/java/com/nis/web/controller/report/NtcSrcipDomesticReportController.java diff --git a/src/main/java/com/nis/domain/report/NtcSrcipDomesticReport.java b/src/main/java/com/nis/domain/report/NtcSrcipDomesticReport.java new file mode 100644 index 000000000..eb472b463 --- /dev/null +++ b/src/main/java/com/nis/domain/report/NtcSrcipDomesticReport.java @@ -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 { + + /** + * @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; + } + +} diff --git a/src/main/java/com/nis/web/controller/report/NtcLwhhReportController.java b/src/main/java/com/nis/web/controller/report/NtcLwhhReportController.java index 98eda403a..334438b64 100644 --- a/src/main/java/com/nis/web/controller/report/NtcLwhhReportController.java +++ b/src/main/java/com/nis/web/controller/report/NtcLwhhReportController.java @@ -5,6 +5,7 @@ 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; @@ -117,7 +118,7 @@ public class NtcLwhhReportController extends BaseController { // trimData.put(trimStr, report.getSum().longValue()); // } // } -// HashMap> showData=new HashMap<>();//构造数据展示集合 +// HashMap> showData=new LinkedHashMap<>();//构造数据展示集合 // for(RequestInfo requestInfo:requestInfos){ // List line= new ArrayList(); // long total=0; @@ -139,7 +140,7 @@ public class NtcLwhhReportController extends BaseController { // // TODO: handle exception // e.printStackTrace(); // } - HashMap> showData=new HashMap<>();//构造数据展示集合 + HashMap> showData=new LinkedHashMap<>();//构造数据展示集合 for(RequestInfo requestInfo:requestInfos){ List line= new ArrayList(); long total=0l; diff --git a/src/main/java/com/nis/web/controller/report/NtcSrcipDomesticReportController.java b/src/main/java/com/nis/web/controller/report/NtcSrcipDomesticReportController.java new file mode 100644 index 000000000..1fa7f2bbf --- /dev/null +++ b/src/main/java/com/nis/web/controller/report/NtcSrcipDomesticReportController.java @@ -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 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 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 titles=new ArrayList(); + while(cal.getTime().getTime() page=result.getData(); +// List list=page.getList(); +// HashMap 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> showData=new HashMap<>();//构造数据展示集合 +// +// for(String key:trimData.keySet()){ +// List line= new ArrayList(); +// 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 _line= new ArrayList(); +// _line.add(total); +// _line.addAll(line); +// showData.put(location, _line); +// } +// model.addAttribute("datas", showData); +// } catch (Exception e) { +// // TODO: handle exception +// e.printStackTrace(); +// } + HashMap> showData=new LinkedHashMap<>();//构造数据展示集合 + long total=0; + List line= new ArrayList(); + for(String title:titles){ + line.add(10000l); + total+=10000l; + } + List _line= new ArrayList(); + _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"; + } +} diff --git a/src/main/java/com/nis/web/controller/report/NtcTagReportController.java b/src/main/java/com/nis/web/controller/report/NtcTagReportController.java index 7a346a8c7..35586024a 100644 --- a/src/main/java/com/nis/web/controller/report/NtcTagReportController.java +++ b/src/main/java/com/nis/web/controller/report/NtcTagReportController.java @@ -32,9 +32,9 @@ import com.nis.web.controller.BaseController; public class NtcTagReportController extends BaseController { @RequestMapping("/ajaxNtcTagReport") public String list(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) { - if (bean.getReportType() == null) { - bean.setReportType(1); - } +// if (bean.getReportType() == null) { +// bean.setReportType(1); +// } List serviceList = DictUtils.getFunctionServiceDictList(bean.getFunctionId()); List labels=serviceDictInfoService.findAllLableDict(); model.addAttribute("labels", labels); @@ -121,7 +121,7 @@ public class NtcTagReportController extends BaseController { // trimData.put(trimStr, report.getSum().longValue()); // } // } -// HashMap> showData=new HashMap<>();//构造数据展示集合 +// HashMap> showData=new LinkedHashMap<>();//构造数据展示集合 // for(ServiceDictInfo label:lables){ // List line= new ArrayList(); // long total=0; diff --git a/src/main/webapp/WEB-INF/views/report/list.jsp b/src/main/webapp/WEB-INF/views/report/list.jsp index 92a03f88c..8fb8fd128 100644 --- a/src/main/webapp/WEB-INF/views/report/list.jsp +++ b/src/main/webapp/WEB-INF/views/report/list.jsp @@ -28,8 +28,10 @@ ajaxGetLabelReport(); }else if("${bean.reportBusinessType}"=="lwhh_report"){ ajaxGetLwhhReport(); + }else if("${bean.reportBusinessType}"=="src_ip_report"){ + ajaxGetSrcIpReport(); } - $("input[name='reportType']").each(function(){ + $("[name='reportType']").each(function(){ var type='${bean.reportType}'; if(type && type==$(this).val()){ $(this).parent(".btn").button("toggle"); @@ -38,13 +40,12 @@ $("a[data-toggle='tab']").on("click",function(){ $("#reportBusinessType").val($(this).data("bussiness")); 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"){ ajaxGetLabelReport(); }else if($(this).data("bussiness")=="lwhh_report"){ ajaxGetLwhhReport(); + }else if($(this).data("bussiness")=="src_ip_report"){ + ajaxGetSrcIpReport(); } } }); @@ -72,8 +73,8 @@ var ajaxGetLabelReport=function(){ async:false, url:'${ctx}/report/ajaxNtcTagReport', data:{ - "action":$('select[name="action"]').val(), - "reportType":$('input[name="reportType"]:checked').val() + "action":$('[name="action"]').val(), + "reportType":$('[name="reportType"]').val() }, dataType:"html", success:function(data){ @@ -89,8 +90,8 @@ var ajaxGetLwhhReport=function(){ async:false, url:'${ctx}/report/ajaxNtcLwhhReport', data:{ - "action":$('select[name="action"]').val(), - "reportType":$('input[name="reportType"]:checked').val() + "action":$('[name="action"]').val(), + "reportType":$('[name="reportType"]').val() }, dataType:"html", success:function(data){ @@ -99,6 +100,23 @@ var ajaxGetLwhhReport=function(){ } }); } +var ajaxGetSrcIpReport=function(){ + loading(''); + $.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(); + } + }); +} @@ -239,7 +257,10 @@ var ajaxGetLwhhReport=function(){ in active "> - <%@include file="/WEB-INF/views/report/srcIp.jsp" %> +
+ in active + ">
<%@include file="/WEB-INF/views/report/destIp.jsp" %> <%@include file="/WEB-INF/views/report/entranceId.jsp" %> diff --git a/src/main/webapp/WEB-INF/views/report/srcIp.jsp b/src/main/webapp/WEB-INF/views/report/srcIp.jsp index 63cc402ae..be44c3c08 100644 --- a/src/main/webapp/WEB-INF/views/report/srcIp.jsp +++ b/src/main/webapp/WEB-INF/views/report/srcIp.jsp @@ -4,40 +4,28 @@ $(function(){ }); -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
所属省所属市总量0点1点2点3点4点5点6点7点8点9点10点11点12点14点15点16点17点18点19点20点21点22点23点
-
${page}
-
\ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + +
${title}
${location}${cloumn}
+
${page}