This commit is contained in:
caozehui
2025-04-09 16:16:33 +08:00
parent 0c30603f31
commit b96d0cdeb1
12 changed files with 294 additions and 26 deletions

View File

@@ -4,9 +4,12 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.LogUtil;
import com.njcn.gather.detection.pojo.param.DevPhaseSequenceParam;
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
import com.njcn.gather.script.pojo.param.PqScriptDtlsParam;
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
import com.njcn.gather.script.pojo.param.PqScriptParam;
@@ -217,5 +220,26 @@ public class PqScriptController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, checkData, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getCheckInfo1")
@ApiOperation("获取脚本与设备校验所需要的信息")
public HttpResult<DevPhaseSequenceParam> getIcdCheckInfo1(@RequestBody PreDetectionParam param) {
String methodDescribe = getMethodDescribe("getIcdCheckInfo1");
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe);
DevPhaseSequenceParam result = pqScriptDtlsService.getScriptToDeviceCheckInfo(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getCheckInfo2")
@ApiOperation("获取脚本与icd校验所需要的信息")
public HttpResult<Map<String, Object>> getIcdCheckInfo2(@RequestBody PreDetectionParam param) {
String methodDescribe = getMethodDescribe("getIcdCheckInfo2");
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe);
Map<String, Object> result = pqScriptDtlsService.getScriptToIcdCheckInfo(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -1,6 +1,8 @@
package com.njcn.gather.script.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.gather.detection.pojo.param.DevPhaseSequenceParam;
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
import com.njcn.gather.script.pojo.param.PqScriptDtlsParam;
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
import com.njcn.gather.script.pojo.param.ScriptParam;
@@ -9,6 +11,7 @@ import com.njcn.gather.script.pojo.po.PqScriptDtls;
import com.njcn.gather.script.pojo.po.SourceIssue;
import java.util.List;
import java.util.Map;
/**
* @author caozehui
@@ -114,11 +117,26 @@ public interface IPqScriptDtlsService extends IService<PqScriptDtls> {
List<PqScriptCheckData> checkDataList(ScriptParam param);
/**
* @Description: 获取脚本详情描述
* @param param
* @Description: 获取脚本详情描述
* @return: java.lang.String
* @Author: wr
* @Date: 2025/3/31 9:40
*/
String getScriptDtlsDesc(ScriptParam.Desc param);
/**
* 获取脚本与设备校验所需要的信息
*
* @param param
* @return
*/
DevPhaseSequenceParam getScriptToDeviceCheckInfo(PreDetectionParam param);
/**
* 获取脚本与icd校验时所需要的信息
*
* @return
*/
Map<String, Object> getScriptToIcdCheckInfo(PreDetectionParam param);
}

View File

@@ -10,9 +10,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum;
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
import com.njcn.gather.detection.pojo.param.DevPhaseSequenceParam;
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
import com.njcn.gather.device.pojo.enums.CommonEnum;
import com.njcn.gather.device.pojo.po.PqDev;
import com.njcn.gather.device.service.IPqDevService;
import com.njcn.gather.icd.pojo.po.PqIcdPath;
import com.njcn.gather.icd.service.IPqIcdPathService;
import com.njcn.gather.script.mapper.PqScriptCheckDataMapper;
import com.njcn.gather.script.mapper.PqScriptDtlsMapper;
import com.njcn.gather.script.mapper.PqScriptMapper;
@@ -30,6 +35,7 @@ import com.njcn.gather.script.util.ScriptDtlsDesc;
import com.njcn.gather.script.util.ThreePhaseUnbalance;
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import com.njcn.gather.system.dictionary.service.IDictTreeService;
import com.njcn.gather.system.pojo.enums.DicDataEnum;
import com.njcn.gather.type.pojo.po.DevType;
import com.njcn.gather.type.service.IDevTypeService;
import lombok.RequiredArgsConstructor;
@@ -83,6 +89,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
private final PqScriptCheckDataMapper pqScriptCheckDataMapper;
private final IDevTypeService devTypeService;
private final IDictTreeService dictTreeService;
private final IPqIcdPathService pqIcdPathService;
@Override
@Transactional
@@ -681,6 +688,57 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
return ScriptDtlsDesc.getStringBuffer(pqScriptDtls, true, isValueType).toString();
}
@Override
public DevPhaseSequenceParam getScriptToDeviceCheckInfo(PreDetectionParam param) {
Map<String, Object> map = new HashMap<>();
PqScriptIssueParam issueParam = new PqScriptIssueParam();
// issueParam.setPlanId(param.getPlanId());
issueParam.setSourceId(param.getSourceId());
issueParam.setDevIds(param.getDevIds());
issueParam.setScriptId(param.getScriptId());
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.FORMAL_TEST.getValue());
List<SourceIssue> sourceIssues = this.listSourceIssue(issueParam);
sourceIssues = sourceIssues.stream().filter(x -> !DicDataEnum.F.getCode().equals(x.getType()) && !DicDataEnum.VOLTAGE.getCode().equals(x.getType()) && !DicDataEnum.HP.getCode().equals(x.getType())).collect(Collectors.toList());
DevPhaseSequenceParam phaseSequenceParam = new DevPhaseSequenceParam();
List<String> dataTypeList = new ArrayList<>();
sourceIssues.forEach(x -> {
dataTypeList.addAll(x.getDevValueTypeList());
});
phaseSequenceParam.setIgnoreCount(0);
phaseSequenceParam.setReadCount(1);
phaseSequenceParam.setDataType(dataTypeList);
return phaseSequenceParam;
}
@Override
public Map<String, Object> getScriptToIcdCheckInfo(PreDetectionParam param) {
Map<String, Object> map = new HashMap<>();
PqScriptIssueParam issueParam = new PqScriptIssueParam();
// issueParam.setPlanId(param.getPlanId());
issueParam.setSourceId(param.getSourceId());
issueParam.setDevIds(param.getDevIds());
issueParam.setScriptId(param.getScriptId());
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.FORMAL_TEST.getValue());
List<SourceIssue> sourceIssues = this.listSourceIssue(issueParam);
sourceIssues = sourceIssues.stream().filter(x -> !DicDataEnum.F.getCode().equals(x.getType()) && !DicDataEnum.VOLTAGE.getCode().equals(x.getType()) && !DicDataEnum.HP.getCode().equals(x.getType())).collect(Collectors.toList());
map.put("scriptList", sourceIssues);
// List<PqDev> devList = pqDevService.listByIds(param.getDevIds());
// // 是否存在多个设备类型?
// List<String> devTypeList = devList.stream().map(PqDev::getDevType).distinct().collect(Collectors.toList());
// if (devTypeList.size() == 1) {
// DevType devType = devTypeService.getById(devTypeList.get(0));
// PqIcdPath icd = pqIcdPathService.getIcdByDevType(devType.getId());
// map.put("icdName", icd.getName());
// }
return map;
}
private void unbanCheck(List<PqScriptDtlsParam.CheckData> info,
PqScriptDtlsParam.CheckData channelListDTO,
List<PqScriptDtlsParam.ChannelListDTO> list,

View File

@@ -130,6 +130,7 @@ public class PqScriptServiceImpl extends ServiceImpl<PqScriptMapper, PqScript> i
*/
private void checkRepeat(PqScriptParam param, boolean isExcludeSelf) {
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("state", DataStateEnum.ENABLE.getCode());
wrapper.eq("name", param.getName());
if (isExcludeSelf) {
if(param instanceof PqScriptParam.UpdateParam){