From c7d64da05cf21a4ea12da86d97c94fc0827850e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Tue, 28 May 2024 09:20:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=A4=84=E7=BD=AE=20?= =?UTF-8?q?=E6=8C=87=E6=8C=A5=E8=B0=83=E5=BA=A6=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=95=B0=E6=8D=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/handler/DeviceMessageHandler.java | 30 +++++++++++++++++++ .../service/impl/DcEventServiceImpl.java | 2 ++ 2 files changed, 32 insertions(+) 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 56a827f5..f89a98a5 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 @@ -591,6 +591,35 @@ public class DeviceMessageHandler { //方向 meteorologicalDetectorData.setDirection(direction); + //todo 首页推送事件消息 3气象检测器 + if (!meteorologicalDetectorData.getPrecipitationType().equals("0")) {//降水类型 0=无降;1=雨;2=雪;3=毛毛雨;4=雨夹雪; + WebSocketService.broadcast("3", meteorologicalDetectorData); + JSONObject object = new JSONObject(); + object.put("meteorologicalDetectorData", meteorologicalDetectorData); + String string = object.toString(); + DcWarning dcWarning = new DcWarning(); + dcWarning.setStakeMark(meteorologicalDetectorData.getStakeMark()); + + dcWarning.setWarningSource(7);//气象检测器 + dcWarning.setOtherConfig(string); + dcWarning.setWarningTitle("气象预警"); + dcWarningService.insertDcWarning(dcWarning); + } + if (!meteorologicalDetectorData.getVisibilityType().equals("4")) {// 能见度类型,4 表示能见度良好3表示阴霾 2表示雾 1表示浓雾; + WebSocketService.broadcast("3", meteorologicalDetectorData); + JSONObject object = new JSONObject(); + object.put("meteorologicalDetectorData", meteorologicalDetectorData); + String string = object.toString(); + DcWarning dcWarning = new DcWarning(); + dcWarning.setStakeMark(meteorologicalDetectorData.getStakeMark()); + dcWarning.setWarningSource(7);//气象检测器 + dcWarning.setOtherConfig(string); + dcWarning.setWarningTitle("气象预警"); + + dcWarningService.insertDcWarning(dcWarning); + } + + meteorologicalDetectorData.setIotDeviceId(msg.get("deviceId").toString()); meteorologicalDetectorDataService.insertDcMeteorologicalDetectorData(meteorologicalDetectorData); @@ -618,6 +647,7 @@ public class DeviceMessageHandler { mdDeviceData.setExpands(JSONObject.toJSONString(expands)); + middleDatabaseService.insertMiddleDatabaseDeviceData(mdDeviceData); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java index 9f2c9158..e2837faa 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java @@ -1096,10 +1096,12 @@ public class DcEventServiceImpl extends ServiceImpl impl if (dcEvent1 == null) { return 1; } +/* //事件状态已被修改 返回成功 if (dcEvent1.getEventState() == state) { return 1; } +*/ int i = dcEventMapper.updateDcEventState(id, state); if (i > 0) {