diff --git a/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java b/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java index 6b981425..97f32cbc 100644 --- a/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java +++ b/detection/src/main/java/com/njcn/gather/detection/controller/PreDetectionController.java @@ -149,32 +149,32 @@ public class PreDetectionController extends BaseController { /** * 测试 */ - @PostMapping("/startTest") - @OperateInfo - @ApiOperation("测试") - @ApiImplicitParam(name = "param", value = "查询参数", required = true) - public HttpResult startTest(@RequestBody PreDetectionParam param) { - String methodDescribe = getMethodDescribe("startTest"); - //preDetectionService.startTest(param); - - - List pqDevList = iPqDevService.getDevInfo(param.getDevIds()); - XiNumberManager.xiDevList = pqDevList; - String s = param.getUserPageId() + "_Dev"; - SocketMsg socketMsg = new SocketMsg<>(); - socketMsg.setRequestId(SourceOperateCodeEnum.Coefficient_Check.getValue()); - socketMsg.setOperateCode(SourceOperateCodeEnum.DATA_CHNFACTOR$01.getValue()); - PreDetection preDetection = pqDevList.get(0); - Map map = new HashMap<>(); - map.put("devIP", preDetection.getDevIP()); - map.put("chnNum", preDetection.getDevChns()); - socketMsg.setData(JSON.toJSONString(map)); - - - NettyClient.socketClient("192.168.1.138", 61000, param, JSON.toJSONString(socketMsg), new NettyDevClientHandler(param, socketDevResponseService)); - - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); - } +// @PostMapping("/startTest") +// @OperateInfo +// @ApiOperation("测试") +// @ApiImplicitParam(name = "param", value = "查询参数", required = true) +// public HttpResult startTest(@RequestBody PreDetectionParam param) { +// String methodDescribe = getMethodDescribe("startTest"); +// //preDetectionService.startTest(param); +// +// +// List pqDevList = iPqDevService.getDevInfo(param.getDevIds()); +// XiNumberManager.xiDevList = pqDevList; +// String s = param.getUserPageId() + "_Dev"; +// SocketMsg socketMsg = new SocketMsg<>(); +// socketMsg.setRequestId(SourceOperateCodeEnum.Coefficient_Check.getValue()); +// socketMsg.setOperateCode(SourceOperateCodeEnum.DATA_CHNFACTOR$01.getValue()); +// PreDetection preDetection = pqDevList.get(0); +// Map map = new HashMap<>(); +// map.put("devIP", preDetection.getDevIP()); +// map.put("chnNum", preDetection.getDevChns()); +// socketMsg.setData(JSON.toJSONString(map)); +// +// +// NettyClient.socketClient("192.168.1.138", 61000, param, JSON.toJSONString(socketMsg), new NettyDevClientHandler(param, socketDevResponseService)); +// +// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); +// } } diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java index d0773825..7c8347b1 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java @@ -93,7 +93,7 @@ public class SocketDevResponseService { */ List devInfo = new ArrayList<>(); - Map devDataMap = new HashMap<>(); + //Map devDataMap = new HashMap<>(); /** * 成功结束的测点 @@ -785,14 +785,16 @@ public class SocketDevResponseService { storageParam.setScriptId(param.getScriptId()); List indexes = adHarmonicService.getIndex(storageParam, true); issueParam.setIndexList(indexes); - issueParam.setIsPhaseSequence(SourceOperateCodeEnum.COEFFICIENT_TEST.getValue()); + issueParam.setIsPhaseSequence(SourceOperateCodeEnum.RE_ERROR_TEST.getValue()); } else { issueParam.setIsPhaseSequence(SourceOperateCodeEnum.FORMAL_TEST.getValue()); } //正式检测 sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam); sourceIssues = sourceIssues.stream().sorted(Comparator.comparing(SourceIssue::getIndex)).collect(Collectors.toList()); + // 存放所有检测小项 SocketManager.addSourceList(sourceIssues); + // 按照大项分组。key为大项code,value为小项个数 Map sourceIssueMap = sourceIssues.stream().collect(Collectors.groupingBy(SourceIssue::getType, Collectors.counting())); SocketManager.initMap(sourceIssueMap); @@ -1468,7 +1470,7 @@ public class SocketDevResponseService { //初始化相序集合 this.devInfo.clear(); - this.devDataMap.clear(); + //this.devDataMap.clear(); //好像没有用到 FormalTestManager.realDataXiList.clear(); this.targetTestMap.clear(); diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java index aa9bb0e5..194bb2ba 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketSourceResponseService.java @@ -64,6 +64,7 @@ public class SocketSourceResponseService { if (ObjectUtil.isNotNull(param.getPlanId())) { detectionDev(param, socketDataMsg); } else { + // 程控源-源通信校验 handleYtxjySimulate(param, socketDataMsg); } break; diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionResponseEnum.java b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionResponseEnum.java index f491afac..584ce551 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionResponseEnum.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionResponseEnum.java @@ -14,7 +14,10 @@ public enum DetectionResponseEnum { PLAN_AND_SOURCE_NOT("A020003", "计划和源关系不存在"), ITEM_TEST_NOT("A020004", "检测项为空"), PLAN_DEV_IP_HAS("A20005","当前计划检测装置ip重复"), - SOURCE_NOT_CONNECT("A020006", "源未连接"); + SOURCE_NOT_CONNECT("A020006", "源未连接"), + + + SCRIPT_CHECK_DATA_NOT_EXIST("A020040","测试脚本项暂无配置" ); private final String code; private final String message; diff --git a/detection/src/main/java/com/njcn/gather/detection/service/PreDetectionService.java b/detection/src/main/java/com/njcn/gather/detection/service/PreDetectionService.java index 9be6864b..62f6ea3d 100644 --- a/detection/src/main/java/com/njcn/gather/detection/service/PreDetectionService.java +++ b/detection/src/main/java/com/njcn/gather/detection/service/PreDetectionService.java @@ -24,9 +24,6 @@ public interface PreDetectionService { void coefficientCheck(PreDetectionParam param); - boolean startTest(PreDetectionParam param); - - boolean temStopTest(); diff --git a/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java b/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java index f8a404e0..0d35e3a3 100644 --- a/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java @@ -162,9 +162,6 @@ public class PreDetectionServiceImpl implements PreDetectionService { param.setSourceId(sourceParam.getSourceId()); WebServiceManager.addPreDetectionParam(param); if (ObjectUtil.isNotNull(sourceParam)) { - //开始组装socket报文请求头 - //socketDevResponseService.initList(param); - //socketSourceResponseService.initList(param); SocketMsg socketMsg = new SocketMsg<>(); socketMsg.setRequestId(SourceOperateCodeEnum.YJC_YTXJY.getValue()); socketMsg.setOperateCode(SourceOperateCodeEnum.INIT_GATHER.getValue()); @@ -175,15 +172,6 @@ public class PreDetectionServiceImpl implements PreDetectionService { } } - - @Override - public boolean startTest(PreDetectionParam param) { - socketDevResponseService.initList(param); - NettyClient.socketClient(ip, port, param, "start\n", new NettySourceClientHandler(param, sourceResponseService)); - - return true; - } - @Override public boolean temStopTest() { FormalTestManager.stopFlag = true; diff --git a/detection/src/main/java/com/njcn/gather/detection/util/socket/SocketManager.java b/detection/src/main/java/com/njcn/gather/detection/util/socket/SocketManager.java index dd1c9d7b..2b76998f 100644 --- a/detection/src/main/java/com/njcn/gather/detection/util/socket/SocketManager.java +++ b/detection/src/main/java/com/njcn/gather/detection/util/socket/SocketManager.java @@ -19,7 +19,10 @@ import java.util.concurrent.CopyOnWriteArrayList; */ public class SocketManager { + // key为userId(xxx_Source、xxx_Dev),value为channel private static final Map socketSessions = new ConcurrentHashMap<>(); + + // key为userId(xxx_Source、xxx_Dev),value为group private static final Map socketGroup = new ConcurrentHashMap<>(); public static void addUser(String userId, Channel channel) { diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptIssueParam.java b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptIssueParam.java index c0666475..ab19365b 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptIssueParam.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptIssueParam.java @@ -37,6 +37,6 @@ public class PqScriptIssueParam { @ApiModelProperty("表明指标类型(例如:Freq频率下的影响、Base额定下的影响、VOL电压下的影响)") private String scriptSubType; - @ApiModelProperty("脚本下发类型") + @ApiModelProperty("脚本下发类型") //在程控源功能中使用。因为在程控源功能中,不知道装置的类型,即不知道额定电压、额定电流;而在正式检测时,知道装置的类型。为了区分,0表示正式检测,1表示程控源功能。 private int type; } diff --git a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptCheckDataServiceImpl.java b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptCheckDataServiceImpl.java index 0d5b459f..cf693e31 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptCheckDataServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptCheckDataServiceImpl.java @@ -9,6 +9,7 @@ import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.exception.BusinessException; import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum; +import com.njcn.gather.detection.pojo.enums.DetectionResponseEnum; import com.njcn.gather.script.mapper.PqScriptCheckDataMapper; import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam; import com.njcn.gather.script.pojo.po.PqScriptCheckData; @@ -80,7 +81,8 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl pqScriptCheckData = this.baseMapper.selectList(queryWrapper); if(CollUtil.isEmpty(pqScriptCheckData)){ - throw new BusinessException(CommonResponseEnum.FAIL,"测试脚本项暂无配置"); +// throw new BusinessException(CommonResponseEnum.FAIL,"测试脚本项暂无配置"); + throw new BusinessException(DetectionResponseEnum.SCRIPT_CHECK_DATA_NOT_EXIST); } List valueTypeList = pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList()); LambdaQueryWrapper dictTreeLambdaQueryWrapper = new LambdaQueryWrapper<>();