流量统计优化sql查询速度
This commit is contained in:
@@ -1,13 +1,18 @@
|
|||||||
package com.nis.web.dao.dashboard;
|
package com.nis.web.dao.dashboard;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import com.nis.domain.restful.dashboard.NtcTotalReport;
|
||||||
import com.nis.web.dao.MyBatisDao;
|
import com.nis.web.dao.MyBatisDao;
|
||||||
@MyBatisDao
|
@MyBatisDao
|
||||||
public interface NtcTotalReportDao {
|
public interface NtcTotalReportDao {
|
||||||
|
NtcTotalReport getMaxReportTime();
|
||||||
List<Map> getTotalReportList();
|
Map getMaxRecvTime();
|
||||||
List<Map> getNetFlowPortInfoNew();
|
List<Map> getTotalReportList(@Param("reportTime") Date reportTime);
|
||||||
List<Map> getNetFlowPortInfoOld();
|
List<Map> getNetFlowPortInfoNew(@Param("reportTime") Date recvTime);
|
||||||
|
List<Map> getNetFlowPortInfoOld(@Param("reportTime") Date recvTime);
|
||||||
}
|
}
|
||||||
@@ -16,18 +16,26 @@
|
|||||||
WHERE app_type !=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
|
WHERE app_type !=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
|
||||||
GROUP BY app_type order by count desc limit 0,10
|
GROUP BY app_type order by count desc limit 0,10
|
||||||
</select> -->
|
</select> -->
|
||||||
|
<!-- 获取最近时间并且有效 -->
|
||||||
|
<select id="getMaxReportTime" resultType="com.nis.domain.restful.dashboard.NtcTotalReport">
|
||||||
|
SELECT MAX(report_time) reportTime FROM galaxy.ntc_total_report
|
||||||
|
</select>
|
||||||
|
<!-- 获取带宽最近时间并且有效 -->
|
||||||
|
<select id="getMaxRecvTime" resultType="java.util.HashMap">
|
||||||
|
SELECT MAX(RECV_TIME) reveTime FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO
|
||||||
|
</select>
|
||||||
<select id="getTotalReportList" resultType="java.util.HashMap">
|
<select id="getTotalReportList" resultType="java.util.HashMap">
|
||||||
SELECT SUM(reject_num) rejectNum,SUM(monitor_num) monitorNum,SUM(c2s_pkt_num) c2sPktNum,SUM(s2c_pkt_num) s2cPktNum,SUM(c2s_byte_len) c2sByteLen,SUM(s2c_byte_len) s2cByteLen,SUM(new_uni_conn_num) newUniConnNum,SUM(live_conn_num) liveConnNum,
|
SELECT SUM(reject_num) rejectNum,SUM(monitor_num) monitorNum,SUM(c2s_pkt_num) c2sPktNum,SUM(s2c_pkt_num) s2cPktNum,SUM(c2s_byte_len) c2sByteLen,SUM(s2c_byte_len) s2cByteLen,SUM(new_uni_conn_num) newUniConnNum,SUM(live_conn_num) liveConnNum,
|
||||||
SUM(drop_conn_num) dropConnNum,SUM(loop_conn_num) loopConnNum FROM galaxy.ntc_total_report
|
SUM(drop_conn_num) dropConnNum,SUM(loop_conn_num) loopConnNum FROM galaxy.ntc_total_report
|
||||||
where report_time = (SELECT MAX(report_time) FROM galaxy.ntc_total_report)
|
where report_time = #{reportTime}
|
||||||
</select>
|
</select>
|
||||||
<select id="getNetFlowPortInfoNew" resultType="java.util.HashMap">
|
<select id="getNetFlowPortInfoNew" resultType="java.util.HashMap">
|
||||||
SELECT SUM(INOCTETS) inoctets ,SUM(OUTOCTETS) outoctets FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO
|
SELECT SUM(INOCTETS) inoctets ,SUM(OUTOCTETS) outoctets FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO
|
||||||
where RECV_TIME = (SELECT MAX(RECV_TIME) FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO)
|
where RECV_TIME = #{recvTime}
|
||||||
</select>
|
</select>
|
||||||
<!-- 获取上个时间段的数据 -->
|
<!-- 获取上个时间段的数据 -->
|
||||||
<select id="getNetFlowPortInfoOld" resultType="java.util.HashMap">
|
<select id="getNetFlowPortInfoOld" resultType="java.util.HashMap">
|
||||||
SELECT SUM(INOCTETS) inoctets ,SUM(OUTOCTETS) outoctets FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO
|
SELECT SUM(INOCTETS) inoctets ,SUM(OUTOCTETS) outoctets FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO
|
||||||
where RECV_TIME = DATE_SUB((SELECT MAX(RECV_TIME) FROM galaxy.TRAFFIC_NETFLOW_PORT_INFO),INTERVAL 5 MINUTE)
|
where RECV_TIME = DATE_SUB(#{recvTime},INTERVAL 5 MINUTE)
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -1,11 +1,16 @@
|
|||||||
package com.nis.web.dao.dashboard;
|
package com.nis.web.dao.dashboard;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import com.nis.domain.restful.dashboard.TrafficAppStatistic;
|
||||||
import com.nis.web.dao.MyBatisDao;
|
import com.nis.web.dao.MyBatisDao;
|
||||||
@MyBatisDao
|
@MyBatisDao
|
||||||
public interface TrafficAppStatisticDao {
|
public interface TrafficAppStatisticDao {
|
||||||
|
|
||||||
List<Map> appChart();
|
TrafficAppStatistic getMaxStatTime();
|
||||||
|
List<Map> appChart(@Param("statTime")Date statTime);
|
||||||
}
|
}
|
||||||
@@ -15,10 +15,13 @@
|
|||||||
stat_id, app_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
|
stat_id, app_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
|
||||||
stat_time
|
stat_time
|
||||||
</sql>
|
</sql>
|
||||||
|
<!-- 查询最近时间 -->
|
||||||
|
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficAppStatistic">
|
||||||
|
SELECT MAX(stat_time) statTime FROM galaxy.traffic_app_statistic WHERE app_type != 0
|
||||||
|
</select>
|
||||||
<select id="appChart" resultType="java.util.HashMap">
|
<select id="appChart" resultType="java.util.HashMap">
|
||||||
SELECT app_type appType, SUM(link_num) count, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
|
SELECT app_type appType, SUM(link_num) count FROM galaxy.traffic_app_statistic
|
||||||
FROM galaxy.traffic_app_statistic
|
WHERE app_type !=0 and stat_time = #{statTime}
|
||||||
WHERE app_type !=0 and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_app_statistic WHERE app_type != 0)
|
|
||||||
GROUP BY app_type order by count desc limit 0,10
|
GROUP BY app_type order by count desc limit 0,10
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.nis.web.dao.dashboard;
|
package com.nis.web.dao.dashboard;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -9,15 +10,16 @@ import com.nis.domain.restful.dashboard.TrafficHttpStatistic;
|
|||||||
import com.nis.web.dao.MyBatisDao;
|
import com.nis.web.dao.MyBatisDao;
|
||||||
@MyBatisDao
|
@MyBatisDao
|
||||||
public interface TrafficHttpStatisticDao {
|
public interface TrafficHttpStatisticDao {
|
||||||
List<TrafficHttpStatistic> websiteList();
|
TrafficHttpStatistic getMaxStatTime();
|
||||||
|
List<TrafficHttpStatistic> websiteList(@Param("statTime")Date statTime);
|
||||||
|
|
||||||
//获取域名分类之后属于的网站
|
//获取域名分类之后属于的网站
|
||||||
List<TrafficHttpStatistic> getDomainByWebsiteList();
|
List<TrafficHttpStatistic> getDomainByWebsiteList(@Param("statTime")Date statTime);
|
||||||
Integer preWebsiteListCount(@Param("websiteServiceId") Integer websiteServiceId);
|
Integer preWebsiteListCount(@Param("websiteServiceId") Integer websiteServiceId,@Param("statTime") Date statTime);
|
||||||
List<Map> getDomainByWebsiteServiceId(@Param("websiteServiceId") Integer websiteServiceId);
|
List<Map> getDomainByWebsiteServiceId(@Param("websiteServiceId") Integer websiteServiceId,@Param("statTime") Date statTime);
|
||||||
Map websiteDomainOthers(@Param("webIdList") List webIdList,@Param("websiteServiceId") Integer websiteServiceId);
|
Map websiteDomainOthers(@Param("webIdList") List webIdList,@Param("websiteServiceId") Integer websiteServiceId,@Param("statTime") Date statTime);
|
||||||
|
|
||||||
List<Map> getDomainByTopicList();
|
List<Map> getDomainByTopicList(@Param("statTime") Date statTime);
|
||||||
|
|
||||||
List<Map> getDomainByTopicId(@Param("topicId")Object TopicId);
|
List<Map> getDomainByTopicId(@Param("topicId")Object TopicId,@Param("statTime")Date statTime);
|
||||||
}
|
}
|
||||||
@@ -15,20 +15,24 @@
|
|||||||
stat_id, web_type, web_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
|
stat_id, web_type, web_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
|
||||||
stat_time
|
stat_time
|
||||||
</sql>
|
</sql>
|
||||||
|
<!-- 获取最近时间并且有效 -->
|
||||||
|
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
|
||||||
|
SELECT MAX(stat_time) statTime FROM galaxy.traffic_http_statistic WHERE web_id != 0
|
||||||
|
</select>
|
||||||
<!-- 根据服务网站将域名分类 网站列表-->
|
<!-- 根据服务网站将域名分类 网站列表-->
|
||||||
<select id="getDomainByWebsiteList" resultType="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
|
<select id="getDomainByWebsiteList" resultType="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
|
||||||
SELECT t.stat_time statTime,SUM(link_num) count, IFNULL( website_service_id, 268435455 ) websiteServiceId
|
SELECT t.stat_time statTime,SUM(link_num) count, IFNULL( website_service_id, 268435455 ) websiteServiceId
|
||||||
FROM galaxy.TRAFFIC_HTTP_STATISTIC t
|
FROM galaxy.TRAFFIC_HTTP_STATISTIC t
|
||||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
|
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
|
||||||
where t.web_id!=0
|
where t.web_id!=0
|
||||||
and t.stat_time = #{statTime}
|
and t.stat_time = #{statTime}
|
||||||
GROUP BY u.website_service_id ORDER BY count desc limit 0,10
|
GROUP BY u.website_service_id ORDER BY count desc limit 0,10
|
||||||
</select>
|
</select>
|
||||||
<!-- 根据主题将域名分类 主题列表 最近五分钟top10-->
|
<!-- 根据主题将域名分类 主题列表 最近五分钟top10-->
|
||||||
<select id="getDomainByTopicList" resultType="java.util.HashMap">
|
<select id="getDomainByTopicList" resultType="java.util.HashMap">
|
||||||
SELECT SUM(link_num) count, IFNULL( topic_id, 268435455 ) topicId
|
SELECT SUM(link_num) count, IFNULL( topic_id, 268435455 ) topicId
|
||||||
FROM galaxy.TRAFFIC_HTTP_STATISTIC t
|
FROM galaxy.TRAFFIC_HTTP_STATISTIC t
|
||||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
|
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
|
||||||
where t.web_id!=0
|
where t.web_id!=0
|
||||||
and t.stat_time =#{statTime}
|
and t.stat_time =#{statTime}
|
||||||
GROUP BY u.topic_id ORDER BY count desc limit 0,10
|
GROUP BY u.topic_id ORDER BY count desc limit 0,10
|
||||||
@@ -37,37 +41,37 @@
|
|||||||
<!--获取上个时间段该网站站域名流量的数据量 -->
|
<!--获取上个时间段该网站站域名流量的数据量 -->
|
||||||
<select id="preWebsiteListCount" resultType="java.lang.Integer">
|
<select id="preWebsiteListCount" resultType="java.lang.Integer">
|
||||||
SELECT SUM(link_num) count FROM galaxy.traffic_http_statistic t
|
SELECT SUM(link_num) count FROM galaxy.traffic_http_statistic t
|
||||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
|
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id = u.id
|
||||||
WHERE u.website_service_id=#{websiteServiceId}
|
WHERE u.website_service_id=#{websiteServiceId}
|
||||||
and stat_time = DATE_SUB(#{statTime},INTERVAL 5 MINUTE)
|
and stat_time = DATE_SUB(#{statTime},INTERVAL 5 MINUTE)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--获取网站列表列表 -->
|
<!--获取网站列表列表 -->
|
||||||
<!-- <select id="websiteList" resultMap="BaseResultMap">
|
<!-- <select id="websiteList" resultMap="BaseResultMap">
|
||||||
SELECT web_id webId, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count FROM galaxy.traffic_http_statistic
|
SELECT web_id webId, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count FROM galaxy.traffic_http_statistic
|
||||||
WHERE web_id !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
WHERE web_id !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_http_statistic),INTERVAL 5 MINUTE)
|
||||||
GROUP BY web_id ORDER BY count DESC limit 0,10
|
GROUP BY web_id ORDER BY count DESC limit 0,10
|
||||||
</select> -->
|
</select> -->
|
||||||
<!-- 根据网站分组获取子域名 -->
|
<!-- 根据网站分组获取子域名 -->
|
||||||
<select id="getDomainByWebsiteServiceId" resultType="java.util.HashMap">
|
<select id="getDomainByWebsiteServiceId" resultType="java.util.HashMap">
|
||||||
SELECT web_id webId,SUM(link_num) count
|
SELECT web_id webId,SUM(link_num) count
|
||||||
FROM galaxy.traffic_http_statistic t
|
FROM galaxy.traffic_http_statistic t
|
||||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
|
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
|
||||||
where u.website_service_id=#{websiteServiceId}
|
where u.website_service_id=#{websiteServiceId}
|
||||||
and t.stat_time =#{statTime}
|
and t.stat_time =#{statTime}
|
||||||
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
||||||
</select>
|
</select>
|
||||||
<!-- 根据主题分组获取子域名 -->
|
<!-- 根据主题分组获取子域名 -->
|
||||||
<select id="getDomainByTopicId" resultType="java.util.HashMap">
|
<select id="getDomainByTopicId" resultType="java.util.HashMap">
|
||||||
SELECT web_id webId,SUM(link_num) count
|
SELECT web_id webId,SUM(link_num) count
|
||||||
FROM galaxy.traffic_http_statistic t
|
FROM galaxy.traffic_http_statistic t
|
||||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
|
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
|
||||||
where u.topic_id=#{topicId}
|
where u.topic_id=#{topicId}
|
||||||
and t.stat_time = #{statTime}
|
and t.stat_time = #{statTime}
|
||||||
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 指定网站下的TOP10之外为others -->
|
<!-- 指定网站下的TOP10之外为others -->
|
||||||
<select id="websiteDomainOthers" resultType="java.util.HashMap">
|
<select id="websiteDomainOthers" resultType="java.util.HashMap">
|
||||||
SELECT SUM(link_num) count FROM galaxy.traffic_http_statistic t
|
SELECT SUM(link_num) count FROM galaxy.traffic_http_statistic t
|
||||||
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
|
LEFT JOIN galaxy.ui_website_domain_topic u ON t.web_id=u.id
|
||||||
@@ -77,6 +81,6 @@
|
|||||||
and t.web_id not in
|
and t.web_id not in
|
||||||
<foreach collection="webIdList" item="singleType" index="index" open="(" close=")" separator=",">
|
<foreach collection="webIdList" item="singleType" index="index" open="(" close=")" separator=",">
|
||||||
#{singleType}
|
#{singleType}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
and stat_time =#{statTime}
|
and stat_time =#{statTime}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
package com.nis.web.dao.dashboard;
|
package com.nis.web.dao.dashboard;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import com.nis.domain.restful.dashboard.TrafficIpActiveStatistic;
|
import com.nis.domain.restful.dashboard.TrafficIpActiveStatistic;
|
||||||
@@ -13,11 +12,12 @@ import com.nis.web.dao.MyBatisDao;
|
|||||||
@MyBatisDao
|
@MyBatisDao
|
||||||
public interface TrafficIpActiveStatisticDao {
|
public interface TrafficIpActiveStatisticDao {
|
||||||
|
|
||||||
List<TrafficIpActiveStatistic> getIpList(TrafficIpActiveStatistic trafficIpActiveStatistic);
|
// List<TrafficIpActiveStatistic> getIpList(TrafficIpActiveStatistic trafficIpActiveStatistic);
|
||||||
|
TrafficIpActiveStatistic getMaxStatTime();
|
||||||
|
|
||||||
ArrayList<TrafficIpActiveStatistic> ipActiveFiveMinute(@Param("ipAddr") String ipAddr);
|
ArrayList<TrafficIpActiveStatistic> ipActiveFiveMinute(@Param("ipAddr") String ipAddr,@Param("statTime")Date statTime);
|
||||||
|
|
||||||
ArrayList<HashMap> ipActiveOneHour(@Param("ipAddr") String ipAddr);
|
ArrayList<HashMap> ipActiveOneHour(@Param("ipAddr") String ipAddr,@Param("statTime")Date statTime);
|
||||||
|
|
||||||
ArrayList<LinkedHashMap> ipActiveChart();
|
ArrayList<LinkedHashMap> ipActiveChart(@Param("statTime")Date statTime);
|
||||||
}
|
}
|
||||||
@@ -17,38 +17,41 @@
|
|||||||
stat_time
|
stat_time
|
||||||
</sql>
|
</sql>
|
||||||
<!-- 活跃IPTOP列表 -->
|
<!-- 活跃IPTOP列表 -->
|
||||||
<select id="getIpList" resultMap="BaseResultMap">
|
<!-- <select id="getIpList" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List"/>
|
<include refid="Base_Column_List"/>
|
||||||
from galaxy.traffic_ip_active_statistic
|
from galaxy.traffic_ip_active_statistic
|
||||||
|
</select> -->
|
||||||
|
<!-- IP流量统计五分钟-->
|
||||||
|
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficIpActiveStatistic">
|
||||||
|
SELECT MAX(stat_time) statTime FROM galaxy.traffic_ip_active_statistic
|
||||||
|
</select>
|
||||||
|
<!-- IP流量统计五分钟-->
|
||||||
|
<select id="ipActiveChart" resultType="java.util.LinkedHashMap">
|
||||||
|
SELECT ip_addr ipAddr, SUM(link_num) linkNum FROM galaxy.traffic_ip_active_statistic
|
||||||
|
WHERE stat_time = #{statTime}
|
||||||
|
GROUP BY ip_addr ORDER BY linkNum DESC limit 0,10
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- IP流量统计一小时内每隔五分钟数据-->
|
<!-- IP流量统计一小时内每隔五分钟数据-->
|
||||||
<select id="ipActiveFiveMinute" parameterType="java.lang.String" resultMap="BaseResultMap">
|
<select id="ipActiveFiveMinute" resultMap="BaseResultMap">
|
||||||
select IFNULL(p.maxNum,0) linkNum, date_format(a.min5,'%Y-%m-%d %H:%i') time from
|
select IFNULL(p.maxNum,0) linkNum, date_format(a.min5,'%Y-%m-%d %H:%i') time from
|
||||||
(select date_sub(date_format((select MAX(stat_time) from traffic_ip_active_statistic), '%Y-%m-%d %H:%i' ),interval @mycnt :=@mycnt + 5 MINUTE) min5
|
(select date_sub(#{statTime},interval @mycnt :=@mycnt + 5 MINUTE) min5
|
||||||
from (SELECT @mycnt:=-5) m, traffic_ip_active_statistic limit 12) a
|
from (SELECT @mycnt:=-5) m, traffic_ip_active_statistic limit 12) a
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT date_format(stat_time, '%Y-%m-%d %H:%i') timestamp, max(link_num) maxNum FROM traffic_ip_active_statistic
|
SELECT date_format(stat_time, '%Y-%m-%d %H:%i') timestamp, max(link_num) maxNum FROM traffic_ip_active_statistic
|
||||||
WHERE ip_addr=#{ipAddr} AND stat_time > DATE_SUB((select MAX(stat_time) from traffic_ip_active_statistic), INTERVAL 1 HOUR)
|
WHERE ip_addr=#{ipAddr} AND stat_time > DATE_SUB(#{statTime,jdbcType=TIMESTAMP}, INTERVAL 1 HOUR)
|
||||||
GROUP by timestamp
|
GROUP by timestamp
|
||||||
) p
|
) p
|
||||||
on date_format(p.timestamp,'%Y-%m-%d %H:%i')=date_format(a.min5,'%Y-%m-%d %H:%i')
|
on date_format(p.timestamp,'%Y-%m-%d %H:%i')=date_format(a.min5,'%Y-%m-%d %H:%i')
|
||||||
ORDER by time
|
ORDER by time
|
||||||
</select>
|
</select>
|
||||||
<!-- IP流量统计一小时-->
|
<!-- IP流量统计一小时-->
|
||||||
<select id="ipActiveOneHour" parameterType="java.lang.String" resultType="java.util.HashMap">
|
<select id="ipActiveOneHour" resultType="java.util.HashMap">
|
||||||
SELECT ip_addr ipAddr,area_id areaId, 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 galaxy.traffic_ip_active_statistic
|
SELECT ip_addr ipAddr,area_id areaId, 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 galaxy.traffic_ip_active_statistic
|
||||||
WHERE ip_addr=#{ipAddr}
|
WHERE ip_addr=#{ipAddr}
|
||||||
and stat_time > DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ip_active_statistic),INTERVAL 1 HOUR)
|
and stat_time > DATE_SUB(#{statTime},INTERVAL 1 HOUR)
|
||||||
ORDER BY linkNum DESC LIMIT 1
|
ORDER BY linkNum DESC LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- IP流量统计五分钟-->
|
|
||||||
<select id="ipActiveChart" resultType="java.util.LinkedHashMap">
|
|
||||||
SELECT ip_addr ipAddr, SUM(link_num) linkNum ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ip_active_statistic
|
|
||||||
WHERE stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ip_active_statistic)
|
|
||||||
GROUP BY ip_addr ORDER BY linkNum DESC limit 0,10
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.nis.web.dao.dashboard;
|
package com.nis.web.dao.dashboard;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ import com.nis.web.dao.MyBatisDao;
|
|||||||
@MyBatisDao
|
@MyBatisDao
|
||||||
public interface TrafficPortActiveStatisticDao {
|
public interface TrafficPortActiveStatisticDao {
|
||||||
|
|
||||||
List<TrafficPortActiveStatistic> getPortActiveList();
|
TrafficPortActiveStatistic getMaxStatTime();
|
||||||
TrafficPortActiveStatistic getPortActiveOld(@Param("port")Integer port);
|
List<TrafficPortActiveStatistic> getPortActiveList(@Param("statTime")Date statTime);
|
||||||
|
TrafficPortActiveStatistic getPortActiveOld(@Param("port")Integer port,@Param("statTime")Date statTime);
|
||||||
}
|
}
|
||||||
@@ -7,16 +7,22 @@
|
|||||||
<result column="sum" jdbcType="BIGINT" property="sum" />
|
<result column="sum" jdbcType="BIGINT" property="sum" />
|
||||||
<result column="stat_time" jdbcType="TIMESTAMP" property="statTime" />
|
<result column="stat_time" jdbcType="TIMESTAMP" property="statTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 获取最大时间 -->
|
||||||
|
<select id="getMaxStatTime" resultMap="BaseResultMap">
|
||||||
|
SELECT MAX(stat_time) statTime FROM galaxy.traffic_port_active_statistic
|
||||||
|
</select>
|
||||||
<!-- 获取当前时间五分钟数据 -->
|
<!-- 获取当前时间五分钟数据 -->
|
||||||
<select id="getPortActiveList" resultMap="BaseResultMap">
|
<select id="getPortActiveList" resultMap="BaseResultMap">
|
||||||
SELECT port ,SUM(sum) sum from galaxy.traffic_port_active_statistic
|
SELECT port ,SUM(sum) sum from galaxy.traffic_port_active_statistic
|
||||||
WHERE stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_port_active_statistic)
|
WHERE stat_time = #{statTime}
|
||||||
GROUP BY port order by sum desc limit 0,10
|
GROUP BY port order by sum desc limit 0,10
|
||||||
</select>
|
</select>
|
||||||
<!-- 获取上个时间段的数据 -->
|
<!-- 获取上个时间段的数据 -->
|
||||||
<select id="getPortActiveOld" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="getPortActiveOld" resultMap="BaseResultMap">
|
||||||
SELECT SUM(sum) sum from galaxy.traffic_port_active_statistic
|
SELECT SUM(sum) sum from galaxy.traffic_port_active_statistic
|
||||||
WHERE port=#{port} and stat_time = DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_port_active_statistic),INTERVAL 5 MINUTE)
|
WHERE port=#{port} and stat_time = DATE_SUB(#{statTime},INTERVAL 5 MINUTE)
|
||||||
GROUP BY port ORDER BY sum DESC limit 0,10
|
GROUP BY port ORDER BY sum DESC limit 0,10
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -1,11 +1,16 @@
|
|||||||
package com.nis.web.dao.dashboard;
|
package com.nis.web.dao.dashboard;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import com.nis.domain.restful.dashboard.TrafficProtocolStatistic;
|
||||||
import com.nis.web.dao.MyBatisDao;
|
import com.nis.web.dao.MyBatisDao;
|
||||||
@MyBatisDao
|
@MyBatisDao
|
||||||
public interface TrafficProtocolStatisticDao {
|
public interface TrafficProtocolStatisticDao {
|
||||||
|
|
||||||
List<Map> protocolChart();
|
TrafficProtocolStatistic getMaxStatTime();
|
||||||
|
List<Map> protocolChart(@Param("statTime")Date statTime);
|
||||||
}
|
}
|
||||||
@@ -15,8 +15,12 @@
|
|||||||
stat_id, proto_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
|
stat_id, proto_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
|
||||||
stat_time
|
stat_time
|
||||||
</sql>
|
</sql>
|
||||||
|
<!-- 获取最近时间 -->
|
||||||
|
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficProtocolStatistic">
|
||||||
|
SELECT MAX(stat_time) statTime FROM galaxy.traffic_protocol_statistic WHERE proto_type != 0
|
||||||
|
</select>
|
||||||
<select id="protocolChart" resultType="java.util.HashMap">
|
<select id="protocolChart" resultType="java.util.HashMap">
|
||||||
SELECT proto_type protoType, SUM(link_num) count, ( SUM(c2s_pkt_num) + SUM(s2c_pkt_num)) pktNum, ( SUM(c2s_byte_len) + SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_protocol_statistic WHERE proto_type != 0
|
SELECT proto_type protoType, SUM(link_num) count FROM galaxy.traffic_protocol_statistic WHERE proto_type != 0
|
||||||
AND stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_protocol_statistic WHERE proto_type != 0) GROUP BY proto_type ORDER BY count DESC LIMIT 0, 10
|
AND stat_time = #{statTime} GROUP BY proto_type ORDER BY count DESC LIMIT 0, 10
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.nis.web.dao.dashboard;
|
package com.nis.web.dao.dashboard;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -10,19 +11,21 @@ import com.nis.web.dao.MyBatisDao;
|
|||||||
@MyBatisDao
|
@MyBatisDao
|
||||||
public interface TrafficUaStatisticDao {
|
public interface TrafficUaStatisticDao {
|
||||||
|
|
||||||
List<TrafficUaStatistic> systemList();
|
TrafficUaStatistic getMaxStatTime();
|
||||||
|
|
||||||
List<Map> getBrowserBySystem(@Param("osType") Integer osType);
|
List<TrafficUaStatistic> systemList(@Param("statTime") Date statTime);
|
||||||
|
|
||||||
List<TrafficUaStatistic> browserList();
|
List<Map> getBrowserBySystem(@Param("osType") Integer osType,@Param("statTime") Date statTime);
|
||||||
|
|
||||||
List<Map> getSystemBybrowser(@Param("bsType") Integer bsType);
|
List<TrafficUaStatistic> browserList(@Param("statTime") Date statTime);
|
||||||
|
|
||||||
Map systemOthers(@Param("bsType") List bsType,@Param("osType") Integer osType);
|
List<Map> getSystemBybrowser(@Param("bsType") Integer bsType,@Param("statTime") Date statTime);
|
||||||
|
|
||||||
Map browserOthers(@Param("osType") List osType,@Param("bsType") Integer bsType);
|
Map systemOthers(@Param("bsType") List bsType,@Param("osType") Integer osType,@Param("statTime") Date statTime);
|
||||||
|
|
||||||
Integer preSystemListCount(@Param("osType") Integer osType);
|
Map browserOthers(@Param("osType") List osType,@Param("bsType") Integer bsType,@Param("statTime") Date statTime);
|
||||||
|
|
||||||
Integer preBrowserListCount(@Param("bsType") Integer bsType);
|
Integer preSystemListCount(@Param("osType") Integer osType,@Param("statTime") Date statTime);
|
||||||
|
|
||||||
|
Integer preBrowserListCount(@Param("bsType") Integer bsType,@Param("statTime") Date statTime);
|
||||||
}
|
}
|
||||||
@@ -16,27 +16,31 @@
|
|||||||
stat_id, bs_type,os_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
|
stat_id, bs_type,os_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
|
||||||
stat_time
|
stat_time
|
||||||
</sql>
|
</sql>
|
||||||
|
<!-- 获取最近时间并且有效 -->
|
||||||
|
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficUaStatistic">
|
||||||
|
SELECT MAX(stat_time) statTime FROM galaxy.traffic_ua_statistic WHERE os_type !=0 and bs_type!=0
|
||||||
|
</select>
|
||||||
<!--获取操作系统列表TOP10 -->
|
<!--获取操作系统列表TOP10 -->
|
||||||
<select id="systemList" resultMap="BaseResultMap">
|
<select id="systemList" resultMap="BaseResultMap">
|
||||||
SELECT os_type osType, SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
|
SELECT os_type osType, SUM(link_num) count FROM galaxy.traffic_ua_statistic
|
||||||
WHERE os_type !=0 and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE os_type != 0)
|
WHERE os_type !=0 and stat_time = #{statTime}
|
||||||
GROUP BY os_type ORDER BY count DESC limit 0,10
|
GROUP BY os_type ORDER BY count DESC limit 0,10
|
||||||
</select>
|
</select>
|
||||||
<!--获取上个时间段操作系统的数据量 -->
|
<!--获取上个时间段操作系统的数据量 -->
|
||||||
<select id="preSystemListCount" resultType="java.lang.Integer">
|
<select id="preSystemListCount" resultType="java.lang.Integer">
|
||||||
SELECT SUM(link_num) count FROM galaxy.traffic_ua_statistic
|
SELECT SUM(link_num) count FROM galaxy.traffic_ua_statistic
|
||||||
WHERE os_type !=0 and os_type=#{osType}
|
WHERE os_type !=0 and os_type=#{osType}
|
||||||
and stat_time = DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE os_type != 0),INTERVAL 5 MINUTE)
|
and stat_time = DATE_SUB(#{statTime},INTERVAL 5 MINUTE)
|
||||||
</select>
|
</select>
|
||||||
<!-- 根据操作系统获取浏览器分类 -->
|
<!-- 根据操作系统获取浏览器分类 -->
|
||||||
<select id="getBrowserBySystem" parameterType="java.lang.Integer" resultType="java.util.HashMap">
|
<select id="getBrowserBySystem" parameterType="java.lang.Integer" resultType="java.util.HashMap">
|
||||||
SELECT bs_type bsType, SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
|
SELECT bs_type bsType, SUM(link_num) count FROM galaxy.traffic_ua_statistic
|
||||||
WHERE bs_type !=0 and os_type=#{osType} and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE bs_type != 0)
|
WHERE bs_type !=0 and os_type=#{osType} and stat_time = #{statTime}
|
||||||
GROUP BY bs_type ORDER BY count DESC limit 0,10
|
GROUP BY bs_type ORDER BY count DESC limit 0,10
|
||||||
</select>
|
</select>
|
||||||
<!--浏览器TOP10后所有为others -->
|
<!--浏览器TOP10后所有为others -->
|
||||||
<select id="systemOthers" resultType="java.util.HashMap">
|
<select id="systemOthers" resultType="java.util.HashMap">
|
||||||
SELECT SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
|
SELECT SUM(link_num) count FROM galaxy.traffic_ua_statistic
|
||||||
WHERE bs_type !=0 and os_type=#{osType}
|
WHERE bs_type !=0 and os_type=#{osType}
|
||||||
<if test="bsType!=null and bsType.size()>0">
|
<if test="bsType!=null and bsType.size()>0">
|
||||||
and os_type not in
|
and os_type not in
|
||||||
@@ -44,30 +48,30 @@
|
|||||||
#{singleType}
|
#{singleType}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE bs_type != 0)
|
and stat_time = #{statTime}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--获取浏览器列表TOP10 -->
|
<!--获取浏览器列表TOP10 -->
|
||||||
<select id="browserList" resultMap="BaseResultMap">
|
<select id="browserList" resultMap="BaseResultMap">
|
||||||
SELECT bs_type bsType, SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
|
SELECT bs_type bsType, SUM(link_num) count FROM galaxy.traffic_ua_statistic
|
||||||
WHERE bs_type !=0 and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE bs_type !=0)
|
WHERE bs_type !=0 and stat_time = #{statTime}
|
||||||
GROUP BY bs_type ORDER BY count DESC limit 0,10
|
GROUP BY bs_type ORDER BY count DESC limit 0,10
|
||||||
</select>
|
</select>
|
||||||
<!--获取上个时间段浏览器的数据量 -->
|
<!--获取上个时间段浏览器的数据量 -->
|
||||||
<select id="preBrowserListCount" resultType="java.lang.Integer">
|
<select id="preBrowserListCount" resultType="java.lang.Integer">
|
||||||
SELECT SUM(link_num) count FROM galaxy.traffic_ua_statistic
|
SELECT SUM(link_num) count FROM galaxy.traffic_ua_statistic
|
||||||
WHERE bs_type !=0 and bs_type=#{bsType}
|
WHERE bs_type !=0 and bs_type=#{bsType}
|
||||||
and stat_time = DATE_SUB((SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE bs_type !=0),INTERVAL 5 MINUTE)
|
and stat_time = DATE_SUB(#{statTime},INTERVAL 5 MINUTE)
|
||||||
</select>
|
</select>
|
||||||
<!-- 根据浏览器获取操作系统分类 -->
|
<!-- 根据浏览器获取操作系统分类 -->
|
||||||
<select id="getSystemBybrowser" parameterType="java.lang.Integer" resultType="java.util.HashMap">
|
<select id="getSystemBybrowser" parameterType="java.lang.Integer" resultType="java.util.HashMap">
|
||||||
SELECT os_type osType, SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
|
SELECT os_type osType, SUM(link_num) count FROM galaxy.traffic_ua_statistic
|
||||||
WHERE os_type !=0 and bs_type=#{bsType} and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE os_type !=0)
|
WHERE os_type !=0 and bs_type=#{bsType} and stat_time = #{statTime}
|
||||||
GROUP BY os_type ORDER BY count DESC limit 0,10
|
GROUP BY os_type ORDER BY count DESC limit 0,10
|
||||||
</select>
|
</select>
|
||||||
<!--操作系统TOP10后所有为others -->
|
<!--操作系统TOP10后所有为others -->
|
||||||
<select id="browserOthers" parameterType="java.util.List" resultType="java.util.HashMap">
|
<select id="browserOthers" parameterType="java.util.List" resultType="java.util.HashMap">
|
||||||
SELECT SUM(link_num) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
|
SELECT SUM(link_num) count FROM galaxy.traffic_ua_statistic
|
||||||
WHERE os_type !=0 and bs_type=#{bsType}
|
WHERE os_type !=0 and bs_type=#{bsType}
|
||||||
<if test="osType!=null and osType.size()>0">
|
<if test="osType!=null and osType.size()>0">
|
||||||
and bs_type not in
|
and bs_type not in
|
||||||
@@ -75,6 +79,6 @@
|
|||||||
#{singleType}
|
#{singleType}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_ua_statistic WHERE os_type !=0)
|
and stat_time = #{statTime}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.nis.web.service.restful;
|
package com.nis.web.service.restful;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -10,9 +11,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.nis.domain.Page;
|
import com.nis.domain.Page;
|
||||||
|
import com.nis.domain.restful.dashboard.NtcTotalReport;
|
||||||
|
import com.nis.domain.restful.dashboard.TrafficAppStatistic;
|
||||||
import com.nis.domain.restful.dashboard.TrafficHttpStatistic;
|
import com.nis.domain.restful.dashboard.TrafficHttpStatistic;
|
||||||
import com.nis.domain.restful.dashboard.TrafficIpActiveStatistic;
|
import com.nis.domain.restful.dashboard.TrafficIpActiveStatistic;
|
||||||
import com.nis.domain.restful.dashboard.TrafficPortActiveStatistic;
|
import com.nis.domain.restful.dashboard.TrafficPortActiveStatistic;
|
||||||
|
import com.nis.domain.restful.dashboard.TrafficProtocolStatistic;
|
||||||
import com.nis.domain.restful.dashboard.TrafficUaStatistic;
|
import com.nis.domain.restful.dashboard.TrafficUaStatistic;
|
||||||
import com.nis.web.dao.dashboard.NtcTotalReportDao;
|
import com.nis.web.dao.dashboard.NtcTotalReportDao;
|
||||||
import com.nis.web.dao.dashboard.TrafficAppStatisticDao;
|
import com.nis.web.dao.dashboard.TrafficAppStatisticDao;
|
||||||
@@ -46,10 +50,21 @@ public class DashboardService extends BaseService{
|
|||||||
* @return Map
|
* @return Map
|
||||||
*/
|
*/
|
||||||
public List<Map> getTotalReportList(){
|
public List<Map> getTotalReportList(){
|
||||||
List<Map> totalReportList = ntcTotalReportDao.getTotalReportList();
|
List<Map> totalReportList =new ArrayList<Map>();
|
||||||
|
NtcTotalReport maxReportTime = ntcTotalReportDao.getMaxReportTime();
|
||||||
|
if(maxReportTime!=null&&maxReportTime.getReportTime()!=null) {
|
||||||
|
Date reportTime = maxReportTime.getReportTime();
|
||||||
|
totalReportList = ntcTotalReportDao.getTotalReportList(reportTime);
|
||||||
|
}
|
||||||
|
Map maxRecvtTime = ntcTotalReportDao.getMaxRecvTime();
|
||||||
|
List<Map> newData = new ArrayList<Map>();
|
||||||
|
List<Map> oldData = new ArrayList<Map>();
|
||||||
|
if(maxRecvtTime!=null&&maxRecvtTime.get("recvTime")!=null) {
|
||||||
|
Date recvTime = (Date) maxRecvtTime.get("recvTime");
|
||||||
|
newData = ntcTotalReportDao.getNetFlowPortInfoNew(recvTime);
|
||||||
|
oldData = ntcTotalReportDao.getNetFlowPortInfoOld(recvTime);
|
||||||
|
}
|
||||||
//统计带宽的流入流出 单位 五分钟 的 byte
|
//统计带宽的流入流出 单位 五分钟 的 byte
|
||||||
List<Map> newData = ntcTotalReportDao.getNetFlowPortInfoNew();
|
|
||||||
List<Map> oldData = ntcTotalReportDao.getNetFlowPortInfoOld();
|
|
||||||
Double inoctets=0d;
|
Double inoctets=0d;
|
||||||
Double outoctets=0d;
|
Double outoctets=0d;
|
||||||
if(newData!=null&&newData.size()>0&&oldData!=null&&oldData.size()>0&&newData.get(0)!=null&&oldData.get(0)!=null){
|
if(newData!=null&&newData.size()>0&&oldData!=null&&oldData.size()>0&&newData.get(0)!=null&&oldData.get(0)!=null){
|
||||||
@@ -75,27 +90,30 @@ public class DashboardService extends BaseService{
|
|||||||
return totalReportList;
|
return totalReportList;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 当前时间五分钟数据
|
* 最近活跃端口时间五分钟数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Map> getPortActiveList(){
|
public List<Map> getPortActiveList(){
|
||||||
List<Map> list = new ArrayList<Map>();
|
List<Map> list = new ArrayList<Map>();
|
||||||
List<TrafficPortActiveStatistic> portActiveList = trafficPortActiveStatisticDao.getPortActiveList();
|
TrafficPortActiveStatistic maxStatTime = trafficPortActiveStatisticDao.getMaxStatTime();
|
||||||
//上个时间五分钟数据
|
if(maxStatTime!=null&&maxStatTime.getStatTime()!=null) {
|
||||||
if(portActiveList!=null&&portActiveList.size()>0) {
|
Date statTime = maxStatTime.getStatTime();
|
||||||
for (TrafficPortActiveStatistic port : portActiveList) {
|
List<TrafficPortActiveStatistic> portActiveList = trafficPortActiveStatisticDao.getPortActiveList(statTime);
|
||||||
if(port.getPort()!=null) {
|
//上个时间五分钟数据
|
||||||
Map map = new HashMap();
|
if(portActiveList!=null&&portActiveList.size()>0) {
|
||||||
|
for (TrafficPortActiveStatistic port : portActiveList) {
|
||||||
map.put("port", port.getPort());
|
if(port.getPort()!=null) {
|
||||||
map.put("sum", port.getSum());
|
Map map = new HashMap();
|
||||||
TrafficPortActiveStatistic portActiveOld = trafficPortActiveStatisticDao.getPortActiveOld(port.getPort());
|
map.put("port", port.getPort());
|
||||||
if(portActiveOld!=null&&portActiveOld.getSum()!=null){
|
map.put("sum", port.getSum());
|
||||||
map.put("preSum",portActiveOld.getSum());
|
TrafficPortActiveStatistic portActiveOld = trafficPortActiveStatisticDao.getPortActiveOld(port.getPort(),statTime);
|
||||||
}else{
|
if(portActiveOld!=null&&portActiveOld.getSum()!=null){
|
||||||
map.put("preSum",0);
|
map.put("preSum",portActiveOld.getSum());
|
||||||
|
}else{
|
||||||
|
map.put("preSum",0);
|
||||||
|
}
|
||||||
|
list.add(map);
|
||||||
}
|
}
|
||||||
list.add(map);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,37 +124,40 @@ public class DashboardService extends BaseService{
|
|||||||
* 分页查询活跃IPtop100
|
* 分页查询活跃IPtop100
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Page<TrafficIpActiveStatistic> getIpList(Page<TrafficIpActiveStatistic> page,TrafficIpActiveStatistic entry){
|
/* public Page<TrafficIpActiveStatistic> getIpList(Page<TrafficIpActiveStatistic> page,TrafficIpActiveStatistic entry){
|
||||||
// 设置分页参数
|
// 设置分页参数
|
||||||
entry.setPage(page);
|
entry.setPage(page);
|
||||||
// 执行分页查询
|
// 执行分页查询
|
||||||
page.setList(trafficIpActiveStatisticDao.getIpList(entry));
|
page.setList(trafficIpActiveStatisticDao.getIpList(entry));
|
||||||
return page;
|
return page;
|
||||||
}
|
}*/
|
||||||
public List<HashMap> ipActiveFiveMinute(){
|
public List<HashMap> ipActiveFiveMinute(){
|
||||||
|
TrafficIpActiveStatistic maxStatTime = trafficIpActiveStatisticDao.getMaxStatTime();
|
||||||
ArrayList<LinkedHashMap> list = trafficIpActiveStatisticDao.ipActiveChart();
|
|
||||||
ArrayList<HashMap> listMap=new ArrayList<HashMap>();
|
ArrayList<HashMap> listMap=new ArrayList<HashMap>();
|
||||||
if(list!=null&&list.size()>0) {
|
if(maxStatTime!=null&&maxStatTime.getStatTime()!=null) {
|
||||||
for (LinkedHashMap map : list) {
|
Date statTime = maxStatTime.getStatTime();
|
||||||
HashMap m = new HashMap();
|
ArrayList<LinkedHashMap> list = trafficIpActiveStatisticDao.ipActiveChart(statTime);
|
||||||
if(map.get("ipAddr")!=null) {
|
if(list!=null&&list.size()>0) {
|
||||||
String ipAddr = (String) map.get("ipAddr");
|
for (LinkedHashMap map : list) {
|
||||||
m.put("ipAddr", ipAddr);
|
HashMap m = new HashMap();
|
||||||
ArrayList<TrafficIpActiveStatistic> ipList = trafficIpActiveStatisticDao.ipActiveFiveMinute(ipAddr);
|
if(map.get("ipAddr")!=null) {
|
||||||
List linkList = new ArrayList();
|
String ipAddr = (String) map.get("ipAddr");
|
||||||
List timeList = new ArrayList();
|
m.put("ipAddr", ipAddr);
|
||||||
if(ipList!=null&&ipList.size()>0) {
|
ArrayList<TrafficIpActiveStatistic> ipList = trafficIpActiveStatisticDao.ipActiveFiveMinute(ipAddr,statTime);
|
||||||
for (TrafficIpActiveStatistic ip : ipList) {
|
List linkList = new ArrayList();
|
||||||
if(ip.getLinkNum()!=null&&ip.getTime()!=null) {
|
List timeList = new ArrayList();
|
||||||
linkList.add(ip.getLinkNum());
|
if(ipList!=null&&ipList.size()>0) {
|
||||||
timeList.add(ip.getTime());
|
for (TrafficIpActiveStatistic ip : ipList) {
|
||||||
|
if(ip.getLinkNum()!=null&&ip.getTime()!=null) {
|
||||||
|
linkList.add(ip.getLinkNum());
|
||||||
|
timeList.add(ip.getTime());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m.put("linkNum",linkList);
|
||||||
|
m.put("statTime",timeList);
|
||||||
|
listMap.add(m);
|
||||||
}
|
}
|
||||||
m.put("linkNum",linkList);
|
|
||||||
m.put("statTime",timeList);
|
|
||||||
listMap.add(m);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,35 +165,73 @@ public class DashboardService extends BaseService{
|
|||||||
return listMap;
|
return listMap;
|
||||||
}
|
}
|
||||||
public List<HashMap> ipActiveOneHour(){
|
public List<HashMap> ipActiveOneHour(){
|
||||||
|
TrafficIpActiveStatistic maxStatTime = trafficIpActiveStatisticDao.getMaxStatTime();
|
||||||
ArrayList<LinkedHashMap> list = trafficIpActiveStatisticDao.ipActiveChart();
|
|
||||||
ArrayList<HashMap> listMap=new ArrayList<HashMap>();
|
ArrayList<HashMap> listMap=new ArrayList<HashMap>();
|
||||||
if(list!=null&&list.size()>0) {
|
if(maxStatTime!=null&&maxStatTime.getStatTime()!=null) {
|
||||||
for (LinkedHashMap map : list) {
|
Date statTime = maxStatTime.getStatTime();
|
||||||
if(map.get("ipAddr")!=null) {
|
ArrayList<LinkedHashMap> list = trafficIpActiveStatisticDao.ipActiveChart(statTime);
|
||||||
String ipAddr = (String) map.get("ipAddr");
|
if(list!=null&&list.size()>0) {
|
||||||
ArrayList<HashMap> iplList = trafficIpActiveStatisticDao.ipActiveOneHour(ipAddr);
|
for (LinkedHashMap map : list) {
|
||||||
listMap.add(iplList.get(0));
|
if(map.get("ipAddr")!=null) {
|
||||||
|
String ipAddr = (String) map.get("ipAddr");
|
||||||
|
ArrayList<HashMap> iplList = trafficIpActiveStatisticDao.ipActiveOneHour(ipAddr,statTime);
|
||||||
|
listMap.add(iplList.get(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return listMap;
|
return listMap;
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
public List<LinkedHashMap> ipActiveChart(){
|
public List<LinkedHashMap> ipActiveChart(){
|
||||||
|
TrafficIpActiveStatistic maxStatTime = trafficIpActiveStatisticDao.getMaxStatTime();
|
||||||
ArrayList<LinkedHashMap> list = trafficIpActiveStatisticDao.ipActiveChart();
|
ArrayList<LinkedHashMap> list = new ArrayList<>();
|
||||||
|
if(maxStatTime!=null&&maxStatTime.getStatTime()!=null) {
|
||||||
|
Date statTime = maxStatTime.getStatTime();
|
||||||
|
list = trafficIpActiveStatisticDao.ipActiveChart(statTime);
|
||||||
|
if(list!=null&&list.size()>0) {
|
||||||
|
for (LinkedHashMap map : list) {
|
||||||
|
if(map.get("ipAddr")!=null) {
|
||||||
|
Map m = new LinkedHashMap();
|
||||||
|
map.put("pktNum",0);
|
||||||
|
map.put("byteLen",0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map> protocolChart() {
|
public List<Map> protocolChart() {
|
||||||
List<Map> list = trafficProtocolStatisticDao.protocolChart();
|
TrafficProtocolStatistic maxStatTime = trafficProtocolStatisticDao.getMaxStatTime();
|
||||||
|
List<Map> list=new ArrayList<Map>();
|
||||||
|
if(maxStatTime!=null&&maxStatTime.getStatTime()!=null) {
|
||||||
|
Date statTime = maxStatTime.getStatTime();
|
||||||
|
list = trafficProtocolStatisticDao.protocolChart(statTime);
|
||||||
|
//当不查询包,字节时 设为0
|
||||||
|
if(list!=null&&list.size()>0) {
|
||||||
|
Map map = new HashMap();
|
||||||
|
map.put("pktNum",0);
|
||||||
|
map.put("byteLen",0);
|
||||||
|
}
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map> appChart() {
|
public List<Map> appChart() {
|
||||||
List<Map> list = trafficAppStatisticDao.appChart();
|
List<Map> list=new ArrayList<Map>();
|
||||||
|
TrafficAppStatistic maxStatTime = trafficAppStatisticDao.getMaxStatTime();
|
||||||
|
if(maxStatTime!=null&&maxStatTime.getStatTime()!=null) {
|
||||||
|
Date statTime = maxStatTime.getStatTime();
|
||||||
|
list = trafficAppStatisticDao.appChart(statTime);
|
||||||
|
//当不查询包,字节时 设为0
|
||||||
|
if(list!=null&&list.size()>0) {
|
||||||
|
Map map = new HashMap();
|
||||||
|
map.put("pktNum",0);
|
||||||
|
map.put("byteLen",0);
|
||||||
|
}
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,100 +239,120 @@ public class DashboardService extends BaseService{
|
|||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
public List<Map> systemList(){
|
public List<Map> systemList(){
|
||||||
List<Map> result = new ArrayList<Map>();
|
List<Map> result = new ArrayList<Map>();
|
||||||
List<TrafficUaStatistic> list = trafficUaStatisticDao.systemList();
|
TrafficUaStatistic maxStatTime = trafficUaStatisticDao.getMaxStatTime();
|
||||||
Integer preCount=0;
|
if(maxStatTime!=null) {
|
||||||
for (TrafficUaStatistic ua : list) {
|
Date statTime = maxStatTime.getStatTime();
|
||||||
Map map = new HashMap();
|
List<TrafficUaStatistic> list = trafficUaStatisticDao.systemList(statTime);
|
||||||
map.put("osType",ua.getOsType());
|
Integer preCount=0;
|
||||||
map.put("count",ua.getCount());
|
for (TrafficUaStatistic ua : list) {
|
||||||
map.put("pktNum",ua.getPktNum());
|
Map map = new HashMap();
|
||||||
map.put("byteLen",ua.getByteLen());
|
map.put("osType",ua.getOsType());
|
||||||
preCount = trafficUaStatisticDao.preSystemListCount(ua.getOsType());//上个时段的量 用于与现在对比
|
map.put("count",ua.getCount());
|
||||||
if(preCount!=null){
|
map.put("pktNum",0);
|
||||||
map.put("preCount",preCount);
|
map.put("byteLen",0);
|
||||||
}else{
|
preCount = trafficUaStatisticDao.preSystemListCount(ua.getOsType(),statTime);//上个时段的量 用于与现在对比
|
||||||
map.put("preCount",0);
|
if(preCount!=null){
|
||||||
}
|
map.put("preCount",preCount);
|
||||||
result.add(map);
|
}else{
|
||||||
|
map.put("preCount",0);
|
||||||
|
}
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public List<Map> getBrowserBySystem(Integer osType ){
|
public List<Map> getBrowserBySystem(Integer osType ){
|
||||||
List<Map> list = trafficUaStatisticDao.getBrowserBySystem(osType);
|
List<Map> list = new ArrayList<Map>();
|
||||||
List bsType = new ArrayList();
|
TrafficUaStatistic maxStatTime = trafficUaStatisticDao.getMaxStatTime();
|
||||||
//查新固定操系统下的除了TOP10以外的others
|
if(maxStatTime!=null) {
|
||||||
if(list!=null&& list.size()>0){
|
Date statTime = maxStatTime.getStatTime();
|
||||||
for (Map map : list) {
|
list = trafficUaStatisticDao.getBrowserBySystem(osType,statTime);
|
||||||
bsType.add(map.get("bsType"));
|
List bsType = new ArrayList();
|
||||||
}
|
//查新固定操系统下的除了TOP10以外的others
|
||||||
Map others = new HashMap();
|
if(list!=null&& list.size()>0){
|
||||||
others = trafficUaStatisticDao.systemOthers(bsType,osType);
|
for (Map map : list) {
|
||||||
if(others!=null&&others.size()>0){
|
bsType.add(map.get("bsType"));
|
||||||
others.put("bsType", "-1");
|
}
|
||||||
list.add(others);
|
Map others = new HashMap();
|
||||||
}
|
others = trafficUaStatisticDao.systemOthers(bsType,osType,statTime);
|
||||||
|
if(others!=null&&others.size()>0){
|
||||||
|
others.put("bsType", "-1");
|
||||||
|
list.add(others);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map> browserList() {
|
public List<Map> browserList() {
|
||||||
List<Map> result = new ArrayList<Map>();
|
List<Map> result = new ArrayList<Map>();
|
||||||
List<TrafficUaStatistic> list = trafficUaStatisticDao.browserList();
|
TrafficUaStatistic maxStatTime = trafficUaStatisticDao.getMaxStatTime();
|
||||||
Integer preCount=0;
|
if(maxStatTime!=null) {
|
||||||
if(list!=null&&list.size()>0){
|
Date statTime = maxStatTime.getStatTime();
|
||||||
for (TrafficUaStatistic ua : list) {
|
List<TrafficUaStatistic> list = trafficUaStatisticDao.browserList(statTime);
|
||||||
Map map = new HashMap();
|
Integer preCount=0;
|
||||||
map.put("bsType",ua.getBsType());
|
if(list!=null&&list.size()>0){
|
||||||
map.put("count",ua.getCount());
|
for (TrafficUaStatistic ua : list) {
|
||||||
map.put("pktNum",ua.getPktNum());
|
Map map = new HashMap();
|
||||||
map.put("byteLen",ua.getByteLen());
|
map.put("bsType",ua.getBsType());
|
||||||
preCount = trafficUaStatisticDao.preBrowserListCount(ua.getBsType());//上个时段的量 用于与现在对比
|
map.put("count",ua.getCount());
|
||||||
if(preCount!=null){
|
map.put("pktNum",0);
|
||||||
map.put("preCount",preCount);
|
map.put("byteLen",0);
|
||||||
}else{
|
preCount = trafficUaStatisticDao.preBrowserListCount(ua.getBsType(),statTime);//上个时段的量 用于与现在对比
|
||||||
map.put("preCount",0);
|
if(preCount!=null){
|
||||||
|
map.put("preCount",preCount);
|
||||||
|
}else{
|
||||||
|
map.put("preCount",0);
|
||||||
|
}
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result.add(map);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public List<Map> getSystemBybrowser(Integer bsType ){
|
public List<Map> getSystemBybrowser(Integer bsType ){
|
||||||
List<Map> list = trafficUaStatisticDao.getSystemBybrowser(bsType);
|
List<Map> list = new ArrayList<Map>();
|
||||||
List osType = new ArrayList();
|
TrafficUaStatistic maxStatTime = trafficUaStatisticDao.getMaxStatTime();
|
||||||
//查询固定操系统下的除了TOP10以外的others
|
if(maxStatTime!=null) {
|
||||||
if(list!=null&& list.size()>0){
|
Date statTime = maxStatTime.getStatTime();
|
||||||
for (Map map : list) {
|
list = trafficUaStatisticDao.getSystemBybrowser(bsType,statTime);
|
||||||
osType.add(map.get("osType"));
|
List osType = new ArrayList();
|
||||||
}
|
//查询固定操系统下的除了TOP10以外的others
|
||||||
Map others = new HashMap();
|
if(list!=null&& list.size()>0){
|
||||||
others = trafficUaStatisticDao.browserOthers(osType,bsType);
|
for (Map map : list) {
|
||||||
if(others!=null&&others.size()>0){
|
osType.add(map.get("osType"));
|
||||||
others.put("osType", "-1");
|
}
|
||||||
list.add(others);
|
Map others = new HashMap();
|
||||||
|
others = trafficUaStatisticDao.browserOthers(osType,bsType,statTime);
|
||||||
|
if(others!=null&&others.size()>0){
|
||||||
|
others.put("osType", "-1");
|
||||||
|
list.add(others);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
public List<Map> websiteList() {
|
public List<Map> websiteList() {
|
||||||
List<Map> result = new ArrayList<Map>();
|
List<Map> result = new ArrayList<Map>();
|
||||||
List<TrafficHttpStatistic> list = trafficHttpStatisticDao.websiteList();
|
TrafficHttpStatistic maxStatTime = trafficHttpStatisticDao.getMaxStatTime();
|
||||||
Integer preCount=0;
|
if(maxStatTime!=null) {
|
||||||
if(list!=null&&list.size()>0){
|
List<TrafficHttpStatistic> list = trafficHttpStatisticDao.websiteList(maxStatTime.getStatTime());
|
||||||
for (TrafficHttpStatistic website : list) {
|
Integer preCount=0;
|
||||||
Map map = new HashMap();
|
if(list!=null&&list.size()>0){
|
||||||
map.put("webId",website.getWebId());
|
for (TrafficHttpStatistic website : list) {
|
||||||
map.put("count",website.getCount());
|
Map map = new HashMap();
|
||||||
map.put("pktNum",website.getPktNum());
|
map.put("webId",website.getWebId());
|
||||||
map.put("byteLen",website.getByteLen());
|
map.put("count",website.getCount());
|
||||||
preCount = trafficHttpStatisticDao.preWebsiteListCount(website.getWebId());//上个时段的量 用于与现在对比
|
map.put("pktNum",0);
|
||||||
if(preCount!=null){
|
map.put("byteLen",0);
|
||||||
map.put("preCount",preCount);
|
preCount = trafficHttpStatisticDao.preWebsiteListCount(website.getWebId(),maxStatTime.getStatTime());//上个时段的量 用于与现在对比
|
||||||
}else{
|
if(preCount!=null){
|
||||||
map.put("preCount",0);
|
map.put("preCount",preCount);
|
||||||
|
}else{
|
||||||
|
map.put("preCount",0);
|
||||||
|
}
|
||||||
|
result.add(map);
|
||||||
}
|
}
|
||||||
result.add(map);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -284,18 +363,23 @@ public class DashboardService extends BaseService{
|
|||||||
* @return list
|
* @return list
|
||||||
*/
|
*/
|
||||||
public List<Map> getDomainByWebsiteServiceId(Integer websiteServiceId ){
|
public List<Map> getDomainByWebsiteServiceId(Integer websiteServiceId ){
|
||||||
List<Map> list = trafficHttpStatisticDao.getDomainByWebsiteServiceId(websiteServiceId);
|
List<Map> list = new ArrayList<Map>();
|
||||||
List webIdList = new ArrayList();
|
TrafficHttpStatistic maxStatTime = trafficHttpStatisticDao.getMaxStatTime();
|
||||||
//查询固定网站下的域名除了TOP10以外的others域名
|
if(maxStatTime!=null) {
|
||||||
if(list!=null&& list.size()>0){
|
Date statTime = maxStatTime.getStatTime();
|
||||||
for (Map map : list) {
|
list = trafficHttpStatisticDao.getDomainByWebsiteServiceId(websiteServiceId,statTime);
|
||||||
webIdList.add(map.get("webId"));
|
List webIdList = new ArrayList();
|
||||||
}
|
//查询固定网站下的域名除了TOP10以外的others域名
|
||||||
Map others = new HashMap();
|
if(list!=null&& list.size()>0){
|
||||||
others = trafficHttpStatisticDao.websiteDomainOthers(webIdList,websiteServiceId);
|
for (Map map : list) {
|
||||||
if(others!=null&&others.size()>0){
|
webIdList.add(map.get("webId"));
|
||||||
others.put("webId", "-1");
|
}
|
||||||
list.add(others);
|
Map others = new HashMap();
|
||||||
|
others = trafficHttpStatisticDao.websiteDomainOthers(webIdList,websiteServiceId,statTime);
|
||||||
|
if(others!=null&&others.size()>0){
|
||||||
|
others.put("webId", "-1");
|
||||||
|
list.add(others);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
@@ -307,26 +391,29 @@ public class DashboardService extends BaseService{
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public List<Map> getDomainByWebsiteList(){
|
public List<Map> getDomainByWebsiteList(){
|
||||||
List<TrafficHttpStatistic> websiteList = trafficHttpStatisticDao.getDomainByWebsiteList();
|
|
||||||
List<Map> result = new ArrayList<Map>();
|
List<Map> result = new ArrayList<Map>();
|
||||||
if(websiteList!=null&&websiteList.size()>0){
|
TrafficHttpStatistic maxStatTime = trafficHttpStatisticDao.getMaxStatTime();
|
||||||
Integer preCount=0;
|
if(maxStatTime!=null) {
|
||||||
for (TrafficHttpStatistic website : websiteList) {
|
Date statTime = maxStatTime.getStatTime();
|
||||||
Map map = new HashMap();
|
List<TrafficHttpStatistic> websiteList = trafficHttpStatisticDao.getDomainByWebsiteList(statTime);
|
||||||
map.put("websiteServiceId",website.getWesiteServiceId());
|
if(websiteList!=null&&websiteList.size()>0){
|
||||||
map.put("count",website.getCount());
|
Integer preCount=0;
|
||||||
map.put("pktNum",website.getPktNum());
|
for (TrafficHttpStatistic website : websiteList) {
|
||||||
map.put("byteLen",website.getByteLen());
|
Map map = new HashMap();
|
||||||
preCount = trafficHttpStatisticDao.preWebsiteListCount(website.getWesiteServiceId());//上个时段的量 用于与现在对比
|
map.put("websiteServiceId",website.getWesiteServiceId());
|
||||||
if(preCount!=null){
|
map.put("count",website.getCount());
|
||||||
map.put("preCount",preCount);
|
map.put("pktNum",0);
|
||||||
}else{
|
map.put("byteLen",0);
|
||||||
map.put("preCount",0);
|
preCount = trafficHttpStatisticDao.preWebsiteListCount(website.getWesiteServiceId(),statTime);//上个时段的量 用于与现在对比
|
||||||
|
if(preCount!=null){
|
||||||
|
map.put("preCount",preCount);
|
||||||
|
}else{
|
||||||
|
map.put("preCount",0);
|
||||||
|
}
|
||||||
|
result.add(map);
|
||||||
}
|
}
|
||||||
result.add(map);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -334,14 +421,19 @@ public class DashboardService extends BaseService{
|
|||||||
*
|
*
|
||||||
* **/
|
* **/
|
||||||
public List<Map> getTopicAndDomainList(){
|
public List<Map> getTopicAndDomainList(){
|
||||||
//按照主题分类 获得主题
|
List<Map> topicList = new ArrayList<Map>();
|
||||||
List<Map> topicList = trafficHttpStatisticDao.getDomainByTopicList();
|
TrafficHttpStatistic maxStatTime = trafficHttpStatisticDao.getMaxStatTime();
|
||||||
if(topicList!=null&&topicList.size()>0){
|
if(maxStatTime!=null) {
|
||||||
for (Map m : topicList) {
|
Date statTime = maxStatTime.getStatTime();
|
||||||
List<Map> domainList= new ArrayList<Map>();
|
//按照主题分类 获得主题
|
||||||
if(m!=null&&m.get("topicId")!=null){
|
topicList = trafficHttpStatisticDao.getDomainByTopicList(statTime);
|
||||||
domainList = trafficHttpStatisticDao.getDomainByTopicId(m.get("topicId"));
|
if(topicList!=null&&topicList.size()>0){
|
||||||
m.put("domainData", domainList);
|
for (Map m : topicList) {
|
||||||
|
List<Map> domainList= new ArrayList<Map>();
|
||||||
|
if(m!=null&&m.get("topicId")!=null){
|
||||||
|
domainList = trafficHttpStatisticDao.getDomainByTopicId(m.get("topicId"),statTime);
|
||||||
|
m.put("domainData", domainList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user