From 603030de170d5c60838d5b3f69bd9ee6afecfd90 Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Sat, 15 Jun 2024 16:15:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=BE=85=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=B6=88=E6=81=AF=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zc/business/service/impl/DcEventServiceImpl.java | 5 ++++- .../zc/business/service/impl/DcWarningServiceImpl.java | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) 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 cf330806..1c7d0c05 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 @@ -2052,8 +2052,11 @@ public class DcEventServiceImpl extends ServiceImpl impl Long eventCount = dcEventMapper.selectEventNumByStatus("0"); + Long num = warningCount + eventCount; - return warningCount + eventCount; + WebSocketService.broadcast(WebSocketEvent.EVENT_COUNT, num); + + return num; } 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 e85b6a36..87ff9f0d 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 @@ -624,7 +624,13 @@ public class DcWarningServiceImpl implements IDcWarningService if (dcWarnings.size()==0){ return 1; } - return dcWarningMapper.updateEndSection(dcWarnings); + Integer i = dcWarningMapper.updateEndSection(dcWarnings); + + //推送待处理消息数量 + Long num = dcEventService.getCountNum(); + WebSocketService.broadcast(WebSocketEvent.EVENT_COUNT, num); + + return i; } @Override From e63dd47ec3d16feccdfbe1b04ab571475c5d7aaa Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Sat, 15 Jun 2024 16:27:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BE=85=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=95=B0=E9=87=8F=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message/device/handler/DeviceMessageHandler.java | 6 ++---- .../zc/business/service/impl/DcEventServiceImpl.java | 9 +++------ .../business/service/impl/DcWarningServiceImpl.java | 12 ++++-------- 3 files changed, 9 insertions(+), 18 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 24452d53..74913066 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 @@ -610,8 +610,7 @@ public class DeviceMessageHandler { dcWarningService.insertDcWarning(dcWarning); //待确认数量 - Long count = dcEventService.getCountNum(); - WebSocketService.broadcast(WebSocketEvent.EVENT_COUNT, count); + dcEventService.getCountNum(); } if (!meteorologicalDetectorData.getVisibilityType().equals("4")) {// 能见度类型,4 表示能见度良好3表示阴霾 2表示雾 1表示浓雾; WebSocketService.broadcast(WebSocketEvent.WARNING, meteorologicalDetectorData); @@ -627,8 +626,7 @@ public class DeviceMessageHandler { dcWarningService.insertDcWarning(dcWarning); //待确认数量 - Long count = dcEventService.getCountNum(); - WebSocketService.broadcast(WebSocketEvent.EVENT_COUNT, count); + dcEventService.getCountNum(); } 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 1c7d0c05..5b780b9c 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 @@ -575,8 +575,7 @@ public class DcEventServiceImpl extends ServiceImpl impl WebSocketService.broadcast(WebSocketEvent.EVENT, contentMap); //推送事件消息 0不是感知事件 - Long count = getCountNum(); - WebSocketService.broadcast(WebSocketEvent.EVENT_COUNT, count); + getCountNum(); } @@ -1059,8 +1058,7 @@ public class DcEventServiceImpl extends ServiceImpl impl } } //推送待处理数量 - Long count = getCountNum(); - WebSocketService.broadcast(WebSocketEvent.EVENT_COUNT,count); + getCountNum(); return i7; } @@ -1235,8 +1233,7 @@ public class DcEventServiceImpl extends ServiceImpl impl if (i > 0) { //推送待处理数量 - Long count = getCountNum(); - WebSocketService.broadcast(WebSocketEvent.EVENT_COUNT,count); + getCountNum(); DcEvent dcEvent = dcEventMapper.selectDcEventMainById(id); 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 87ff9f0d..0d68974f 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 @@ -236,8 +236,7 @@ public class DcWarningServiceImpl implements IDcWarningService contentMap.put("content",content); contentMap.put("event",dcWarning); WebSocketService.broadcast(WebSocketEvent.WARNING, contentMap); //推送事件消息 0不是感知事件 - Long count = dcEventService.getCountNum(); - WebSocketService.broadcast(WebSocketEvent.EVENT_COUNT, count); //推送待处理数量 + dcEventService.getCountNum(); } //优先级策略(还差优先级策略需要配置) @@ -527,8 +526,7 @@ public class DcWarningServiceImpl implements IDcWarningService return AjaxResult.error("操作失败"); } //推送待处理数量 - Long count = dcEventService.getCountNum(); - WebSocketService.broadcast(WebSocketEvent.EVENT_COUNT,count); + dcEventService.getCountNum(); return AjaxResult.success("操作成功"); } @@ -627,8 +625,7 @@ public class DcWarningServiceImpl implements IDcWarningService Integer i = dcWarningMapper.updateEndSection(dcWarnings); //推送待处理消息数量 - Long num = dcEventService.getCountNum(); - WebSocketService.broadcast(WebSocketEvent.EVENT_COUNT, num); + dcEventService.getCountNum(); return i; } @@ -953,8 +950,7 @@ public class DcWarningServiceImpl implements IDcWarningService dcWarning.setUpdateTime(DateUtils.getNowDate()); Integer i = dcWarningMapper.falseAlarmResolution(dcWarning); //推送待处理数量 - Long count = dcEventService.getCountNum(); - WebSocketService.broadcast(WebSocketEvent.EVENT_COUNT,count); + dcEventService.getCountNum(); return i; }