From 15cfa9594a9a5787a9903dcaf8d5044601eed25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Mon, 8 Jul 2024 16:58:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B0=94=E8=B1=A1=E6=A3=80=E6=B5=8B=E5=99=A8?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=20=E5=8A=A0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/handler/DeviceMessageHandler.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 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 48954624..2a6b446b 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 @@ -611,16 +611,14 @@ 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(); DcWarning dcWarning = new DcWarning(); dcWarning.setWarningState(UniversalEnum.ONE.getNumber()); - dcWarning.setRemark(content); + dcWarning.setRemark(new Date()+" "+content); dcWarning.setWarningTime(new Date()); dcWarning.setWarningType(UniversalEnum.EIGHT_ONE.getNumber()); dcWarning.setWarningSubclass(UniversalEnum.EIGHT_ONE.getValue()); @@ -635,6 +633,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); @@ -663,7 +665,7 @@ public class DeviceMessageHandler { String string = object.toString(); DcWarning dcWarning = new DcWarning(); dcWarning.setWarningState(UniversalEnum.ONE.getNumber()); - dcWarning.setRemark(content); + dcWarning.setRemark(new Date()+" "+content); dcWarning.setWarningTime(new Date()); dcWarning.setWarningType(UniversalEnum.EIGHT_FOUR.getNumber()); dcWarning.setWarningSubclass(UniversalEnum.EIGHT_FOUR.getValue()); @@ -677,7 +679,11 @@ public class DeviceMessageHandler { if (direction.equals(UniversalEnum.DIRECTION_OF_JINAN.getValue())) { dcWarning.setDirection(UniversalEnum.THREE.getValue()); } + dcWarningService.insertDcWarning(dcWarning); + contentMap.put("content", content); + contentMap.put("event", dcWarning); + WebSocketService.broadcast(WebSocketEvent.WARNING, contentMap); //待确认数量 dcEventService.getCountNum();