From 2b14a7db2bf960f32cb3983736cd312925431458 Mon Sep 17 00:00:00 2001 From: leijun Date: Tue, 28 Aug 2018 18:52:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B0=8F=E6=97=B6=E6=8A=A5?= =?UTF-8?q?=E3=80=81=E6=97=A5=E6=8A=A5=E3=80=81=E6=9C=88=E6=8A=A5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=9B=B4=E6=8E=A5=E4=BB=8E=E6=8E=A5=E5=8F=A3=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/NtcDestIpReportController.java | 19 +++++++++++-------- .../report/NtcEntranceReportController.java | 16 +++++++++------- .../report/NtcLwhhReportController.java | 17 ++++++++++------- .../report/NtcServiceReportController.java | 16 ++++++++++------ .../NtcSrcipDomesticReportController.java | 15 +++++++++------ .../report/NtcTagReportController.java | 14 ++++++++------ .../report/NtcXzReportController.java | 13 ++++++++----- 7 files changed, 65 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/nis/web/controller/report/NtcDestIpReportController.java b/src/main/java/com/nis/web/controller/report/NtcDestIpReportController.java index c9b1dde0a..ff86dbde4 100644 --- a/src/main/java/com/nis/web/controller/report/NtcDestIpReportController.java +++ b/src/main/java/com/nis/web/controller/report/NtcDestIpReportController.java @@ -52,7 +52,14 @@ public class NtcDestIpReportController extends BaseController { } bean.setSearchService(serviceId.toString()); } - bean.setSearchBusinessType("1"); + //根据reportType获取小时、日报、月报 + if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){ + bean.setSearchBusinessType("2"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){ + bean.setSearchBusinessType("3"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){ + bean.setSearchBusinessType("4"); + } // 调用服务接口... @@ -69,14 +76,13 @@ public class NtcDestIpReportController extends BaseController { try { StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_NTC_DESTIP_REPORT); String json=ConfigServiceUtil.getReport(url.toString(), bean); - HashMap trimData=new HashMap<>();//数据累加去重 + HashMap trimData=new HashMap<>(); // SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT); for(NtcDestIpReport report:getList(json)){ String trimStr=""; if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){ trimStr=report.getDestCountry().trim()+Constants.REPORT_TRIM_CONNECTOR+ report.getReportTime().substring(0,13); - }else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){ trimStr=report.getDestCountry().trim()+Constants.REPORT_TRIM_CONNECTOR+ report.getReportTime().substring(0,10); @@ -85,11 +91,8 @@ public class NtcDestIpReportController extends BaseController { trimStr=report.getDestCountry().trim()+Constants.REPORT_TRIM_CONNECTOR+ report.getReportTime().substring(0,7); } - if(trimData.containsKey(trimStr)){ - trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue()); - }else{ - trimData.put(trimStr, report.getSum().longValue()); - } + trimData.put(trimStr, report.getSum().longValue()); + } HashMap> showData=new LinkedHashMap<>();//构造数据展示集合 for(Entry counrty:trimData.entrySet()){ diff --git a/src/main/java/com/nis/web/controller/report/NtcEntranceReportController.java b/src/main/java/com/nis/web/controller/report/NtcEntranceReportController.java index d54041392..0006c83ee 100644 --- a/src/main/java/com/nis/web/controller/report/NtcEntranceReportController.java +++ b/src/main/java/com/nis/web/controller/report/NtcEntranceReportController.java @@ -52,8 +52,14 @@ public class NtcEntranceReportController extends BaseController { } bean.setSearchService(serviceId.toString()); } - bean.setSearchBusinessType("1"); - + //根据reportType获取小时、日报、月报 + if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){ + bean.setSearchBusinessType("2"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){ + bean.setSearchBusinessType("3"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){ + bean.setSearchBusinessType("4"); + } // 调用服务接口... bean.setPageSize(-1); @@ -85,11 +91,7 @@ public class NtcEntranceReportController extends BaseController { trimStr=report.getEntranceId().intValue()+Constants.REPORT_TRIM_CONNECTOR+ report.getReportTime().substring(0,7); } - if(trimData.containsKey(trimStr)){ - trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue()); - }else{ - trimData.put(trimStr, report.getSum().longValue()); - } + trimData.put(trimStr, report.getSum().longValue()); } HashMap> showData=new LinkedHashMap<>();//构造数据展示集合 for(Entry counrty:trimData.entrySet()){ 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 9bd3716ef..ecb45e1ed 100644 --- a/src/main/java/com/nis/web/controller/report/NtcLwhhReportController.java +++ b/src/main/java/com/nis/web/controller/report/NtcLwhhReportController.java @@ -52,7 +52,14 @@ public class NtcLwhhReportController extends BaseController { } bean.setSearchService(serviceId.toString()); } - bean.setSearchBusinessType("1"); + //根据reportType获取小时、日报、月报 + if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){ + bean.setSearchBusinessType("2"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){ + bean.setSearchBusinessType("3"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){ + bean.setSearchBusinessType("4"); + } bean.setPageSize(-1); bean.setFields("lwhh,sum,reportTime"); try { @@ -66,7 +73,7 @@ public class NtcLwhhReportController extends BaseController { try { StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_NTC_LWHH_REPORT); String json=ConfigServiceUtil.getReport(url.toString(), bean); - HashMap trimData=new HashMap<>();//数据累加去重 + HashMap trimData=new HashMap<>(); // SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT); for(NtcLwhhReport report:getList(json)){ String trimStr=""; @@ -82,11 +89,7 @@ public class NtcLwhhReportController extends BaseController { trimStr=report.getLwhh().intValue()+Constants.REPORT_TRIM_CONNECTOR+ report.getReportTime().substring(0,7); } - if(trimData.containsKey(trimStr)){ - trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue()); - }else{ - trimData.put(trimStr, report.getSum().longValue()); - } + trimData.put(trimStr, report.getSum().longValue()); } HashMap> showData=new LinkedHashMap<>();//构造数据展示集合 for(RequestInfo requestInfo:requestInfos){ diff --git a/src/main/java/com/nis/web/controller/report/NtcServiceReportController.java b/src/main/java/com/nis/web/controller/report/NtcServiceReportController.java index d452302aa..ede3d2d93 100644 --- a/src/main/java/com/nis/web/controller/report/NtcServiceReportController.java +++ b/src/main/java/com/nis/web/controller/report/NtcServiceReportController.java @@ -50,7 +50,14 @@ public class NtcServiceReportController extends BaseController { } } bean.setSearchService(serviceId.toString()); - bean.setSearchBusinessType("1"); + //根据reportType获取小时、日报、月报 + if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){ + bean.setSearchBusinessType("2"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){ + bean.setSearchBusinessType("3"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){ + bean.setSearchBusinessType("4"); + } bean.setPageSize(-1); try { this.setReportSearchTime(bean); @@ -60,15 +67,12 @@ public class NtcServiceReportController extends BaseController { } StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_SERVICE_REPORT); try { + //bean.setSearchReportEndTime("2018-08-27 00:00:00"); String json=ConfigServiceUtil.getReport(url.toString(), bean); List data=getList(json); Map dataMap=new HashMap<>(); for(NtcServiceReport report:data){ - if(dataMap.containsKey(report.getService())){ - dataMap.put(report.getService(), dataMap.get(report.getService())+report.getSum().longValue()); - }else{ - dataMap.put(report.getService(),report.getSum().longValue()); - } + dataMap.put(report.getService(),report.getSum().longValue()); } for(Entry e:dataMap.entrySet()) { Map _data=new HashMap<>(); diff --git a/src/main/java/com/nis/web/controller/report/NtcSrcipDomesticReportController.java b/src/main/java/com/nis/web/controller/report/NtcSrcipDomesticReportController.java index 20a446a76..1a976932e 100644 --- a/src/main/java/com/nis/web/controller/report/NtcSrcipDomesticReportController.java +++ b/src/main/java/com/nis/web/controller/report/NtcSrcipDomesticReportController.java @@ -51,7 +51,14 @@ public class NtcSrcipDomesticReportController extends BaseController { bean.setSearchService(serviceId.toString()); } - bean.setSearchBusinessType("1"); + //根据reportType获取小时、日报、月报 + if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){ + bean.setSearchBusinessType("2"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){ + bean.setSearchBusinessType("3"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){ + bean.setSearchBusinessType("4"); + } bean.setPageSize(-1); bean.setFields("srcProvince,srcCity,sum,reportTime"); try { @@ -120,11 +127,7 @@ public class NtcSrcipDomesticReportController extends BaseController { report.getSrcCity().trim()+Constants.REPORT_TRIM_CONNECTOR+ report.getReportTime().substring(0,7); } - if(trimData.containsKey(trimStr)){ - trimData.put(trimStr, trimData.get(trimStr)+report.getSum().longValue()); - }else{ - trimData.put(trimStr, report.getSum().longValue()); - } + trimData.put(trimStr, report.getSum().longValue()); } HashMap> showData=new LinkedHashMap<>();//构造数据展示集合 for(String key:trimData.keySet()){ 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 b2efc2c95..f8a157ebc 100644 --- a/src/main/java/com/nis/web/controller/report/NtcTagReportController.java +++ b/src/main/java/com/nis/web/controller/report/NtcTagReportController.java @@ -52,8 +52,14 @@ public class NtcTagReportController extends BaseController { } bean.setSearchService(serviceId.toString()); } - bean.setSearchBusinessType("1"); - + //根据reportType获取小时、日报、月报 + if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){ + bean.setSearchBusinessType("2"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){ + bean.setSearchBusinessType("3"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){ + bean.setSearchBusinessType("4"); + } bean.setPageSize(-1); bean.setFields("tag,sum,reportTime"); try { @@ -84,11 +90,7 @@ public class NtcTagReportController extends BaseController { trimStr=report.getTag().intValue()+Constants.REPORT_TRIM_CONNECTOR+ report.getReportTime().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 LinkedHashMap<>();//构造数据展示集合 for(ServiceDictInfo label:labels){ diff --git a/src/main/java/com/nis/web/controller/report/NtcXzReportController.java b/src/main/java/com/nis/web/controller/report/NtcXzReportController.java index eb6aa74c7..3bfda5ee0 100644 --- a/src/main/java/com/nis/web/controller/report/NtcXzReportController.java +++ b/src/main/java/com/nis/web/controller/report/NtcXzReportController.java @@ -53,7 +53,14 @@ public class NtcXzReportController extends BaseController { } bean.setSearchService(serviceId.toString()); } - bean.setSearchBusinessType("1"); + //根据reportType获取小时、日报、月报 + if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){ + bean.setSearchBusinessType("2"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){ + bean.setSearchBusinessType("3"); + }else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){ + bean.setSearchBusinessType("4"); + } // 调用服务接口... @@ -88,11 +95,7 @@ public class NtcXzReportController extends BaseController { trimStr=report.getAttrType().intValue()+Constants.REPORT_TRIM_CONNECTOR+ report.getReportTime().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 LinkedHashMap<>();//构造数据展示集合 for(ServiceDictInfo xz:xzs){