增加界面大屏图表服务接口

This commit is contained in:
zhanghongqing
2018-07-13 19:39:04 +08:00
parent 30e09bfeda
commit 1ecd4ecdaa
17 changed files with 1117 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
package com.nis.web.dao.dashboard;
import java.util.List;
import java.util.Map;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface TrafficAppStatisticDao {
List<Map> appChart();
}

View File

@@ -0,0 +1,23 @@
<?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.TrafficAppStatisticDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.dashboard.TrafficAppStatistic">
<id column="stat_id" jdbcType="INTEGER" property="statId" />
<result column="app_type" jdbcType="INTEGER" property="appType" />
<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="stat_time" jdbcType="TIMESTAMP" property="statTime" />
</resultMap>
<sql id="Base_Column_List">
stat_id, app_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
stat_time
</sql>
<select id="appChart" resultType="java.util.HashMap">
SELECT app_type appType, count(app_type) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_app_statistic
WHERE app_type !=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 555 HOUR)
GROUP BY app_type limit 0,10
</select>
</mapper>

View File

@@ -0,0 +1,15 @@
package com.nis.web.dao.dashboard;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.restful.dashboard.TrafficHttpStatistic;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface TrafficHttpStatisticDao {
List<TrafficHttpStatistic> websiteList();
List<Map> getTypeBywebsite(@Param("webId") Integer webId);
}

View File

@@ -0,0 +1,30 @@
<?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.TrafficHttpStatisticDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
<id column="stat_id" jdbcType="INTEGER" property="statId" />
<result column="web_type" jdbcType="INTEGER" property="webType" />
<result column="web_id" jdbcType="INTEGER" property="webId" />
<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="stat_time" jdbcType="TIMESTAMP" property="statTime" />
</resultMap>
<sql id="Base_Column_List">
stat_id, web_type, web_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
stat_time
</sql>
<!--获取网站列表列表 -->
<select id="websiteList" resultMap="BaseResultMap">
SELECT web_id webId, count(web_id) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_http_statistic
WHERE web_id !=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 555 HOUR)
GROUP BY web_id ORDER BY count DESC limit 0,10
</select>
<!-- 根据网站分类 -->
<select id="getTypeBywebsite" parameterType="java.lang.Integer" resultMap="BaseResultMap">
SELECT web_type webType, count(web_type) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_http_statistic
WHERE web_type !=0 and web_id=#{webId} and stat_time >= DATE_SUB(NOW(),INTERVAL 555 HOUR)
GROUP BY web_type limit 0,10
</select>
</mapper>

View File

@@ -0,0 +1,16 @@
package com.nis.web.dao.dashboard;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import com.nis.domain.restful.dashboard.TrafficIpActiveStatistic;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface TrafficIpActiveStatisticDao {
List<TrafficIpActiveStatistic> getList(TrafficIpActiveStatistic trafficIpActiveStatistic);
ArrayList<LinkedHashMap> ipActiveChart();
}

View File

@@ -0,0 +1,33 @@
<?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.TrafficIpActiveStatisticDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.dashboard.TrafficIpActiveStatistic">
<id column="stat_id" jdbcType="INTEGER" property="statId" />
<result column="ip_addr" jdbcType="VARCHAR" property="ipAddr" />
<result column="area_id" jdbcType="INTEGER" property="areaId" />
<result column="link_num" jdbcType="INTEGER" property="linkNum" />
<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="stat_time" jdbcType="TIMESTAMP" property="statTime" />
</resultMap>
<sql id="Base_Column_List">
stat_id, ip_addr, area_id, link_num, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
stat_time
</sql>
<!-- 活跃IPTOP列表 -->
<select id="getList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from galaxy.traffic_ip_active_statistic
</select>
<!-- IP流量统计-->
<select id="ipActiveChart" resultType="java.util.LinkedHashMap">
SELECT ip_addr ipAddr, SUM(link_num) linkNum ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ip_active_statistic
WHERE stat_time >= DATE_SUB(NOW(),INTERVAL 555 HOUR)
GROUP BY ip_addr ORDER BY link_num DESC limit 0,10
</select>
</mapper>

View File

@@ -0,0 +1,11 @@
package com.nis.web.dao.dashboard;
import java.util.List;
import java.util.Map;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface TrafficProtocolStatisticDao {
List<Map> protocolChart();
}

View File

@@ -0,0 +1,23 @@
<?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.TrafficProtocolStatisticDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.dashboard.TrafficProtocolStatistic">
<id column="stat_id" jdbcType="INTEGER" property="statId" />
<result column="proto_type" jdbcType="INTEGER" property="protoType" />
<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="stat_time" jdbcType="TIMESTAMP" property="statTime" />
</resultMap>
<sql id="Base_Column_List">
stat_id, proto_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
stat_time
</sql>
<select id="protocolChart" resultType="java.util.HashMap">
SELECT proto_type protoType, count(proto_type) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_protocol_statistic
WHERE proto_type!=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 555 HOUR)
GROUP BY proto_type limit 0,10
</select>
</mapper>

View File

@@ -0,0 +1,20 @@
package com.nis.web.dao.dashboard;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.restful.dashboard.TrafficUaStatistic;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface TrafficUaStatisticDao {
List<TrafficUaStatistic> systemList();
List<Map> getBrowserBySystem(@Param("osType") Integer osType);
List<TrafficUaStatistic> browserList();
List<Map> getSystemBybrowser(@Param("bsType") Integer bsType);
}

View File

@@ -0,0 +1,43 @@
<?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.TrafficUaStatisticDao">
<resultMap id="BaseResultMap" type="com.nis.domain.restful.dashboard.TrafficUaStatistic">
<id column="stat_id" jdbcType="INTEGER" property="statId" />
<result column="bs_type" jdbcType="INTEGER" property="bsType" />
<result column="os_type" jdbcType="INTEGER" property="osType" />
<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="stat_time" jdbcType="TIMESTAMP" property="statTime" />
</resultMap>
<sql id="Base_Column_List">
stat_id, bs_type,os_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
stat_time
</sql>
<!--获取操作系统列表 -->
<select id="systemList" resultMap="BaseResultMap">
SELECT os_type osType, count(os_type) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE os_type !=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 555 HOUR)
GROUP BY os_type ORDER BY count DESC limit 0,10
</select>
<!-- 根据操作系统获取浏览器分类 -->
<select id="getBrowserBySystem" parameterType="java.lang.Integer" resultMap="BaseResultMap">
SELECT bs_type bsType, count(bs_type) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE bs_type !=0 and os_type=#{osType} and stat_time >= DATE_SUB(NOW(),INTERVAL 555 HOUR)
GROUP BY bs_type limit 0,10
</select>
<!--获取浏览器列表 -->
<select id="browserList" resultMap="BaseResultMap">
SELECT bs_type bsType, count(bs_type) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE bs_type !=0 and stat_time >= DATE_SUB(NOW(),INTERVAL 555 HOUR)
GROUP BY bs_type ORDER BY count DESC limit 0,10
</select>
<!-- 根据浏览器获取操作系统分类 -->
<select id="getSystemBybrowser" parameterType="java.lang.Integer" resultMap="BaseResultMap">
SELECT os_type osType, count(os_type) count ,(SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen FROM galaxy.traffic_ua_statistic
WHERE os_type !=0 and bs_type=#{bsType} and stat_time >= DATE_SUB(NOW(),INTERVAL 555 HOUR)
GROUP BY os_type limit 0,10
</select>
</mapper>