带宽统计的五分钟、小时、天报查各自的表;
旧的带宽统计7天查询5分钟报表,大于7天查询小时报。
This commit is contained in:
@@ -148,12 +148,29 @@
|
||||
resultMap="TrafficTransStatisticCKResultMap">
|
||||
select
|
||||
(SUM(c2s_byte_len + s2c_byte_len)* 8)/ 300 / 1024 / 1024 / 1024 num,
|
||||
toStartOfFiveMinute(stat_time) stat_time,
|
||||
stat_time,
|
||||
addr_type,
|
||||
trans_type,
|
||||
entrance_id
|
||||
from
|
||||
ntc_network_traffic_stat
|
||||
<choose>
|
||||
<!-- 5分钟 -->
|
||||
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
|
||||
ntc_network_traffic_stat
|
||||
</when>
|
||||
<!-- 小时 -->
|
||||
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||
ntc_network_traffic_stat_hour
|
||||
</when>
|
||||
<!-- 天 -->
|
||||
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||
ntc_network_traffic_stat_daily
|
||||
</when>
|
||||
<!-- 月和年 -->
|
||||
<otherwise>
|
||||
ntc_network_traffic_stat_daily
|
||||
</otherwise>
|
||||
</choose>
|
||||
where
|
||||
<![CDATA[stat_time>=#{beginDate} and stat_time<#{endDate} ]]>
|
||||
<if test="searchDirection != null">
|
||||
@@ -184,12 +201,29 @@
|
||||
resultMap="TrafficTransStatisticCKResultMap">
|
||||
select
|
||||
SUM(c2s_pkt_num + s2c_pkt_num)/ 300 num,
|
||||
toStartOfFiveMinute(stat_time) stat_time,
|
||||
stat_time stat_time,
|
||||
addr_type,
|
||||
trans_type,
|
||||
entrance_id
|
||||
from
|
||||
ntc_network_traffic_stat
|
||||
<choose>
|
||||
<!-- 5分钟 -->
|
||||
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
|
||||
ntc_network_traffic_stat
|
||||
</when>
|
||||
<!-- 小时 -->
|
||||
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||
ntc_network_traffic_stat_hour
|
||||
</when>
|
||||
<!-- 天 -->
|
||||
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||
ntc_network_traffic_stat_daily
|
||||
</when>
|
||||
<!-- 月和年 -->
|
||||
<otherwise>
|
||||
ntc_network_traffic_stat_daily
|
||||
</otherwise>
|
||||
</choose>
|
||||
where
|
||||
<![CDATA[stat_time>=#{beginDate} and stat_time<#{endDate} ]]>
|
||||
<if test="searchDirection != null">
|
||||
@@ -219,12 +253,29 @@
|
||||
resultMap="TrafficTransStatisticCKResultMap">
|
||||
select
|
||||
SUM(link_num) num,
|
||||
toStartOfFiveMinute(stat_time) stat_time,
|
||||
stat_time,
|
||||
addr_type,
|
||||
trans_type,
|
||||
entrance_id
|
||||
from
|
||||
ntc_network_traffic_stat
|
||||
<choose>
|
||||
<!-- 5分钟 -->
|
||||
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
|
||||
ntc_network_traffic_stat
|
||||
</when>
|
||||
<!-- 小时 -->
|
||||
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||
ntc_network_traffic_stat_hour
|
||||
</when>
|
||||
<!-- 天 -->
|
||||
<when test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||
ntc_network_traffic_stat_daily
|
||||
</when>
|
||||
<!-- 月和年 -->
|
||||
<otherwise>
|
||||
ntc_network_traffic_stat_daily
|
||||
</otherwise>
|
||||
</choose>
|
||||
where
|
||||
<![CDATA[stat_time>=#{beginDate} and stat_time<#{endDate} ]]>
|
||||
<if test="searchDirection != null">
|
||||
|
||||
@@ -1305,9 +1305,18 @@ public class DashboardService extends BaseService {
|
||||
}
|
||||
|
||||
public Map<?, ?> getBandwidthTransByQuoTaType(String beginDate, String endDate, String searchQuotaType,
|
||||
Integer searchDirection) {
|
||||
Integer searchDirection) throws ParseException {
|
||||
TrafficTransStatisticCK trafficTransStatisticCK = new TrafficTransStatisticCK();
|
||||
trafficTransStatisticCK.setSearchBusinessType(1);
|
||||
//V1的带宽统计,时间范围大于一个周,则小时粒度;时间范围小于一个周,则5分钟粒度
|
||||
double setTimeRange=7;
|
||||
double timeRange=DateUtils.getDistanceOfTwoDate(DateUtils.strToDate(beginDate, "yyyy-MM-dd HH:mm:ss"),
|
||||
DateUtils.strToDate(endDate, "yyyy-MM-dd HH:mm:ss"));
|
||||
if(timeRange>setTimeRange){
|
||||
trafficTransStatisticCK.setSearchBusinessType(2);
|
||||
}else{
|
||||
trafficTransStatisticCK.setSearchBusinessType(1);
|
||||
}
|
||||
|
||||
trafficTransStatisticCK.setBeginDate(beginDate);
|
||||
trafficTransStatisticCK.setEndDate(endDate);
|
||||
if (searchQuotaType.toLowerCase().equals("gbps")) {
|
||||
|
||||
@@ -166,12 +166,12 @@ public class TrafficReportService extends BaseLogService {
|
||||
if (list2 != null && list2.size() > 0) {
|
||||
for (TrafficTransStatisticCK trafficTransStatisticCK : list2) {
|
||||
long transTime = trafficTransStatisticCK.getStatTime().getTime();
|
||||
if (searchBusinessType == 1) {// 五分钟不需要转换了,时间已经是五分钟的格式了
|
||||
// transTime = DateUtils.getTimeByType(transTime, 0);//
|
||||
if (searchBusinessType == 1) {// 带宽五分钟不需要转换了,时间已经是五分钟的格式了
|
||||
// transTime = DateUtils.getTimeByType(transTime, 0);
|
||||
} else if (searchBusinessType == 2) {
|
||||
transTime = DateUtils.getTimeByType(transTime, 1);
|
||||
//transTime = DateUtils.getTimeByType(transTime, 1);
|
||||
} else if (searchBusinessType == 3) {
|
||||
transTime = DateUtils.getTimeByType(transTime, 2);
|
||||
//transTime = DateUtils.getTimeByType(transTime, 2);
|
||||
} else if (searchBusinessType == 4) {
|
||||
transTime = DateUtils.getTimeByType(transTime, 3);
|
||||
} else if (searchBusinessType == 5) {
|
||||
|
||||
Reference in New Issue
Block a user