From 017f9205d2ac02ba1f5206bf1d9d285342906743 Mon Sep 17 00:00:00 2001 From: zhuxinyu <1799009482@qq.com> Date: Fri, 5 May 2023 16:36:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=88=E7=AB=AF=E5=BC=82=E5=B8=B8=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeviceAbnormaStatisticsServiceImpl.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/device/DeviceAbnormaStatisticsServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/device/DeviceAbnormaStatisticsServiceImpl.java index 55fab72d5..ab8f8538f 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/device/DeviceAbnormaStatisticsServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/device/DeviceAbnormaStatisticsServiceImpl.java @@ -47,9 +47,16 @@ public class DeviceAbnormaStatisticsServiceImpl implements DeviceAbnormalStatist // 根据装置id分组 Map> devMap = lines.stream().collect(Collectors.groupingBy(AlarmPO::getDeviceId)); // 监测点集合 - List monotorIds = lines.stream().map(AlarmPO::getId).collect(Collectors.toList()); +// List monotorIds = lines.stream().map(AlarmPO::getId).collect(Collectors.toList()); // 装置id集合 - List devIds = new ArrayList<>(devMap.keySet()); +// List devIds = new ArrayList<>(devMap.keySet()); + + List monitors = devMap.get("f82ab14fd5950ac5f7deaf75af360333"); + List monotorIds = monitors.stream().map(AlarmPO::getId).collect(Collectors.toList()); + List devIds = new ArrayList(Collections.singleton("f82ab14fd5950ac5f7deaf75af360333")); + Map> map = new HashMap<>(); + map.put("f82ab14fd5950ac5f7deaf75af360333",monitors); + // 获取异常告警策略 List alarmStrategyVOS = deviceAbnormaStatisticsMapper.selectAlarmStrategy(); Map> levMap = alarmStrategyVOS.stream().collect(Collectors.groupingBy(AlarmStrategyVO::getAlgoDesc)); @@ -84,7 +91,7 @@ public class DeviceAbnormaStatisticsServiceImpl implements DeviceAbnormalStatist } // 整合装置信息 List topMsgPOS = new ArrayList<>(); - for (Map.Entry> devEntry : devMap.entrySet()) { + for (Map.Entry> devEntry : map.entrySet()) { TopMsgPO topMsg = new TopMsgPO(); topMsg.setDevId(devEntry.getKey()); int deviceLevel = devEntry.getValue().stream().mapToInt(AlarmPO::getLevel).min().orElse(-1); @@ -145,10 +152,7 @@ public class DeviceAbnormaStatisticsServiceImpl implements DeviceAbnormalStatist } } - for (TopMsgPO topMsgPO : topMsgPOS) { - System.out.println(topMsgPO); - } - return deviceAbnormaStatisticsMapper.insertTopMsg(topMsgPOS); + return topMsgPOS.size()>0 ? deviceAbnormaStatisticsMapper.insertTopMsg(topMsgPOS) : true; } public List getCommunicate(List devs, String time) {