Bläddra i källkod

告警统计和驾驶舱

王辉 2 veckor sedan
förälder
incheckning
15bc89e9c4
37 ändrade filer med 1493 tillägg och 59 borttagningar
  1. 10 0
      .idea/.gitignore
  2. 6 0
      .idea/ApifoxUploaderProjectSetting.xml
  3. 19 0
      .idea/compiler.xml
  4. 6 0
      .idea/encodings.xml
  5. 15 0
      .idea/inspectionProfiles/Project_Default.xml
  6. 20 0
      .idea/jarRepositories.xml
  7. 12 0
      .idea/misc.xml
  8. 6 0
      .idea/vcs.xml
  9. 11 0
      logs/monitoring.log
  10. BIN
      logs/monitoring.log.2026-02-11.0.gz
  11. 64 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/controller/DashboardController.java
  12. 0 1
      src/main/java/cn/chinaunicom/omniFlowNetCompute/controller/FreemarketController.java
  13. 0 1
      src/main/java/cn/chinaunicom/omniFlowNetCompute/controller/InspectionController.java
  14. 0 1
      src/main/java/cn/chinaunicom/omniFlowNetCompute/controller/OpportunityController.java
  15. 9 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/domain/SystemInfo.java
  16. 15 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/dto/AlarmStatusDTO.java
  17. 13 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/dto/DeliveryRecordDTO.java
  18. 10 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/dto/SystemExistenceStatsDTO.java
  19. 9 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/dto/SystemInfo.java
  20. 13 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/dto/SystemMetricConfigDTO.java
  21. 68 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/mapper/DashboardMapper.java
  22. 16 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/AlarmListVO.java
  23. 11 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/ContentMetricVO.java
  24. 19 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/DashboardNewVO.java
  25. 11 20
      src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/DashboardVO.java
  26. 9 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/DateCountVO.java
  27. 12 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/MetricCategoryVO.java
  28. 12 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/MonitorPointCountVO.java
  29. 13 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/SystemCategoryVO.java
  30. 10 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/SystemExistenceWeekVO.java
  31. 27 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/SystemStatsDetailVO.java
  32. 11 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/ThresholdMetricVO.java
  33. 14 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/TrendVO.java
  34. 7 32
      src/main/java/cn/chinaunicom/omniFlowNetCompute/service/DashboardService.java
  35. 373 0
      src/main/java/cn/chinaunicom/omniFlowNetCompute/service/impl/DashboardServiceImpl.java
  36. 155 4
      src/main/java/cn/chinaunicom/omniFlowNetCompute/until/ExcelExportUtil.java
  37. 487 0
      src/main/resources/mapper/omni/DashboardMapper.xml

+ 10 - 0
.idea/.gitignore

@@ -0,0 +1,10 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# 依赖于环境的 Maven 主目录路径
+/mavenHomeManager.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 6 - 0
.idea/ApifoxUploaderProjectSetting.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ApifoxUploaderProjectSetting">
+    <option name="apiAccessToken" value="APS-A4yGGLnDHA7XkVDipXRqJwyti82JxHAK" />
+  </component>
+</project>

+ 19 - 0
.idea/compiler.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <annotationProcessing>
+      <profile default="true" name="Default" enabled="true" />
+      <profile name="Maven default annotation processors profile" enabled="true">
+        <sourceOutputDir name="target/generated-sources/annotations" />
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
+        <outputRelativeToContentRoot value="true" />
+        <module name="omniFlowNetCompute" />
+      </profile>
+    </annotationProcessing>
+  </component>
+  <component name="JavacSettings">
+    <option name="ADDITIONAL_OPTIONS_OVERRIDE">
+      <module name="omniFlowNetCompute" options="-parameters" />
+    </option>
+  </component>
+</project>

+ 6 - 0
.idea/encodings.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
+  </component>
+</project>

+ 15 - 0
.idea/inspectionProfiles/Project_Default.xml

@@ -0,0 +1,15 @@
+<component name="InspectionProjectProfileManager">
+  <profile version="1.0">
+    <option name="myName" value="Project Default" />
+    <inspection_tool class="DuplicatedCode" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
+    <inspection_tool class="ExtractMethodRecommender" enabled="true" level="WARNING" enabled_by_default="true">
+      <option name="minLength" value="503" />
+    </inspection_tool>
+    <inspection_tool class="MisspelledHeader" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
+    <inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
+      <option name="processCode" value="true" />
+      <option name="processLiterals" value="true" />
+      <option name="processComments" value="true" />
+    </inspection_tool>
+  </profile>
+</component>

+ 20 - 0
.idea/jarRepositories.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RemoteRepositoriesConfiguration">
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Central Repository" />
+      <option name="url" value="https://repo.maven.apache.org/maven2" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Maven Central repository" />
+      <option name="url" value="https://repo1.maven.org/maven2" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="jboss.community" />
+      <option name="name" value="JBoss Community repository" />
+      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
+    </remote-repository>
+  </component>
+</project>

+ 12 - 0
.idea/misc.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
+  <component name="MavenProjectsManager">
+    <option name="originalFiles">
+      <list>
+        <option value="$PROJECT_DIR$/pom.xml" />
+      </list>
+    </option>
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
+</project>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 11 - 0
logs/monitoring.log


BIN
logs/monitoring.log.2026-02-11.0.gz


+ 64 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/controller/DashboardController.java

@@ -0,0 +1,64 @@
+package cn.chinaunicom.omniFlowNetCompute.controller;
+
+import cn.chinaunicom.omniFlowNetCompute.core.web.domain.AjaxResult;
+import cn.chinaunicom.omniFlowNetCompute.pojo.DashboardVO;
+import cn.chinaunicom.omniFlowNetCompute.service.DashboardService;
+import cn.chinaunicom.omniFlowNetCompute.until.DateUtil;
+import cn.chinaunicom.omniFlowNetCompute.until.ExcelExportUtil;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/stage-api/dashboard")
+@RequiredArgsConstructor
+public class DashboardController {
+
+    private final DashboardService dashboardService;
+
+    private final ExcelExportUtil excelExportUtil;
+
+    @GetMapping("/data")
+    public AjaxResult getDashboardData(@RequestParam(value = "month", required = false) String month) {
+        return AjaxResult.success(dashboardService.getDashboardData(month));
+    }
+
+    @GetMapping("/export")
+    public void export(@RequestParam(value = "month", required = false) String month, HttpServletResponse response) {
+        try {
+            if (month == null || month.isEmpty()) {
+                month = DateUtil.getCurrentMonth();
+            }
+            // 获取导出数据
+            final DashboardVO dashboardData = dashboardService.getDashboardData(month);
+            // 导出Excel
+            excelExportUtil.exportAlarmReportToExcelNew(response, month, dashboardData);
+
+        } catch (Exception e) {
+            try {
+                response.setContentType("application/json");
+                response.setCharacterEncoding("UTF-8");
+                Map<String, Object> errorResult = new HashMap<>();
+                errorResult.put("success", false);
+                errorResult.put("message", "导出失败:" + e.getMessage());
+                response.getWriter().write(new ObjectMapper().writeValueAsString(errorResult));
+            } catch (IOException ioException) {
+                ioException.printStackTrace();
+            }
+        }
+    }
+
+   @GetMapping("/dashboard")
+    public AjaxResult getDashboard() {
+        return AjaxResult.success(dashboardService.getDashboard());
+    }
+
+}

+ 0 - 1
src/main/java/cn/chinaunicom/omniFlowNetCompute/controller/FreemarketController.java

@@ -9,7 +9,6 @@ import cn.chinaunicom.omniFlowNetCompute.service.FreemarketService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import javax.validation.Valid;
 import java.util.List;
 
 @RestController

+ 0 - 1
src/main/java/cn/chinaunicom/omniFlowNetCompute/controller/InspectionController.java

@@ -8,7 +8,6 @@ import cn.chinaunicom.omniFlowNetCompute.domain.InspectionTask;
 import cn.chinaunicom.omniFlowNetCompute.service.InspectionService;
 import cn.chinaunicom.omniFlowNetCompute.until.ImageUtil;
 import lombok.RequiredArgsConstructor;
-import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 

+ 0 - 1
src/main/java/cn/chinaunicom/omniFlowNetCompute/controller/OpportunityController.java

