Kaynağa Gözat

内容类阈值类修改

王辉 4 gün önce
ebeveyn
işleme
5372a0efa4

+ 29 - 28
src/main/java/cn/chinaunicom/omniFlowNetCompute/service/impl/DashboardServiceImpl.java

@@ -25,20 +25,19 @@ public class DashboardServiceImpl implements DashboardService {
         // 1. 总告警数
         List<Long> alarmCounts = dashboardMapper.getTotalAlarmCounts(month);
         Long totalAlarms = alarmCounts.stream().mapToLong(Long::longValue).sum();
-        dashboard.setTotalAlarms(totalAlarms);
 
         // 2. 已办理未办理
         AlarmStatusDTO untreatedAndProcessedCounts = dashboardMapper.getUntreatedAndProcessedCounts(month);
-        dashboard.setTotalUntreated(untreatedAndProcessedCounts != null ? untreatedAndProcessedCounts.getUntreated() : 0L);
-        dashboard.setTotalProcessed(untreatedAndProcessedCounts != null ? untreatedAndProcessedCounts.getProcessed() : 0L);
 
         // 3. 内容性告警
         Long contentAlarms = dashboardMapper.getContentAlarmCount(month);
-        dashboard.setToralContentAlarms(contentAlarms != null ? contentAlarms : 0L);
+        dashboard.setTotalThresholdAlarms(contentAlarms != null ? contentAlarms : 0L);
+
 
         // 4. 阈值类告警
         Long thresholdAlarms = dashboardMapper.getThresholdAlarmCount(month);
-        dashboard.setTotalThresholdAlarms(thresholdAlarms != null ? thresholdAlarms : 0L);
+        dashboard.setToralContentAlarms(thresholdAlarms != null ? thresholdAlarms : 0L);
+
 
         // 5. 存在性告警 - 系统统计和总量统计
         List<SystemExistenceStatsDTO> systemExistenceStats = calculateSystemExistenceAlarms(month);
@@ -46,7 +45,9 @@ public class DashboardServiceImpl implements DashboardService {
                 .mapToLong(SystemExistenceStatsDTO::getExistenceAlarms)
                 .sum();
         dashboard.setExistenceAlarms(totalExistenceAlarms);
-
+        dashboard.setTotalAlarms(totalAlarms+totalExistenceAlarms);
+        dashboard.setTotalProcessed(untreatedAndProcessedCounts != null ? untreatedAndProcessedCounts.getProcessed() : 0L);
+        dashboard.setTotalUntreated(dashboard.getTotalAlarms()-dashboard.getTotalProcessed());
         // 6. 系统统计列表
         List<SystemStatsDetailVO> systemStats = dashboardMapper.getSystemStatsDetail(month);
 
@@ -59,6 +60,8 @@ public class DashboardServiceImpl implements DashboardService {
 
         for (SystemStatsDetailVO stat : systemStats) {
             stat.setExistenceAlarms(existenceMap.getOrDefault(stat.getSystemId(), 0L));
+            stat.setTotalAlarms(stat.getTotalAlarms()+stat.getExistenceAlarms());
+            stat.setUntreatedCount(stat.getTotalAlarms()-stat.getProcessedCount());
         }
 
         dashboard.setSystemStats(systemStats);
@@ -178,29 +181,27 @@ public class DashboardServiceImpl implements DashboardService {
         MetricCategoryVO vo = new MetricCategoryVO();
 
         // 内容类
-        ContentMetricVO content = new ContentMetricVO();
-        content.setTotalSystems(5);
-
-        List<String> contentConfigured = dashboardMapper.getContentConfiguredSystems();
-        content.setConfiguredCount(contentConfigured.size());
-        content.setUnconfiguredCount(5 - contentConfigured.size());
-
-        List<String> contentHasData = dashboardMapper.getContentHasDataSystems();
-        content.setNoDataCount(content.getConfiguredCount() - contentHasData.size());
-        vo.setContent(content);
-
-        // 阈值类
         ThresholdMetricVO threshold = new ThresholdMetricVO();
         threshold.setTotalSystems(5);
 
-        List<String> thresholdConfigured = dashboardMapper.getThresholdConfiguredSystems();
+        List<String> thresholdConfigured = dashboardMapper.getContentConfiguredSystems();
         threshold.setConfiguredCount(thresholdConfigured.size());
         threshold.setUnconfiguredCount(5 - thresholdConfigured.size());
 
-        List<String> thresholdHasData = dashboardMapper.getThresholdHasDataSystems();
-        threshold.setNoDataCount(threshold.getConfiguredCount() - thresholdHasData.size());
+        List<String> contentHasData = dashboardMapper.getContentHasDataSystems();
+        threshold.setNoDataCount(threshold.getConfiguredCount() - contentHasData.size());
         vo.setThreshold(threshold);
 
+        // 阈值类
+        ContentMetricVO content = new ContentMetricVO();
+        content.setTotalSystems(5);
+
+        List<String> contentConfigured = dashboardMapper.getThresholdConfiguredSystems();
+        content.setConfiguredCount(contentConfigured.size());
+        content.setUnconfiguredCount(5 - contentConfigured.size());
+        List<String> thresholdHasData = dashboardMapper.getThresholdHasDataSystems();
+        content.setNoDataCount(content.getConfiguredCount() - thresholdHasData.size());
+        vo.setContent(content);
         return vo;
     }
 
@@ -247,10 +248,10 @@ public class DashboardServiceImpl implements DashboardService {
 
         for (String date : dates) {
             // 内容类
-            contentCounts.add(contentMap.getOrDefault(date, 0L));
+            contentCounts.add(thresholdMap.getOrDefault(date, 0L));
 
             // 阈值类
-            thresholdCounts.add(thresholdMap.getOrDefault(date, 0L));
+            thresholdCounts.add(contentMap.getOrDefault(date, 0L));
 
             // 存在性 - 每天应发-实发
             long dailyMissedCount = 0L;
@@ -300,14 +301,14 @@ public class DashboardServiceImpl implements DashboardService {
 
         // 2. 获取7天内内容类告警数量(cus_db_monitor)
         List<SystemCategoryVO> contentAlarms = dashboardMapper.getContentAlarmCountLast7Days();
-        Map<String, Long> contentMap = contentAlarms.stream()
+        // 3. 获取7天内阈值类告警数量(其他四个表)
+        List<SystemCategoryVO> thresholdAlarms = dashboardMapper.getThresholdAlarmCountLast7Days();
+
+        Map<String, Long> contentMap = thresholdAlarms.stream()
                 .collect(Collectors.toMap(SystemCategoryVO::getSystemId,
                         SystemCategoryVO::getContentCount,
                         (v1, v2) -> v1));
-
-        // 3. 获取7天内阈值类告警数量(其他四个表)
-        List<SystemCategoryVO> thresholdAlarms = dashboardMapper.getThresholdAlarmCountLast7Days();
-        Map<String, Long> thresholdMap = thresholdAlarms.stream()
+        Map<String, Long> thresholdMap = contentAlarms.stream()
                 .collect(Collectors.toMap(SystemCategoryVO::getSystemId,
                         SystemCategoryVO::getThresholdCount,
                         (v1, v2) -> v1));

+ 12 - 12
src/main/resources/mapper/omni/DashboardMapper.xml

@@ -150,11 +150,11 @@
                COALESCE(ipm.untreated, 0) + COALESCE(tm.untreated, 0) as untreatedCount,
                
                -- 内容类告警(数据库监控)
-               COALESCE(dbm.total, 0)                                 as contentAlarms,
+               COALESCE(dbm.total, 0)                                 as thresholdAlarms,
                
                -- 阈值类告警(权限+连接+异常IP+定时任务)
                COALESCE(pm.total, 0) + COALESCE(cm.total, 0) +
-               COALESCE(ipm.total, 0) + COALESCE(tm.total, 0)         as thresholdAlarms,
+               COALESCE(ipm.total, 0) + COALESCE(tm.total, 0)         as contentAlarms,
                
                -- 各监控类型数量
                COALESCE(pm.total, 0)                                  as permissionCount,
@@ -283,7 +283,7 @@
                      (SELECT system_name FROM sec_system_info WHERE system_id = t.system_id) as systemName,
                      t.alarm_status                                                          as alarmStatus,
                      t.trigger_time                                                          as triggerTime,
-                     '内容类'                                                                as category
+                     '阈值类'                                                                as category
               FROM cus_db_monitor t
               WHERE t.alarm_status = 'untreated'
               
@@ -295,7 +295,7 @@
                      (SELECT system_name FROM sec_system_info WHERE system_id = t.system_id) as systemName,
                      t.alert_status                                                          as alarmStatus,
                      t.trigger_time                                                          as triggerTime,
-                     '阈值类'                                                                as category
+                     '内容类'                                                                as category
               FROM sec_permission_monitor t
               WHERE t.alert_status = 'untreated'
               
@@ -307,7 +307,7 @@
                      (SELECT system_name FROM sec_system_info WHERE system_id = t.system_id) as systemName,
                      t.alarm_status                                                          as alarmStatus,
                      t.trigger_time                                                          as triggerTime,
-                     '阈值类'                                                                as category
+                     '内容类'                                                                as category
               FROM cus_internal_connect_monitor t
               WHERE t.alarm_status = 'untreated'
               
@@ -319,7 +319,7 @@
                      (SELECT system_name FROM sec_system_info WHERE system_id = t.system_id) as systemName,
                      t.alarm_status                                                          as alarmStatus,
                      t.trigger_time                                                          as triggerTime,
-                     '阈值类'                                                                as category
+                     '内容类'                                                                as category
               FROM cus_ip_abnormal_monitor t
               WHERE t.alarm_status = 'untreated'
               
@@ -331,7 +331,7 @@
                      (SELECT system_name FROM sec_system_info WHERE system_id = t.system_id) as systemName,
                      t.alarm_status                                                          as alarmStatus,
                      t.trigger_time                                                          as triggerTime,
-                     '阈值类'                                                                as category
+                     '内容类'                                                                as category
               FROM cus_task_exception_monitor t
               WHERE t.alarm_status = 'untreated') t
         ORDER BY t.triggerTime DESC
@@ -342,7 +342,7 @@
     <select id="getMonitorPointCounts" resultType="cn.chinaunicom.omniFlowNetCompute.pojo.MonitorPointCountVO">
         SELECT '数据库监控'     as monitorName,
                'cus_db_monitor' as tableName,
-               '内容类'         as category,
+               '阈值类'         as category,
                COUNT(*)         as count
         FROM cus_db_monitor
         WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
@@ -351,7 +351,7 @@
         
         SELECT '用户权限变更监控',
                'sec_permission_monitor',
-               '阈值类',
+               '内容类',
                COUNT(*)
         FROM sec_permission_monitor
         WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
@@ -360,7 +360,7 @@
         
         SELECT '系统内部连接性监控',
                'cus_internal_connect_monitor',
-               '阈值类',
+               '内容类',
                COUNT(*)
         FROM cus_internal_connect_monitor
         WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
@@ -369,7 +369,7 @@
         
         SELECT '异常IP访问监控',
                'cus_ip_abnormal_monitor',
-               '阈值类',
+               '内容类',
                COUNT(*)
         FROM cus_ip_abnormal_monitor
         WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
@@ -378,7 +378,7 @@
         
         SELECT '定时任务异常监控',
                'cus_task_exception_monitor',
-               '阈值类',
+               '内容类',
                COUNT(*)
         FROM cus_task_exception_monitor
         WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)