测试提交

This commit is contained in:
2024-12-18 11:00:08 +08:00
parent 3e90016ad5
commit e9a294acdb

View File

@@ -8,6 +8,7 @@ import com.njcn.gather.detection.pojo.enums.SourceResponseCodeEnum;
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
import com.njcn.gather.detection.pojo.vo.SocketMsg;
import com.njcn.gather.detection.pojo.vo.WebSocketVO;
import com.njcn.gather.detection.util.socket.MsgUtil;
import com.njcn.gather.detection.util.socket.SocketManager;
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
@@ -31,7 +32,10 @@ import java.util.*;
public class SocketDevResponseService {
private final String handlerStr = "_dev";
private final WebSocketHandler webSocketHandler;
private final IPqDevService iPqDevService;
@@ -41,11 +45,11 @@ public class SocketDevResponseService {
switch (sourceOperateCodeEnum) {
case YJC_SBTXJY:
devComm(socketDataMsg,param,msg);
break;
case YJC_XYJY:
devXieyi(socketDataMsg,param,msg);
break;
case YJC_XUJY:
break;
}
@@ -57,10 +61,63 @@ public class SocketDevResponseService {
private void devComm(SocketDataMsg socketDataMsg,PreDetectionParam param){
private void devComm(SocketDataMsg socketDataMsg,PreDetectionParam param,String msg){
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
String s = param.getUserPageId() + handlerStr;
SocketMsg socketMsg=new SocketMsg();
switch (dictDataEnumByCode){
case SUCCESS:
//通讯校验成功
webSocketHandler.sendMsgToUser(param.getUserPageId(), msg);
//开始进行协议校验
List<PreDetection> devList = iPqDevService.getDevInfo(param.getDevIds());
Map<String, List<PreDetection>> map = new HashMap(1);
map.put("deviceList", devList);
String jsonString = JSON.toJSONString(map);
socketMsg.setRequestId(SourceOperateCodeEnum.YJC_XYJY.getValue());
socketMsg.setOperateCode(SourceOperateCodeEnum.DEV_INIT_GATHER_02.getValue());
socketMsg.setData(jsonString);
String json = JSON.toJSONString(socketMsg);
SocketManager.sendMsg(s,json);
break;
case UNPROCESSED_BUSINESS:
break;
case RE_OPERATE:
//发起关闭操作
//SocketMsg socketMsg = new SocketMsg();
// socketMsg.setRequestId("quit");
// socketMsg.setOperateCode("QUIT_FUNEND$01");
// SocketManager.sendMsg(s,JSON.toJSONString(socketMsg));
break;
default:
WebSocketVO webSocketVO = new WebSocketVO();
break;
}
}
private void devXieyi(SocketDataMsg socketDataMsg,PreDetectionParam param,String msg){
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
switch (dictDataEnumByCode){
case SUCCESS:
webSocketHandler.sendMsgToUser(param.getUserPageId(), msg);
String s = param.getUserPageId() + handlerStr;
break;
case UNPROCESSED_BUSINESS:
break;
case RE_OPERATE:
//发起关闭操作
break;
default:
WebSocketVO webSocketVO = new WebSocketVO();
break;
}
}
@@ -70,7 +127,4 @@ public class SocketDevResponseService {
}