From 83296d257cbd7024d5431b04be41abfb638bafd9 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Thu, 23 Apr 2026 13:59:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/SocketFreqConverterService.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketFreqConverterService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketFreqConverterService.java index d8e20f9f..c39c9144 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketFreqConverterService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketFreqConverterService.java @@ -150,16 +150,23 @@ public class SocketFreqConverterService { public void handleRead(String converterChannelTag, String msg) { FreqConverterRespDTO respDTO = JSON.parseObject(msg, FreqConverterRespDTO.class); - switch (FormalTestManager.freqConverterStep) { - case CMD_INIT_SERIAL: - handleInitSerial(converterChannelTag, respDTO); - break; - case CMD_GET_DEVICE_STATUS: - handleGetDeviceStatus(converterChannelTag, respDTO); - break; - case CMD_CLOSE_SERIAL: - handleCloseSerial(converterChannelTag, respDTO); - break; + if (respDTO.getCode() != 0) { + SocketDataMsg socketDataMsg = new SocketDataMsg(); + socketDataMsg.setRequestId(FormalTestManager.freqConverterStep.getValue()); + socketDataMsg.setCode(respDTO.getCode()); + WebServiceManager.sendMsg(this.userId, JSON.toJSONString(socketDataMsg)); + } else { + switch (FormalTestManager.freqConverterStep) { + case CMD_INIT_SERIAL: + handleInitSerial(converterChannelTag, respDTO); + break; + case CMD_GET_DEVICE_STATUS: + handleGetDeviceStatus(converterChannelTag, respDTO); + break; + case CMD_CLOSE_SERIAL: + handleCloseSerial(converterChannelTag, respDTO); + break; + } } } @@ -266,6 +273,7 @@ public class SocketFreqConverterService { /** * 如果变频器已停止,则清除共享的运行时状态 + * * @param currentUserId 当前用户ID */ private void clearStateIfStopped(String currentUserId) {