新增流量统计带宽详情接口,查询ipv4,6,tcp,udp条件
This commit is contained in:
@@ -5,16 +5,16 @@ import java.util.Date;
|
||||
public class NtcTotalReport {
|
||||
|
||||
private Integer statId ;//int(11) NOT NULL AUTO_INCREMENT COMMENT id自增,
|
||||
private Integer rejectNum ;//int(11) NOT NULL COMMENT 封堵数量,
|
||||
private Integer monitorNum ;//int(11) NOT NULL COMMENT 监测数量,
|
||||
private Integer c2sPktNum ;//int(11) DEFAULT NULL COMMENT c2s包数,
|
||||
private Integer s2cPktNum ;//int(11) DEFAULT NULL COMMENT s2c包数,
|
||||
private Integer c2sByteLen ;//int(11) NOT NULL COMMENT c2s字节数,
|
||||
private Integer s2cByteLen ;//int(11) NOT NULL COMMENT s2c字节数,
|
||||
private Integer newUniConnNum ;//int(11) DEFAULT NULL COMMENT 新建链接数,
|
||||
private Integer liveConnNum ;//int(11) DEFAULT NULL COMMENT 活跃链接数,
|
||||
private Integer dropConnNum ;//int(11) DEFAULT NULL COMMENT 丢弃链接数,
|
||||
private Integer loopConnNum ;//int(11) DEFAULT NULL COMMENT 回流链接数,
|
||||
private Long rejectNum ;//int(11) NOT NULL COMMENT 封堵数量,
|
||||
private Long monitorNum ;//int(11) NOT NULL COMMENT 监测数量,
|
||||
private Long c2sPktNum ;//int(11) DEFAULT NULL COMMENT c2s包数,
|
||||
private Long s2cPktNum ;//int(11) DEFAULT NULL COMMENT s2c包数,
|
||||
private Long c2sByteLen ;//int(11) NOT NULL COMMENT c2s字节数,
|
||||
private Long s2cByteLen ;//int(11) NOT NULL COMMENT s2c字节数,
|
||||
private Long newUniConnNum ;//int(11) DEFAULT NULL COMMENT 新建链接数,
|
||||
private Long liveConnNum ;//int(11) DEFAULT NULL COMMENT 活跃链接数,
|
||||
private Long dropConnNum ;//int(11) DEFAULT NULL COMMENT 丢弃链接数,
|
||||
private Long loopConnNum ;//int(11) DEFAULT NULL COMMENT 回流链接数,
|
||||
private Date reportTime ;//datetime NOT NULL COMMENT 统计时间,
|
||||
|
||||
public Integer getStatId() {
|
||||
@@ -23,64 +23,65 @@ public class NtcTotalReport {
|
||||
public void setStatId(Integer statId) {
|
||||
this.statId = statId;
|
||||
}
|
||||
public Integer getRejectNum() {
|
||||
|
||||
public Long getRejectNum() {
|
||||
return rejectNum;
|
||||
}
|
||||
public void setRejectNum(Integer rejectNum) {
|
||||
public void setRejectNum(Long rejectNum) {
|
||||
this.rejectNum = rejectNum;
|
||||
}
|
||||
public Integer getMonitorNum() {
|
||||
public Long getMonitorNum() {
|
||||
return monitorNum;
|
||||
}
|
||||
public void setMonitorNum(Integer monitorNum) {
|
||||
public void setMonitorNum(Long monitorNum) {
|
||||
this.monitorNum = monitorNum;
|
||||
}
|
||||
public Integer getC2sPktNum() {
|
||||
public Long getC2sPktNum() {
|
||||
return c2sPktNum;
|
||||
}
|
||||
public void setC2sPktNum(Integer c2sPktNum) {
|
||||
public void setC2sPktNum(Long c2sPktNum) {
|
||||
this.c2sPktNum = c2sPktNum;
|
||||
}
|
||||
public Integer getS2cPktNum() {
|
||||
public Long getS2cPktNum() {
|
||||
return s2cPktNum;
|
||||
}
|
||||
public void setS2cPktNum(Integer s2cPktNum) {
|
||||
public void setS2cPktNum(Long s2cPktNum) {
|
||||
this.s2cPktNum = s2cPktNum;
|
||||
}
|
||||
public Integer getC2sByteLen() {
|
||||
public Long getC2sByteLen() {
|
||||
return c2sByteLen;
|
||||
}
|
||||
public void setC2sByteLen(Integer c2sByteLen) {
|
||||
public void setC2sByteLen(Long c2sByteLen) {
|
||||
this.c2sByteLen = c2sByteLen;
|
||||
}
|
||||
public Integer getS2cByteNen() {
|
||||
public Long getS2cByteLen() {
|
||||
return s2cByteLen;
|
||||
}
|
||||
public void setS2cByteNen(Integer s2cByteLen) {
|
||||
public void setS2cByteLen(Long s2cByteLen) {
|
||||
this.s2cByteLen = s2cByteLen;
|
||||
}
|
||||
public Integer getNewUniConnNum() {
|
||||
public Long getNewUniConnNum() {
|
||||
return newUniConnNum;
|
||||
}
|
||||
public void setNewUniConnNum(Integer newUniConnNum) {
|
||||
public void setNewUniConnNum(Long newUniConnNum) {
|
||||
this.newUniConnNum = newUniConnNum;
|
||||
}
|
||||
public Integer getLiveConnNum() {
|
||||
public Long getLiveConnNum() {
|
||||
return liveConnNum;
|
||||
}
|
||||
public void setLiveConnNum(Integer liveConnNum) {
|
||||
public void setLiveConnNum(Long liveConnNum) {
|
||||
this.liveConnNum = liveConnNum;
|
||||
}
|
||||
public Integer getDropConnNum() {
|
||||
public Long getDropConnNum() {
|
||||
return dropConnNum;
|
||||
}
|
||||
public void setDropConnNum(Integer dropConnNum) {
|
||||
public void setDropConnNum(Long dropConnNum) {
|
||||
this.dropConnNum = dropConnNum;
|
||||
}
|
||||
public Integer getLoopConnNum() {
|
||||
public Long getLoopConnNum() {
|
||||
return loopConnNum;
|
||||
}
|
||||
public void setLoopConnNum(Integer loopConnNum) {
|
||||
public void setLoopConnNum(Long loopConnNum) {
|
||||
this.loopConnNum = loopConnNum;
|
||||
}
|
||||
public Date getReportTime() {
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.nis.domain.restful.dashboard;
|
||||
import java.util.Date;
|
||||
|
||||
public class TrafficTransStatistic {
|
||||
|
||||
private Integer statId ;
|
||||
private String addrType ;
|
||||
private Integer transType ;
|
||||
private Integer entranceId ;
|
||||
private Long linkNum;
|
||||
private Long c2sPktNum ;
|
||||
private Long s2cPktNum ;
|
||||
private Long c2sByteLen ;
|
||||
private Long s2cByteLen ;
|
||||
private Date statTime ;
|
||||
|
||||
private String time;
|
||||
private Long pps;
|
||||
private Long gbps;
|
||||
|
||||
public Long getPps() {
|
||||
return pps;
|
||||
}
|
||||
public void setPps(Long pps) {
|
||||
this.pps = pps;
|
||||
}
|
||||
public Long getGbps() {
|
||||
return gbps;
|
||||
}
|
||||
public void setGbps(Long gbps) {
|
||||
this.gbps = gbps;
|
||||
}
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
public Long getLinkNum() {
|
||||
return linkNum;
|
||||
}
|
||||
public void setLinkNum(Long linkNum) {
|
||||
this.linkNum = linkNum;
|
||||
}
|
||||
public Integer getStatId() {
|
||||
return statId;
|
||||
}
|
||||
public void setStatId(Integer statId) {
|
||||
this.statId = statId;
|
||||
}
|
||||
public String getAddrType() {
|
||||
return addrType;
|
||||
}
|
||||
public void setAddrType(String addrType) {
|
||||
this.addrType = addrType;
|
||||
}
|
||||
public Integer getTransType() {
|
||||
return transType;
|
||||
}
|
||||
public void setTransType(Integer transType) {
|
||||
this.transType = transType;
|
||||
}
|
||||
public Integer getEntranceId() {
|
||||
return entranceId;
|
||||
}
|
||||
public void setEntranceId(Integer entranceId) {
|
||||
this.entranceId = entranceId;
|
||||
}
|
||||
public Long getC2sPktNum() {
|
||||
return c2sPktNum;
|
||||
}
|
||||
public void setC2sPktNum(Long c2sPktNum) {
|
||||
this.c2sPktNum = c2sPktNum;
|
||||
}
|
||||
public Long getS2cPktNum() {
|
||||
return s2cPktNum;
|
||||
}
|
||||
public void setS2cPktNum(Long s2cPktNum) {
|
||||
this.s2cPktNum = s2cPktNum;
|
||||
}
|
||||
public Long getC2sByteLen() {
|
||||
return c2sByteLen;
|
||||
}
|
||||
public void setC2sByteLen(Long c2sByteLen) {
|
||||
this.c2sByteLen = c2sByteLen;
|
||||
}
|
||||
public Long getS2cByteLen() {
|
||||
return s2cByteLen;
|
||||
}
|
||||
public void setS2cByteLen(Long s2cByteLen) {
|
||||
this.s2cByteLen = s2cByteLen;
|
||||
}
|
||||
public Date getStatTime() {
|
||||
return statTime;
|
||||
}
|
||||
public void setStatTime(Date statTime) {
|
||||
this.statTime = statTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,6 +61,30 @@ public class DashboardServiceController extends BaseRestController {
|
||||
}
|
||||
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "业务总量汇聚实时统计数据检索成功",list, 0);
|
||||
}
|
||||
/**
|
||||
* 根据ip46,协议tcp,udp查询带宽
|
||||
*/
|
||||
@RequestMapping(value = "trafficBandwidthTrans", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "带宽根据ip46,协议tcp,udp查询详情", httpMethod = "GET", notes = "对应带宽根据IPv4,6,协议tcp,udp统计数据显示")
|
||||
public Map<String,?> trafficBandwidthTrans(String addrType,Integer transType,Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
|
||||
List<HashMap> list = new ArrayList<HashMap>();
|
||||
try {
|
||||
List<HashMap> resultList = dashboardService.getBandwidthTrans(addrType, transType);
|
||||
if (resultList!=null&&resultList.size() > 0) {
|
||||
list = resultList;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
||||
logger.error("带宽实时统计数据检索失败"+ExceptionUtil.getExceptionMsg(e));
|
||||
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
|
||||
"带宽实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
|
||||
}
|
||||
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "带宽实时统计数据检索成功",list, 0);
|
||||
}
|
||||
/**
|
||||
* 流量统计活跃端口统计
|
||||
*/
|
||||
|
||||
@@ -7,12 +7,13 @@ import java.util.Map;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.restful.dashboard.NtcTotalReport;
|
||||
import com.nis.domain.restful.dashboard.TrafficTransStatistic;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
@MyBatisDao
|
||||
public interface NtcTotalReportDao {
|
||||
NtcTotalReport getMaxReportTime();
|
||||
Map getMaxRecvTime();
|
||||
Map getMaxStatTime();
|
||||
List<Map> getTotalReportList(@Param("reportTime") Date reportTime);
|
||||
List<Map> getNetFlowPortInfoNew(@Param("statTime") Date statTime);
|
||||
// List<Map> getNetFlowPortInfoOld(@Param("recvTime") Date recvTime);
|
||||
List<TrafficTransStatistic> getBandwidthTrans(@Param("statTime") Date statTime,@Param("addrType") String addrType,@Param("transType") Integer transType);
|
||||
}
|
||||
@@ -1,41 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nis.web.dao.dashboard.NtcTotalReportDao">
|
||||
<!-- <resultMap id="BaseResultMap" type="com.nis.domain.restful.dashboard.NtcTotalReport">
|
||||
<resultMap id="BandwidthResultMap" type="com.nis.domain.restful.dashboard.TrafficTransStatistic">
|
||||
<id column="stat_id" jdbcType="INTEGER" property="statId" />
|
||||
<result column="app_type" jdbcType="INTEGER" property="appType" />
|
||||
<result column="addr_type" jdbcType="INTEGER" property="addrType" />
|
||||
<result column="trans_type" jdbcType="INTEGER" property="transType" />
|
||||
<result column="entrance_id" jdbcType="INTEGER" property="entranceId" />
|
||||
<result column="c2s_pkt_num" jdbcType="INTEGER" property="c2sPktNum" />
|
||||
<result column="s2c_pkt_num" jdbcType="INTEGER" property="s2cPktNum" />
|
||||
<result column="c2s_byte_len" jdbcType="INTEGER" property="c2sByteLen" />
|
||||
<result column="s2c_byte_len" jdbcType="INTEGER" property="s2cByteLen" />
|
||||
<result column="link_num" jdbcType="BIGINT" property="linkNum" />
|
||||
<result column="c2s_pkt_num" jdbcType="BIGINT" property="c2sPktNum" />
|
||||
<result column="s2c_pkt_num" jdbcType="BIGINT" property="s2cPktNum" />
|
||||
<result column="c2s_byte_len" jdbcType="BIGINT" property="c2sByteLen" />
|
||||
<result column="s2c_byte_len" jdbcType="BIGINT" property="s2cByteLen" />
|
||||
<result column="stat_time" jdbcType="TIMESTAMP" property="statTime" />
|
||||
</resultMap> -->
|
||||
<!-- <select id="appChart" resultType="java.util.HashMap">
|
||||
SELECT app_type appType, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)+SUM(c2s_byte_len)+SUM(s2c_byte_len)) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM traffic_app_statistic
|
||||
WHERE app_type !=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 5 MINUTE)
|
||||
GROUP BY app_type order by count desc limit 0,10
|
||||
</select> -->
|
||||
<!-- 获取最近时间并且有效 -->
|
||||
</resultMap>
|
||||
|
||||
<!-- 获取取阻断,监测等流量信息最近时间 -->
|
||||
<select id="getMaxReportTime" resultType="com.nis.domain.restful.dashboard.NtcTotalReport">
|
||||
SELECT MAX(report_time) reportTime FROM ntc_total_report
|
||||
</select>
|
||||
<!-- 获取带宽最近时间并且有效 -->
|
||||
<select id="getMaxRecvTime" resultType="java.util.HashMap">
|
||||
SELECT MAX(stat_time) statTime FROM traffic_trans_statistic
|
||||
</select>
|
||||
|
||||
<!-- 根据最近的时间获取阻断,监测等流量信息 -->
|
||||
<select id="getTotalReportList" resultType="java.util.HashMap">
|
||||
SELECT SUM(reject_num) rejectNum,SUM(monitor_num) monitorNum,SUM(c2s_pkt_num) c2sPktNum,SUM(s2c_pkt_num) s2cPktNum,SUM(c2s_byte_len) c2sByteLen,SUM(s2c_byte_len) s2cByteLen,SUM(new_uni_conn_num) newUniConnNum,SUM(live_conn_num) liveConnNum,
|
||||
SUM(drop_conn_num) dropConnNum,SUM(loop_conn_num) loopConnNum FROM ntc_total_report
|
||||
where report_time = #{reportTime}
|
||||
</select>
|
||||
|
||||
<!-- 获取带宽最近时间 -->
|
||||
<select id="getMaxStatTime" resultType="java.util.HashMap">
|
||||
SELECT MAX(stat_time) statTime FROM traffic_trans_statistic
|
||||
</select>
|
||||
<!-- 根据最近时间条获取带宽,进出口流量 -->
|
||||
<select id="getNetFlowPortInfoNew" resultType="java.util.HashMap">
|
||||
SELECT IFNULL(SUM(c2s_byte_len),0) inoctets ,IFNULL(SUM(s2c_byte_len),0) outoctets FROM traffic_trans_statistic
|
||||
where stat_time = #{statTime}
|
||||
</select>
|
||||
<!-- 获取上个时间段的数据 -->
|
||||
<!-- <select id="getNetFlowPortInfoOld" resultType="java.util.HashMap">
|
||||
SELECT IFNULL(SUM(INOCTETS),0) inoctets ,IFNULL(SUM(OUTOCTETS),0) outoctets FROM TRAFFIC_NETFLOW_PORT_INFO
|
||||
where RECV_TIME = DATE_SUB(#{recvTime},INTERVAL 5 MINUTE)
|
||||
</select>-->
|
||||
<!-- 获取近五分钟的带宽根据ip46,协议 tcp,udp变化 -->
|
||||
<select id="getBandwidthTrans" resultMap="BandwidthResultMap">
|
||||
select IFNULL(p.gbps,0) gbps,IFNULL(p.pps,0) pps,IFNULL(p.sumNum,0) linkNum, date_format(a.min5,'%Y-%m-%d %H:%i') time from
|
||||
(select date_sub(#{statTime},interval @mycnt :=@mycnt + 1 MINUTE) min5
|
||||
from (SELECT @mycnt:=-1) m, traffic_trans_statistic limit 12) a
|
||||
LEFT JOIN (
|
||||
SELECT date_format(stat_time, '%Y-%m-%d %H:%i') timestamp,
|
||||
SUM(link_num)/300 sumNum,
|
||||
SUM(c2s_pkt_num+s2c_pkt_num)/300 AS pps,
|
||||
(SUM(c2s_byte_len+s2c_byte_len)*8/300/1024/1024/1024) AS gbps
|
||||
FROM traffic_trans_statistic
|
||||
<where>
|
||||
<if test="addrType != null">
|
||||
and addr_type=#{addrType}
|
||||
</if>
|
||||
<if test="transType != null">
|
||||
and trans_type=${transType}
|
||||
</if>
|
||||
AND stat_time > DATE_SUB(#{statTime,jdbcType=TIMESTAMP}, INTERVAL 1 HOUR)
|
||||
</where>
|
||||
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>
|
||||
|
||||
</mapper>
|
||||
@@ -35,11 +35,11 @@
|
||||
|
||||
<!-- IP流量统计一小时内每隔五分钟数据-->
|
||||
<select id="ipActiveFiveMinute" resultMap="BaseResultMap">
|
||||
select IFNULL(p.maxNum,0) linkNum, date_format(a.min5,'%Y-%m-%d %H:%i') time from
|
||||
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
|
||||
LEFT JOIN (
|
||||
SELECT date_format(stat_time, '%Y-%m-%d %H:%i') timestamp, max(link_num) maxNum FROM traffic_ip_active_statistic
|
||||
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)
|
||||
GROUP by timestamp
|
||||
) p
|
||||
|
||||
@@ -30,25 +30,23 @@ public class DashboardService extends BaseService{
|
||||
|
||||
/**
|
||||
* 流量统计 数据显示
|
||||
* @return Map
|
||||
* info:先查询最近时间,根据时间条件查询数据 效率提高
|
||||
*/
|
||||
public List<Map> getTotalReportList(){
|
||||
List<Map> totalReportList =new ArrayList<Map>();
|
||||
List<Map> newData = new ArrayList<Map>();
|
||||
// 流量统计阻断丢弃回流等数据显示最近时间
|
||||
NtcTotalReport maxReportTime = ntcTotalReportDao.getMaxReportTime();
|
||||
if(maxReportTime!=null&&maxReportTime.getReportTime()!=null) {
|
||||
Date reportTime = maxReportTime.getReportTime();
|
||||
totalReportList = ntcTotalReportDao.getTotalReportList(reportTime);
|
||||
totalReportList = ntcTotalReportDao.getTotalReportList(reportTime);// 返回阻断,监测等結果
|
||||
}
|
||||
Map maxRecvtTime = ntcTotalReportDao.getMaxRecvTime();
|
||||
|
||||
List<Map> newData = new ArrayList<Map>();
|
||||
|
||||
if(maxRecvtTime!=null && maxRecvtTime.get("statTime")!=null) {
|
||||
Map maxRecvtTime = ntcTotalReportDao.getMaxStatTime();
|
||||
if(maxRecvtTime!=null && maxRecvtTime.get("statTime")!=null) {
|
||||
Date recvTime = (Date) maxRecvtTime.get("statTime");
|
||||
newData = ntcTotalReportDao.getNetFlowPortInfoNew(recvTime);
|
||||
|
||||
}
|
||||
//统计带宽的流入流出 单位 五分钟 的 byte
|
||||
// 统计带宽的流入流出 单位 五分钟 的 byte
|
||||
if(StringUtil.isNotEmpty(newData)){
|
||||
Double inoctets = Double.parseDouble(newData.get(0).get("inoctets").toString()) ;
|
||||
Double outoctets = Double.parseDouble(newData.get(0).get("outoctets").toString()) ;
|
||||
@@ -62,17 +60,55 @@ public class DashboardService extends BaseService{
|
||||
totalReportList.get(0).put("inoctets", inoctets);
|
||||
totalReportList.get(0).put("outoctets", outoctets);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return totalReportList;
|
||||
}
|
||||
/**
|
||||
* 最近活跃端口时间五分钟数据
|
||||
* 根据ip46,协议tcp,udp查询带宽
|
||||
* @param addrType
|
||||
* @param transType
|
||||
* @return
|
||||
*/
|
||||
public List<HashMap> getBandwidthTrans(String addrType,Integer transType) {
|
||||
ArrayList<HashMap> listMap=new ArrayList<HashMap>();
|
||||
List<TrafficTransStatistic> bandwidthList = new ArrayList<TrafficTransStatistic>();
|
||||
Map maxStatTime = ntcTotalReportDao.getMaxStatTime();
|
||||
if(maxStatTime!=null && maxStatTime.get("statTime")!=null) {
|
||||
Date stat = (Date) maxStatTime.get("statTime");
|
||||
HashMap m = new HashMap();
|
||||
bandwidthList=ntcTotalReportDao.getBandwidthTrans(stat, addrType, transType);
|
||||
List timeList = new ArrayList();
|
||||
List linkList = new ArrayList();
|
||||
List gbpsList = new ArrayList();
|
||||
List ppsList = new ArrayList();
|
||||
if(bandwidthList!=null&&bandwidthList.size()>0) {
|
||||
for (TrafficTransStatistic tt : bandwidthList) {
|
||||
if(tt.getTime()!=null) {
|
||||
timeList.add(tt.getTime());
|
||||
if(tt.getLinkNum()!=null) {
|
||||
linkList.add(tt.getLinkNum());
|
||||
}
|
||||
if(tt.getPps()!=null) {
|
||||
ppsList.add(tt.getPps());
|
||||
}
|
||||
if(tt.getGbps()!=null) {
|
||||
gbpsList.add(tt.getGbps());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m.put("linkNum",linkList);
|
||||
m.put("gbps",linkList);
|
||||
m.put("pps",linkList);
|
||||
m.put("statTime",timeList);
|
||||
listMap.add(m);
|
||||
}
|
||||
return listMap;
|
||||
}
|
||||
/**
|
||||
* 最近活跃端口时间五分钟数据
|
||||
* @return List
|
||||
*/
|
||||
public List<Map> getPortActiveList(){
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
TrafficPortActiveStatistic maxStatTime = trafficPortActiveStatisticDao.getMaxStatTime();
|
||||
@@ -100,22 +136,17 @@ public class DashboardService extends BaseService{
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询活跃IPtop100
|
||||
* 活跃IP最近五分钟数据TOP10
|
||||
* @return
|
||||
*/
|
||||
/* public Page<TrafficIpActiveStatistic> getIpList(Page<TrafficIpActiveStatistic> page,TrafficIpActiveStatistic entry){
|
||||
// 设置分页参数
|
||||
entry.setPage(page);
|
||||
// 执行分页查询
|
||||
page.setList(trafficIpActiveStatisticDao.getIpList(entry));
|
||||
return page;
|
||||
}*/
|
||||
public List<HashMap> ipActiveFiveMinute(){
|
||||
TrafficIpActiveStatistic maxStatTime = trafficIpActiveStatisticDao.getMaxStatTime();
|
||||
ArrayList<HashMap> listMap=new ArrayList<HashMap>();
|
||||
if(maxStatTime!=null&&maxStatTime.getStatTime()!=null) {
|
||||
Date statTime = maxStatTime.getStatTime();
|
||||
// 查询最近五分钟TOP10
|
||||
ArrayList<LinkedHashMap> list = trafficIpActiveStatisticDao.ipActiveChart(statTime);
|
||||
if(list!=null&&list.size()>0) {
|
||||
for (LinkedHashMap map : list) {
|
||||
@@ -123,7 +154,8 @@ public class DashboardService extends BaseService{
|
||||
if(map.get("ipAddr")!=null) {
|
||||
String ipAddr = (String) map.get("ipAddr");
|
||||
m.put("ipAddr", ipAddr);
|
||||
ArrayList<TrafficIpActiveStatistic> ipList = trafficIpActiveStatisticDao.ipActiveFiveMinute(ipAddr,statTime);
|
||||
// 根据五分钟TOP10IP,查询TOP10中每个IP最近一小时的变化
|
||||
ArrayList<TrafficIpActiveStatistic> ipList = trafficIpActiveStatisticDao.ipActiveFiveMinute(ipAddr,statTime);
|
||||
List linkList = new ArrayList();
|
||||
List timeList = new ArrayList();
|
||||
if(ipList!=null&&ipList.size()>0) {
|
||||
@@ -144,6 +176,10 @@ public class DashboardService extends BaseService{
|
||||
|
||||
return listMap;
|
||||
}
|
||||
/**
|
||||
* 根据活跃IP最近五分钟TOP10,查询近1小时最大值
|
||||
* @return
|
||||
*/
|
||||
public List<HashMap> ipActiveOneHour(){
|
||||
TrafficIpActiveStatistic maxStatTime = trafficIpActiveStatisticDao.getMaxStatTime();
|
||||
ArrayList<HashMap> listMap=new ArrayList<HashMap>();
|
||||
|
||||
Reference in New Issue
Block a user