@@ -9,7 +9,6 @@ import cn.chinaunicom.omniFlowNetCompute.service.OpportunityService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import javax.validation.Valid;
 import java.util.List;
 
 @RestController

+ 9 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/domain/SystemInfo.java

@@ -0,0 +1,9 @@
+package cn.chinaunicom.omniFlowNetCompute.domain;
+
+import lombok.Data;
+
+@Data
+class SystemInfo {
+    private String systemId;
+    private String systemName;
+}

+ 15 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/dto/AlarmStatusDTO.java

@@ -0,0 +1,15 @@
+package cn.chinaunicom.omniFlowNetCompute.dto;
+
+import lombok.Data;
+
+@Data
+public class AlarmStatusDTO {
+    /**
+     * 已处理
+     */
+    private Long untreated;
+    /**
+     * 未处理
+     */
+    private Long processed;
+}

+ 13 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/dto/DeliveryRecordDTO.java

@@ -0,0 +1,13 @@
+package cn.chinaunicom.omniFlowNetCompute.dto;
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+public class DeliveryRecordDTO {
+    private String date;          // 日期 MM-dd
+    private String systemId;      // 系统ID
+    private String metricType;    // 指标类型
+    private LocalDateTime reportTime; // 报送时间
+}

+ 10 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/dto/SystemExistenceStatsDTO.java

@@ -0,0 +1,10 @@
+package cn.chinaunicom.omniFlowNetCompute.dto;
+
+import lombok.Data;
+
+@Data
+public class SystemExistenceStatsDTO {
+    private String systemId;
+    private String systemName;
+    private Long existenceAlarms;
+}

+ 9 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/dto/SystemInfo.java

@@ -0,0 +1,9 @@
+package cn.chinaunicom.omniFlowNetCompute.dto;
+
+import lombok.Data;
+
+@Data
+public class SystemInfo {
+    private String systemId;
+    private String systemName;
+}

+ 13 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/dto/SystemMetricConfigDTO.java

@@ -0,0 +1,13 @@
+package cn.chinaunicom.omniFlowNetCompute.dto;
+
+import lombok.Data;
+
+@Data
+public class SystemMetricConfigDTO {
+    private String systemId;           // 系统ID
+    private String systemName;         // 系统名称
+    private String metricCode;         // 指标代码
+    private String metricType;         // 指标类型
+    private Integer reportInterval;    // 报送频率(分钟)
+    private String jsonName;          // JSON文件名
+}

+ 68 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/mapper/DashboardMapper.java

@@ -0,0 +1,68 @@
+package cn.chinaunicom.omniFlowNetCompute.mapper;
+
+import cn.chinaunicom.omniFlowNetCompute.dto.*;
+import cn.chinaunicom.omniFlowNetCompute.pojo.*;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface DashboardMapper {
+
+    // 1. 总告警数(所有监控表)
+    List<Long> getTotalAlarmCounts(@Param("month") String month);
+
+    // 2.查询已处理 未处理
+    AlarmStatusDTO getUntreatedAndProcessedCounts(@Param("month") String month);
+
+    // 3. 内容性告警
+    Long getContentAlarmCount(@Param("month")String month);
+
+    // 4. 阈值类告警
+    Long getThresholdAlarmCount(@Param("month")String month);
+
+    // 5. 存在性告警
+    List<SystemMetricConfigDTO> getAllSystemMetrics();
+
+    // 5.1 获取该指标当月已经报送的次数(只统计已送达)
+    Integer getActualReportCount(@Param("systemId")String systemId, @Param("metricType")String metricType, @Param("month")String month);
+
+    // 6. 按系统统计(完整列表)
+    List<SystemStatsDetailVO> getSystemStatsDetail(@Param("month") String month);
+
+    // 1.2 获取配置了内容类指标的系统列表
+    List<String> getContentConfiguredSystems();
+
+    // 1.3 获取已配置内容类指标且7日内有发送数据的系统列表
+    List<String> getContentHasDataSystems();
+
+    // 1.4 获取配置了阈值类指标的系统列表
+    List<String> getThresholdConfiguredSystems();
+
+    // 1.5 获取已配置阈值类指标且7日内有发送数据的系统列表
+    List<String> getThresholdHasDataSystems();
+
+    // 2. 获取实时告警列表
+    List<AlarmListVO> getAlarmList();
+
+    // 3. 查询七日内各监测点数量
+    List<MonitorPointCountVO> getMonitorPointCounts();
+
+    // 4.1 查询七日内内容类每日趋势
+    List<DateCountVO> getContentDailyTrend();
+
+    // 4.2 查询七日内阈值类每日趋势
+    List<DateCountVO> getThresholdDailyTrend();
+
+    // 5.1 查询七日内每个系统存在性告警数量
+    List<SystemExistenceWeekVO> getSystemExistenceWeekCounts();
+
+    List<DeliveryRecordDTO> getDeliveryRecordsLast7Days();
+
+    List<SystemCategoryVO> getContentAlarmCountLast7Days();
+
+    List<SystemCategoryVO> getThresholdAlarmCountLast7Days();
+
+    List<SystemInfo> getAllSystemInfos();
+}

+ 16 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/AlarmListVO.java

@@ -0,0 +1,16 @@
+package cn.chinaunicom.omniFlowNetCompute.pojo;
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+public class AlarmListVO {
+    private String monitorName;           // 监测点名称(数据库监控、系统内部连接性监控等)
+    private String tableName;            // 表名
+    private String systemId;            // 系统ID
+    private String systemName;          // 系统名称
+    private String alarmStatus;         // 未处理/已处理
+    private LocalDateTime triggerTime;  // 触发时间
+    private String category;           // 内容类/阈值类
+}

+ 11 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/ContentMetricVO.java

@@ -0,0 +1,11 @@
+package cn.chinaunicom.omniFlowNetCompute.pojo;
+
+import lombok.Data;
+
+@Data
+public class ContentMetricVO {
+    private Integer totalSystems = 5;      // 总共5个系统
+    private Integer configuredCount;       // 配置了内容类指标的系统数
+    private Integer unconfiguredCount;     // 未配置内容类指标的系统数
+    private Integer noDataCount;          // 7日内没发送数据的系统数
+}

+ 19 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/DashboardNewVO.java

@@ -0,0 +1,19 @@
+package cn.chinaunicom.omniFlowNetCompute.pojo;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class DashboardNewVO {
+
+    private MetricCategoryVO metricCategory;
+
+    private List<AlarmListVO> alarmList;
+
+    private List<MonitorPointCountVO> monitorPointCounts;
+
+    private TrendVO trend;
+
+    private List<SystemCategoryVO> systemCategories;
+}

+ 11 - 20
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/DashboardVO.java

@@ -2,27 +2,18 @@ package cn.chinaunicom.omniFlowNetCompute.pojo;
 
 import lombok.Data;
 import java.util.List;
-import java.util.Map;
 
 @Data
 public class DashboardVO {
-    // 指标分类数据获取情况
-    private Map<String, Object> indicatorStatus;
+    
+    // 顶部统计
+    private Long totalAlarms;           // 总告警数
+    private Long totalUntreated;        // 未处理
+    private Long totalProcessed;        // 已处理
+    private Long toralContentAlarms;    //内容行性告警
+    private Long totalThresholdAlarms;  // 阈值类告警
+    private Long existenceAlarms;       // 存在性告警总数
 
-    // 实时告警列表
-    private List<Map<String, Object>> realTimeAlarms;
-
-    // 七日告警数据分布
-    private Map<String, Object> sevenDaysDistribution;
-
-    // 七日告警趋势分析
-    private List<Map<String, Object>> sevenDaysTrend;
-
-    // 各系统七日告警统计
-    private List<Map<String, Object>> systemSevenDaysStats;
-
-    // 页面刷新相关信息
-    private Long refreshTime;
-    private Long nextRefresh;
-    private Boolean autoRefresh = false;
-}
+    // 系统列表
+    private List<SystemStatsDetailVO> systemStats;
+}

+ 9 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/DateCountVO.java

@@ -0,0 +1,9 @@
+package cn.chinaunicom.omniFlowNetCompute.pojo;
+
+import lombok.Data;
+
+@Data
+public class DateCountVO {
+    private String date;
+    private Long count;
+}

