From ac5d0cc739ca2e0f1d7d33cb609d6215f7dcb494 Mon Sep 17 00:00:00 2001 From: zhangdongxu Date: Mon, 24 Dec 2018 19:08:01 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=8A=8Asql=E8=AF=AD=E5=8F=A5?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=97=B6=E9=97=B4=E6=9D=A1=E4=BB=B6=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=94=B9=E4=B8=BA=E5=B7=A6=E9=97=AD=E5=8F=B3=E5=BC=80?= =?UTF-8?q?=202=E3=80=81DashboardService=E4=B8=AD=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95=E6=B7=BB=E5=8A=A0@Deprecated?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/nis/web/dao/NtcReportDao.xml | 4 +-- .../java/com/nis/web/dao/TrafficReportDao.xml | 10 +++---- .../web/dao/dashboard/NtcTotalReportDao.xml | 2 +- .../dao/dashboard/TrafficAppStatisticDao.xml | 2 +- .../dao/dashboard/TrafficHttpStatisticDao.xml | 2 +- .../dashboard/TrafficIpActiveStatisticDao.xml | 2 +- .../dashboard/TrafficProtocolStatisticDao.xml | 2 +- .../web/service/restful/DashboardService.java | 30 +++++++++++-------- 8 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/nis/web/dao/NtcReportDao.xml b/src/main/java/com/nis/web/dao/NtcReportDao.xml index 4839b66..7b242a9 100644 --- a/src/main/java/com/nis/web/dao/NtcReportDao.xml +++ b/src/main/java/com/nis/web/dao/NtcReportDao.xml @@ -170,11 +170,11 @@ - STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]> + = STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]> - + diff --git a/src/main/java/com/nis/web/dao/TrafficReportDao.xml b/src/main/java/com/nis/web/dao/TrafficReportDao.xml index b213b69..23ed40e 100644 --- a/src/main/java/com/nis/web/dao/TrafficReportDao.xml +++ b/src/main/java/com/nis/web/dao/TrafficReportDao.xml @@ -170,11 +170,11 @@ - STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]> + = STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]> - + @@ -960,7 +960,7 @@ select addr_type,trans_type,entrance_id,IFNULL((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024,0) gbps,IFNULL(SUM(c2s_pkt_num+s2c_pkt_num)/300,0) pps,IFNULL(SUM(link_num),0) linkNum, stat_time time from traffic_trans_statistic - where =#{beginDate}]]> + where =#{beginDate}]]> and addr_type !=0 and trans_type!=0 group by stat_time,addr_type,trans_type order by stat_time @@ -988,7 +988,7 @@ diff --git a/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.xml b/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.xml index 448a6ee..1e26626 100644 --- a/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/NtcTotalReportDao.xml @@ -129,7 +129,7 @@ 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 e6154ec..d0f8ada 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficAppStatisticDao.xml @@ -32,7 +32,7 @@ SELECT app_type,SUM(link_num) AS link_num,SUM(c2s_pkt_num+s2c_pkt_num) AS packets, ((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024) AS GByte FROM traffic_app_statistic WHERE - = #{beginTime} and stat_time<= #{endTime}]]> + = #{beginTime} and stat_time< #{endTime}]]> and app_type in 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 f86c48a..ae339a5 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml @@ -125,7 +125,7 @@ FROM SELECT ip_addr ipAddr,area_id areaId,SUM(c2s_byte_len+s2c_byte_len) count, link_num linkNum ,c2s_pkt_num c2sPktNum,s2c_pkt_num s2cPktNum,c2s_byte_len c2sByteLen,s2c_byte_len s2cByteLen,date_format(stat_time, '%Y-%m-%d %H:%i:%s') statTime FROM traffic_ip_active_statistic WHERE ip_addr=#{ipAddr} - and #{beginDate} and stat_time<=#{endDate}]]> GROUP BY statTime + and = #{beginDate} and stat_time<#{endDate}]]> GROUP BY statTime ORDER BY count DESC LIMIT 1 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 e0a79c5..45c8ccf 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficProtocolStatisticDao.xml @@ -29,7 +29,7 @@ SELECT proto_type,SUM(link_num) AS link_num,SUM(c2s_pkt_num+s2c_pkt_num) AS packets, ((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024) AS GByte FROM traffic_protocol_statistic WHERE - = #{beginTime} and stat_time<= #{endTime}]]> + = #{beginTime} and stat_time< #{endTime}]]> and proto_type in 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 5dd72a6..7847733 100644 --- a/src/main/java/com/nis/web/service/restful/DashboardService.java +++ b/src/main/java/com/nis/web/service/restful/DashboardService.java @@ -102,6 +102,7 @@ public class DashboardService extends BaseService { * @param transType * @return */ + @Deprecated public List getBandwidthTrans(String addrType, Integer transType, String beginDate, String endDate) { ArrayList listMap = new ArrayList(); @@ -121,6 +122,7 @@ public class DashboardService extends BaseService { * @param transType * @return */ + @Deprecated public List getBandwidthTrans2(String addrType, Integer transType, String beginDate, String endDate) { ArrayList listMap = new ArrayList(); @@ -143,6 +145,7 @@ public class DashboardService extends BaseService { * @param entranceId * @return */ + @Deprecated public HashMap getBandwidthTransEntrance(String addrType, Integer transType, String beginDate, String endDate, Integer entranceId) { long start = System.currentTimeMillis(); @@ -220,6 +223,7 @@ public class DashboardService extends BaseService { * @param li * @return */ + @Deprecated public static List formatDateData(String begin, String end, List li) { List resList = new ArrayList(); Map m = new HashMap(); @@ -260,6 +264,7 @@ public class DashboardService extends BaseService { * @param format 如:yyyy-MM-dd HH:mm:ss * @return */ + @Deprecated public static Long dateToStamp(String date_str) { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -277,6 +282,7 @@ public class DashboardService extends BaseService { * @param format 如:yyyy-MM-dd HH:mm:ss * @return */ + @Deprecated public static String stampToDate(long timeStamp) { SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm");// 这个是你要转成后的时间的格式 String sd = sdf.format(new Date(timeStamp)); // 时间戳转换成时间 @@ -622,23 +628,23 @@ public class DashboardService extends BaseService { * @return */ public List ipActiveOneHour(Date beginDate, Date endDate) { - TrafficIpActiveStatistic maxStatTime = trafficIpActiveStatisticDao.getMaxStatTime(); +// TrafficIpActiveStatistic maxStatTime = trafficIpActiveStatisticDao.getMaxStatTime(); ArrayList listMap = new ArrayList(); - if (maxStatTime != null && maxStatTime.getStatTime() != null) { - Date statTime = maxStatTime.getStatTime(); - ArrayList list = trafficIpActiveStatisticDao.ipActiveChart(beginDate, endDate); - 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); - if(resMap!=null){ - listMap.add(resMap); - } +// if (maxStatTime != null && maxStatTime.getStatTime() != null) { +// Date statTime = maxStatTime.getStatTime(); + ArrayList list = trafficIpActiveStatisticDao.ipActiveChart(beginDate, endDate); + 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); + if(resMap!=null){ + listMap.add(resMap); } } } } +// } return listMap; }