From a705b00a150d81bf529607c1524fb316261e8b2f Mon Sep 17 00:00:00 2001 From: zhanghongqing Date: Tue, 8 Jan 2019 20:28:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E9=87=8F=E7=BB=9F=E8=AE=A1=E8=AF=A6?= =?UTF-8?q?=E6=83=85app,=E5=8D=8F=E8=AE=AE=EF=BC=8C=E6=B4=BB=E8=B7=83IP?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9C=B0=E5=9F=9F=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../restful/DashboardServiceController.java | 18 +++++++-------- .../dao/dashboard/TrafficAppStatisticDao.java | 2 +- .../dao/dashboard/TrafficAppStatisticDao.xml | 5 ++++- .../TrafficIpActiveStatisticDao.java | 6 ++--- .../dashboard/TrafficIpActiveStatisticDao.xml | 16 +++++++++++--- .../TrafficProtocolStatisticDao.java | 2 +- .../dashboard/TrafficProtocolStatisticDao.xml | 5 ++++- .../web/service/restful/DashboardService.java | 22 +++++++++---------- 8 files changed, 46 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java b/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java index fe3a4db..7b488d8 100644 --- a/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java +++ b/src/main/java/com/nis/web/controller/restful/DashboardServiceController.java @@ -42,7 +42,7 @@ import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; import com.zdjizhi.utils.StringUtil; -@SuppressWarnings("unchecked") +@SuppressWarnings("all") @RestController @RequestMapping(value = "${servicePath}/log/v1") @Api(value = "DashboardServiceController", description = "统计分析图表基本服务接口") @@ -320,14 +320,14 @@ public class DashboardServiceController extends BaseRestController { */ @RequestMapping(value = "trafficProtocolList", method = RequestMethod.GET) @ApiOperation(value = "协议统计占比与报表", httpMethod = "GET", notes = "对应协议统计详情占比与报表") - public Map trafficProtocolList(Integer[] protoType,String beginDate, String endDate, Model model, HttpServletRequest request, + public Map trafficProtocolList(Integer[] protoType,String beginDate, String endDate,Integer entranceId, Model model, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); List list = new ArrayList(); try { - List ipActiveList = dashboardService.getProtocolList(beginDate, endDate,protoType); + List ipActiveList = dashboardService.getProtocolList(beginDate, endDate,protoType,entranceId); if (ipActiveList != null && ipActiveList.size() > 0) { String jsonString = JsonMapper.toJsonString(ipActiveList); list = (java.util.List) JsonMapper.fromJsonList(jsonString, HashMap.class); @@ -403,7 +403,7 @@ public class DashboardServiceController extends BaseRestController { */ @RequestMapping(value = "trafficIpActiveOneHour", method = RequestMethod.GET) @ApiOperation(value = "活跃IP统计一个小时的活跃IP", httpMethod = "GET", notes = "对应活跃IP实时统计查询服务。") - public Map trafficIpActiveOneHour(String beginDate, String endDate, Model model, + public Map trafficIpActiveOneHour(String beginDate, String endDate, Model model,Integer entranceId, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); @@ -413,7 +413,7 @@ public class DashboardServiceController extends BaseRestController { try { Date begin = DateUtils.parseDate(beginDate); Date end = DateUtils.parseDate(endDate); - List ipActiveChart = dashboardService.ipActiveOneHour(begin, end); + List ipActiveChart = dashboardService.ipActiveOneHour(begin, end,entranceId); if (ipActiveChart != null && ipActiveChart.size() > 0) { list = ipActiveChart; } @@ -440,7 +440,7 @@ public class DashboardServiceController extends BaseRestController { */ @RequestMapping(value = "trafficIpActiveFiveMinute", method = RequestMethod.GET) @ApiOperation(value = "活跃IP最近一个小时的变化趋势统计", httpMethod = "GET", notes = "对最新TOP10的活跃IP,在近一个小时的变化情况进行统计") - public Map trafficIpActiveFiveMinute(String beginDate, String endDate, Model model, + public Map trafficIpActiveFiveMinute(String beginDate, String endDate, Model model,Integer entranceId, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); @@ -454,7 +454,7 @@ public class DashboardServiceController extends BaseRestController { begin = DateUtils.parseDate(beginDate); end = DateUtils.parseDate(endDate); } - List ipActiveChart = dashboardService.ipActiveFiveMinute(begin, end); + List ipActiveChart = dashboardService.ipActiveFiveMinute(begin, end,entranceId); if (ipActiveChart != null && ipActiveChart.size() > 0) { list = ipActiveChart; } @@ -515,14 +515,14 @@ public class DashboardServiceController extends BaseRestController { */ @RequestMapping(value = "trafficAppList", method = RequestMethod.GET) @ApiOperation(value = "App统计占比与报表", httpMethod = "GET", notes = "对应App统计详情占比与报表") - public Map trafficAppList(Integer[] appType, String beginDate, String endDate, Model model, + public Map trafficAppList(Integer[] appType, String beginDate, String endDate, Model model,Integer entranceId, HttpServletRequest request, HttpServletResponse response) { long start = System.currentTimeMillis(); AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null); List list = new ArrayList(); try { - List appList = dashboardService.getAppList(beginDate, endDate, appType); + List appList = dashboardService.getAppList(beginDate, endDate, appType,entranceId); if (appList != null && appList.size() > 0) { String jsonString = JsonMapper.toJsonString(appList); list = (java.util.List) JsonMapper.fromJsonList(jsonString, HashMap.class); diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.java b/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.java index 5033cd8..fc8d147 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.java +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.java @@ -14,7 +14,7 @@ public interface TrafficAppStatisticDao { TrafficAppStatistic getMaxStatTime(); List appChart(@Param("statTime")Date statTime); - List getAppList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("appType")Integer[] appType); + List getAppList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("appType")Integer[] appType,@Param("entranceId")Integer entranceId); List getAppTrend(TrafficAppFocusStatistic entity); List appConnRecordTop100(AppConnRecordStatistic entity); List appConnRecordTotal(AppConnRecordStatistic entity); diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.xml b/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.xml index 1f1f304..9c2f382 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.xml @@ -30,7 +30,7 @@ diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.java b/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.java index e22e825..9c606aa 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.java +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.java @@ -15,9 +15,9 @@ public interface TrafficIpActiveStatisticDao { // List getIpList(TrafficIpActiveStatistic trafficIpActiveStatistic); TrafficIpActiveStatistic getMaxStatTime(); - ArrayList ipActiveFiveMinute( @Param("ipAddr") String ipAddr,@Param("beginDate")Date beginDate,@Param("endDate")Date endDate); + ArrayList ipActiveFiveMinute( @Param("ipAddr") String ipAddr,@Param("beginDate")Date beginDate,@Param("endDate")Date endDate,@Param("entranceId")Integer entranceId); - HashMap ipActiveOneHour(@Param("ipAddr") String ipAddr,@Param("beginDate")Date beginDate,@Param("endDate")Date endDate); + HashMap ipActiveOneHour(@Param("ipAddr") String ipAddr,@Param("beginDate")Date beginDate,@Param("endDate")Date endDate,@Param("entranceId")Integer entranceId); - ArrayList ipActiveChart(@Param("beginDate")Date beginDate,@Param("endDate")Date endDate); + ArrayList ipActiveChart(@Param("beginDate")Date beginDate,@Param("endDate")Date endDate,@Param("entranceId")Integer entranceId); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.xml b/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.xml index cbacf36..ed1eedd 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficIpActiveStatisticDao.xml @@ -36,6 +36,9 @@ @@ -61,14 +64,21 @@ diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.java b/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.java index f551971..839c05c 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.java +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.java @@ -13,6 +13,6 @@ public interface TrafficProtocolStatisticDao { TrafficProtocolStatistic getMaxStatTime(); List protocolChart(@Param("statTime")Date statTime); - List getProtocolList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("protoType")Integer[] protoType); + List getProtocolList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("protoType")Integer[] protoType,@Param("entranceId")Integer entranceId); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.xml b/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.xml index 45c8ccf..17e989e 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.xml @@ -27,7 +27,7 @@ diff --git a/src/main/java/com/nis/web/service/restful/DashboardService.java b/src/main/java/com/nis/web/service/restful/DashboardService.java index a622e73..b50ce34 100644 --- a/src/main/java/com/nis/web/service/restful/DashboardService.java +++ b/src/main/java/com/nis/web/service/restful/DashboardService.java @@ -538,9 +538,9 @@ public class DashboardService extends BaseService { /** * 获取活跃IPtop10 的趋势图 */ - public List ipActiveFiveMinute(Date beginDate, Date endDate) { + public List ipActiveFiveMinute(Date beginDate, Date endDate,Integer entranceId) { List listMap = new ArrayList(); - List ipListTop10 = trafficIpActiveStatisticDao.ipActiveChart(beginDate, endDate); + List ipListTop10 = trafficIpActiveStatisticDao.ipActiveChart(beginDate, endDate,entranceId); if (ipListTop10 != null && ipListTop10.size() > 0) { StringBuilder ipStr = new StringBuilder(); for (LinkedHashMap map : ipListTop10) { @@ -561,7 +561,7 @@ public class DashboardService extends BaseService { } ArrayList ipInfoList = trafficIpActiveStatisticDao - .ipActiveFiveMinute(ipStr.toString(), beginDate, endDate); + .ipActiveFiveMinute(ipStr.toString(), beginDate, endDate,entranceId); // 存放每个IP,每个时间点的总数 Map ipCountListMap = new HashMap(); int index = 0; @@ -629,18 +629,18 @@ public class DashboardService extends BaseService { * * @return */ - public List ipActiveOneHour(Date beginDate, Date endDate) { + public List ipActiveOneHour(Date beginDate, Date endDate,Integer entranceId) { // TrafficIpActiveStatistic maxStatTime = trafficIpActiveStatisticDao.getMaxStatTime(); ArrayList listMap = new ArrayList(); // if (maxStatTime != null && maxStatTime.getStatTime() != null) { // Date statTime = maxStatTime.getStatTime(); - ArrayList list = trafficIpActiveStatisticDao.ipActiveChart(beginDate, endDate); + ArrayList list = trafficIpActiveStatisticDao.ipActiveChart(beginDate, endDate,entranceId); if (list != null && list.size() > 0) { for (LinkedHashMap map : list) { if (map.get("ipAddr") != null) { String ipAddr = (String) map.get("ipAddr"); - HashMap resMap = trafficIpActiveStatisticDao.ipActiveOneHour(ipAddr, beginDate, endDate); + HashMap resMap = trafficIpActiveStatisticDao.ipActiveOneHour(ipAddr, beginDate, endDate,entranceId); if (resMap != null) { listMap.add(resMap); } @@ -666,7 +666,7 @@ public class DashboardService extends BaseService { ArrayList list = new ArrayList<>(); // if (maxStatTime != null && maxStatTime.getStatTime() != null) { // Date statTime = maxStatTime.getStatTime(); - list = trafficIpActiveStatisticDao.ipActiveChart(beginDate, endDate); + list = trafficIpActiveStatisticDao.ipActiveChart(beginDate, endDate,null); if (list != null && list.size() > 0) { for (LinkedHashMap map : list) { if (map.get("ipAddr") != null) { @@ -706,12 +706,12 @@ public class DashboardService extends BaseService { * * @return */ - public List getProtocolList(String startTime, String endTime, Integer[] protoType) { + public List getProtocolList(String startTime, String endTime, Integer[] protoType,Integer entranceId) { // TrafficProtocolStatistic maxStatTime = trafficProtocolStatisticDao.getMaxStatTime(); List list = new ArrayList(); // if (maxStatTime != null && maxStatTime.getStatTime() != null) { // Date statTime = maxStatTime.getStatTime(); - list = trafficProtocolStatisticDao.getProtocolList(startTime, endTime, protoType); + list = trafficProtocolStatisticDao.getProtocolList(startTime, endTime, protoType,entranceId); // } return list; } @@ -742,12 +742,12 @@ public class DashboardService extends BaseService { * * @return */ - public List getAppList(String startTime, String endTime, Integer[] appType) { + public List getAppList(String startTime, String endTime, Integer[] appType,Integer entranceId) { // TrafficAppStatistic maxStatTime = trafficAppStatisticDao.getMaxStatTime(); List list = new ArrayList(); // if (maxStatTime != null && maxStatTime.getStatTime() != null) { // Date statTime = maxStatTime.getStatTime(); - list = trafficAppStatisticDao.getAppList(startTime, endTime, appType); + list = trafficAppStatisticDao.getAppList(startTime, endTime, appType,entranceId); // } return list; }