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); }