From 8d58c40af40493bd5f066cbfdb1ffd9f113c22fc Mon Sep 17 00:00:00 2001
From: 严智鑫 <test>
Date: 星期三, 03 九月 2025 16:37:21 +0800
Subject: [PATCH] 1.前端推数据使用了最新的webSokect客户现场总是掉线,修改为接口方式 2.设备交互整体增加异常处理以及PLC连接方式改为短连接
---
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/mechanicalMonitor/controller/MechanicalMonitorController.java | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/mechanicalMonitor/controller/MechanicalMonitorController.java b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/mechanicalMonitor/controller/MechanicalMonitorController.java
index eab9b9e..c3198e8 100644
--- a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/mechanicalMonitor/controller/MechanicalMonitorController.java
+++ b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/mechanicalMonitor/controller/MechanicalMonitorController.java
@@ -1,22 +1,22 @@
package com.mes.mechanicalMonitor.controller;
+import cn.hutool.json.JSONObject;
import com.mes.mechanicalMonitor.entity.MechanicalMonitor;
import com.mes.mechanicalMonitor.service.MechanicalMonitorService;
-import com.mes.tools.WebSocketServer;
import com.mes.utils.Result;
+import com.mes.websocket.WebSocketServer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
-import cn.hutool.json.JSONObject;
-import java.util.ArrayList;
-import java.util.List;
+
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
@Api(tags = "璁惧鐘舵�佺洃鎺�")
@RestController
-@RequestMapping("/deviceInteraction/mechanicalMonitor")
+@RequestMapping("/mechanicalMonitor")
public class MechanicalMonitorController {
@Autowired
@@ -42,10 +42,10 @@
@ResponseBody
public Result updateMechanicalStatus(@RequestBody JSONObject status) {
try {
- ArrayList<WebSocketServer> servers = WebSocketServer.sessionMap.get("mechanicalMonitor");
+ List<WebSocketServer> servers = WebSocketServer.SESSIONMAP.get("mechanicalMonitor");
if (servers != null) {
for (WebSocketServer server : servers) {
- server.sendMessage(status.toString());
+ server.sendToWeb("",status.toString());
}
}
return Result.build(200, "鐘舵�佹洿鏂版垚鍔�", null);
--
Gitblit v1.8.0