Merge branch 'develop' of http://192.168.10.125/galaxy/galaxy-service.git into develop
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
SELECT MAX(stat_time) statTime FROM traffic_app_statistic WHERE app_type != 0
|
||||
</select>
|
||||
<select id="appChart" resultType="java.util.HashMap">
|
||||
SELECT app_type appType, SUM(link_num) count FROM traffic_app_statistic
|
||||
SELECT app_type appType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_app_statistic
|
||||
WHERE app_type !=0 and stat_time = #{statTime}
|
||||
GROUP BY app_type order by count desc limit 0,10
|
||||
</select>
|
||||
|
||||
@@ -15,7 +15,7 @@ public interface TrafficHttpStatisticDao {
|
||||
|
||||
//获取域名分类之后属于的网站
|
||||
List<TrafficHttpStatistic> getDomainByWebsiteList(@Param("statTime")Date statTime);
|
||||
Integer preWebsiteListCount(@Param("websiteServiceId") Integer websiteServiceId,@Param("statTime") Date statTime);
|
||||
Long preWebsiteListCount(@Param("websiteServiceId") Integer websiteServiceId,@Param("statTime") Date statTime);
|
||||
List<Map> getDomainByWebsiteServiceId(@Param("websiteServiceId") Integer websiteServiceId,@Param("statTime") Date statTime);
|
||||
Map websiteDomainOthers(@Param("webIdList") List webIdList,@Param("websiteServiceId") Integer websiteServiceId,@Param("statTime") Date statTime);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
SELECT MAX(stat_time) statTime FROM traffic_http_statistic WHERE web_id != 0
|
||||
</select>
|
||||
<!-- 根据服务网站将域名分类 网站列表-->
|
||||
<select id="getDomainByWebsiteList" resultType="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
|
||||
<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
|
||||
@@ -28,7 +28,7 @@
|
||||
and t.stat_time = #{statTime}
|
||||
GROUP BY u.website_service_id ORDER BY count desc limit 0,10
|
||||
</select>
|
||||
<!-- 根据主题将域名分类 主题列表 最近五分钟top10-->
|
||||
<!-- 根据主题将域名分类 主题列表 最近五分钟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
|
||||
@@ -37,8 +37,8 @@
|
||||
and t.stat_time =#{statTime}
|
||||
GROUP BY u.topic_id ORDER BY count desc limit 0,10
|
||||
|
||||
</select>
|
||||
<!--获取上个时间段该网站站域名流量的数据量 -->
|
||||
</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
|
||||
@@ -52,7 +52,7 @@
|
||||
WHERE web_id !=0 and stat_time >= DATE_SUB((SELECT MAX(stat_time) FROM traffic_http_statistic),INTERVAL 5 MINUTE)
|
||||
GROUP BY web_id ORDER BY count DESC limit 0,10
|
||||
</select> -->
|
||||
<!-- 根据网站分组获取子域名 -->
|
||||
<!-- 根据网站分组获取子域名 -->
|
||||
<select id="getDomainByWebsiteServiceId" resultType="java.util.HashMap">
|
||||
SELECT web_id webId,SUM(c2s_byte_len+s2c_byte_len) count
|
||||
FROM traffic_http_statistic t
|
||||
@@ -61,7 +61,7 @@
|
||||
and t.stat_time =#{statTime}
|
||||
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
||||
</select>
|
||||
<!-- 根据主题分组获取子域名 -->
|
||||
<!-- 根据主题分组获取子域名 -->
|
||||
<select id="getDomainByTopicId" resultType="java.util.HashMap">
|
||||
SELECT web_id webId,SUM(c2s_byte_len+s2c_byte_len) count
|
||||
FROM traffic_http_statistic t
|
||||
@@ -71,7 +71,7 @@
|
||||
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
||||
</select>
|
||||
|
||||
<!-- 指定网站下的TOP10之外为others -->
|
||||
<!-- 指定网站下的TOP10之外为others -->
|
||||
<select id="websiteDomainOthers" resultType="java.util.HashMap">
|
||||
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
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</select>
|
||||
<!-- IP流量统计五分钟-->
|
||||
<select id="ipActiveChart" resultType="java.util.LinkedHashMap">
|
||||
SELECT ip_addr ipAddr, SUM(link_num) linkNum FROM traffic_ip_active_statistic
|
||||
SELECT ip_addr ipAddr, SUM(c2s_byte_len+s2c_byte_len) linkNum FROM traffic_ip_active_statistic
|
||||
WHERE stat_time = #{statTime}
|
||||
GROUP BY ip_addr ORDER BY linkNum DESC limit 0,10
|
||||
</select>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
SELECT MAX(stat_time) statTime FROM traffic_protocol_statistic WHERE proto_type != 0
|
||||
</select>
|
||||
<select id="protocolChart" resultType="java.util.HashMap">
|
||||
SELECT proto_type protoType, SUM(link_num) count FROM traffic_protocol_statistic WHERE proto_type != 0
|
||||
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>
|
||||
</mapper>
|
||||
@@ -25,7 +25,7 @@ public interface TrafficUaStatisticDao {
|
||||
|
||||
Map browserOthers(@Param("osType") List osType,@Param("bsType") Integer bsType,@Param("statTime") Date statTime);
|
||||
|
||||
Integer preSystemListCount(@Param("osType") Integer osType,@Param("statTime") Date statTime);
|
||||
Long preSystemListCount(@Param("osType") Integer osType,@Param("statTime") Date statTime);
|
||||
|
||||
Integer preBrowserListCount(@Param("bsType") Integer bsType,@Param("statTime") Date statTime);
|
||||
Long preBrowserListCount(@Param("bsType") Integer bsType,@Param("statTime") Date statTime);
|
||||
}
|
||||
@@ -22,25 +22,25 @@
|
||||
</select>
|
||||
<!--获取操作系统列表TOP10 -->
|
||||
<select id="systemList" resultMap="BaseResultMap">
|
||||
SELECT os_type osType, SUM(link_num) count FROM traffic_ua_statistic
|
||||
SELECT os_type osType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
|
||||
WHERE os_type !=0 and stat_time = #{statTime}
|
||||
GROUP BY os_type ORDER BY count DESC limit 0,10
|
||||
</select>
|
||||
<!--获取上个时间段操作系统的数据量 -->
|
||||
<select id="preSystemListCount" resultType="java.lang.Integer">
|
||||
SELECT SUM(link_num) count FROM traffic_ua_statistic
|
||||
<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)
|
||||
</select>
|
||||
<!-- 根据操作系统获取浏览器分类 -->
|
||||
<select id="getBrowserBySystem" resultType="java.util.HashMap">
|
||||
SELECT bs_type bsType, SUM(link_num) count FROM traffic_ua_statistic
|
||||
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}
|
||||
GROUP BY bs_type ORDER BY count DESC limit 0,10
|
||||
</select>
|
||||
<!--浏览器TOP10后所有为others -->
|
||||
<select id="systemOthers" resultType="java.util.HashMap">
|
||||
SELECT SUM(link_num) count FROM traffic_ua_statistic
|
||||
SELECT SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
|
||||
WHERE bs_type !=0 and os_type=#{osType}
|
||||
<if test="bsType!=null and bsType.size()>0">
|
||||
and bs_type not in
|
||||
@@ -53,25 +53,25 @@
|
||||
|
||||
<!--获取浏览器列表TOP10 -->
|
||||
<select id="browserList" resultMap="BaseResultMap">
|
||||
SELECT bs_type bsType, SUM(link_num) count FROM traffic_ua_statistic
|
||||
SELECT bs_type bsType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
|
||||
WHERE bs_type !=0 and stat_time = #{statTime}
|
||||
GROUP BY bs_type ORDER BY count DESC limit 0,10
|
||||
</select>
|
||||
<!--获取上个时间段浏览器的数据量 -->
|
||||
<select id="preBrowserListCount" resultType="java.lang.Integer">
|
||||
SELECT SUM(link_num) count FROM traffic_ua_statistic
|
||||
<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)
|
||||
</select>
|
||||
<!-- 根据浏览器获取操作系统分类 -->
|
||||
<select id="getSystemBybrowser" resultType="java.util.HashMap">
|
||||
SELECT os_type osType, SUM(link_num) count FROM traffic_ua_statistic
|
||||
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}
|
||||
GROUP BY os_type ORDER BY count DESC limit 0,10
|
||||
</select>
|
||||
<!--操作系统TOP10后所有为others -->
|
||||
<select id="browserOthers" parameterType="java.util.List" resultType="java.util.HashMap">
|
||||
SELECT SUM(link_num) count FROM traffic_ua_statistic
|
||||
SELECT SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_ua_statistic
|
||||
WHERE os_type !=0 and bs_type=#{bsType}
|
||||
<if test="osType!=null and osType.size()>0">
|
||||
and os_type not in
|
||||
|
||||
@@ -1,31 +1,14 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.beust.jcommander.internal.Maps;
|
||||
import com.nis.domain.restful.dashboard.*;
|
||||
import com.nis.web.dao.dashboard.*;
|
||||
import com.nis.web.service.BaseService;
|
||||
import com.zdjizhi.utils.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.dashboard.NtcTotalReport;
|
||||
import com.nis.domain.restful.dashboard.TrafficAppStatistic;
|
||||
import com.nis.domain.restful.dashboard.TrafficHttpStatistic;
|
||||
import com.nis.domain.restful.dashboard.TrafficIpActiveStatistic;
|
||||
import com.nis.domain.restful.dashboard.TrafficPortActiveStatistic;
|
||||
import com.nis.domain.restful.dashboard.TrafficProtocolStatistic;
|
||||
import com.nis.domain.restful.dashboard.TrafficUaStatistic;
|
||||
import com.nis.web.dao.dashboard.NtcTotalReportDao;
|
||||
import com.nis.web.dao.dashboard.TrafficAppStatisticDao;
|
||||
import com.nis.web.dao.dashboard.TrafficHttpStatisticDao;
|
||||
import com.nis.web.dao.dashboard.TrafficIpActiveStatisticDao;
|
||||
import com.nis.web.dao.dashboard.TrafficPortActiveStatisticDao;
|
||||
import com.nis.web.dao.dashboard.TrafficProtocolStatisticDao;
|
||||
import com.nis.web.dao.dashboard.TrafficUaStatisticDao;
|
||||
import com.nis.web.service.BaseService;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class DashboardService extends BaseService{
|
||||
@@ -57,33 +40,32 @@ public class DashboardService extends BaseService{
|
||||
totalReportList = ntcTotalReportDao.getTotalReportList(reportTime);
|
||||
}
|
||||
Map maxRecvtTime = ntcTotalReportDao.getMaxRecvTime();
|
||||
|
||||
List<Map> newData = new ArrayList<Map>();
|
||||
// List<Map> oldData = new ArrayList<Map>();
|
||||
if(maxRecvtTime!=null&&maxRecvtTime.get("statTime")!=null) {
|
||||
|
||||
if(maxRecvtTime!=null && maxRecvtTime.get("statTime")!=null) {
|
||||
Date recvTime = (Date) maxRecvtTime.get("statTime");
|
||||
newData = ntcTotalReportDao.getNetFlowPortInfoNew(recvTime);
|
||||
// oldData = ntcTotalReportDao.getNetFlowPortInfoOld(recvTime);
|
||||
|
||||
}
|
||||
//统计带宽的流入流出 单位 五分钟 的 byte
|
||||
Double inoctets=0d;
|
||||
Double outoctets=0d;
|
||||
if(newData!=null&&newData.size()>0&&newData.get(0)!=null){
|
||||
Double newInoctets=Double.parseDouble(newData.get(0).get("inoctets").toString()) ;
|
||||
Double newOutoctets=Double.parseDouble(newData.get(0).get("outoctets").toString()) ;
|
||||
//结果为当前五分钟减去上个五分钟
|
||||
inoctets=newInoctets;
|
||||
outoctets=newOutoctets;
|
||||
if(inoctets<0||outoctets<0){
|
||||
inoctets=0d;
|
||||
outoctets=0d;
|
||||
}
|
||||
}
|
||||
if(totalReportList!=null&&totalReportList.size()>0){
|
||||
for (Map map : totalReportList) {
|
||||
map.put("inoctets", inoctets);
|
||||
map.put("outoctets", outoctets);
|
||||
if(StringUtil.isNotEmpty(newData)){
|
||||
Double inoctets = Double.parseDouble(newData.get(0).get("inoctets").toString()) ;
|
||||
Double outoctets = Double.parseDouble(newData.get(0).get("outoctets").toString()) ;
|
||||
|
||||
if (StringUtil.isEmpty(totalReportList)) {
|
||||
Map valueMap = Maps.newHashMap();
|
||||
valueMap.put("inoctets", inoctets);
|
||||
valueMap.put("outoctets", outoctets);
|
||||
totalReportList.add(valueMap);
|
||||
} else {
|
||||
totalReportList.get(0).put("inoctets", inoctets);
|
||||
totalReportList.get(0).put("outoctets", outoctets);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return totalReportList;
|
||||
}
|
||||
@@ -241,7 +223,7 @@ public class DashboardService extends BaseService{
|
||||
if(maxStatTime!=null) {
|
||||
Date statTime = maxStatTime.getStatTime();
|
||||
List<TrafficUaStatistic> list = trafficUaStatisticDao.systemList(statTime);
|
||||
Integer preCount=0;
|
||||
Long preCount=0l;
|
||||
for (TrafficUaStatistic ua : list) {
|
||||
Map map = new HashMap();
|
||||
map.put("osType",ua.getOsType());
|
||||
@@ -290,7 +272,7 @@ public class DashboardService extends BaseService{
|
||||
if(maxStatTime!=null) {
|
||||
Date statTime = maxStatTime.getStatTime();
|
||||
List<TrafficUaStatistic> list = trafficUaStatisticDao.browserList(statTime);
|
||||
Integer preCount=0;
|
||||
Long preCount=0l;
|
||||
if(list!=null&&list.size()>0){
|
||||
for (TrafficUaStatistic ua : list) {
|
||||
Map map = new HashMap();
|
||||
@@ -339,7 +321,7 @@ public class DashboardService extends BaseService{
|
||||
TrafficHttpStatistic maxStatTime = trafficHttpStatisticDao.getMaxStatTime();
|
||||
if(maxStatTime!=null) {
|
||||
List<TrafficHttpStatistic> list = trafficHttpStatisticDao.websiteList(maxStatTime.getStatTime());
|
||||
Integer preCount=0;
|
||||
Long preCount=0l;
|
||||
if(list!=null&&list.size()>0){
|
||||
for (TrafficHttpStatistic website : list) {
|
||||
Map map = new HashMap();
|
||||
@@ -401,7 +383,7 @@ public class DashboardService extends BaseService{
|
||||
Date statTime = maxStatTime.getStatTime();
|
||||
List<TrafficHttpStatistic> websiteList = trafficHttpStatisticDao.getDomainByWebsiteList(statTime);
|
||||
if(websiteList!=null&&websiteList.size()>0){
|
||||
Integer preCount=0;
|
||||
Long preCount=0l;
|
||||
for (TrafficHttpStatistic website : websiteList) {
|
||||
Map map = new HashMap();
|
||||
map.put("websiteServiceId",website.getWesiteServiceId());
|
||||
|
||||
Reference in New Issue
Block a user