+ 12 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/MetricCategoryVO.java

@@ -0,0 +1,12 @@
+package cn.chinaunicom.omniFlowNetCompute.pojo;
+
+import lombok.Data;
+
+// 1. 指标分类情况
+@Data
+public class MetricCategoryVO {
+    // 内容类
+    private ContentMetricVO content;
+    // 阈值类
+    private ThresholdMetricVO threshold;
+}

+ 12 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/MonitorPointCountVO.java

@@ -0,0 +1,12 @@
+package cn.chinaunicom.omniFlowNetCompute.pojo;
+
+import lombok.Data;
+
+// 3. 各监测点数量
+@Data
+public class MonitorPointCountVO {
+    private String monitorName;        // 监测点名称
+    private String tableName;         // 表名
+    private Integer count;           // 数量
+    private String category;         // 内容类/阈值类
+}

+ 13 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/SystemCategoryVO.java

@@ -0,0 +1,13 @@
+package cn.chinaunicom.omniFlowNetCompute.pojo;
+
+import lombok.Data;
+
+// 5. 每个系统各分类数量
+@Data
+public class SystemCategoryVO {
+    private String systemId;
+    private String systemName;
+    private Long contentCount;      // 内容类数量
+    private Long thresholdCount;    // 阈值类数量
+    private Long existenceCount;    // 存在性数量
+}

+ 10 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/SystemExistenceWeekVO.java

@@ -0,0 +1,10 @@
+package cn.chinaunicom.omniFlowNetCompute.pojo;
+
+import lombok.Data;
+
+@Data
+public class SystemExistenceWeekVO {
+    private String systemId;
+    private String systemName;
+    private Long existenceCount;
+}

+ 27 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/SystemStatsDetailVO.java

@@ -0,0 +1,27 @@
+package cn.chinaunicom.omniFlowNetCompute.pojo;
+
+import lombok.Data;
+
+@Data
+public class SystemStatsDetailVO {
+    // 系统信息
+    private String systemId;
+    private String systemName;
+
+    // 告警统计
+    private Long totalAlarms;           // 总告警数
+    private Long processedCount;       // 已办理告警数
+    private Long untreatedCount;       // 未办理告警数
+    
+    // 分类告警统计
+    private Long contentAlarms;        // 内容类告警(数据库监控)
+    private Long thresholdAlarms;      // 阈值类告警(权限+连接+异常IP+定时任务)
+    private Long existenceAlarms;      // 存在性告警(数据未送达)
+    
+    // 各监控类型数量
+    private Long permissionCount;      // 用户权限变更监控数量
+    private Long dbCount;             // 数据库监控数量
+    private Long connectCount;        // 系统内部连接性监控数量
+    private Long ipCount;            // 异常IP访问监控数量
+    private Long taskCount;          // 定时任务异常情况监控数量
+}

+ 11 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/ThresholdMetricVO.java

@@ -0,0 +1,11 @@
+package cn.chinaunicom.omniFlowNetCompute.pojo;
+
+import lombok.Data;
+
+@Data
+public class ThresholdMetricVO {
+    private Integer totalSystems = 5;      // 总共5个系统
+    private Integer configuredCount;       // 配置了阈值类指标的系统数
+    private Integer unconfiguredCount;     // 未配置阈值类指标的系统数
+    private Integer noDataCount;          // 7日内没发送数据的系统数
+}

+ 14 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/pojo/TrendVO.java

@@ -0,0 +1,14 @@
+package cn.chinaunicom.omniFlowNetCompute.pojo;
+
+import lombok.Data;
+
+import java.util.List;
+
+// 4. 趋势数据
+@Data
+public class TrendVO {
+    private List<String> dates;                  // 日期列表
+    private List<Long> contentCounts;           // 内容类每日数量
+    private List<Long> thresholdCounts;         // 阈值类每日数量
+    private List<Long> existenceCounts;         // 存在性每日数量
+}

+ 7 - 32
src/main/java/cn/chinaunicom/omniFlowNetCompute/service/DashboardService.java

@@ -1,43 +1,18 @@
 package cn.chinaunicom.omniFlowNetCompute.service;
 
+import cn.chinaunicom.omniFlowNetCompute.pojo.DashboardNewVO;
 import cn.chinaunicom.omniFlowNetCompute.pojo.DashboardVO;
 
-import java.util.Map;
 
 public interface DashboardService {
-
-    /**
-     * 获取告警驾驶舱数据
-     */
-    DashboardVO getAlarmDashboardData();
-
-    /**
-     * 获取指标分类数据获取情况
-     */
-    Map<String, Object> getIndicatorStatus();
-
-    /**
-     * 获取实时告警列表
-     */
-    Map<String, Object> getRealTimeAlarms();
-
-    /**
-     * 获取七日告警数据分布
-     */
-    Map<String, Object> getSevenDaysDistribution();
-
-    /**
-     * 获取七日告警趋势分析
-     */
-    Map<String, Object> getSevenDaysTrend();
-
     /**
-     * 获取各系统七日告警统计
+     * 获取仪表盘数据
+     * @param month 月份,格式:YYYY-MM
      */
-    Map<String, Object> getSystemSevenDaysStats();
+    DashboardVO getDashboardData(String month);
 
     /**
-     * 添加测试告警数据
+     * 驾驶舱
      */
-    void addTestAlarm(Map<String, Object> testData);
-}
+    DashboardNewVO getDashboard();
+}

+ 373 - 0
src/main/java/cn/chinaunicom/omniFlowNetCompute/service/impl/DashboardServiceImpl.java

