流量统计详情app,协议,活跃IP增加地域查询条件

This commit is contained in:
zhanghongqing
2019-01-08 20:28:54 +08:00
parent f51120bd33
commit a705b00a15
8 changed files with 46 additions and 30 deletions

View File

@@ -14,7 +14,7 @@ public interface TrafficAppStatisticDao {
TrafficAppStatistic getMaxStatTime();
List<Map> appChart(@Param("statTime")Date statTime);
List<Map> getAppList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("appType")Integer[] appType);
List<Map> getAppList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("appType")Integer[] appType,@Param("entranceId")Integer entranceId);
List<TrafficAppFocusStatistic> getAppTrend(TrafficAppFocusStatistic entity);
List<AppConnRecordStatistic> appConnRecordTop100(AppConnRecordStatistic entity);
List<AppConnRecordStatistic> appConnRecordTotal(AppConnRecordStatistic entity);

View File

@@ -30,7 +30,7 @@
<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)*8)/300/1024/1024/1024) AS GByte
((SUM(c2s_byte_len+s2c_byte_len))/1024/1024/1024) AS GByte
FROM traffic_app_statistic WHERE
<![CDATA[ stat_time>= #{beginTime} and stat_time< #{endTime}]]>
<if test="appType!=null">
@@ -39,6 +39,9 @@
#{item}
</foreach>
</if>
<if test="entranceId !=null">
and entrance_id=#{entranceId}
</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>

View File

@@ -15,9 +15,9 @@ public interface TrafficIpActiveStatisticDao {
// List<TrafficIpActiveStatistic> getIpList(TrafficIpActiveStatistic trafficIpActiveStatistic);
TrafficIpActiveStatistic getMaxStatTime();
ArrayList<TrafficIpActiveStatistic> ipActiveFiveMinute( @Param("ipAddr") String ipAddr,@Param("beginDate")Date beginDate,@Param("endDate")Date endDate);
ArrayList<TrafficIpActiveStatistic> ipActiveFiveMinute( @Param("ipAddr") String ipAddr,@Param("beginDate")Date beginDate,@Param("endDate")Date endDate,@Param("entranceId")Integer entranceId);
HashMap ipActiveOneHour(@Param("ipAddr") String ipAddr,@Param("beginDate")Date beginDate,@Param("endDate")Date endDate);
HashMap ipActiveOneHour(@Param("ipAddr") String ipAddr,@Param("beginDate")Date beginDate,@Param("endDate")Date endDate,@Param("entranceId")Integer entranceId);
ArrayList<LinkedHashMap> ipActiveChart(@Param("beginDate")Date beginDate,@Param("endDate")Date endDate);
ArrayList<LinkedHashMap> ipActiveChart(@Param("beginDate")Date beginDate,@Param("endDate")Date endDate,@Param("entranceId")Integer entranceId);
}

View File

@@ -36,6 +36,9 @@
<select id="ipActiveChart" resultType="java.util.LinkedHashMap">
SELECT ip_addr ipAddr,SUM(link_num) linkNum FROM traffic_ip_active_statistic WHERE
<![CDATA[stat_time >= #{beginDate} AND stat_time < #{endDate}]]>
<if test="entranceId !=null">
and area_id=#{entranceId}
</if>
GROUP BY ip_addr ORDER BY linkNum DESC LIMIT 0,10
</select>
@@ -61,14 +64,21 @@
<select id="ipActiveFiveMinute" resultMap="BaseResultMap">
select ip_addr,SUM(link_num) count ,stat_time from traffic_ip_active_statistic
WHERE
<![CDATA[ip_addr in (${ipAddr}) and
stat_time>= #{beginDate} and stat_time<#{endDate} GROUP BY stat_time,ip_addr order by stat_time asc]]>
<![CDATA[ip_addr in (${ipAddr}) and stat_time>= #{beginDate} and stat_time<#{endDate}]]>
<if test="entranceId !=null">
and area_id=#{entranceId}
</if>
GROUP BY stat_time,ip_addr order by stat_time asc
</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 <![CDATA[ stat_time>= #{beginDate} and stat_time<#{endDate}]]> GROUP BY statTime
and <![CDATA[ stat_time>= #{beginDate} and stat_time<#{endDate}]]>
<if test="entranceId !=null">
and area_id=#{entranceId}
</if>
GROUP BY statTime
ORDER BY count DESC LIMIT 1
</select>

View File

@@ -13,6 +13,6 @@ public interface TrafficProtocolStatisticDao {
TrafficProtocolStatistic getMaxStatTime();
List<Map> protocolChart(@Param("statTime")Date statTime);
List<Map> getProtocolList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("protoType")Integer[] protoType);
List<Map> getProtocolList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("protoType")Integer[] protoType,@Param("entranceId")Integer entranceId);
}

View File

@@ -27,7 +27,7 @@
<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)*8)/300/1024/1024/1024) AS GByte
((SUM(c2s_byte_len+s2c_byte_len))/1024/1024/1024) AS GByte
FROM traffic_protocol_statistic WHERE
<![CDATA[ stat_time>= #{beginTime} and stat_time< #{endTime}]]>
<if test="protoType!=null">
@@ -36,6 +36,9 @@
#{item}
</foreach>
</if>
<if test="entranceId !=null">
and entrance_id=#{entranceId}
</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>