1:为实时统计配置中jediscluster改为每次使用都获取一个新的
2:添加根据配置id获取编译,组,域等信息的接口 3:修改获取或释放redis分布式锁后,将redis连接释放 4:解决冲突
This commit is contained in:
@@ -16,24 +16,24 @@
|
||||
|
||||
<!-- 获取取阻断,监测等流量信息最近时间 -->
|
||||
<select id="getMaxReportTime" resultType="com.nis.domain.restful.dashboard.NtcTotalReport">
|
||||
SELECT MAX(report_time) reportTime FROM ntc_total_report
|
||||
SELECT report_time reportTime FROM ntc_total_report order by report_time desc limit 1
|
||||
</select>
|
||||
|
||||
<!-- 根据最近的时间获取阻断,监测等流量信息 -->
|
||||
<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,
|
||||
SUM(drop_conn_num) dropConnNum,SUM(loop_conn_num) loopConnNum FROM ntc_total_report
|
||||
where report_time = #{reportTime}
|
||||
where report_time > DATE_SUB(#{reportTime}, INTERVAL 1 HOUR)
|
||||
</select>
|
||||
|
||||
<!-- 获取带宽最近时间 -->
|
||||
<select id="getMaxStatTime" resultType="java.util.HashMap">
|
||||
SELECT MAX(stat_time) statTime FROM traffic_trans_statistic
|
||||
SELECT stat_time statTime FROM traffic_trans_statistic order by stat_time desc limit 1
|
||||
</select>
|
||||
<!-- 根据最近时间条获取带宽,进出口流量 -->
|
||||
<select id="getNetFlowPortInfoNew" resultType="java.util.HashMap">
|
||||
SELECT IFNULL(SUM(c2s_byte_len),0) inoctets ,IFNULL(SUM(s2c_byte_len),0) outoctets FROM traffic_trans_statistic
|
||||
where stat_time = #{statTime}
|
||||
SELECT IFNULL(SUM(c2s_byte_len),0) AS inoctets ,IFNULL(SUM(s2c_byte_len),0) AS outoctets FROM traffic_trans_statistic
|
||||
WHERE stat_time > DATE_SUB(#{statTime}, INTERVAL 1 HOUR)
|
||||
</select>
|
||||
<!-- 获取近五分钟的带宽根据ip46,协议 tcp,udp变化 -->
|
||||
<select id="getBandwidthTrans" resultMap="BandwidthResultMap">
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
<!-- 获取报表最近时间 -->
|
||||
<select id="getEntranceMaxReportTime" resultType="java.util.HashMap">
|
||||
SELECT MAX(report_time) reportTime FROM ntc_entrance_report
|
||||
SELECT report_time reportTime FROM ntc_entrance_report order by report_time desc limit 1
|
||||
</select>
|
||||
<!-- entrance 1,2 ,动作为阻断,近五分钟数据 -->
|
||||
<select id="getActionTrans" resultType="com.nis.domain.restful.NtcEntranceReport">
|
||||
|
||||
@@ -13,5 +13,5 @@ public interface TrafficAppStatisticDao {
|
||||
|
||||
TrafficAppStatistic getMaxStatTime();
|
||||
List<Map> appChart(@Param("statTime")Date statTime);
|
||||
List<Map> getAppList(@Param("statTime")Date statTime);
|
||||
List<Map> getAppList(@Param("statTime")Date statTime,@Param("beginTime")String beginTime,@Param("endTime")String endTime);
|
||||
}
|
||||
@@ -17,19 +17,28 @@
|
||||
</sql>
|
||||
<!-- 查询最近时间 -->
|
||||
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficAppStatistic">
|
||||
SELECT MAX(stat_time) statTime FROM traffic_app_statistic WHERE app_type != 0
|
||||
SELECT stat_time statTime FROM traffic_app_statistic order by stat_time desc limit 1
|
||||
</select>
|
||||
<select id="appChart" resultType="java.util.HashMap">
|
||||
|
||||
<select id="appChart" resultType="java.util.HashMap">
|
||||
SELECT app_type appType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_app_statistic
|
||||
WHERE app_type !=0 and stat_time = #{statTime}
|
||||
WHERE stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
GROUP BY app_type order by count desc limit 0,10
|
||||
</select>
|
||||
|
||||
<!-- 获取app统计详情 -->
|
||||
<select id="getAppList" resultType="java.util.HashMap">
|
||||
SELECT IFNULL(c.app_name,p.app_type) appName,p.app_type appType,p.link_num linkNum, p.packets packets, p.GByte GByte FROM (
|
||||
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)/1024/1024/1024) AS GByte
|
||||
FROM traffic_app_statistic WHERE stat_time=#{statTime} GROUP BY app_type ) p
|
||||
FROM traffic_app_statistic WHERE
|
||||
<if test="beginTime==null or endTime==null">
|
||||
stat_time > DATE_SUB(#{statTime},INTERVAL 1 HOUR)
|
||||
</if>
|
||||
<if test="beginTime!=null and endTime!=null">
|
||||
stat_time >= #{beginTime} and stat_time <= #{endTime}
|
||||
</if>
|
||||
GROUP BY app_type ) p
|
||||
LEFT JOIN ui_code_app_dic c ON p.app_type=c.view_code ORDER BY p.GByte DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -17,31 +17,32 @@
|
||||
</sql>
|
||||
<!-- 获取最近时间并且有效 -->
|
||||
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
|
||||
SELECT MAX(stat_time) statTime FROM traffic_http_statistic WHERE web_id != 0
|
||||
SELECT stat_time statTime FROM traffic_http_statistic order by stat_time desc limit 1
|
||||
</select>
|
||||
<!-- 根据服务网站将域名分类 网站列表-->
|
||||
<!-- 根据服务网站将域名分类 网站列表-->
|
||||
<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
|
||||
LEFT JOIN ui_website_domain_topic u ON t.web_id = u.id
|
||||
where t.web_id!=0
|
||||
where t.stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
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-->
|
||||
<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
|
||||
LEFT JOIN ui_website_domain_topic u ON t.web_id = u.id
|
||||
FROM TRAFFIC_HTTP_STATISTIC t
|
||||
LEFT JOIN ui_website_domain_topic u ON t.web_id = u.id
|
||||
and t.stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
GROUP BY u.topic_id ORDER BY count desc limit 0,10
|
||||
|
||||
GROUP BY u.topic_id ORDER BY count desc limit 0,10
|
||||
</select>
|
||||
<!--获取上个时间段该网站站域名流量的数据量 -->
|
||||
<select id="preWebsiteListCount" resultType="java.lang.Long">
|
||||
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
|
||||
WHERE u.website_service_id=#{websiteServiceId}
|
||||
LEFT JOIN ui_website_domain_topic u ON t.web_id = u.id
|
||||
and stat_time < DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
and stat_time > DATE_SUB(#{statTime},INTERVAL 2 hour)
|
||||
</select>
|
||||
|
||||
<!--获取网站列表列表 -->
|
||||
@@ -56,7 +57,7 @@
|
||||
FROM traffic_http_statistic t
|
||||
LEFT JOIN ui_website_domain_topic u ON t.web_id=u.id
|
||||
where u.website_service_id=#{websiteServiceId}
|
||||
LEFT JOIN ui_website_domain_topic u ON t.web_id=u.id
|
||||
and t.stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
||||
</select>
|
||||
<!-- 根据主题分组获取子域名 -->
|
||||
@@ -65,7 +66,7 @@
|
||||
FROM traffic_http_statistic t
|
||||
LEFT JOIN ui_website_domain_topic u ON t.web_id=u.id
|
||||
where u.topic_id=#{topicId}
|
||||
LEFT JOIN ui_website_domain_topic u ON t.web_id=u.id
|
||||
and t.stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
||||
</select>
|
||||
|
||||
@@ -74,13 +75,13 @@
|
||||
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
|
||||
where u.website_service_id=#{websiteServiceId}
|
||||
LEFT JOIN ui_website_domain_topic u ON t.web_id=u.id
|
||||
|
||||
<if test="webIdList!=null and webIdList.size()>0">
|
||||
and t.web_id not in
|
||||
<foreach collection="webIdList" item="singleType" index="index" open="(" close=")" separator=",">
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
</foreach>
|
||||
and stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -24,12 +24,12 @@
|
||||
</select> -->
|
||||
<!-- IP流量统计五分钟-->
|
||||
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficIpActiveStatistic">
|
||||
SELECT MAX(stat_time) statTime FROM traffic_ip_active_statistic
|
||||
SELECT stat_time statTime FROM traffic_ip_active_statistic order by stat_time desc limit 1
|
||||
</select>
|
||||
<!-- IP流量统计五分钟-->
|
||||
<select id="ipActiveChart" resultType="java.util.LinkedHashMap">
|
||||
SELECT ip_addr ipAddr, SUM(c2s_byte_len+s2c_byte_len) linkNum FROM traffic_ip_active_statistic
|
||||
WHERE stat_time = #{statTime}
|
||||
WHERE stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
GROUP BY ip_addr ORDER BY linkNum DESC limit 0,10
|
||||
</select>
|
||||
|
||||
|
||||
@@ -11,18 +11,19 @@
|
||||
|
||||
<!-- 获取最大时间 -->
|
||||
<select id="getMaxStatTime" resultMap="BaseResultMap">
|
||||
SELECT MAX(stat_time) statTime FROM traffic_port_active_statistic
|
||||
SELECT stat_time statTime FROM traffic_port_active_statistic order by stat_time desc limit 1
|
||||
</select>
|
||||
<!-- 获取当前时间五分钟数据 -->
|
||||
<select id="getPortActiveList" resultMap="BaseResultMap">
|
||||
SELECT port ,SUM(sum) sum from traffic_port_active_statistic
|
||||
WHERE stat_time = #{statTime}
|
||||
WHERE stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
GROUP BY port order by sum desc limit 0,10
|
||||
</select>
|
||||
<!-- 获取上个时间段的数据 -->
|
||||
<select id="getPortActiveOld" resultMap="BaseResultMap">
|
||||
SELECT SUM(sum) sum from traffic_port_active_statistic
|
||||
WHERE port=#{port} and stat_time = DATE_SUB(#{statTime},INTERVAL 5 MINUTE)
|
||||
WHERE port=#{port} and stat_time < DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
and stat_time > DATE_SUB(#{statTime},INTERVAL 2 hour)
|
||||
GROUP BY port ORDER BY sum DESC limit 0,10
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -13,5 +13,5 @@ public interface TrafficProtocolStatisticDao {
|
||||
|
||||
TrafficProtocolStatistic getMaxStatTime();
|
||||
List<Map> protocolChart(@Param("statTime")Date statTime);
|
||||
List<Map> getProtocolList(@Param("statTime")Date statTime);
|
||||
List<Map> getProtocolList(@Param("statTime")Date statTime,@Param("beginTime")String beginTime,@Param("endTime")String endTime);
|
||||
}
|
||||
@@ -17,18 +17,25 @@
|
||||
</sql>
|
||||
<!-- 获取最近时间 -->
|
||||
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficProtocolStatistic">
|
||||
SELECT MAX(stat_time) statTime FROM traffic_protocol_statistic WHERE proto_type != 0
|
||||
SELECT stat_time statTime FROM traffic_protocol_statistic WHERE proto_type != 0 order by stat_time desc limit 1
|
||||
</select>
|
||||
<select id="protocolChart" resultType="java.util.HashMap">
|
||||
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 id="protocolChart" resultType="java.util.HashMap">
|
||||
SELECT proto_type protoType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_protocol_statistic WHERE
|
||||
stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour) GROUP BY proto_type ORDER BY count DESC LIMIT 0, 10
|
||||
</select>
|
||||
|
||||
<select id="getProtocolList" resultType="java.util.HashMap">
|
||||
SELECT IFNULL(c.protocol_type,p.proto_type) protocolType,p.proto_type protoType,p.link_num linkNum, p.packets packets, p.GByte GByte FROM (
|
||||
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)/1024/1024/1024) AS GByte
|
||||
FROM traffic_protocol_statistic WHERE stat_time=#{statTime} GROUP BY proto_type ) p
|
||||
FROM traffic_protocol_statistic WHERE
|
||||
<if test="beginTime==null or endTime==null">
|
||||
stat_time > DATE_SUB(#{statTime},INTERVAL 1 HOUR)
|
||||
</if>
|
||||
<if test="beginTime!=null and endTime!=null">
|
||||
stat_time >= #{beginTime} and stat_time <= #{endTime}
|
||||
</if>
|
||||
GROUP BY proto_type ) p
|
||||
LEFT JOIN ui_code_protocol_type_dic c ON p.proto_type=c.view_code ORDER BY p.GByte DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -18,24 +18,25 @@
|
||||
</sql>
|
||||
<!-- 获取最近时间并且有效 -->
|
||||
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficUaStatistic">
|
||||
SELECT MAX(stat_time) statTime FROM traffic_ua_statistic WHERE os_type !=0 and bs_type!=0
|
||||
SELECT stat_time statTime FROM traffic_ua_statistic order by stat_time desc limit 1
|
||||
</select>
|
||||
<!--获取操作系统列表TOP10 -->
|
||||
<select id="systemList" resultMap="BaseResultMap">
|
||||
<select id="systemList" resultMap="BaseResultMap">
|
||||
SELECT os_type osType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
|
||||
WHERE os_type !=0 and stat_time = #{statTime}
|
||||
WHERE stat_time > DATE_SUB(#{statTime}, INTERVAL 1 HOUR)
|
||||
GROUP BY os_type ORDER BY count DESC limit 0,10
|
||||
</select>
|
||||
<!--获取上个时间段操作系统的数据量 -->
|
||||
<select id="preSystemListCount" resultType="java.lang.Long">
|
||||
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)
|
||||
WHERE os_type=#{osType}
|
||||
and stat_time < DATE_SUB(#{statTime},INTERVAL 1 HOUR)
|
||||
and stat_time > DATE_SUB(#{statTime},INTERVAL 2 HOUR)
|
||||
</select>
|
||||
<!-- 根据操作系统获取浏览器分类 -->
|
||||
<select id="getBrowserBySystem" resultType="java.util.HashMap">
|
||||
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}
|
||||
WHERE os_type=#{osType} and stat_time > DATE_SUB(#{statTime},INTERVAL 1 HOUR)
|
||||
GROUP BY bs_type ORDER BY count DESC limit 0,10
|
||||
</select>
|
||||
<!--浏览器TOP10后所有为others -->
|
||||
@@ -48,25 +49,24 @@
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
and stat_time = #{statTime}
|
||||
and stat_time > DATE_SUB(#{statTime},INTERVAL 1 HOUR)
|
||||
</select>
|
||||
|
||||
<!--获取浏览器列表TOP10 -->
|
||||
<select id="browserList" resultMap="BaseResultMap">
|
||||
SELECT bs_type bsType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
|
||||
WHERE bs_type !=0 and stat_time = #{statTime}
|
||||
WHERE stat_time > DATE_SUB(#{statTime},INTERVAL 1 HOUR)
|
||||
GROUP BY bs_type ORDER BY count DESC limit 0,10
|
||||
</select>
|
||||
<!--获取上个时间段浏览器的数据量 -->
|
||||
<select id="preBrowserListCount" resultType="java.lang.Long">
|
||||
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)
|
||||
WHERE bs_type=#{bsType}
|
||||
and stat_time < DATE_SUB(#{statTime},INTERVAL 1 HOUR) and stat_time > DATE_SUB(#{statTime},INTERVAL 2 HOUR)
|
||||
</select>
|
||||
<!-- 根据浏览器获取操作系统分类 -->
|
||||
<select id="getSystemBybrowser" resultType="java.util.HashMap">
|
||||
<select id="getSystemBybrowser" resultType="java.util.HashMap">
|
||||
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}
|
||||
WHERE bs_type=#{bsType} and stat_time > DATE_SUB(#{statTime},INTERVAL 1 HOUR)
|
||||
GROUP BY os_type ORDER BY count DESC limit 0,10
|
||||
</select>
|
||||
<!--操作系统TOP10后所有为others -->
|
||||
@@ -79,6 +79,6 @@
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
and stat_time = #{statTime}
|
||||
and stat_time > DATE_SUB(#{statTime},INTERVAL 1 HOUR)
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user