@@ -0,0 +1,373 @@
+package cn.chinaunicom.omniFlowNetCompute.service.impl;
+
+import cn.chinaunicom.omniFlowNetCompute.dto.*;
+import cn.chinaunicom.omniFlowNetCompute.mapper.DashboardMapper;
+import cn.chinaunicom.omniFlowNetCompute.pojo.*;
+import cn.chinaunicom.omniFlowNetCompute.service.DashboardService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDate;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+@RequiredArgsConstructor
+public class DashboardServiceImpl implements DashboardService {
+
+    private final DashboardMapper dashboardMapper;
+
+    public DashboardVO getDashboardData(String month) {
+        DashboardVO dashboard = new DashboardVO();
+
+        // 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);
+
+        // 4. 阈值类告警
+        Long thresholdAlarms = dashboardMapper.getThresholdAlarmCount(month);
+        dashboard.setTotalThresholdAlarms(thresholdAlarms != null ? thresholdAlarms : 0L);
+
+        // 5. 存在性告警 - 系统统计和总量统计
+        List<SystemExistenceStatsDTO> systemExistenceStats = calculateSystemExistenceAlarms(month);
+        Long totalExistenceAlarms = systemExistenceStats.stream()
+                .mapToLong(SystemExistenceStatsDTO::getExistenceAlarms)
+                .sum();
+        dashboard.setExistenceAlarms(totalExistenceAlarms);
+
+        // 6. 系统统计列表
+        List<SystemStatsDetailVO> systemStats = dashboardMapper.getSystemStatsDetail(month);
+
+        // 7. 设置每个系统的存在性告警数量
+        Map<String, Long> existenceMap = systemExistenceStats.stream()
+                .collect(Collectors.toMap(
+                        SystemExistenceStatsDTO::getSystemId,
+                        SystemExistenceStatsDTO::getExistenceAlarms
+                ));
+
+        for (SystemStatsDetailVO stat : systemStats) {
+            stat.setExistenceAlarms(existenceMap.getOrDefault(stat.getSystemId(), 0L));
+        }
+
+        dashboard.setSystemStats(systemStats);
+
+        return dashboard;
+    }
+
+    /**
+     * 统计每个系统的存在性告警数量
+     * 与calculateExistenceAlarms方法逻辑完全一致
+     */
+    public List<SystemExistenceStatsDTO> calculateSystemExistenceAlarms(String month) {
+        List<SystemExistenceStatsDTO> result = new ArrayList<>();
+
+        // 1. 获取所有系统配置的指标
+        List<SystemMetricConfigDTO> metrics = dashboardMapper.getAllSystemMetrics();
+        if (metrics.isEmpty()) {
+            return result;
+        }
+
+        // 2. 解析月份
+        YearMonth yearMonth = YearMonth.parse(month, DateTimeFormatter.ofPattern("yyyy-MM"));
+        boolean isCurrentMonth = YearMonth.now().equals(yearMonth);
+
+        // 3. 按系统分组统计
+        Map<String, List<SystemMetricConfigDTO>> metricsBySystem = metrics.stream()
+                .collect(Collectors.groupingBy(SystemMetricConfigDTO::getSystemId));
+
+        // 4. 获取所有系统名称
+        Map<String, String> systemNameMap = metrics.stream()
+                .collect(Collectors.toMap(
+                        SystemMetricConfigDTO::getSystemId,
+                        SystemMetricConfigDTO::getSystemName,
+                        (v1, v2) -> v1
+                ));
+
+        // 5. 遍历每个系统
+        for (Map.Entry<String, List<SystemMetricConfigDTO>> entry : metricsBySystem.entrySet()) {
+            String systemId = entry.getKey();
+            List<SystemMetricConfigDTO> systemMetrics = entry.getValue();
+
+            long systemMissedCount = 0L;
+
+            // 6. 遍历该系统的每个指标
+            for (SystemMetricConfigDTO metric : systemMetrics) {
+                Integer reportInterval = metric.getReportInterval();
+                if (reportInterval == null || reportInterval <= 0) {
+                    reportInterval = 60;
+                }
+
+                // 6.1 计算应报总数
+                long shouldReportTotal;
+                if (isCurrentMonth) {
+                    LocalDate today = LocalDate.now();
+                    int daysUntilToday = today.getDayOfMonth();
+                    long dailyReportCount = (24 * 60) / reportInterval;
+                    shouldReportTotal = dailyReportCount * daysUntilToday;
+                } else {
+                    int daysInMonth = yearMonth.lengthOfMonth();
+                    long dailyReportCount = (24 * 60) / reportInterval;
+                    shouldReportTotal = dailyReportCount * daysInMonth;
+                }
+
+                // 6.2 查询实报次数
+                Integer actualReportCount = dashboardMapper.getActualReportCount(
+                        systemId,
+                        metric.getMetricType(),
+                        month
+                );
+
+                // 6.3 计算未报次数
+                long missedCount = shouldReportTotal - (actualReportCount != null ? actualReportCount : 0);
+                systemMissedCount += Math.max(0, missedCount);
+            }
+
+            // 7. 封装结果
+            SystemExistenceStatsDTO dto = new SystemExistenceStatsDTO();
+            dto.setSystemId(systemId);
+            dto.setSystemName(systemNameMap.getOrDefault(systemId, systemId));
+            dto.setExistenceAlarms(systemMissedCount);
+            result.add(dto);
+        }
+
+        // 8. 按系统ID排序
+        result.sort(Comparator.comparing(SystemExistenceStatsDTO::getSystemId));
+
+        return result;
+    }
+
+
+    @Override
+    public DashboardNewVO getDashboard() {
+        final DashboardNewVO vo = new DashboardNewVO();
+        // 1. 指标分类情况
+        vo.setMetricCategory(getMetricCategory());
+
+        // 2. 实时告警列表
+        vo.setAlarmList(dashboardMapper.getAlarmList());
+
+        // 3. 七日内各监测点数量
+        vo.setMonitorPointCounts(dashboardMapper.getMonitorPointCounts());
+
+        // 4. 七日内内容类、阈值类、存在性趋势
+        vo.setTrend(getWeekTrend());
+
+        // 5. 七日内每个系统各分类数量
+        vo.setSystemCategories(getSystemCategoryWeekCounts());
+
+        return vo;
+
+    }
+
+    /**
+     * 1. 指标分类情况
+     */
+    private MetricCategoryVO getMetricCategory() {
+        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();
+        threshold.setConfiguredCount(thresholdConfigured.size());
+        threshold.setUnconfiguredCount(5 - thresholdConfigured.size());
+
+        List<String> thresholdHasData = dashboardMapper.getThresholdHasDataSystems();
+        threshold.setNoDataCount(threshold.getConfiguredCount() - thresholdHasData.size());
+        vo.setThreshold(threshold);
+
+        return vo;
+    }
+
+
+    private TrendVO getWeekTrend() {
+        TrendVO vo = new TrendVO();
+
+        // 1. 生成最近7天的日期
+        List<String> dates = new ArrayList<>();
+        LocalDate today = LocalDate.now();
+        for (int i = 6; i >= 0; i--) {
+            dates.add(today.minusDays(i).format(DateTimeFormatter.ofPattern("MM-dd")));
+        }
+        vo.setDates(dates);
+
+        // 2. 获取内容类和阈值类每日数量
+        List<DateCountVO> contentDaily = dashboardMapper.getContentDailyTrend();
+        Map<String, Long> contentMap = contentDaily.stream()
+                .collect(Collectors.toMap(DateCountVO::getDate, DateCountVO::getCount));
+
+        List<DateCountVO> thresholdDaily = dashboardMapper.getThresholdDailyTrend();
+        Map<String, Long> thresholdMap = thresholdDaily.stream()
+                .collect(Collectors.toMap(DateCountVO::getDate, DateCountVO::getCount));
+
+        // 3. 获取所有系统配置的指标
+        List<SystemMetricConfigDTO> allMetrics = dashboardMapper.getAllSystemMetrics();
+
+        // 4. 获取7天内所有已送达的报送记录
+        List<DeliveryRecordDTO> deliveryRecords = dashboardMapper.getDeliveryRecordsLast7Days();
+
+        // 5. 按日期-系统-指标分组统计实发次数
+        Map<String, Map<String, Map<String, Long>>> actualSendMap = new HashMap<>();
+        for (DeliveryRecordDTO record : deliveryRecords) {
+            actualSendMap
+                    .computeIfAbsent(record.getDate(), k -> new HashMap<>())
+                    .computeIfAbsent(record.getSystemId(), k -> new HashMap<>())
+                    .merge(record.getMetricType(), 1L, Long::sum);
+        }
+
+        // 6. 计算每天的存在性告警数量
+        List<Long> contentCounts = new ArrayList<>();
+        List<Long> thresholdCounts = new ArrayList<>();
+        List<Long> existenceCounts = new ArrayList<>();
+
+        for (String date : dates) {
+            // 内容类
+            contentCounts.add(contentMap.getOrDefault(date, 0L));
+
+            // 阈值类
+            thresholdCounts.add(thresholdMap.getOrDefault(date, 0L));
+
+            // 存在性 - 每天应发-实发
+            long dailyMissedCount = 0L;
+
+            for (SystemMetricConfigDTO metric : allMetrics) {
+                Integer reportInterval = metric.getReportInterval();
+                if (reportInterval == null || reportInterval <= 0) {
+                    reportInterval = 60;
+                }
+
+                // 当天应发次数
+                long shouldSendCount = (24 * 60) / reportInterval;
+
+                // 当天实际已送达次数
+                long actualSendCount = 0L;
+                if (actualSendMap.containsKey(date)
+                        && actualSendMap.get(date).containsKey(metric.getSystemId())
+                        && actualSendMap.get(date).get(metric.getSystemId()).containsKey(metric.getMetricType())) {
+                    actualSendCount = actualSendMap.get(date).get(metric.getSystemId()).get(metric.getMetricType());
+                }
+
+                dailyMissedCount += Math.max(0, shouldSendCount - actualSendCount);
+            }
+
+            existenceCounts.add(dailyMissedCount);
+        }
+
+        vo.setContentCounts(contentCounts);
+        vo.setThresholdCounts(thresholdCounts);
+        vo.setExistenceCounts(existenceCounts);
+
+        return vo;
+    }
+
+    /**
+     * 查询七日内每个系统各分类数量(内容类、阈值类、存在性告警)
+     * 存在性告警 = 7天应该发送的总数量 - 7天已经发送的总数量
+     */
+    public List<SystemCategoryVO> getSystemCategoryWeekCounts() {
+        List<SystemCategoryVO> result = new ArrayList<>();
+
+        // 1. 获取所有系统
+        List<SystemInfo> systems = dashboardMapper.getAllSystemInfos();
+        if (systems.isEmpty()) {
+            return result;
+        }
+
+        // 2. 获取7天内内容类告警数量(cus_db_monitor)
+        List<SystemCategoryVO> contentAlarms = dashboardMapper.getContentAlarmCountLast7Days();
+        Map<String, Long> contentMap = contentAlarms.stream()
+                .collect(Collectors.toMap(SystemCategoryVO::getSystemId,
+                        SystemCategoryVO::getContentCount,
+                        (v1, v2) -> v1));
+
+        // 3. 获取7天内阈值类告警数量(其他四个表)
+        List<SystemCategoryVO> thresholdAlarms = dashboardMapper.getThresholdAlarmCountLast7Days();
+        Map<String, Long> thresholdMap = thresholdAlarms.stream()
+                .collect(Collectors.toMap(SystemCategoryVO::getSystemId,
+                        SystemCategoryVO::getThresholdCount,
+                        (v1, v2) -> v1));
+
+        // 4. 获取所有系统配置的指标(用于存在性计算)
+        List<SystemMetricConfigDTO> allMetrics = dashboardMapper.getAllSystemMetrics();
+        Map<String, List<SystemMetricConfigDTO>> metricsBySystem = allMetrics.stream()
+                .collect(Collectors.groupingBy(SystemMetricConfigDTO::getSystemId));
+
+        // 5. 获取7天内所有已送达的报送记录(存在性实发)
+        List<DeliveryRecordDTO> deliveryRecords = dashboardMapper.getDeliveryRecordsLast7Days();
+
+        // 按系统+指标分组统计7天实发次数
+        Map<String, Long> actualSendMap = new HashMap<>();
+        for (DeliveryRecordDTO record : deliveryRecords) {
+            String key = record.getSystemId() + ":" + record.getMetricType();
+            actualSendMap.put(key, actualSendMap.getOrDefault(key, 0L) + 1);
+        }
+
+        // 6. 遍历每个系统
+        for (SystemInfo system : systems) {
+            SystemCategoryVO vo = new SystemCategoryVO();
+            vo.setSystemId(system.getSystemId());
+            vo.setSystemName(system.getSystemName());
+
+            // 内容类数量
+            vo.setContentCount(contentMap.getOrDefault(system.getSystemId(), 0L));
+
+            // 阈值类数量
+            vo.setThresholdCount(thresholdMap.getOrDefault(system.getSystemId(), 0L));
+
+            // 存在性告警数量 = 7天应发总数 - 7天实发总数
+            long existenceCount = 0L;
+            List<SystemMetricConfigDTO> systemMetrics = metricsBySystem.getOrDefault(system.getSystemId(), new ArrayList<>());
+
+            for (SystemMetricConfigDTO metric : systemMetrics) {
+                Integer reportInterval = metric.getReportInterval();
+                if (reportInterval == null || reportInterval <= 0) {
+                    reportInterval = 60; // 默认60分钟
+                }
+
+                // 7天应发总数 = 每天应发次数 × 7天
+                long dailyShouldSend = (24 * 60) / reportInterval;
+                long weekShouldSend = dailyShouldSend * 7;
+
+                // 7天实发总数
+                String key = system.getSystemId() + ":" + metric.getMetricType();
+                long weekActualSend = actualSendMap.getOrDefault(key, 0L);
+
+                // 未发送数量
+                existenceCount += Math.max(0, weekShouldSend - weekActualSend);
+            }
+
+            vo.setExistenceCount(existenceCount);
+            result.add(vo);
+        }
+
+        // 7. 按系统ID排序
+        result.sort(Comparator.comparing(SystemCategoryVO::getSystemId));
+
+        return result;
+    }
+}

