1:核对阀门业务添加四个固定属性
2:修改网站流量的两个接口,改为用程序计算top10
This commit is contained in:
@@ -59,7 +59,7 @@ CREATE TABLE `ui_asn_ip_cfg` (
|
||||
`user_region4` varchar(1024) DEFAULT '' COMMENT '预留自定义域4',
|
||||
`user_region5` varchar(1024) DEFAULT '' COMMENT '预留自定义域5',
|
||||
PRIMARY KEY (`cfg_id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/asn_ip_cfg';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/asn_ip_cfg';
|
||||
|
||||
CREATE TABLE `ui_sys_dict_info` (
|
||||
`sys_dict_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '字典ID',
|
||||
@@ -77,7 +77,7 @@ CREATE TABLE `ui_sys_dict_info` (
|
||||
`edit_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
`is_initianlize` int(11) NOT NULL DEFAULT 0 COMMENT '是否是初始化数据:1是,0否',
|
||||
PRIMARY KEY (`sys_dict_id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=448 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/sys_dict_info';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=448 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/sys_dict_info';
|
||||
|
||||
|
||||
CREATE TABLE `ui_code_app_dic` (
|
||||
@@ -92,7 +92,7 @@ CREATE TABLE `ui_sys_dict_info` (
|
||||
`app_service` varchar(255) CHARACTER SET utf8mb4 DEFAULT '',
|
||||
`lib` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT 'lib类别',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_app_dic';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/code_app_dic';
|
||||
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ CREATE TABLE `ui_cfg_num_statistics` (
|
||||
`compile_id` int(11) DEFAULT 0,
|
||||
`statistic_time` datetime DEFAULT NULL COMMENT '统计时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/cfg_num_statistics';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/cfg_num_statistics';
|
||||
|
||||
|
||||
CREATE TABLE `ui_request_num_statistics` (
|
||||
@@ -116,7 +116,7 @@ CREATE TABLE `ui_request_num_statistics` (
|
||||
`statistic_time` datetime DEFAULT NULL COMMENT '统计时间',
|
||||
`compile_id` int(11) DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
)ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/request_num_statistics';
|
||||
)ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/request_num_statistics';
|
||||
|
||||
|
||||
CREATE TABLE `ui_sys_data_dictionary_item` (
|
||||
@@ -129,14 +129,14 @@ CREATE TABLE `ui_sys_data_dictionary_item` (
|
||||
`type` int(11) DEFAULT 1 COMMENT '该条记录页面是否可维护(1:可维护 0:不可维护)',
|
||||
`dictionary_id` int(11) DEFAULT NULL COMMENT '关联数据字典外键',
|
||||
PRIMARY KEY (`id`)
|
||||
)ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/sys_data_dictionary_item';
|
||||
)ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/sys_data_dictionary_item';
|
||||
|
||||
CREATE TABLE `ui_code_behavior_type_dic` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`behavior_type` varchar(255) DEFAULT NULL,
|
||||
`view_code` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_behavior_type_dic';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/code_behavior_type_dic';
|
||||
|
||||
CREATE TABLE `ui_code_browser_type_dic` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
@@ -144,7 +144,7 @@ CREATE TABLE `ui_code_browser_type_dic` (
|
||||
`view_code` varchar(255) DEFAULT NULL,
|
||||
`icon` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_browser_type_dic';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/code_browser_type_dic';
|
||||
|
||||
|
||||
CREATE TABLE `ui_code_os_type_dic` (
|
||||
@@ -153,7 +153,7 @@ CREATE TABLE `ui_code_os_type_dic` (
|
||||
`view_code` varchar(255) DEFAULT NULL,
|
||||
`icon` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_os_type_dic';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/code_os_type_dic';
|
||||
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ CREATE TABLE `ui_code_service_type_dic` (
|
||||
`service_type` varchar(255) DEFAULT '' COMMENT '业务类型',
|
||||
`view_code` varchar(255) DEFAULT NULL COMMENT '界面编码',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_service_type_dic';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/code_service_type_dic';
|
||||
|
||||
|
||||
CREATE TABLE `ui_code_web_service_dic` (
|
||||
@@ -182,7 +182,7 @@ CREATE TABLE `ui_code_web_service_dic` (
|
||||
`view_code` varchar(255) DEFAULT '',
|
||||
`icon` varchar(255) DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_web_service_dic';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/code_web_service_dic';
|
||||
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ CREATE TABLE `ui_service_dict_info` (
|
||||
`editor_id` int(11) DEFAULT NULL COMMENT '修改人员取自sys_user.id',
|
||||
`edit_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`service_dict_id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/service_dict_info';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/service_dict_info';
|
||||
|
||||
|
||||
CREATE TABLE `ui_request_info` (
|
||||
@@ -222,7 +222,7 @@ CREATE TABLE `ui_service_dict_info` (
|
||||
`task_id` bigint(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `request_info_request_number` (`request_number`) USING BTREE
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/request_info';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/request_info';
|
||||
|
||||
|
||||
CREATE TABLE `ui_task_info` (
|
||||
@@ -241,7 +241,7 @@ CREATE TABLE `ui_service_dict_info` (
|
||||
`audit_time` date DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `task_info_task_name` (`task_name`) USING BTREE
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/task_info';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/task_info';
|
||||
|
||||
|
||||
CREATE TABLE `ui_config_group_info` (
|
||||
@@ -254,7 +254,7 @@ CREATE TABLE `ui_service_dict_info` (
|
||||
`group_type` int(11) DEFAULT NULL COMMENT '1:协议,2:内容,3:区域 ,4 asn',
|
||||
`compile_id` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/config_group_info';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/config_group_info';
|
||||
|
||||
CREATE TABLE `ui_website_domain_topic` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
@@ -267,7 +267,7 @@ CREATE TABLE `ui_service_dict_info` (
|
||||
`desc` varchar(400) DEFAULT NULL COMMENT '描述信息',
|
||||
`creator_id` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/website_domain_topic';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/website_domain_topic';
|
||||
|
||||
|
||||
|
||||
@@ -307,4 +307,4 @@ CREATE TABLE `ui_http_url_cfg` (
|
||||
`user_region4` varchar(1024) DEFAULT '' COMMENT '预留自定义域4',
|
||||
`user_region5` varchar(1024) DEFAULT '' COMMENT '预留自定义域5',
|
||||
PRIMARY KEY (`cfg_id`)
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/http_url_cfg';
|
||||
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/http_url_cfg';
|
||||
@@ -8,20 +8,26 @@ import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.nis.domain.restful.dashboard.TrafficHttpStatistic;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface TrafficHttpStatisticDao {
|
||||
TrafficHttpStatistic getMaxStatTime();
|
||||
|
||||
List<TrafficHttpStatistic> websiteList(@Param("statTime") Date statTime);
|
||||
|
||||
// 获取域名分类之后属于的网站
|
||||
List<TrafficHttpStatistic> getDomainByWebsiteList(@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);
|
||||
List<Map> getDomainByWebsiteList(@Param("statTime") Date statTime, @Param("endTime") Date endTime);
|
||||
|
||||
List<Map> preWebsiteListCount(@Param("statTime") Date statTime, @Param("endTime") Date endTime);
|
||||
|
||||
List<Map> getDomainByWebsiteServiceId(@Param("webIdList") List webIdList,@Param("statTime") Date statTime, @Param("endTime") Date endTime);
|
||||
|
||||
Map websiteDomainOthers(@Param("webIdList") List webIdList, @Param("statTime") Date statTime,
|
||||
@Param("endTime") Date endTime);
|
||||
|
||||
List<Map> getDomainByTopicList(@Param("statTime") Date statTime, @Param("endTime") Date endTime);
|
||||
|
||||
List<Map> getUiWebsiteDomainTopicList( );
|
||||
|
||||
List<Map> getDomainByTopicId(@Param("statTime") Date statTime, @Param("endTime") Date endTime);
|
||||
|
||||
List getIdByWebSiteId(@Param("websiteId") Integer websiteId);
|
||||
}
|
||||
@@ -19,27 +19,33 @@
|
||||
property="statTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
stat_id, web_type, web_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len,
|
||||
stat_id, web_type, web_id, c2s_pkt_num, s2c_pkt_num,
|
||||
c2s_byte_len,
|
||||
s2c_byte_len,
|
||||
stat_time
|
||||
</sql>
|
||||
<!-- 获取最近时间并且有效 -->
|
||||
<select id="getMaxStatTime"
|
||||
resultType="com.nis.domain.restful.dashboard.TrafficHttpStatistic">
|
||||
SELECT stat_time statTime FROM traffic_http_statistic order by stat_time
|
||||
SELECT stat_time statTime FROM traffic_http_statistic order
|
||||
by stat_time
|
||||
desc limit 1
|
||||
</select>
|
||||
<!-- 根据服务网站将域名分类 网站列表 -->
|
||||
<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
|
||||
where t.stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
GROUP BY u.website_service_id ORDER BY count desc limit 0,10
|
||||
resultType="java.util.HashMap">
|
||||
SELECT
|
||||
IFNULL(
|
||||
website_service_id,
|
||||
268435455
|
||||
) websiteServiceId,
|
||||
id
|
||||
FROM
|
||||
ui_website_domain_topic t group by website_service_id,id
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!-- 根据主题将域名分类 主题列表 最近五分钟top10 -->
|
||||
<select id="getDomainByTopicList" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
@@ -53,12 +59,11 @@
|
||||
</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
|
||||
WHERE u.website_service_id=#{websiteServiceId}
|
||||
and stat_time < DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
and stat_time > DATE_SUB(#{statTime},INTERVAL 2 hour)
|
||||
<select id="preWebsiteListCount" resultType="java.util.HashMap">
|
||||
select web_id webId, SUM(c2s_byte_len + s2c_byte_len) count from
|
||||
traffic_http_statistic t where
|
||||
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} group by t.web_id ]]>
|
||||
|
||||
</select>
|
||||
|
||||
<!--获取网站列表列表 -->
|
||||
@@ -70,13 +75,29 @@
|
||||
<!-- 根据网站分组获取子域名 -->
|
||||
<select id="getDomainByWebsiteServiceId"
|
||||
resultType="java.util.HashMap">
|
||||
SELECT web_id webId,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
|
||||
where u.website_service_id=#{websiteServiceId}
|
||||
and t.stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
GROUP BY t.web_id ORDER BY count desc limit 0,10
|
||||
SELECT
|
||||
web_id webId,
|
||||
SUM(c2s_byte_len + s2c_byte_len) count
|
||||
FROM
|
||||
traffic_http_statistic t where
|
||||
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} ]]>
|
||||
<if test="webIdList!=null and webIdList.size()>0">
|
||||
and web_id in
|
||||
<foreach collection="webIdList" item="singleType"
|
||||
index="index" open="(" close=")" separator=",">
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
group by t.web_id
|
||||
</select>
|
||||
|
||||
<select id="getIdByWebSiteId"
|
||||
resultType="java.lang.String">
|
||||
SELECT
|
||||
distinct id FROM ui_website_domain_topic where website_service_id= #{websiteId}
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 根据主题分组获取子域名 -->
|
||||
<select id="getDomainByTopicId" resultType="java.util.HashMap">
|
||||
select web_id webId,sum(c2s_byte_len + s2c_byte_len) count from
|
||||
@@ -91,9 +112,8 @@
|
||||
<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
|
||||
where u.website_service_id=#{websiteServiceId}
|
||||
|
||||
where
|
||||
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} ]]>
|
||||
<if test="webIdList!=null and webIdList.size()>0">
|
||||
and t.web_id not in
|
||||
<foreach collection="webIdList" item="singleType"
|
||||
@@ -101,6 +121,6 @@
|
||||
#{singleType}
|
||||
</foreach>
|
||||
</if>
|
||||
and stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour)
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -466,32 +466,32 @@ public class DashboardService extends BaseService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Map> websiteList() {
|
||||
List<Map> result = new ArrayList<Map>();
|
||||
TrafficHttpStatistic maxStatTime = trafficHttpStatisticDao.getMaxStatTime();
|
||||
if (maxStatTime != null) {
|
||||
List<TrafficHttpStatistic> list = trafficHttpStatisticDao.websiteList(maxStatTime.getStatTime());
|
||||
Long preCount = 0l;
|
||||
if (list != null && list.size() > 0) {
|
||||
for (TrafficHttpStatistic website : list) {
|
||||
Map map = new HashMap();
|
||||
map.put("webId", website.getWebId());
|
||||
map.put("count", website.getCount());
|
||||
map.put("pktNum", 0);
|
||||
map.put("byteLen", 0);
|
||||
preCount = trafficHttpStatisticDao.preWebsiteListCount(website.getWebId(),
|
||||
maxStatTime.getStatTime());// 上个时段的量 用于与现在对比
|
||||
if (preCount != null) {
|
||||
map.put("preCount", preCount);
|
||||
} else {
|
||||
map.put("preCount", 0);
|
||||
}
|
||||
result.add(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// public List<Map> websiteList() {
|
||||
// List<Map> result = new ArrayList<Map>();
|
||||
// TrafficHttpStatistic maxStatTime = trafficHttpStatisticDao.getMaxStatTime();
|
||||
// if (maxStatTime != null) {
|
||||
// List<TrafficHttpStatistic> list = trafficHttpStatisticDao.websiteList(maxStatTime.getStatTime());
|
||||
// Long preCount = 0l;
|
||||
// if (list != null && list.size() > 0) {
|
||||
// for (TrafficHttpStatistic website : list) {
|
||||
// Map map = new HashMap();
|
||||
// map.put("webId", website.getWebId());
|
||||
// map.put("count", website.getCount());
|
||||
// map.put("pktNum", 0);
|
||||
// map.put("byteLen", 0);
|
||||
// preCount = trafficHttpStatisticDao.preWebsiteListCount(website.getWebId(),
|
||||
// maxStatTime.getStatTime());// 上个时段的量 用于与现在对比
|
||||
// if (preCount != null) {
|
||||
// map.put("preCount", preCount);
|
||||
// } else {
|
||||
// map.put("preCount", 0);
|
||||
// }
|
||||
// result.add(map);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 根据网站服务查询子域名
|
||||
@@ -500,28 +500,53 @@ public class DashboardService extends BaseService {
|
||||
* @return list
|
||||
*/
|
||||
public List<Map> getDomainByWebsiteServiceId(Integer websiteServiceId) {
|
||||
List<Map> list = new ArrayList<Map>();
|
||||
TrafficHttpStatistic maxStatTime = trafficHttpStatisticDao.getMaxStatTime();
|
||||
if (maxStatTime != null) {
|
||||
Date statTime = maxStatTime.getStatTime();
|
||||
list = trafficHttpStatisticDao.getDomainByWebsiteServiceId(websiteServiceId, statTime);
|
||||
List webIdList = new ArrayList();
|
||||
// 查询固定网站下的域名除了TOP10以外的others域名
|
||||
if (list != null && list.size() > 0) {
|
||||
for (Map map : list) {
|
||||
webIdList.add(map.get("webId"));
|
||||
|
||||
Date statTime = getBeforeByHourTime(1);// 获取上一个小时
|
||||
|
||||
List idList = trafficHttpStatisticDao.getIdByWebSiteId(websiteServiceId);
|
||||
|
||||
List<Map> matchList = trafficHttpStatisticDao.getDomainByWebsiteServiceId(idList, statTime, new Date());// 获取webid和count的对应关系,key是webid,val是count
|
||||
// 获取webid和count的对应关系,key是webid,val是count
|
||||
Set<Long> set = new HashSet<>();
|
||||
Map<Long, List<Map>> countMap = new HashMap();// 存储count和map的对应关系,后面根据count过滤,获取top10的count
|
||||
for (Map map : matchList) {
|
||||
String countStr = String.valueOf(map.get("count"));
|
||||
long count = Long.parseLong(countStr);
|
||||
set.add(count);
|
||||
if (countMap.containsKey(count)) {// 将每个count和对应的viewmap放到map中,count可能相同所以value是list
|
||||
countMap.get(count).add(map);
|
||||
} else {
|
||||
List<Map> listMap = new ArrayList<>();
|
||||
listMap.add(map);
|
||||
countMap.put(count, listMap);
|
||||
}
|
||||
if (list.size() > 10) {
|
||||
Map others = new HashMap();
|
||||
others = trafficHttpStatisticDao.websiteDomainOthers(webIdList, websiteServiceId, statTime);
|
||||
}
|
||||
List<Map> top10Data = getTop10Data(set, countMap);
|
||||
List<String> notTop10List = new ArrayList<>();// 获取不在top10中的webid,用来查询标记为orther
|
||||
for (Map map : matchList) {
|
||||
String webIdStr = String.valueOf(map.get("webId"));
|
||||
boolean exist = false;
|
||||
for (Map map1 : top10Data) {
|
||||
String webIdStr1 = String.valueOf(map1.get("webId"));
|
||||
if (webIdStr1 != null && webIdStr != null && webIdStr1.equals(webIdStr)) {
|
||||
exist = true;
|
||||
}
|
||||
if (!exist) {
|
||||
notTop10List.add(webIdStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 查询固定网站下的域名除了TOP10以外的others域名
|
||||
if (matchList != null && matchList.size() > 10) {
|
||||
Map others = trafficHttpStatisticDao.websiteDomainOthers(notTop10List, statTime, new Date());
|
||||
if (others != null && others.size() > 0) {
|
||||
others.put("webId", "-1");
|
||||
list.add(others);
|
||||
top10Data.add(others);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
return top10Data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -531,31 +556,71 @@ public class DashboardService extends BaseService {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Map> getDomainByWebsiteList() {
|
||||
List<Map> result = new ArrayList<Map>();
|
||||
TrafficHttpStatistic maxStatTime = trafficHttpStatisticDao.getMaxStatTime();
|
||||
if (maxStatTime != null) {
|
||||
Date statTime = maxStatTime.getStatTime();
|
||||
List<TrafficHttpStatistic> websiteList = trafficHttpStatisticDao.getDomainByWebsiteList(statTime);
|
||||
if (websiteList != null && websiteList.size() > 0) {
|
||||
Long preCount = 0l;
|
||||
for (TrafficHttpStatistic website : websiteList) {
|
||||
Map map = new HashMap();
|
||||
map.put("websiteServiceId", website.getWesiteServiceId());
|
||||
map.put("count", website.getCount());
|
||||
map.put("pktNum", 0);
|
||||
map.put("byteLen", 0);
|
||||
preCount = trafficHttpStatisticDao.preWebsiteListCount(website.getWesiteServiceId(), statTime);// 上个时段的量
|
||||
// 用于与现在对比
|
||||
if (preCount != null) {
|
||||
map.put("preCount", preCount);
|
||||
Date statTime = getBeforeByHourTime(1);// 获取上一个小时
|
||||
Map<String, List<String>> websiteIdAndIdMap = new HashMap<>();// 存储websiteServiceId和id的对应关系,一个websiteServiceId有多个id
|
||||
List<Map> websiteIdAndidList = trafficHttpStatisticDao.getDomainByWebsiteList(statTime, new Date());// 获取website_service_id和id的对应关系,group
|
||||
// by
|
||||
// website_service_id,id
|
||||
for (Map map : websiteIdAndidList) {
|
||||
Object websiteServiceIdObj = map.get("websiteServiceId");
|
||||
Object idObj = map.get("id");
|
||||
if (websiteServiceIdObj != null && idObj != null) {
|
||||
if (websiteIdAndIdMap.containsKey(String.valueOf(websiteServiceIdObj))) {
|
||||
websiteIdAndIdMap.get(String.valueOf(websiteServiceIdObj)).add(String.valueOf(idObj));
|
||||
} else {
|
||||
map.put("preCount", 0);
|
||||
}
|
||||
result.add(map);
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(String.valueOf(idObj));
|
||||
websiteIdAndIdMap.put(String.valueOf(websiteServiceIdObj), list);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
Set<Long> set = new HashSet<>();
|
||||
Map<Long, List<Map>> countAndViewMap = new HashMap<>();// 存储count和map的对应关系,后面根据count过滤,获取top10的count
|
||||
List<Map> webIdAndCountList = trafficHttpStatisticDao.preWebsiteListCount(statTime, new Date());// 获取最近一小时的webid和count的关系
|
||||
List<Map> prevWebIdAndCountList = trafficHttpStatisticDao.preWebsiteListCount(getBeforeByHourTime(2), statTime);// 获取最近一小时的webid和count的关系
|
||||
for (String websiteServiceId : websiteIdAndIdMap.keySet()) {// 遍历上面获取的websiteServiceId和id的对应关系,拼接json
|
||||
Map viewMap = new HashMap<>();
|
||||
long count = 0l;// 记录当前websiteServiceId所有的count
|
||||
long prevCount = 0l;// 记录当前websiteServiceId所有的count
|
||||
List<String> idList = websiteIdAndIdMap.get(websiteServiceId);// 根据websiteServiceId获取对应的id
|
||||
for (String id : idList) {
|
||||
for (Map webIdAndCountMap : webIdAndCountList) {// 遍历webid和count
|
||||
String webId = String.valueOf(webIdAndCountMap.get("webId"));
|
||||
if (webId != null && webId.equals(id)) {// 如果webid和id相等则获取count数据并统计
|
||||
String countStr = String.valueOf(webIdAndCountMap.get("count"));
|
||||
if (countStr != null) {
|
||||
count += Long.parseLong(countStr);// 将count累加
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Map webIdAndCountMap : prevWebIdAndCountList) {// 遍历webid和count
|
||||
String webId = String.valueOf(webIdAndCountMap.get("webId"));
|
||||
if (webId != null && webId.equals(id)) {// 如果webid和id相等则获取count数据并统计
|
||||
String countStr = String.valueOf(webIdAndCountMap.get("count"));
|
||||
if (countStr != null) {
|
||||
prevCount += Long.parseLong(countStr);// 将count累加
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
viewMap.put("websiteServiceId", websiteServiceId);
|
||||
viewMap.put("count", count);
|
||||
viewMap.put("pktNum", 0);
|
||||
viewMap.put("byteLen", 0);
|
||||
viewMap.put("preCount", prevCount);
|
||||
|
||||
if (countAndViewMap.containsKey(count)) {// 将每个count和对应的viewmap放到map中,count可能相同所以value是list
|
||||
countAndViewMap.get(count).add(viewMap);
|
||||
} else {
|
||||
List<Map> listMap = new ArrayList<>();
|
||||
listMap.add(viewMap);
|
||||
countAndViewMap.put(count, listMap);
|
||||
}
|
||||
set.add(count);
|
||||
}
|
||||
return getTop10Data(set, countAndViewMap);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -616,6 +681,4 @@ public class DashboardService extends BaseService {
|
||||
return getTop10Data(set, countAndViewMap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ tapRedisDb=5
|
||||
#0x205 基于PXY IP替换 517
|
||||
#0x402 APP DOMAIN特征发现 1026
|
||||
#0x404 APP IP特征 1028
|
||||
maat2Valve=33:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;512:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;513:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;514:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;515:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;517:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1026:strRegion|strStrRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1028:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;5:ipRegion@COMPILE_ID&USER_REGION&EFFECTIVE_RANGE
|
||||
maat2Valve=33:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;512:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;513:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;514:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;515:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;517:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1026:strRegion|strStrRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1028:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1040:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1056:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;5:ipRegion@COMPILE_ID&USER_REGION&EFFECTIVE_RANGE
|
||||
|
||||
##记录哪些service可以被分组复用(只有maat类配置可以被分组复用)
|
||||
#业务ID:域类型1@表名,表名|域类型2@表名;业务ID:域类型1@表名,表名|域类型2@表名
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<t:field fieldType="Number" srcName="isValid" dstName="is_valid" isRequired="true" regexp="[1]"/>
|
||||
<t:field fieldType="String" srcName="effectiveRange" dstName="effective_range" isRequired="true"/>
|
||||
<t:field fieldType="Date" srcName="opTime" dstName="op_time" isRequired="true"/>
|
||||
<t:field fieldType="String" srcName="userRegion" dstName="user_region" defaultVal="0"/>
|
||||
</t:commonSource>
|
||||
<!--
|
||||
#0x05 DDOS流量丢弃 5=0:DDOS_PROTECT_TARGET_IP_CB
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<p:maatType service="3;4;25;28;274">
|
||||
<p:expressions>
|
||||
<p:keyExpression>EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id]</p:keyExpression>
|
||||
<p:valueExpression>[cfg_id];\t;0;\t;[addr_type];\t;[src_ip];\t;[mask_src_ip];\t;[src_port];\t;[mask_src_port];\t;[dst_ip];\t;[mask_dst_ip];\t;[dst_port];\t;[mask_dst_port];\t;[protocol];\t;[direction];\t;[is_valid];\t;[action];\t;[service];\t;[effective_range];\t;[op_time];&nbsp;0;\n</p:valueExpression>
|
||||
<p:valueExpression>[cfg_id];\t;0;\t;[addr_type];\t;[src_ip];\t;[mask_src_ip];\t;[src_port];\t;[mask_src_port];\t;[dst_ip];\t;[mask_dst_ip];\t;[dst_port];\t;[mask_dst_port];\t;[protocol];\t;[direction];\t;[is_valid];\t;[action];\t;[service];\t;[user_region];\t;[effective_range];\t;[op_time];&nbsp;0;\n</p:valueExpression>
|
||||
</p:expressions>
|
||||
<p:sequences>
|
||||
<p:operation>1</p:operation>
|
||||
|
||||
Reference in New Issue
Block a user