From ab58ad626ea3e6338f2800be810cc36536d003cc Mon Sep 17 00:00:00 2001 From: wanggeng <450292408@qq.com> Date: Thu, 22 Jul 2021 22:59:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E4=B8=AD=E7=9A=84service=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cm/websocket/pojo/AppSocketMessage.java | 16 ++++++++++++++++ .../service/impl/MessageServiceImpl.java | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/cloud-common-websocket/src/main/java/com/cm/websocket/pojo/AppSocketMessage.java b/cloud-common-websocket/src/main/java/com/cm/websocket/pojo/AppSocketMessage.java index f2ff815..38f41d2 100644 --- a/cloud-common-websocket/src/main/java/com/cm/websocket/pojo/AppSocketMessage.java +++ b/cloud-common-websocket/src/main/java/com/cm/websocket/pojo/AppSocketMessage.java @@ -219,6 +219,7 @@ public class AppSocketMessage { private String title; private String msg; private String target; + private String serviceId; public NoticeBody() { } @@ -234,6 +235,13 @@ public class AppSocketMessage { this.target = target; } + public NoticeBody(String title, String msg, String target, String serviceId) { + this.title = title; + this.msg = msg; + this.target = target; + this.serviceId = serviceId; + } + public String getTitle() { return title == null ? "" : title; } @@ -257,6 +265,14 @@ public class AppSocketMessage { public void setTarget(String target) { this.target = target; } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } } public static class CountNeedToDealWithBody { diff --git a/cloud-common-websocket/src/main/java/com/cm/websocket/service/impl/MessageServiceImpl.java b/cloud-common-websocket/src/main/java/com/cm/websocket/service/impl/MessageServiceImpl.java index cec13ab..d7ce5e4 100644 --- a/cloud-common-websocket/src/main/java/com/cm/websocket/service/impl/MessageServiceImpl.java +++ b/cloud-common-websocket/src/main/java/com/cm/websocket/service/impl/MessageServiceImpl.java @@ -102,7 +102,7 @@ public class MessageServiceImpl extends AbstractService implements IMessageServi scheduledExecutorService.schedule(() -> { for (AppSocketSession appSocketSession : appSocketSessions) { Session session = appSocketSession.getSession(); - AppSocketMessage.NoticeBody noticeBody = new AppSocketMessage.NoticeBody(notice.getTitle(), notice.getMsg(), notice.getTarget()); + AppSocketMessage.NoticeBody noticeBody = new AppSocketMessage.NoticeBody(notice.getTitle(), notice.getMsg(), notice.getTarget(), notice.getServiceId()); AppSocketMessage appSocketMessage = new AppSocketMessage(AppSocketTypeEnum.NOTICE_TARGET_MESSAGE.getValue(), true, AppSocketSessionManager.FORM_SYSTEM,