This commit is contained in:
caozehui
2025-04-03 08:37:50 +08:00
parent 186d701dcb
commit 6c34c4a968
4 changed files with 15 additions and 61 deletions

View File

@@ -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<String> startTest(@RequestBody PreDetectionParam param) {
// String methodDescribe = getMethodDescribe("startTest");
// //preDetectionService.startTest(param);
//
//
// List<PreDetection> pqDevList = iPqDevService.getDevInfo(param.getDevIds());
// XiNumberManager.xiDevList = pqDevList;
// String s = param.getUserPageId() + "_Dev";
// SocketMsg<String> socketMsg = new SocketMsg<>();
// socketMsg.setRequestId(SourceOperateCodeEnum.Coefficient_Check.getValue());
// socketMsg.setOperateCode(SourceOperateCodeEnum.DATA_CHNFACTOR$01.getValue());
// PreDetection preDetection = pqDevList.get(0);
// Map<String, Object> 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);
// }
}

View File

@@ -1269,6 +1269,11 @@ public class SocketDevResponseService {
}
/**
*
* @param issue
* @return key为V或Ivalue为对应的源下发信息
*/
private Map<String, String> sourceMessage(SourceIssue issue) {
//Ua=59.0V,相角=0.0° Ub=59.0V,相角=0.0° Uc=59.0V,相角=0.0°)
Map<String, String> 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;

View File

@@ -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<SourceIssue> 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);

View File

@@ -28,7 +28,7 @@ public class XiNumberManager {
public static List<String> devXiList = new ArrayList<>();
/**
* 最开始存储装置通道原始系数,后续存储大电压计算出来的系数
* 最开始存储装置通道原始系数,后续存储大电压计算出来的系数。key为装置ip
*/
public static Map<String, DevXiNumData> devXiNumDataMap = new ConcurrentHashMap<>();
@@ -43,6 +43,7 @@ public class XiNumberManager {
public static Integer stepNumber = 0;
// 存放大电压、小电压、大电流、小电流的数值
public static List<CoefficientVO.DevParameter> devParameterList = new ArrayList<>();