新增app流量统计计算bps和pps的接口

This commit is contained in:
renkaige
2019-02-21 14:09:21 +08:00
parent 6269991f79
commit c3c81ca8b8
6 changed files with 528 additions and 136 deletions

View File

@@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.restful.dashboard.AppConnRecordStatistic;
import com.nis.domain.restful.dashboard.TrafficAppFocusStatistic;
import com.nis.domain.restful.dashboard.TrafficAppBpsStatistic;
import com.nis.domain.restful.dashboard.TrafficAppPpsStatistic;
import com.nis.domain.restful.dashboard.TrafficAppStatistic;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
@@ -16,6 +19,8 @@ public interface TrafficAppStatisticDao {
List<Map> appChart(@Param("statTime")Date statTime);
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<TrafficAppBpsStatistic> getAppBpsTrend(TrafficAppBpsStatistic entity);
List<TrafficAppPpsStatistic> getAppPpsTrend(TrafficAppPpsStatistic entity);
List<AppConnRecordStatistic> appConnRecordTop100(AppConnRecordStatistic entity);
List<AppConnRecordStatistic> appConnRecordTotal(AppConnRecordStatistic entity);
}

View File

@@ -59,6 +59,32 @@
group by stat_time
order by stat_time
</select>
<select id="getAppBpsTrend" parameterType="com.nis.domain.restful.dashboard.TrafficAppBpsStatistic" resultType="com.nis.domain.restful.dashboard.TrafficAppBpsStatistic">
select stat_time time, sum(c2s_byte_len) c2sNum,sum(s2c_byte_len) s2cNum,sum(s2c_byte_len+c2s_byte_len) totalNum from traffic_app_focus_statistic t where
<![CDATA[ stat_time>= toDateTime(#{searchStartTime}) and stat_time< toDateTime(#{searchEndTime})
and app_id=toInt64(#{searchAppId}) ]]>
<if test="searchEntranceId !=null and searchEntranceId != ''">
<![CDATA[and entrance_id=toInt64(#{searchEntranceId}) ]]>
</if>
<if test="ispNum !=null and ispNum != ''">
<![CDATA[and concat(toString(entrance_id),toString(device_id)) in (${ispNum})]]>
</if>
group by stat_time
order by stat_time
</select>
<select id="getAppPpsTrend" parameterType="com.nis.domain.restful.dashboard.TrafficAppPpsStatistic" resultType="com.nis.domain.restful.dashboard.TrafficAppPpsStatistic">
select stat_time time, sum(c2s_pkt_num) c2sNum,sum(s2c_pkt_num) s2cNum,sum(s2c_pkt_num+c2s_pkt_num) totalNum from traffic_app_focus_statistic t where
<![CDATA[ stat_time>= toDateTime(#{searchStartTime}) and stat_time< toDateTime(#{searchEndTime})
and app_id=toInt64(#{searchAppId}) ]]>
<if test="searchEntranceId !=null and searchEntranceId != ''">
<![CDATA[and entrance_id=toInt64(#{searchEntranceId}) ]]>
</if>
<if test="ispNum !=null and ispNum != ''">
<![CDATA[and concat(toString(entrance_id),toString(device_id)) in (${ispNum})]]>
</if>
group by stat_time
order by stat_time
</select>
<!-- App 活跃IP Top100 -->
<select id="appConnRecordTop100" parameterType="com.nis.domain.restful.dashboard.AppConnRecordStatistic" resultType="com.nis.domain.restful.dashboard.AppConnRecordStatistic">
select s_ip ipAddr, sum(c2s_byte_num + s2c_byte_num) byteNum, sum(c2s_pkt_num + s2c_pkt_num) pktNum, count(s_ip) logNum