From 66e1705ee76b2c72ed09fdf747e5d5253b8155bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Wed, 17 Jul 2024 14:44:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=A9=E6=B0=94=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/handler/DeviceMessageHandler.java | 15 +++------------ .../service/impl/DcWarningServiceImpl.java | 12 ++++++++++-- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java index 1af9467f..dfc2fef7 100644 --- a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java +++ b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java @@ -616,7 +616,6 @@ public class DeviceMessageHandler { } String content = direction + stakeMark + precipitationType; - Map contentMap = new HashMap<>(); JSONObject object = new JSONObject(); object.put("meteorologicalDetectorData", meteorologicalDetectorData); @@ -641,13 +640,10 @@ public class DeviceMessageHandler { if (direction.equals(UniversalEnum.DIRECTION_OF_JINAN.getValue())) { dcWarning.setDirection(UniversalEnum.THREE.getValue()); } - contentMap.put("content", content); - contentMap.put("event", dcWarning); - - WebSocketService.broadcast(WebSocketEvent.WARNING, contentMap); dcWarningService.insertDcWarning(dcWarning); + //待确认数量 dcEventService.getCountNum(); } @@ -664,10 +660,7 @@ public class DeviceMessageHandler { } String content = direction + stakeMark + precipitationType; - Map contentMap = new HashMap<>(); - contentMap.put("content", content); - contentMap.put("event", meteorologicalDetectorData); - WebSocketService.broadcast(WebSocketEvent.WARNING, contentMap); + JSONObject object = new JSONObject(); object.put("meteorologicalDetectorData", meteorologicalDetectorData); String string = object.toString(); @@ -691,9 +684,7 @@ public class DeviceMessageHandler { } dcWarningService.insertDcWarning(dcWarning); - contentMap.put("content", content); - contentMap.put("event", dcWarning); - WebSocketService.broadcast(WebSocketEvent.WARNING, contentMap); + //待确认数量 dcEventService.getCountNum(); diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index 1a8c08b9..4433214c 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -242,9 +242,17 @@ public class DcWarningServiceImpl implements IDcWarningService break; } } - String content= direction+UniversalEnum.BLANK_SPACE.getValue() + dcWarning.getStakeMark()+UniversalEnum.BLANK_SPACE.getValue()+HAPPEN+EventSubclass+EVENT ; Map contentMap = new HashMap<>(); - contentMap.put("content",content); + + if (dcWarning.getWarningSource() == 7) { + String remark = dcWarning.getRemark(); + String[] split = remark.split(" "); + String s = split[split.length - 1]; + contentMap.put("content",s); + }else { + String content= direction+UniversalEnum.BLANK_SPACE.getValue() + dcWarning.getStakeMark()+UniversalEnum.BLANK_SPACE.getValue()+HAPPEN+EventSubclass+EVENT ; + contentMap.put("content",content); + } contentMap.put("event",dcWarning); WebSocketService.broadcast(WebSocketEvent.WARNING, contentMap); //推送事件消息 0不是感知事件 dcEventService.getCountNum();