diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.java b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.java index 5a7ce5d..1b3bd8e 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.java +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.java @@ -24,6 +24,7 @@ public interface TrafficHttpStatisticDao { @Param("endTime") Date endTime); List getDomainByTopicList(@Param("statTime") Date statTime, @Param("endTime") Date endTime); + List getHttpStatisticNoLinkAndPkt(@Param("statTime") Date statTime, @Param("endTime") Date endTime); List getTrafficHttpStatistic(@Param("statTime") Date statTime, @Param("endTime") Date endTime); List getIdByWebSiteId(@Param("websiteId") Integer websiteId); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml index baa4003..a14cbe7 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml @@ -59,13 +59,19 @@ + 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 421cd96..1c170ed 100644 --- a/src/main/java/com/nis/web/service/restful/DashboardService.java +++ b/src/main/java/com/nis/web/service/restful/DashboardService.java @@ -852,14 +852,12 @@ public class DashboardService extends BaseService { Set set = new HashSet<>(); Map> countAndViewMap = new HashMap<>();// 存储count和map的对应关系,后面根据count过滤,获取top10的count - List webIdAndCountList = trafficHttpStatisticDao.getTrafficHttpStatistic(beginDate, endDate);// 获取最近一小时的webid和count的关系 - List prevWebIdAndCountList = trafficHttpStatisticDao.getTrafficHttpStatistic(getBeforeByHourTime(2), + List webIdAndCountList = trafficHttpStatisticDao.getHttpStatisticNoLinkAndPkt(beginDate, endDate);// 获取最近一小时的webid和count的关系 + List prevWebIdAndCountList = trafficHttpStatisticDao.getHttpStatisticNoLinkAndPkt(getBeforeByHourTime(2), beginDate);// 获取最近一小时的webid和count的关系 for (String websiteServiceId : websiteIdAndIdMap.keySet()) {// 遍历上面获取的websiteServiceId和id的对应关系,拼接json Map viewMap = new HashMap<>(); long count = 0l;// 记录当前websiteServiceId所有的count - long linkNum = 0l;// - long packets = 0l;// long prevCount = 0l;// 记录当前websiteServiceId所有的count List idList = websiteIdAndIdMap.get(websiteServiceId);// 根据websiteServiceId获取对应的id for (String id : idList) { @@ -867,17 +865,9 @@ public class DashboardService extends BaseService { String webId = String.valueOf(webIdAndCountMap.get("webId")); if (webId != null && webId.equals(id)) {// 如果webid和id相等则获取count数据并统计 String countStr = String.valueOf(webIdAndCountMap.get("byteCount")); - String linkNumStr = String.valueOf(webIdAndCountMap.get("linkNum")); - String packetsStr = String.valueOf(webIdAndCountMap.get("pktCount")); if (countStr != null) { count += Long.parseLong(countStr);// 将count累加 } - if (linkNumStr != null) { - linkNum += Long.parseLong(linkNumStr);// 将count累加 - } - if (packetsStr != null) { - packets += Long.parseLong(packetsStr);// 将count累加 - } } } for (Map webIdAndCountMap : prevWebIdAndCountList) {// 遍历webid和count @@ -893,8 +883,6 @@ public class DashboardService extends BaseService { } viewMap.put("websiteServiceId", websiteServiceId); viewMap.put("count", count); - viewMap.put("linkNum", linkNum); - viewMap.put("packets", packets); viewMap.put("pktNum", 0); viewMap.put("byteLen", 0); viewMap.put("preCount", prevCount);