diff --git a/db/init/galaxy_stru_ui_mysql.sql b/db/init/galaxy_stru_ui_mysql.sql index 409505e..a303340 100644 --- a/db/init/galaxy_stru_ui_mysql.sql +++ b/db/init/galaxy_stru_ui_mysql.sql @@ -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'; \ No newline at end of file + ) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@10.0.4.6:3306/ntc_db/http_url_cfg'; \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.java b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.java index 7e61d1a..28b4f80 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.java +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.java @@ -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 websiteList(@Param("statTime")Date statTime); - - //获取域名分类之后属于的网站 - List getDomainByWebsiteList(@Param("statTime")Date statTime); - Long preWebsiteListCount(@Param("websiteServiceId") Integer websiteServiceId,@Param("statTime") Date statTime); - List getDomainByWebsiteServiceId(@Param("websiteServiceId") Integer websiteServiceId,@Param("statTime") Date statTime); - Map websiteDomainOthers(@Param("webIdList") List webIdList,@Param("websiteServiceId") Integer websiteServiceId,@Param("statTime") Date statTime); - List getDomainByTopicList(@Param("statTime") Date statTime,@Param("endTime")Date endTime); - - List getUiWebsiteDomainTopicList( ); + List websiteList(@Param("statTime") Date statTime); - List getDomainByTopicId( @Param("statTime")Date statTime ,@Param("endTime")Date endTime); + // 获取域名分类之后属于的网站 + List getDomainByWebsiteList(@Param("statTime") Date statTime, @Param("endTime") Date endTime); + + List preWebsiteListCount(@Param("statTime") Date statTime, @Param("endTime") Date endTime); + + List 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 getDomainByTopicList(@Param("statTime") Date statTime, @Param("endTime") Date endTime); + + List getDomainByTopicId(@Param("statTime") Date statTime, @Param("endTime") Date endTime); + + List getIdByWebSiteId(@Param("websiteId") Integer websiteId); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml index d229a7e..978b373 100644 --- a/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml +++ b/src/main/java/com/nis/web/dao/dashboard/TrafficHttpStatisticDao.xml @@ -19,27 +19,33 @@ property="statTime" /> - 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 + + - + select web_id webId, SUM(c2s_byte_len + s2c_byte_len) count from + traffic_http_statistic t where + = #{statTime} and stat_time< #{endTime} group by t.web_id ]]> + @@ -70,13 +75,29 @@ + + + + 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 + = #{statTime} and stat_time< #{endTime} ]]> and t.web_id not in - and stat_time > DATE_SUB(#{statTime},INTERVAL 1 hour) + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/restful/DashboardService.java b/src/main/java/com/nis/web/service/restful/DashboardService.java index 341db09..f3fcdc7 100644 --- a/src/main/java/com/nis/web/service/restful/DashboardService.java +++ b/src/main/java/com/nis/web/service/restful/DashboardService.java @@ -466,32 +466,32 @@ public class DashboardService extends BaseService { return list; } - public List websiteList() { - List result = new ArrayList(); - TrafficHttpStatistic maxStatTime = trafficHttpStatisticDao.getMaxStatTime(); - if (maxStatTime != null) { - List 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 websiteList() { +// List result = new ArrayList(); +// TrafficHttpStatistic maxStatTime = trafficHttpStatisticDao.getMaxStatTime(); +// if (maxStatTime != null) { +// List 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 getDomainByWebsiteServiceId(Integer websiteServiceId) { - List list = new ArrayList(); - 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 matchList = trafficHttpStatisticDao.getDomainByWebsiteServiceId(idList, statTime, new Date());// 获取webid和count的对应关系,key是webid,val是count +// 获取webid和count的对应关系,key是webid,val是count + Set set = new HashSet<>(); + 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 listMap = new ArrayList<>(); + listMap.add(map); + countMap.put(count, listMap); + } + } + List top10Data = getTop10Data(set, countMap); + List 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 (list.size() > 10) { - Map others = new HashMap(); - others = trafficHttpStatisticDao.websiteDomainOthers(webIdList, websiteServiceId, statTime); - if (others != null && others.size() > 0) { - others.put("webId", "-1"); - list.add(others); - } + if (!exist) { + notTop10List.add(webIdStr); } } } - return list; + + // 查询固定网站下的域名除了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"); + top10Data.add(others); + } + } + return top10Data; + } /** @@ -531,31 +556,71 @@ public class DashboardService extends BaseService { */ @SuppressWarnings("unchecked") public List getDomainByWebsiteList() { - List result = new ArrayList(); - TrafficHttpStatistic maxStatTime = trafficHttpStatisticDao.getMaxStatTime(); - if (maxStatTime != null) { - Date statTime = maxStatTime.getStatTime(); - List 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); - } else { - map.put("preCount", 0); - } - result.add(map); + Date statTime = getBeforeByHourTime(1);// 获取上一个小时 + Map> websiteIdAndIdMap = new HashMap<>();// 存储websiteServiceId和id的对应关系,一个websiteServiceId有多个id + List 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 { + List list = new ArrayList<>(); + list.add(String.valueOf(idObj)); + websiteIdAndIdMap.put(String.valueOf(websiteServiceIdObj), list); } } } - return result; + + Set set = new HashSet<>(); + Map> countAndViewMap = new HashMap<>();// 存储count和map的对应关系,后面根据count过滤,获取top10的count + List webIdAndCountList = trafficHttpStatisticDao.preWebsiteListCount(statTime, new Date());// 获取最近一小时的webid和count的关系 + List 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 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 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); } - - } diff --git a/src/main/resources/applicationConfig-rule.properties b/src/main/resources/applicationConfig-rule.properties index 94410dd..bfc8515 100644 --- a/src/main/resources/applicationConfig-rule.properties +++ b/src/main/resources/applicationConfig-rule.properties @@ -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@表名 diff --git a/src/main/resources/commonSources/applicationConfig-parser.xml b/src/main/resources/commonSources/applicationConfig-parser.xml index 444abbd..7348fbc 100644 --- a/src/main/resources/commonSources/applicationConfig-parser.xml +++ b/src/main/resources/commonSources/applicationConfig-parser.xml @@ -29,6 +29,7 @@ +