+ 155 - 4
src/main/java/cn/chinaunicom/omniFlowNetCompute/until/ExcelExportUtil.java

@@ -1,5 +1,8 @@
 // ExcelExportUtil.java
 package cn.chinaunicom.omniFlowNetCompute.until;
+
+import cn.chinaunicom.omniFlowNetCompute.pojo.DashboardVO;
+import cn.chinaunicom.omniFlowNetCompute.pojo.SystemStatsDetailVO;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.stereotype.Component;
@@ -9,8 +12,11 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.function.Supplier;
+
 
 @Component
 public class ExcelExportUtil {
@@ -36,7 +42,7 @@ public class ExcelExportUtil {
         // 2. 创建系统统计Sheet
         createSystemStatsSheet(workbook, headerStyle, dataStyle, month, systemStats);
 
-        // // 3. 创建系统指标统计Sheet
+        // 3. 创建系统指标统计Sheet
         // createSystemIndicatorStatsSheet(workbook, headerStyle, dataStyle, month, systemIndicatorStats);
 
         // 设置响应头
@@ -56,6 +62,151 @@ public class ExcelExportUtil {
         }
     }
 
+    public void exportAlarmReportToExcelNew(HttpServletResponse response, String month, DashboardVO dashboardVO) throws IOException {
+
+        // 创建工作簿 - 兼容POI 4.1.2
+        Workbook workbook = new XSSFWorkbook();
+
+        // 创建样式
+        CellStyle headerStyle = createHeaderStyle(workbook);
+        CellStyle dataStyle = createDataStyle(workbook);
+
+        // 1. 创建整体统计Sheet
+        createOverallStatsSheetNew(workbook, headerStyle, dataStyle, month, dashboardVO);
+
+        // 2. 创建系统统计Sheet
+        createSystemStatsSheetNew(workbook, headerStyle, dataStyle, month, dashboardVO);
+
+
+        // 设置响应头
+        String fileName = "告警报表统计_" + month + ".xlsx";
+        fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name())
+                .replaceAll("\\+", "%20");
+
+        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+        response.setCharacterEncoding(StandardCharsets.UTF_8.name());
+        response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + fileName);
+
+        // 写入响应流
+        try (OutputStream outputStream = response.getOutputStream()) {
+            workbook.write(outputStream);
+        } finally {
+            workbook.close();
+        }
+    }
+
+    private void createOverallStatsSheetNew(final Workbook workbook, final CellStyle headerStyle, final CellStyle dataStyle, final String month, final DashboardVO dashboardVO) {
+        Sheet sheet = workbook.createSheet("整体统计");
+
+        // 创建标题行
+        Row titleRow = sheet.createRow(0);
+        Cell titleCell = titleRow.createCell(0);
+        titleCell.setCellValue(month + "告警整体统计");
+        titleCell.setCellStyle(headerStyle);
+        sheet.addMergedRegion(new org.apache.poi.ss.util.CellRangeAddress(0, 0, 0, 7));
+        Row headerRow = sheet.createRow(1);
+        String[] headers = {"统计项", "总数", "未处理", "已处理", "内容类告警", "阈值类告警","存在性告警"};
+        for (int i = 0; i < headers.length; i++) {
+            Cell cell = headerRow.createCell(i);
+            cell.setCellValue(headers[i]);
+            cell.setCellStyle(headerStyle);
+        }
+
+        // 创建数据行
+        Row dataRow = sheet.createRow(2);
+        Cell cell0 = dataRow.createCell(0);
+        cell0.setCellValue("告警统计");
+        cell0.setCellStyle(dataStyle);
+        Map<String, Supplier<Number>> fieldGetters = new LinkedHashMap<>();
+        fieldGetters.put("totalAlarms", dashboardVO::getTotalAlarms);
+        fieldGetters.put("totalUntreated", dashboardVO::getTotalUntreated);
+        fieldGetters.put("totalProcessed", dashboardVO::getTotalProcessed);
+        fieldGetters.put("contentAlarms", dashboardVO::getToralContentAlarms);
+        fieldGetters.put("thresholdAlarms", dashboardVO::getTotalThresholdAlarms);
+        fieldGetters.put("existenceAlarms", dashboardVO::getExistenceAlarms);
+
+        int cellIndex = 1;
+        for (Map.Entry<String, Supplier<Number>> entry : fieldGetters.entrySet()) {
+            Cell cell = dataRow.createCell(cellIndex++);
+            Number value = entry.getValue().get();
+            if (value != null) {
+                cell.setCellValue(value.doubleValue());
+            } else {
+                cell.setCellValue(0);
+            }
+            cell.setCellStyle(dataStyle);
+        }
+
+        // 自动调整列宽
+        for (int i = 0; i < headers.length; i++) {
+            sheet.setColumnWidth(i, 20 * 256);
+        }
+
+    }
+
+    /**
+     * 创建系统统计Sheet
+     */
+    private void createSystemStatsSheetNew(Workbook workbook, CellStyle headerStyle, CellStyle dataStyle, String month, DashboardVO dashboardVO) {
+        Sheet sheet = workbook.createSheet("系统统计");
+
+        // 创建标题行
+        Row titleRow = sheet.createRow(0);
+        Cell titleCell = titleRow.createCell(0);
+        titleCell.setCellValue(month + "各系统告警统计");
+        titleCell.setCellStyle(headerStyle);
+
+        // 合并单元格
+        sheet.addMergedRegion(new org.apache.poi.ss.util.CellRangeAddress(0, 0, 0, 11));
+
+        // 创建表头
+        Row headerRow = sheet.createRow(1);
+        String[] headers = {"系统名称", "告警总数", "已处理", "未处理", "内容类警告", "阈值类警告", "存在性警告", "用户权限变更监控数", "数据库监控数", "系统内部连接监控数", "异常IP访问监控数", "定时任务异常监控数"};
+
+        for (int i = 0; i < headers.length; i++) {
+            Cell cell = headerRow.createCell(i);
+            cell.setCellValue(headers[i]);
+            cell.setCellStyle(headerStyle);
+        }
+
+        // 创建数据行
+        int rowNum = 2;
+        if (dashboardVO != null) {
+            // 获取systemStats列表
+            List<SystemStatsDetailVO> systemStatsList = dashboardVO.getSystemStats();
+
+            if (systemStatsList != null && !systemStatsList.isEmpty()) {
+                for (SystemStatsDetailVO stats : systemStatsList) {
+                    Row dataRow = sheet.createRow(rowNum++);
+
+                    // 按照表头顺序写入数据
+                    dataRow.createCell(0).setCellValue(stats.getSystemName() != null ? stats.getSystemName() : "");
+                    dataRow.createCell(1).setCellValue(stats.getTotalAlarms() != null ? stats.getTotalAlarms().doubleValue() : 0);
+                    dataRow.createCell(2).setCellValue(stats.getProcessedCount() != null ? stats.getProcessedCount().doubleValue() : 0);
+                    dataRow.createCell(3).setCellValue(stats.getUntreatedCount() != null ? stats.getUntreatedCount().doubleValue() : 0);
+                    dataRow.createCell(4).setCellValue(stats.getContentAlarms() != null ? stats.getContentAlarms().doubleValue() : 0);
+                    dataRow.createCell(5).setCellValue(stats.getThresholdAlarms() != null ? stats.getThresholdAlarms().doubleValue() : 0);
+                    dataRow.createCell(6).setCellValue(stats.getExistenceAlarms() != null ? stats.getExistenceAlarms().doubleValue() : 0);
+                    dataRow.createCell(7).setCellValue(stats.getPermissionCount() != null ? stats.getPermissionCount().doubleValue() : 0);
+                    dataRow.createCell(8).setCellValue(stats.getDbCount() != null ? stats.getDbCount().doubleValue() : 0);
+                    dataRow.createCell(9).setCellValue(stats.getConnectCount() != null ? stats.getConnectCount().doubleValue() : 0);
+                    dataRow.createCell(10).setCellValue(stats.getIpCount() != null ? stats.getIpCount().doubleValue() : 0);
+                    dataRow.createCell(11).setCellValue(stats.getTaskCount() != null ? stats.getTaskCount().doubleValue() : 0);
+
+                    // 设置数据行样式
+                    for (int i = 0; i < headers.length; i++) {
+                        dataRow.getCell(i).setCellStyle(dataStyle);
+                    }
+                }
+            }
+        }
+
+        // 自动调整列宽
+        for (int i = 0; i < headers.length; i++) {
+            sheet.setColumnWidth(i, 20 * 256);
+        }
+    }
+
     /**
      * 创建整体统计Sheet
      */
