|
@@ -40,25 +40,31 @@ public class AlarmService {
|
|
|
Map<String, List<AlertHistory>> collect = list.stream()
|
|
|
.filter(a -> !StringUtils.isEmpty(a.getCategory2()))
|
|
|
.collect(Collectors.groupingBy(AlertHistory::getCategory2));
|
|
|
- collect.forEach((k, v) ->{
|
|
|
+ int count = 0;
|
|
|
+ for (Map.Entry<String, List<AlertHistory>> entry : collect.entrySet()) {
|
|
|
+ String k = entry.getKey();
|
|
|
+ List<AlertHistory> v = entry.getValue();
|
|
|
List<Object> ls = new ArrayList<>();
|
|
|
Map<String, Object> mp = new HashMap<>();
|
|
|
String name = InitialRunner.scadaWarnMap.get(k.toUpperCase());
|
|
|
- if (!StringUtils.isEmpty(name)){
|
|
|
+ if (!StringUtils.isEmpty(name)) {
|
|
|
mp.put("name", name);
|
|
|
- v.stream().filter(CollectUtil.distinctByKey(AlertHistory::getAlertText)).collect(Collectors.toList()).forEach(a -> {
|
|
|
+ for (AlertHistory a : v.stream().filter(CollectUtil.distinctByKey(AlertHistory::getAlertText)).collect(Collectors.toList())) {
|
|
|
Map<String, String> pm = new HashMap<>();
|
|
|
pm.put("name", a.getAlertText());
|
|
|
ls.add(pm);
|
|
|
- });
|
|
|
+ count += 1;
|
|
|
+ }
|
|
|
mp.put("children", ls);
|
|
|
faults.add(mp);
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("name", "总故障");
|
|
|
map.put("children", faults);
|
|
|
+ map.put("count", count);
|
|
|
|
|
|
return map;
|
|
|
}
|
|
|
}
|
|
|
+
|