Koishi il y a 1 an
Parent
commit
3617c21764

+ 12 - 10
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Application/ApplicationService.java

@@ -293,7 +293,7 @@ public class ApplicationService {
 
         List<ProEconAlarmType> types =  alarmTypeService.list();
         List<ProEconAlarmConfiguration> configurations = alarmConfigurationService.list();
-
+        int totalSize = 0;
         for (ProEconAlarmType ty :types) {
 
             List<ProEconShutdownEvent> qwt = null;
@@ -303,20 +303,22 @@ public class ApplicationService {
                     .filter(c -> ty.getNemCode().equals(c.getComponents()))
                     .collect(Collectors.toList());
 
-            for (ProEconAlarmConfiguration c : collect){
+            totalSize += collect.stream()
+                    .flatMap(c -> {
+                        QueryWrapper<ProEconShutdownEvent> qw = new QueryWrapper<>();
+                        qw.lambda().ge(ProEconShutdownEvent::getStartTime, startTime);
+                        qw.lambda().eq(ProEconShutdownEvent::getWarningId, c.getId());
+                        return shutdownEventService.list(qw).stream();
+                    })
+                    .collect(Collectors.toList())
+                    .size(); // 累加每个列表的大小
 
-                    QueryWrapper<ProEconShutdownEvent> qw = new QueryWrapper<>();
-                    qw.lambda().eq(ProEconShutdownEvent::getStartTime,startTime);
-                    qw.lambda().eq(ProEconShutdownEvent::getWarningId,c.getId());
-                    qwt = shutdownEventService.list(qw);
 
-                    zb.put("name",ty.getName());
-                    zb.put("rgzcs",qwt.size());
+            zb.put("name",ty.getName());
+            zb.put("rgzcs",totalSize);
 //                    zb.put("rgzcs",qwt.size());
 //                    zb.put("rgzcs",qwt.size());
 
-            }
-
         }
 
         return null;