@@ -155,9 +306,9 @@ public class ExcelExportUtil {
                 // 各统计字段
                 String[] fields = {"total", "processed", "unprocessed",
                         "contentCount", "thresholdCount", "existenceCount",
-                        "indicator_dataNoDeliveredCount","indicator_internalConnetCount","indicator_interfaceFrequencyCount",
-                        "indicator_databaseConnectCount","indicator_pageTamperProofCount","indicator_networkBoundaryConnectCount",
-                        "indicator_scheduledTaskCount","indicator_ossUseCount","indicator_abnormalAccessCount"};
+                        "indicator_dataNoDeliveredCount", "indicator_internalConnetCount", "indicator_interfaceFrequencyCount",
+                        "indicator_databaseConnectCount", "indicator_pageTamperProofCount", "indicator_networkBoundaryConnectCount",
+                        "indicator_scheduledTaskCount", "indicator_ossUseCount", "indicator_abnormalAccessCount"};
 
                 for (int i = 0; i < fields.length; i++) {
                     Cell cell = dataRow.createCell(i + 1);

+ 487 - 0
src/main/resources/mapper/omni/DashboardMapper.xml

@@ -0,0 +1,487 @@
+<?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="cn.chinaunicom.omniFlowNetCompute.mapper.DashboardMapper">
+    <!-- 1. 总告警数(所有监控表) -->
+    <select id="getTotalAlarmCounts" resultType="java.lang.Long" parameterType="java.lang.String">
+        SELECT COUNT(*)
+        FROM sec_permission_monitor
+        WHERE alert_level IN ('notice', 'alarm')
+          AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+        
+        UNION ALL
+        
+        SELECT COUNT(*)
+        FROM cus_db_monitor
+        WHERE alarm_level IN ('notice', 'alarm')
+          AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+        
+        UNION ALL
+        
+        SELECT COUNT(*)
+        FROM cus_internal_connect_monitor
+        WHERE alarm_level IN ('notice', 'alarm')
+          AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+        
+        UNION ALL
+        
+        SELECT COUNT(*)
+        FROM cus_ip_abnormal_monitor
+        WHERE alarm_level IN ('notice', 'alarm')
+          AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+        
+        UNION ALL
+        
+        SELECT COUNT(*)
+        FROM cus_task_exception_monitor
+        WHERE alarm_level IN ('notice', 'alarm')
+          AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+    </select>
+    
+    <!-- 3. 查询已处理未处理总数 -->
+    <select id="getUntreatedAndProcessedCounts" resultType="cn.chinaunicom.omniFlowNetCompute.dto.AlarmStatusDTO"
+            parameterType="java.lang.String">
+        SELECT SUM(CASE WHEN alarm_status = 'untreated' THEN 1 ELSE 0 END) as untreated,
+               SUM(CASE WHEN alarm_status = 'processed' THEN 1 ELSE 0 END) as processed
+        FROM (SELECT alert_status as alarm_status
+              FROM sec_permission_monitor
+              WHERE DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+              
+              UNION ALL
+              
+              SELECT alarm_status
+              FROM cus_db_monitor
+              WHERE DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+              
+              UNION ALL
+              
+              SELECT alarm_status
+              FROM cus_internal_connect_monitor
+              WHERE DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+              
+              UNION ALL
+              
+              SELECT alarm_status
+              FROM cus_ip_abnormal_monitor
+              WHERE DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+              
+              UNION ALL
+              
+              SELECT alarm_status
+              FROM cus_task_exception_monitor
+              WHERE DATE_FORMAT(trigger_time, '%Y-%m') = #{month}) t
+    </select>
+    
+    
+    <!-- 3. 内容性告警(数据库监控 - cus_db_monitor) -->
+    <select id="getContentAlarmCount" resultType="java.lang.Long" parameterType="java.lang.String">
+        SELECT COUNT(*)
+        FROM cus_db_monitor
+        WHERE alarm_level IN ('notice', 'alarm')
+          AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+    </select>
+    
+    
+    <!-- 4. 阈值类告警(其他4个监控表:权限变更、连接性、异常IP、定时任务) -->
+    <select id="getThresholdAlarmCount" resultType="java.lang.Long" parameterType="java.lang.String">
+        SELECT (SELECT COUNT(*)
+                FROM sec_permission_monitor
+                WHERE alert_level IN ('notice', 'alarm')
+                  AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}) +
+               (SELECT COUNT(*)
+                FROM cus_internal_connect_monitor
+                WHERE alarm_level IN ('notice', 'alarm')
+                  AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}) +
+               (SELECT COUNT(*)
+                FROM cus_ip_abnormal_monitor
+                WHERE alarm_level IN ('notice', 'alarm')
+                  AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}) +
+               (SELECT COUNT(*)
+                FROM cus_task_exception_monitor
+                WHERE alarm_level IN ('notice', 'alarm')
+                  AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month})
+    </select>
+    
+    <!--5. 存在性告警-->
+    <select id="getAllSystemMetrics" resultType="cn.chinaunicom.omniFlowNetCompute.dto.SystemMetricConfigDTO">
+        SELECT sm.system_id                      as systemId,
+               si.system_name                    as systemName,
+               sm.metric_type                    as metricType,
+               sm.metric_code                    as metricCode,
+               COALESCE(sdm.report_interval, 60) as reportInterval,
+               sm.json_name                      as jsonName
+        FROM sec_system_metrics sm
+                 INNER JOIN sec_system_info si ON sm.system_id = si.system_id
+                 LEFT JOIN (SELECT system_id, metric_name, MAX(report_interval) as report_interval
+                            FROM sec_data_undelivered_monitor
+                            GROUP BY system_id, metric_name) sdm
+                           ON sm.system_id = sdm.system_id AND sm.metric_type = sdm.metric_name
+        WHERE si.del_flag = '0'
+          AND si.status = '1'
+    </select>
+    
+    <!-- 5.1获取指定指标在指定月份的实际报送次数(只统计已送达) -->
+    <select id="getActualReportCount" resultType="java.lang.Integer">
+        SELECT COUNT(*)
+        FROM sec_data_undelivered_monitor
+        WHERE system_id = #{systemId}
+          AND metric_name = #{metricType}
+          AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+    </select>
+    
+    <!-- 6. 按系统统计列表(完整信息) -->
+    <select id="getSystemStatsDetail" resultType="cn.chinaunicom.omniFlowNetCompute.pojo.SystemStatsDetailVO">
+        SELECT si.system_id                                           as systemId,
+               si.system_name                                         as systemName,
+               si.business_unit                                       as businessUnit,
+               si.vendor                                              as vendor,
+               si.contact_name                                        as contactName,
+               si.contact_phone                                       as contactPhone,
+               
+               -- 总告警数
+               COALESCE(pm.total, 0) + COALESCE(dbm.total, 0) + COALESCE(cm.total, 0) +
+               COALESCE(ipm.total, 0) + COALESCE(tm.total, 0)         as totalAlarms,
+               
+               -- 已办理数
+               COALESCE(pm.processed, 0) + COALESCE(dbm.processed, 0) + COALESCE(cm.processed, 0) +
+               COALESCE(ipm.processed, 0) + COALESCE(tm.processed, 0) as processedCount,
+               
+               -- 未办理数
+               COALESCE(pm.untreated, 0) + COALESCE(dbm.untreated, 0) + COALESCE(cm.untreated, 0) +
+               COALESCE(ipm.untreated, 0) + COALESCE(tm.untreated, 0) as untreatedCount,
+               
+               -- 内容类告警(数据库监控)
+               COALESCE(dbm.total, 0)                                 as contentAlarms,
+               
+               -- 阈值类告警(权限+连接+异常IP+定时任务)
+               COALESCE(pm.total, 0) + COALESCE(cm.total, 0) +
+               COALESCE(ipm.total, 0) + COALESCE(tm.total, 0)         as thresholdAlarms,
+               
+               -- 各监控类型数量
+               COALESCE(pm.total, 0)                                  as permissionCount,
+               COALESCE(dbm.total, 0)                                 as dbCount,
+               COALESCE(cm.total, 0)                                  as connectCount,
+               COALESCE(ipm.total, 0)                                 as ipCount,
+               COALESCE(tm.total, 0)                                  as taskCount
+        
+        FROM sec_system_info si
+                 
+                 LEFT JOIN (SELECT system_id,
+                                   COUNT(*)                                                    as total,
+                                   SUM(CASE WHEN alert_status = 'processed' THEN 1 ELSE 0 END) as processed,
+                                   SUM(CASE WHEN alert_status = 'untreated' THEN 1 ELSE 0 END) as untreated
+                            FROM sec_permission_monitor
+                            WHERE alert_level IN ('notice', 'alarm')
+                              AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+                            GROUP BY system_id) pm ON si.system_id = pm.system_id
+                 
+                 LEFT JOIN (SELECT system_id,
+                                   COUNT(*)                                                    as total,
+                                   SUM(CASE WHEN alarm_status = 'processed' THEN 1 ELSE 0 END) as processed,
+                                   SUM(CASE WHEN alarm_status = 'untreated' THEN 1 ELSE 0 END) as untreated
+                            FROM cus_db_monitor
+                            WHERE alarm_level IN ('notice', 'alarm')
+                              AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+                            GROUP BY system_id) dbm ON si.system_id = dbm.system_id
+                 
+                 LEFT JOIN (SELECT system_id,
+                                   COUNT(*)                                                    as total,
+                                   SUM(CASE WHEN alarm_status = 'processed' THEN 1 ELSE 0 END) as processed,
+                                   SUM(CASE WHEN alarm_status = 'untreated' THEN 1 ELSE 0 END) as untreated
+                            FROM cus_internal_connect_monitor
+                            WHERE alarm_level IN ('notice', 'alarm')
+                              AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+                            GROUP BY system_id) cm ON si.system_id = cm.system_id
+                 
+                 LEFT JOIN (SELECT system_id,
+                                   COUNT(*)                                                    as total,
+                                   SUM(CASE WHEN alarm_status = 'processed' THEN 1 ELSE 0 END) as processed,
+                                   SUM(CASE WHEN alarm_status = 'untreated' THEN 1 ELSE 0 END) as untreated
+                            FROM cus_ip_abnormal_monitor
+                            WHERE alarm_level IN ('notice', 'alarm')
+                              AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+                            GROUP BY system_id) ipm ON si.system_id = ipm.system_id
+                 
+                 LEFT JOIN (SELECT system_id,
+                                   COUNT(*)                                                    as total,
+                                   SUM(CASE WHEN alarm_status = 'processed' THEN 1 ELSE 0 END) as processed,
+                                   SUM(CASE WHEN alarm_status = 'untreated' THEN 1 ELSE 0 END) as untreated
+                            FROM cus_task_exception_monitor
+                            WHERE alarm_level IN ('notice', 'alarm')
+                              AND DATE_FORMAT(trigger_time, '%Y-%m') = #{month}
+                            GROUP BY system_id) tm ON si.system_id = tm.system_id
+        
+        WHERE si.del_flag = '0'
+          AND si.status = '1'
+        ORDER BY systemId, totalAlarms DESC
+    </select>
+    
+    
+    
+    <!-- 1.2 获取配置了内容类指标(cus_db_monitor)的系统列表 -->
+    <select id="getContentConfiguredSystems" resultType="java.lang.String">
+        SELECT DISTINCT system_id
+        FROM sec_system_metrics
+        WHERE metric_type = 'cus_db_monitor'
+    </select>
+    
+    <!-- 1.3 获取已配置内容类指标且7日内有发送数据的系统列表 -->
+    <select id="getContentHasDataSystems" resultType="java.lang.String">
+        SELECT DISTINCT system_id
+        FROM cus_db_monitor
+        WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+          AND system_id IN (SELECT DISTINCT system_id
+                            FROM sec_system_metrics
+                            WHERE metric_type = 'cus_db_monitor')
+    </select>
+    
+    <!-- 1.4 获取配置了阈值类指标的系统列表 -->
+    <select id="getThresholdConfiguredSystems" resultType="java.lang.String">
+        SELECT DISTINCT system_id
+        FROM sec_system_metrics
+        WHERE metric_type IN (
+                              'sec_permission_monitor',
+                              'cus_internal_connect_monitor',
+                              'cus_ip_abnormal_monitor',
+                              'cus_task_exception_monitor'
+            )
+    </select>
+    
+    <!-- 1.5 获取已配置阈值类指标且7日内有发送数据的系统列表 -->
+    <select id="getThresholdHasDataSystems" resultType="java.lang.String">
+        SELECT DISTINCT system_id
+        FROM (SELECT system_id
+              FROM sec_permission_monitor
+              WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+              UNION
+              SELECT system_id
+              FROM cus_internal_connect_monitor
+              WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+              UNION
+              SELECT system_id
+              FROM cus_ip_abnormal_monitor
+              WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+              UNION
+              SELECT system_id
+              FROM cus_task_exception_monitor
+              WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)) t
+        WHERE system_id IN (SELECT DISTINCT system_id
+                            FROM sec_system_metrics
+                            WHERE metric_type IN (
+                                                  'sec_permission_monitor',
+                                                  'cus_internal_connect_monitor',
+                                                  'cus_ip_abnormal_monitor',
+                                                  'cus_task_exception_monitor'
+                                ))
+    </select>
+    
+    <!-- 2. 获取实时告警列表(按时间排序取20条) -->
+    <select id="getAlarmList" resultType="cn.chinaunicom.omniFlowNetCompute.pojo.AlarmListVO">
+        SELECT *
+        FROM (SELECT '数据库监控'                                                            as monitorName,
+                     'cus_db_monitor'                                                        as tableName,
+                     t.system_id                                                             as systemId,
+                     (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
+              FROM cus_db_monitor t
+              WHERE t.alarm_status = 'untreated'
+              
+              UNION ALL
+              
+              SELECT '用户权限变更监控'                                                      as monitorName,
+                     'sec_permission_monitor'                                                as tableName,
+                     t.system_id                                                             as systemId,
+                     (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
+              FROM sec_permission_monitor t
+              WHERE t.alert_status = 'untreated'
+              
+              UNION ALL
+              
+              SELECT '系统内部连接性监控'                                                    as monitorName,
+                     'cus_internal_connect_monitor'                                          as tableName,
+                     t.system_id                                                             as systemId,
+                     (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
+              FROM cus_internal_connect_monitor t
+              WHERE t.alarm_status = 'untreated'
+              
+              UNION ALL
+              
+              SELECT '异常IP访问监控'                                                        as monitorName,
+                     'cus_ip_abnormal_monitor'                                               as tableName,
+                     t.system_id                                                             as systemId,
+                     (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
+              FROM cus_ip_abnormal_monitor t
+              WHERE t.alarm_status = 'untreated'
+              
+              UNION ALL
+              
+              SELECT '定时任务异常监控'                                                      as monitorName,
+                     'cus_task_exception_monitor'                                            as tableName,
+                     t.system_id                                                             as systemId,
+                     (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
+              FROM cus_task_exception_monitor t
+              WHERE t.alarm_status = 'untreated') t
+        ORDER BY t.triggerTime DESC
+        LIMIT 20
+    </select>
+    
+    <!-- 3. 查询七日内各监测点数量 -->
+    <select id="getMonitorPointCounts" resultType="cn.chinaunicom.omniFlowNetCompute.pojo.MonitorPointCountVO">
+        SELECT '数据库监控'     as monitorName,
+               'cus_db_monitor' as tableName,
+               '内容类'         as category,
+               COUNT(*)         as count
+        FROM cus_db_monitor
+        WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+        
+        UNION ALL
+        
+        SELECT '用户权限变更监控',
+               'sec_permission_monitor',
+               '阈值类',
+               COUNT(*)
+        FROM sec_permission_monitor
+        WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+        
+        UNION ALL
+        
+        SELECT '系统内部连接性监控',
+               'cus_internal_connect_monitor',
+               '阈值类',
+               COUNT(*)
+        FROM cus_internal_connect_monitor
+        WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+        
+        UNION ALL
+        
+        SELECT '异常IP访问监控',
+               'cus_ip_abnormal_monitor',
+               '阈值类',
+               COUNT(*)
+        FROM cus_ip_abnormal_monitor
+        WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+        
+        UNION ALL
+        
+        SELECT '定时任务异常监控',
+               'cus_task_exception_monitor',
+               '阈值类',
+               COUNT(*)
+        FROM cus_task_exception_monitor
+        WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+        
+        ORDER BY count DESC
+    </select>
+    
+    <!-- 4.1 查询七日内内容类每日趋势 -->
+    <select id="getContentDailyTrend" resultType="cn.chinaunicom.omniFlowNetCompute.pojo.DateCountVO">
+        SELECT DATE_FORMAT(trigger_time, '%m-%d') as date,
+               COUNT(*)                           as count
+        FROM cus_db_monitor
+        WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+        GROUP BY DATE_FORMAT(trigger_time, '%m-%d')
+        ORDER BY date
+    </select>
+    
+    <!-- 4.2 查询七日内阈值类每日趋势 -->
+    <select id="getThresholdDailyTrend" resultType="cn.chinaunicom.omniFlowNetCompute.pojo.DateCountVO">
+        SELECT DATE_FORMAT(trigger_time, '%m-%d') as date,
+               COUNT(*)                           as count
+        FROM (SELECT trigger_time
+              FROM sec_permission_monitor
+              WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+              UNION ALL
+              SELECT trigger_time
+              FROM cus_internal_connect_monitor
+              WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+              UNION ALL
+              SELECT trigger_time
+              FROM cus_ip_abnormal_monitor
+              WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+              UNION ALL
+              SELECT trigger_time
+              FROM cus_task_exception_monitor
+              WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)) t
+        GROUP BY DATE_FORMAT(trigger_time, '%m-%d')
+        ORDER BY date
+    </select>
+    
+    <!-- 5.1 查询七日内每个系统存在性告警数量(单独) -->
+    <select id="getSystemExistenceWeekCounts" resultType="cn.chinaunicom.omniFlowNetCompute.pojo.SystemExistenceWeekVO">
+        SELECT si.system_id                       as systemId,
+               si.system_name                     as systemName,
+               COALESCE(COUNT(sdm.monitor_id), 0) as existenceCount
+        FROM sec_system_info si
+                 LEFT JOIN sec_data_undelivered_monitor sdm
+                           ON si.system_id = sdm.system_id
+                               AND sdm.trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+                               AND sdm.alarm_status = 'untreated'
+        WHERE si.del_flag = '0'
+          AND si.status = '1'
+        GROUP BY si.system_id, si.system_name
+        ORDER BY si.system_id
+    </select>
+    
+    <!-- 4.4 获取7天内所有已送达的报送记录 -->
+    <select id="getDeliveryRecordsLast7Days" resultType="cn.chinaunicom.omniFlowNetCompute.dto.DeliveryRecordDTO">
+        SELECT
+            DATE_FORMAT(trigger_time, '%m-%d') as date,
+            system_id as systemId,
+            metric_name as metricType,
+            last_report_time as reportTime
+        FROM sec_data_undelivered_monitor
+        WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+          AND delivery_status = 1
+    </select>
+    
+    <!-- 获取所有系统信息 -->
+    <select id="getAllSystemInfos" resultType="cn.chinaunicom.omniFlowNetCompute.dto.SystemInfo">
+        SELECT
+            system_id as systemId,
+            system_name as systemName
+        FROM sec_system_info
+        WHERE del_flag = '0'
+          AND status = '1'
+    </select>
+    
+    <!-- 获取7天内内容类告警数量(按系统分组) -->
+    <select id="getContentAlarmCountLast7Days" resultType="cn.chinaunicom.omniFlowNetCompute.pojo.SystemCategoryVO">
+        SELECT
+            system_id as systemId,
+            COUNT(*) as contentCount
+        FROM cus_db_monitor
+        WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+        GROUP BY system_id
+    </select>
+    
+    <!-- 获取7天内阈值类告警数量(按系统分组) -->
+    <select id="getThresholdAlarmCountLast7Days" resultType="cn.chinaunicom.omniFlowNetCompute.pojo.SystemCategoryVO">
+        SELECT
+            system_id as systemId,
+            COUNT(*) as thresholdCount
+        FROM (
+                 SELECT system_id FROM sec_permission_monitor WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+                 UNION ALL
+                 SELECT system_id FROM cus_internal_connect_monitor WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+                 UNION ALL
+                 SELECT system_id FROM cus_ip_abnormal_monitor WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+                 UNION ALL
+                 SELECT system_id FROM cus_task_exception_monitor WHERE trigger_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+             ) t
+        GROUP BY system_id
+    </select>
+    
+</mapper>

Vissa filer visades inte eftersom för många filer har ändrats