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,