From 6c34c4a968f9c07ad843c0a16afdc56da1d0c7a9 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Thu, 3 Apr 2025 08:37:50 +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 --- .../controller/PreDetectionController.java | 45 +------------------ .../handler/SocketDevResponseService.java | 12 +++++ .../service/impl/PreDetectionServiceImpl.java | 16 ------- .../util/socket/XiNumberManager.java | 3 +- 4 files changed, 15 insertions(+), 61 deletions(-) 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 97f32cbc..49f6001f 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 @@ -1,20 +1,13 @@ package com.njcn.gather.detection.controller; -import com.alibaba.fastjson.JSON; import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.response.HttpResult; import com.njcn.gather.detection.handler.SocketDevResponseService; -import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum; import com.njcn.gather.detection.pojo.param.PreDetectionParam; import com.njcn.gather.detection.pojo.param.SimulateDetectionParam; -import com.njcn.gather.detection.pojo.vo.SocketMsg; import com.njcn.gather.detection.service.PreDetectionService; import com.njcn.gather.detection.service.impl.DetectionServiceImpl; -import com.njcn.gather.detection.util.socket.XiNumberManager; -import com.njcn.gather.detection.util.socket.cilent.NettyClient; -import com.njcn.gather.detection.util.socket.cilent.NettyDevClientHandler; -import com.njcn.gather.device.pojo.vo.PreDetection; import com.njcn.gather.device.service.IPqDevService; import com.njcn.gather.script.service.IPqScriptDtlsService; import com.njcn.web.controller.BaseController; @@ -27,10 +20,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @Slf4j @Api(tags = "预检测") @@ -65,6 +54,7 @@ public class PreDetectionController extends BaseController { /** * 程控源-源通讯校验 + * * @param param * @return */ @@ -144,37 +134,4 @@ public class PreDetectionController extends BaseController { preDetectionService.restartTemTest(param); 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 f620d0d9..53ff06ac 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 @@ -1269,6 +1269,11 @@ public class SocketDevResponseService { } + /** + * + * @param issue + * @return key为V或I,value为对应的源下发信息 + */ private Map sourceMessage(SourceIssue issue) { //(Ua=59.0V,相角=0.0° Ub=59.0V,相角=0.0° Uc=59.0V,相角=0.0°) Map map = new HashMap<>(); @@ -1394,6 +1399,13 @@ public class SocketDevResponseService { return compareDev; } + /** + * 相须校验-从幅值、相角两个维度判断是否合格 + * @param channelListDTO + * @param devData + * @param devPhase + * @return + */ private Boolean getaBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devData, Double devPhase) { Boolean isDev = false; Boolean isPhase = false; 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 0d35e3a3..22449c12 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 @@ -212,19 +212,6 @@ public class PreDetectionServiceImpl implements PreDetectionService { preDetectionParam.setSendWebMsg(true); specialDealSimulate(preDetectionParam); - -// String code = dictDataService.getDictDataById(param.getPattern()).getCode(); -// DictDataEnum dictDataEnumByCode = DictDataEnum.getDictDataEnumByCode(code); -// switch (dictDataEnumByCode) { -// case DIGITAL: -// case SIMULATE: -// sendYtxSocketSimulate(preDetectionParam); -// break; -// case CONTRAST: -// break; -// default: -// throw new BusinessException(DetectionResponseEnum.PLAN_PATTERN_NOT); -// } sendYtxSocketSimulate(preDetectionParam); } @@ -241,9 +228,7 @@ public class PreDetectionServiceImpl implements PreDetectionService { } //组装源控制脚本 PqScriptIssueParam issueParam = new PqScriptIssueParam(); - //issueParam.setPlanId(param.getPlanId()); issueParam.setSourceId(param.getSourceId()); - //issueParam.setDevIds(param.getDevIds()); issueParam.setScriptId(param.getScriptId()); issueParam.setType(1); issueParam.setIsPhaseSequence(SourceOperateCodeEnum.SIMULATE_TEST.getValue()); @@ -251,7 +236,6 @@ public class PreDetectionServiceImpl implements PreDetectionService { List sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam); sourceIssues = sourceIssues.stream() .filter(s -> s.getIndex().equals(param.getScriptIndex())) - .sorted(Comparator.comparing(SourceIssue::getIndex)) .collect(Collectors.toList()); SourceIssue sourceIssue = sourceIssues.get(0); diff --git a/detection/src/main/java/com/njcn/gather/detection/util/socket/XiNumberManager.java b/detection/src/main/java/com/njcn/gather/detection/util/socket/XiNumberManager.java index 02e69744..dd81b6b7 100644 --- a/detection/src/main/java/com/njcn/gather/detection/util/socket/XiNumberManager.java +++ b/detection/src/main/java/com/njcn/gather/detection/util/socket/XiNumberManager.java @@ -28,7 +28,7 @@ public class XiNumberManager { public static List devXiList = new ArrayList<>(); /** - * 最开始存储装置通道原始系数,后续存储大电压计算出来的系数 + * 最开始存储装置通道原始系数,后续存储大电压计算出来的系数。key为装置ip */ public static Map devXiNumDataMap = new ConcurrentHashMap<>(); @@ -43,6 +43,7 @@ public class XiNumberManager { public static Integer stepNumber = 0; + // 存放大电压、小电压、大电流、小电流的数值 public static List devParameterList = new ArrayList<>();