|
|
@@ -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));
|