This commit is contained in:
2025-01-15 14:22:41 +08:00
parent 1ee77361ff
commit f3a0bb75ee
3 changed files with 19 additions and 3 deletions

View File

@@ -684,7 +684,7 @@ public class SocketDevResponseService {
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XYJY.getValue()); socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XYJY.getValue());
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_03.getValue()); socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_03.getValue());
socketMsg.setData(jsonString); socketMsg.setData(jsonString);
System.out.println("开始3协议校验++++++++++"); System.out.println("开始暂态协议校验++++++++++");
SocketManager.sendMsg(s, JSON.toJSONString(socketMsg)); SocketManager.sendMsg(s, JSON.toJSONString(socketMsg));
} }
@@ -954,7 +954,6 @@ public class SocketDevResponseService {
if (successComm.size() == FormalTestManager.monitorIdListComm.size()) { if (successComm.size() == FormalTestManager.monitorIdListComm.size()) {
System.out.println(sourceIssue.getType() + splitTag + sourceIssue.getIndex() + "当前测试小项读取数据已经全部结束。。。。。。。。。"); System.out.println(sourceIssue.getType() + splitTag + sourceIssue.getIndex() + "当前测试小项读取数据已经全部结束。。。。。。。。。");
//修改装置为监测中 //修改装置为监测中
adPlanService.updateTestState(param.getPlanId(), param.getDevIds()); adPlanService.updateTestState(param.getPlanId(), param.getDevIds());
@@ -996,6 +995,7 @@ public class SocketDevResponseService {
SocketManager.addTargetMap(sourceIssue.getType(), tem); SocketManager.addTargetMap(sourceIssue.getType(), tem);
System.out.println("该大项还有" + tem + "个小项没有进行检测!!!!!!!!"); System.out.println("该大项还有" + tem + "个小项没有进行检测!!!!!!!!");
if (tem == 0) { if (tem == 0) {
System.out.println(sourceIssue.getType() + sourceIssue.getIndex() + "当前测试大项已经全部结束》》》》》》》》"); System.out.println(sourceIssue.getType() + sourceIssue.getIndex() + "当前测试大项已经全部结束》》》》》》》》");
//当val为0则认为大项中的小项已经全部跑完开始组装信息推送给前端 //当val为0则认为大项中的小项已经全部跑完开始组装信息推送给前端
List<DevLineTestResult> resultList = new ArrayList<>(); List<DevLineTestResult> resultList = new ArrayList<>();
@@ -1013,6 +1013,8 @@ public class SocketDevResponseService {
resultList.add(devTem); resultList.add(devTem);
}); });
allDevTestList.clear();
webSocketVO = new WebSocketVO<>(); webSocketVO = new WebSocketVO<>();
webSocketVO.setRequestId(socketDataMsg.getRequestId().split(stepTag)[1] + stepEnd); webSocketVO.setRequestId(socketDataMsg.getRequestId().split(stepTag)[1] + stepEnd);
webSocketVO.setData(resultList); webSocketVO.setData(resultList);
@@ -1342,6 +1344,7 @@ public class SocketDevResponseService {
this.devInfo.clear(); this.devInfo.clear();
this.devDataMap.clear(); this.devDataMap.clear();
this.realDataXiList.clear(); this.realDataXiList.clear();
this.allDevTestList.clear();
List<PreDetection> pqDevList = iPqDevService.getDevInfo(param.getDevIds()); List<PreDetection> pqDevList = iPqDevService.getDevInfo(param.getDevIds());
FormalTestManager.devList = pqDevList; FormalTestManager.devList = pqDevList;

View File

@@ -4,7 +4,12 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum; import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
import com.njcn.gather.detection.pojo.param.PreDetectionParam; import com.njcn.gather.detection.pojo.param.PreDetectionParam;
import com.njcn.gather.detection.pojo.vo.CoefficientVO;
import com.njcn.gather.detection.pojo.vo.SocketMsg; import com.njcn.gather.detection.pojo.vo.SocketMsg;
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
import com.njcn.gather.detection.util.socket.web.WebSocketHandler;
import java.util.Objects;
/** /**
* @Author: cdf * @Author: cdf
@@ -38,4 +43,12 @@ public class CnSocketUtil {
socketMsg.setData(jsonObject.toJSONString()); socketMsg.setData(jsonObject.toJSONString());
SocketManager.sendMsg(param.getUserPageId() + sourceTag, JSON.toJSONString(socketMsg)); SocketManager.sendMsg(param.getUserPageId() + sourceTag, JSON.toJSONString(socketMsg));
} }
public static void sendToWebSocket(String userId,String requestId, String operatorType, Object data){
WebSocketVO<Object> webSocketVO = new WebSocketVO<>();
webSocketVO.setRequestId(requestId);
webSocketVO.setOperateCode(operatorType);
webSocketVO.setData(data);
WebServiceManager.sendMessage(userId,webSocketVO);
}
} }

View File

@@ -60,7 +60,7 @@ public class WebServiceManager {
} }
public static void sendMessage(String userId, WebSocketVO webSocketVO) { public static void sendMessage(String userId, WebSocketVO<Object> webSocketVO) {
Channel channel = userSessions.get(userId); Channel channel = userSessions.get(userId);
if(Objects.nonNull(channel) && channel.isActive()){ if(Objects.nonNull(channel) && channel.isActive()){
TextWebSocketFrame wd = new TextWebSocketFrame(JSON.toJSONString(webSocketVO)); TextWebSocketFrame wd = new TextWebSocketFrame(JSON.toJSONString(webSocketVO));