From b4dbd615633aba052ff21285d408b8f95683d462 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Sun, 20 Aug 2023 10:02:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E5=8F=91=E6=B6=88=E6=81=AF=E7=B1=BB?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/socket/client/SocketMsgService.java | 5 ++++ .../socket/client/SpsWebSocketClient.java | 23 +++++++++---------- .../socket/client/WebSocketComponent.java | 12 +--------- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/api-admin/src/main/java/com/glxp/sale/admin/socket/client/SocketMsgService.java b/api-admin/src/main/java/com/glxp/sale/admin/socket/client/SocketMsgService.java index 8c8c1e0..3956fae 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/socket/client/SocketMsgService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/socket/client/SocketMsgService.java @@ -17,4 +17,9 @@ public class SocketMsgService { public void sendNoticeMsg(String message) { spsSyncWebSocket.sendMessage(message, "2:" + token); } + + + public void sendDeleteMsg(String message) { + spsSyncWebSocket.sendMessage(message, "2:" + token); + } } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/socket/client/SpsWebSocketClient.java b/api-admin/src/main/java/com/glxp/sale/admin/socket/client/SpsWebSocketClient.java index 5800f18..d720af4 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/socket/client/SpsWebSocketClient.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/socket/client/SpsWebSocketClient.java @@ -54,18 +54,17 @@ public class SpsWebSocketClient extends WebSocketClient { //收到更新下载数据则赋值由外部处理,多个任务只处理一次避免重复处理 if (s.contains(SocketMsgType.DL_ALL_DATA)) { this.excptMessage = s; - } else if(s.contains(SocketMsgType.BASIC_DATA_DELETE)) { - this.excptMessage = s; - }else if(s.contains(SocketMsgType.BASIC_MANAGE_DELETE)){ - this.excptMessage = s; - }else if(s.contains(SocketMsgType.BASIC_CORP_MAINTAIN_DELETE)){ - this.excptMessage = s; - }else if(s.contains(SocketMsgType.BASIC_BUSINESS_TYPE_DELETE)){ - this.excptMessage = s; - } - else { - //通知类消息则需转发 - socketMsgService.sendNoticeMsg(s); + } else if (s.contains(SocketMsgType.BASIC_DATA_DELETE)) { + socketMsgService.sendDeleteMsg(s); + } else if (s.contains(SocketMsgType.BASIC_MANAGE_DELETE)) { + socketMsgService.sendDeleteMsg(s); + } else if (s.contains(SocketMsgType.BASIC_CORP_MAINTAIN_DELETE)) { + socketMsgService.sendDeleteMsg(s); + } else if (s.contains(SocketMsgType.BASIC_BUSINESS_TYPE_DELETE)) { + socketMsgService.sendDeleteMsg(s); + } else { + //通知类消息则需转发 + socketMsgService.sendNoticeMsg(s); } } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/socket/client/WebSocketComponent.java b/api-admin/src/main/java/com/glxp/sale/admin/socket/client/WebSocketComponent.java index 5ff9684..6e62f48 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/socket/client/WebSocketComponent.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/socket/client/WebSocketComponent.java @@ -27,8 +27,7 @@ public class WebSocketComponent implements CommandLineRunner { HeartTaskService heartTaskService; @Resource SocketMsgService socketMsgService; - @Resource - SpsSyncWebSocket spsSyncWebSocket; + @Override public void run(String... args) throws Exception { @@ -50,16 +49,7 @@ public class WebSocketComponent implements CommandLineRunner { } if (message.contains(SocketMsgType.DL_ALL_DATA)) { heartTaskService.dlAllData(); - } else if(message.contains(SocketMsgType.BASIC_DATA_DELETE)){ - spsSyncWebSocket.sendMessage(message,"2:"+socketToken); - }else if(message.contains(SocketMsgType.BASIC_MANAGE_DELETE)){ - spsSyncWebSocket.sendMessage(message,"2:"+socketToken); - }else if(message.contains(SocketMsgType.BASIC_CORP_MAINTAIN_DELETE)){ - spsSyncWebSocket.sendMessage(message,"2:"+socketToken); - }else if(message.contains(SocketMsgType.BASIC_BUSINESS_TYPE_DELETE)){ - spsSyncWebSocket.sendMessage(message,"2:"+socketToken); } - //打印服务端返回的数据 log.info("成功获取数据:" + message); }