app ,http网站,活跃IP,协议统计,ua浏览器操作系统 改为bytes维度

This commit is contained in:
zhanghongqing
2018-12-01 14:10:59 +08:00
parent 9e56a1f1cd
commit 8e8b519167
5 changed files with 17 additions and 17 deletions

View File

@@ -20,7 +20,7 @@
SELECT MAX(stat_time) statTime FROM traffic_app_statistic WHERE app_type != 0
</select>
<select id="appChart" resultType="java.util.HashMap">
SELECT app_type appType, SUM(link_num) count FROM traffic_app_statistic
SELECT app_type appType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_app_statistic
WHERE app_type !=0 and stat_time = #{statTime}
GROUP BY app_type order by count desc limit 0,10
</select>

View File

@@ -20,7 +20,7 @@
SELECT MAX(stat_time) statTime FROM 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 SUM(c2s_byte_len+s2c_byte_len) count, IFNULL( website_service_id, 268435455 ) websiteServiceId
FROM TRAFFIC_HTTP_STATISTIC t
LEFT JOIN ui_website_domain_topic u ON t.web_id = u.id
@@ -28,7 +28,7 @@
and t.stat_time = #{statTime}
GROUP BY u.website_service_id ORDER BY count desc limit 0,10
</select>
<!-- 根据主题将域名分类 主题列表 最近五分钟top10-->
<!-- 根据主题将域名分类 主题列表 最近五分钟top10-->
<select id="getDomainByTopicList" resultType="java.util.HashMap">
SELECT SUM(c2s_byte_len+s2c_byte_len) count, IFNULL( topic_id, 268435455 ) topicId
FROM TRAFFIC_HTTP_STATISTIC t
@@ -38,7 +38,7 @@
GROUP BY u.topic_id ORDER BY count desc limit 0,10
</select>
<!--获取上个时间段该网站站域名流量的数据量 -->
<!--获取上个时间段该网站站域名流量的数据量 -->
<select id="preWebsiteListCount" resultType="java.lang.Integer">
SELECT SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_http_statistic t
LEFT JOIN ui_website_domain_topic u ON t.web_id = u.id
@@ -52,7 +52,7 @@
WHERE web_id !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM traffic_http_statistic),INTERVAL 5 MINUTE)
GROUP BY web_id ORDER BY count DESC limit 0,10
</select> -->
<!-- 根据网站分组获取子域名 -->
<!-- 根据网站分组获取子域名 -->
<select id="getDomainByWebsiteServiceId" resultType="java.util.HashMap">
SELECT web_id webId,SUM(c2s_byte_len+s2c_byte_len) count
FROM traffic_http_statistic t
@@ -61,7 +61,7 @@
and t.stat_time =#{statTime}
GROUP BY t.web_id ORDER BY count desc limit 0,10
</select>
<!-- 根据主题分组获取子域名 -->
<!-- 根据主题分组获取子域名 -->
<select id="getDomainByTopicId" resultType="java.util.HashMap">
SELECT web_id webId,SUM(c2s_byte_len+s2c_byte_len) count
FROM traffic_http_statistic t
@@ -71,7 +71,7 @@
GROUP BY t.web_id ORDER BY count desc limit 0,10
</select>
<!-- 指定网站下的TOP10之外为others -->
<!-- 指定网站下的TOP10之外为others -->
<select id="websiteDomainOthers" resultType="java.util.HashMap">
SELECT SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_http_statistic t
LEFT JOIN ui_website_domain_topic u ON t.web_id=u.id

View File

@@ -28,7 +28,7 @@
</select>
<!-- IP流量统计五分钟-->
<select id="ipActiveChart" resultType="java.util.LinkedHashMap">
SELECT ip_addr ipAddr, SUM(link_num) linkNum FROM traffic_ip_active_statistic
SELECT ip_addr ipAddr, SUM(c2s_byte_len+s2c_byte_len) linkNum FROM traffic_ip_active_statistic
WHERE stat_time = #{statTime}
GROUP BY ip_addr ORDER BY linkNum DESC limit 0,10
</select>

View File

@@ -20,7 +20,7 @@
SELECT MAX(stat_time) statTime FROM traffic_protocol_statistic WHERE proto_type != 0
</select>
<select id="protocolChart" resultType="java.util.HashMap">
SELECT proto_type protoType, SUM(link_num) count FROM traffic_protocol_statistic WHERE proto_type != 0
SELECT proto_type protoType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_protocol_statistic WHERE proto_type != 0
AND stat_time = #{statTime} GROUP BY proto_type ORDER BY count DESC LIMIT 0, 10
</select>
</mapper>

View File

@@ -22,25 +22,25 @@
</select>
<!--获取操作系统列表TOP10 -->
<select id="systemList" resultMap="BaseResultMap">
SELECT os_type osType, SUM(link_num) count FROM traffic_ua_statistic
SELECT os_type osType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
WHERE os_type !=0 and stat_time = #{statTime}
GROUP BY os_type ORDER BY count DESC limit 0,10
</select>
<!--获取上个时间段操作系统的数据量 -->
<select id="preSystemListCount" resultType="java.lang.Integer">
SELECT SUM(link_num) count FROM traffic_ua_statistic
SELECT SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
WHERE os_type !=0 and os_type=#{osType}
and stat_time = DATE_SUB(#{statTime},INTERVAL 5 MINUTE)
</select>
<!-- 根据操作系统获取浏览器分类 -->
<select id="getBrowserBySystem" resultType="java.util.HashMap">
SELECT bs_type bsType, SUM(link_num) count FROM traffic_ua_statistic
SELECT bs_type bsType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
WHERE bs_type !=0 and os_type=#{osType} and stat_time = #{statTime}
GROUP BY bs_type ORDER BY count DESC limit 0,10
</select>
<!--浏览器TOP10后所有为others -->
<select id="systemOthers" resultType="java.util.HashMap">
SELECT SUM(link_num) count FROM traffic_ua_statistic
SELECT SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
WHERE bs_type !=0 and os_type=#{osType}
<if test="bsType!=null and bsType.size()>0">
and bs_type not in
@@ -53,25 +53,25 @@
<!--获取浏览器列表TOP10 -->
<select id="browserList" resultMap="BaseResultMap">
SELECT bs_type bsType, SUM(link_num) count FROM traffic_ua_statistic
SELECT bs_type bsType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
WHERE bs_type !=0 and stat_time = #{statTime}
GROUP BY bs_type ORDER BY count DESC limit 0,10
</select>
<!--获取上个时间段浏览器的数据量 -->
<select id="preBrowserListCount" resultType="java.lang.Integer">
SELECT SUM(link_num) count FROM traffic_ua_statistic
SELECT SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
WHERE bs_type !=0 and bs_type=#{bsType}
and stat_time = DATE_SUB(#{statTime},INTERVAL 5 MINUTE)
</select>
<!-- 根据浏览器获取操作系统分类 -->
<select id="getSystemBybrowser" resultType="java.util.HashMap">
SELECT os_type osType, SUM(link_num) count FROM traffic_ua_statistic
SELECT os_type osType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
WHERE os_type !=0 and bs_type=#{bsType} and stat_time = #{statTime}
GROUP BY os_type ORDER BY count DESC limit 0,10
</select>
<!--操作系统TOP10后所有为others -->
<select id="browserOthers" parameterType="java.util.List" resultType="java.util.HashMap">
SELECT SUM(link_num) count FROM traffic_ua_statistic
SELECT SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
WHERE os_type !=0 and bs_type=#{bsType}
<if test="osType!=null and osType.size()>0">
and os_type not in