流量统计增加域名查询接口,修改活跃IP增加时间查询,app增加appType条件查询,增加主题详情统计
This commit is contained in:
@@ -13,5 +13,5 @@ public interface TrafficAppStatisticDao {
|
||||
|
||||
TrafficAppStatistic getMaxStatTime();
|
||||
List<Map> appChart(@Param("statTime")Date statTime);
|
||||
List<Map> getAppList(@Param("statTime")Date statTime,@Param("beginTime")String beginTime,@Param("endTime")String endTime);
|
||||
List<Map> getAppList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("appType")Integer appType);
|
||||
}
|
||||
@@ -32,12 +32,12 @@
|
||||
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
|
||||
<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>
|
||||
<if test="appType!=null and appType!=''">
|
||||
and app_type=#{appType}
|
||||
</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>
|
||||
|
||||
@@ -30,4 +30,7 @@ public interface TrafficHttpStatisticDao {
|
||||
List<Map> getDomainByTopicId(@Param("statTime") Date statTime, @Param("endTime") Date endTime);
|
||||
|
||||
List getIdByWebSiteId(@Param("websiteId") Integer websiteId);
|
||||
|
||||
List<Map> getDomainList(@Param("beginDate")Date beginDate, @Param("endDate") Date endDate);
|
||||
|
||||
}
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
<!--获取上个时间段该网站站域名流量的数据量 -->
|
||||
<select id="preWebsiteListCount" resultType="java.util.HashMap">
|
||||
select web_id webId, SUM(c2s_byte_len + s2c_byte_len) count from
|
||||
select web_id webId,SUM(c2s_byte_len + s2c_byte_len) count from
|
||||
traffic_http_statistic t where
|
||||
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} group by t.web_id ]]>
|
||||
|
||||
@@ -100,9 +100,15 @@ FROM
|
||||
|
||||
<!-- 根据主题分组获取子域名 -->
|
||||
<select id="getDomainByTopicId" resultType="java.util.HashMap">
|
||||
select web_id webId,sum(c2s_byte_len + s2c_byte_len) count from
|
||||
select web_id webId,link_num linkNum,SUM(c2s_pkt_num+s2c_pkt_num) packets,sum(c2s_byte_len + s2c_byte_len) count from
|
||||
traffic_http_statistic t where
|
||||
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} group by t.web_id ]]>
|
||||
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} group by t.web_id]]>
|
||||
</select>
|
||||
<!-- 获取域名列表 -->
|
||||
<select id="getDomainList" resultType="java.util.HashMap">
|
||||
select web_id webId,link_num linkNum,SUM(c2s_pkt_num+s2c_pkt_num) packets,sum(c2s_byte_len + s2c_byte_len) count from
|
||||
traffic_http_statistic t where
|
||||
<![CDATA[ stat_time>= #{beginDate} and stat_time< #{endDate} group by t.web_id order by count]]>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ public interface TrafficIpActiveStatisticDao {
|
||||
// List<TrafficIpActiveStatistic> getIpList(TrafficIpActiveStatistic trafficIpActiveStatistic);
|
||||
TrafficIpActiveStatistic getMaxStatTime();
|
||||
|
||||
ArrayList<TrafficIpActiveStatistic> ipActiveFiveMinute(@Param("ipAddr") String ipAddr,@Param("statTime")Date statTime);
|
||||
ArrayList<TrafficIpActiveStatistic> ipActiveFiveMinute( @Param("ipAddr") String ipAddr,@Param("beginDate")Date beginDate,@Param("endDate")Date endDate);
|
||||
|
||||
ArrayList<HashMap> ipActiveOneHour(@Param("ipAddr") String ipAddr,@Param("statTime")Date statTime);
|
||||
ArrayList<HashMap> ipActiveOneHour(@Param("ipAddr") String ipAddr,@Param("beginDate")Date beginDate,@Param("endDate")Date endDate);
|
||||
|
||||
ArrayList<LinkedHashMap> ipActiveChart(@Param("statTime")Date statTime);
|
||||
ArrayList<LinkedHashMap> ipActiveChart(@Param("beginDate")Date beginDate,@Param("endDate")Date endDate);
|
||||
}
|
||||
@@ -26,31 +26,37 @@
|
||||
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficIpActiveStatistic">
|
||||
SELECT stat_time statTime FROM traffic_ip_active_statistic order by stat_time desc limit 1
|
||||
</select>
|
||||
<!-- IP流量统计五分钟-->
|
||||
<!-- IP流量统计五分钟TOp10-->
|
||||
<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 > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
WHERE
|
||||
<![CDATA[ stat_time> #{beginDate} and stat_time<=#{endDate}]]>
|
||||
GROUP BY ip_addr ORDER BY linkNum DESC limit 0,10
|
||||
</select>
|
||||
|
||||
<!-- IP流量统计一小时内每隔五分钟数据-->
|
||||
<select id="ipActiveFiveMinute" resultMap="BaseResultMap">
|
||||
<!-- <select id="ipActiveFiveMinute" resultMap="BaseResultMap">
|
||||
select IFNULL(p.sumNum,0) linkNum, date_format(a.min5,'%Y-%m-%d %H:%i') time from
|
||||
(select date_sub(#{statTime},interval @mycnt :=@mycnt + 5 MINUTE) min5
|
||||
from (SELECT @mycnt:=-5) m, traffic_ip_active_statistic limit 12) a
|
||||
(select date_sub(#{endDate},interval @mycnt :=@mycnt + 5 MINUTE) min5
|
||||
from (SELECT @mycnt:=-5) m, traffic_ip_active_statistic limit #{inter}) a
|
||||
LEFT JOIN (
|
||||
SELECT date_format(stat_time, '%Y-%m-%d %H:%i') timestamp, SUM(c2s_byte_len+s2c_byte_len) sumNum FROM traffic_ip_active_statistic
|
||||
WHERE ip_addr=#{ipAddr} AND stat_time > DATE_SUB(#{statTime,jdbcType=TIMESTAMP}, INTERVAL 1 HOUR)
|
||||
WHERE ip_addr=#{ipAddr} AND <![CDATA[ stat_time> #{beginDate} and stat_time<=#{endDate}]]>
|
||||
GROUP by timestamp
|
||||
) p
|
||||
on date_format(p.timestamp,'%Y-%m-%d %H:%i')=date_format(a.min5,'%Y-%m-%d %H:%i')
|
||||
ORDER by time
|
||||
</select> -->
|
||||
<select id="ipActiveFiveMinute" resultMap="BaseResultMap">
|
||||
select SUM(c2s_byte_len+s2c_byte_len) count ,stat_time time from traffic_ip_active_statistic
|
||||
WHERE ip_addr=#{ipAddr} and
|
||||
<![CDATA[ stat_time> #{beginDate} and stat_time<=#{endDate}]]>
|
||||
</select>
|
||||
<!-- IP流量统计一小时-->
|
||||
<select id="ipActiveOneHour" resultType="java.util.HashMap">
|
||||
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 stat_time > DATE_SUB(#{statTime},INTERVAL 1 HOUR) GROUP BY statTime
|
||||
and <![CDATA[ stat_time> #{beginDate} and stat_time<=#{endDate}]]> GROUP BY statTime
|
||||
ORDER BY count DESC LIMIT 1
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user