微调
This commit is contained in:
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.njcn.gather.detection.pojo.dto.DevXiNumData;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceResponseCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.param.DevPhaseSequenceParam;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.po.DevData;
|
||||
import com.njcn.gather.detection.pojo.po.SourceCompareDev;
|
||||
@@ -18,12 +19,12 @@ import com.njcn.gather.detection.util.socket.*;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
||||
import com.njcn.gather.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.storage.pojo.param.StorageParam;
|
||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||
@@ -67,6 +68,8 @@ public class SocketDevResponseService {
|
||||
// ISO 8601格式
|
||||
private final DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
|
||||
|
||||
private DevPhaseSequenceParam devPhaseSequenceParam;
|
||||
|
||||
|
||||
private final List<String> nonHarmonicList = Stream.of(DicDataEnum.FREQ.getCode(), DicDataEnum.V.getCode(), DicDataEnum.I.getCode(), DicDataEnum.IMBV.getCode(), DicDataEnum.IMBA.getCode(), DicDataEnum.VOLTAGE.getCode(), DicDataEnum.F.getCode()).collect(Collectors.toList());
|
||||
private final List<String> harmonicList = Stream.of(DicDataEnum.HV.getCode(), DicDataEnum.HI.getCode(), DicDataEnum.HP.getCode(), DicDataEnum.HSV.getCode(), DicDataEnum.HSI.getCode()).collect(Collectors.toList());
|
||||
@@ -1081,7 +1084,7 @@ public class SocketDevResponseService {
|
||||
checkDataParam.setIsValueTypeName(false);
|
||||
List<String> valueType = iPqScriptCheckDataService.getValueType(checkDataParam);
|
||||
|
||||
iPqDevService.updateResult(param.getDevIds(), valueType, param.getCode(),param.getUserId());
|
||||
iPqDevService.updateResult(param.getDevIds(), valueType, param.getCode(), param.getUserId());
|
||||
CnSocketUtil.quitSend(param);
|
||||
}
|
||||
successComm.clear();
|
||||
@@ -1271,7 +1274,6 @@ public class SocketDevResponseService {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param issue
|
||||
* @return key为V或I,value为对应的源下发信息
|
||||
*/
|
||||
@@ -1299,8 +1301,8 @@ public class SocketDevResponseService {
|
||||
List<DevData.SqlDataDTO> data,
|
||||
List<DevData.SqlDataDTO> dataPhase) {
|
||||
StringBuffer str = new StringBuffer();
|
||||
if(isPhaseAngle){
|
||||
if(CollUtil.isNotEmpty(data)&&CollUtil.isNotEmpty(dataPhase)){
|
||||
if (isPhaseAngle) {
|
||||
if (CollUtil.isNotEmpty(data) && CollUtil.isNotEmpty(dataPhase)) {
|
||||
if (data.size() == dataPhase.size()) {
|
||||
DevData.SqlDataDTO.ListDTO dto = data.get(0).getList();
|
||||
DevData.SqlDataDTO.ListDTO phase = dataPhase.get(0).getList();
|
||||
@@ -1310,11 +1312,11 @@ public class SocketDevResponseService {
|
||||
str.append(")");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
DevData.SqlDataDTO.ListDTO dto = data.get(0).getList();
|
||||
str.append("装置(" + type + "a=" + String.format("%.4f", dto.getA()) +
|
||||
type + "b=" + String.format("%.4f", dto.getB()) +
|
||||
type + "c=" + String.format("%.4f", dto.getC()) );
|
||||
type + "b=" + String.format("%.4f", dto.getB()) +
|
||||
type + "c=" + String.format("%.4f", dto.getC()));
|
||||
str.append(")");
|
||||
}
|
||||
return str.toString();
|
||||
@@ -1390,11 +1392,11 @@ public class SocketDevResponseService {
|
||||
Map<String, SourceIssue.ChannelListDTO> sourceMap = channelList.stream()
|
||||
.collect(Collectors.toMap(x -> x.getChannelType(), Function.identity()));
|
||||
Boolean a = getaBoolean(sourceMap.get(type + "a"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getA() : null,
|
||||
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getA(): null);
|
||||
Boolean b = getaBoolean(sourceMap.get(type + "b"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getB(): null,
|
||||
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getB(): null);
|
||||
Boolean c = getaBoolean(sourceMap.get(type + "c"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getC(): null,
|
||||
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getC(): null);
|
||||
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getA() : null);
|
||||
Boolean b = getaBoolean(sourceMap.get(type + "b"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getB() : null,
|
||||
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getB() : null);
|
||||
Boolean c = getaBoolean(sourceMap.get(type + "c"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getC() : null,
|
||||
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getC() : null);
|
||||
compareDev.setIsQualified(a && b && c);
|
||||
compareDev.setDesc(name + (compareDev.getIsQualified() ? "合格->" : "不合格->") + stepTag + desc + stepTag + devMessage(type, data, dataPhase));
|
||||
return compareDev;
|
||||
@@ -1402,25 +1404,26 @@ public class SocketDevResponseService {
|
||||
|
||||
/**
|
||||
* 相须校验-从幅值、相角两个维度判断是否合格
|
||||
*
|
||||
* @param channelListDTO
|
||||
* @param devData
|
||||
* @param devPhase
|
||||
* @return
|
||||
*/
|
||||
private Boolean getaBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devData, Double devPhase) {
|
||||
private Boolean getaBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devData, Double devPhase) {
|
||||
Boolean isDev = false;
|
||||
Boolean isPhase = false;
|
||||
if(ObjectUtil.isNotNull(devData)){
|
||||
isDev= NumberUtil.isIn(BigDecimal.valueOf(devData),
|
||||
if (ObjectUtil.isNotNull(devData)) {
|
||||
isDev = NumberUtil.isIn(BigDecimal.valueOf(devData),
|
||||
BigDecimal.valueOf(channelListDTO.getFAmp() * 0.95),
|
||||
BigDecimal.valueOf(channelListDTO.getFAmp() * 1.05));
|
||||
}
|
||||
if(isPhaseAngle){
|
||||
if(ObjectUtil.isNotNull(devPhase)){
|
||||
if (isPhaseAngle) {
|
||||
if (ObjectUtil.isNotNull(devPhase)) {
|
||||
isPhase = phaseBoolean(channelListDTO, devPhase);
|
||||
}
|
||||
}else{
|
||||
isPhase=true;
|
||||
} else {
|
||||
isPhase = true;
|
||||
}
|
||||
return isDev && isPhase;
|
||||
|
||||
@@ -1434,7 +1437,7 @@ public class SocketDevResponseService {
|
||||
* @param devPhase 装置返回角度
|
||||
* @return
|
||||
*/
|
||||
private Boolean phaseBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devPhase) {
|
||||
private Boolean phaseBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devPhase) {
|
||||
Double phase = devPhase;
|
||||
if (devPhase < -180) {
|
||||
phase = devPhase + 360;
|
||||
@@ -1755,4 +1758,47 @@ public class SocketDevResponseService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 脚本与设备校验
|
||||
*
|
||||
* @param param
|
||||
* @param socketDataMsg
|
||||
*/
|
||||
public void scriptToDeviceCheck(PreDetectionParam param,SocketDataMsg socketDataMsg) {
|
||||
String data = socketDataMsg.getData();
|
||||
DevData devData = JSON.parseObject(data, DevData.class);
|
||||
SourceResponseCodeEnum dictDataEnumByCode = SourceResponseCodeEnum.getDictDataEnumByCode(socketDataMsg.getCode());
|
||||
//SourceIssue sourceIssue = SocketManager.getSourceList().get(0);
|
||||
|
||||
switch (Objects.requireNonNull(dictDataEnumByCode)) {
|
||||
case SUCCESS:
|
||||
List<String> dataTypeList = new ArrayList<>();
|
||||
devData.getSqlData().forEach(obj -> {
|
||||
dataTypeList.add(obj.getDesc());
|
||||
});
|
||||
devData.getSqlDataHarm().forEach(obj -> {
|
||||
dataTypeList.add(obj.getDesc());
|
||||
});
|
||||
List<String> dataTypeCopy = new ArrayList<>(devPhaseSequenceParam.getDataType());
|
||||
dataTypeCopy.removeAll(dataTypeList);
|
||||
|
||||
|
||||
break;
|
||||
case UNPROCESSED_BUSINESS:
|
||||
break;
|
||||
case NORMAL_RESPONSE:
|
||||
break;
|
||||
case DEV_ERROR:
|
||||
break;
|
||||
case DEV_TARGET:
|
||||
break;
|
||||
case RE_OPERATE:
|
||||
break;
|
||||
case MESSAGE_PARSING_ERROR:
|
||||
break;
|
||||
default:
|
||||
CnSocketUtil.sendUnSocket(param.getUserPageId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.gather.icd.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.icd.pojo.po.PqIcdPath;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
@@ -9,5 +10,12 @@ import com.njcn.gather.icd.pojo.po.PqIcdPath;
|
||||
*/
|
||||
public interface PqIcdPathMapper extends MPJBaseMapper<PqIcdPath> {
|
||||
|
||||
/**
|
||||
* 根据设备类型id获取Icd
|
||||
*
|
||||
* @param devTypeId
|
||||
* @return
|
||||
*/
|
||||
PqIcdPath selectIcdByDevType(@Param("devTypeId") String devTypeId);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,5 +3,11 @@
|
||||
<mapper namespace="com.njcn.gather.icd.mapper.PqIcdPathMapper">
|
||||
|
||||
|
||||
<select id="selectIcdByDevType" resultType="com.njcn.gather.icd.pojo.po.PqIcdPath">
|
||||
select *
|
||||
from pq_icd_path path
|
||||
inner join pq_dev_type type on path.id = type.icd
|
||||
where type.id = #{devTypeId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -51,4 +51,12 @@ public interface IPqIcdPathService extends IService<PqIcdPath> {
|
||||
* @return 成功返回true,失败返回false
|
||||
*/
|
||||
boolean deleteIcd(List<String> ids);
|
||||
|
||||
/**
|
||||
* 根据设备类型id获取Icd
|
||||
*
|
||||
* @param devTypeId
|
||||
* @return
|
||||
*/
|
||||
PqIcdPath getIcdByDevType(String devTypeId);
|
||||
}
|
||||
|
||||
@@ -69,6 +69,11 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
|
||||
return this.lambdaUpdate().in(PqIcdPath::getId, ids).set(PqIcdPath::getState, DataStateEnum.DELETED.getCode()).update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqIcdPath getIcdByDevType(String devTypeId) {
|
||||
return this.baseMapper.selectIcdByDevType(devTypeId);
|
||||
}
|
||||
|
||||
private void checkRepeat(PqIcdPathParam param, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<PqIcdPath> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PqIcdPath::getName, param.getName())
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
@@ -66,4 +66,6 @@ public interface IPqReportService extends IService<PqReport> {
|
||||
void generateReport(DevReportParam devReportParam);
|
||||
|
||||
void downloadReport(DevReportParam devReportParam, HttpServletResponse response);
|
||||
|
||||
Map<String, Object> getMap(DevReportParam devReportParam);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@@ -72,6 +73,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.file.Files;
|
||||
@@ -265,7 +267,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
if (baseOriginalFilename.equals(detailOriginalFilename)) {
|
||||
throw new BusinessException(ReportResponseEnum.FILE_NAME_SAME_ERROR);
|
||||
}
|
||||
if(baseFile.getSize() > FILE_SIZE_LIMIT || detailFile.getSize() > FILE_SIZE_LIMIT){
|
||||
if (baseFile.getSize() > FILE_SIZE_LIMIT || detailFile.getSize() > FILE_SIZE_LIMIT) {
|
||||
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
||||
}
|
||||
|
||||
@@ -289,7 +291,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
if (!baseFileOriginalFilename.endsWith(".docx")) {
|
||||
throw new BusinessException(ReportResponseEnum.FILE_SUFFIX_ERROR);
|
||||
}
|
||||
if(baseFile.getSize() > FILE_SIZE_LIMIT){
|
||||
if (baseFile.getSize() > FILE_SIZE_LIMIT) {
|
||||
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -300,7 +302,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
if (!detailFileOriginalFilename.endsWith(".docx")) {
|
||||
throw new BusinessException(ReportResponseEnum.FILE_SUFFIX_ERROR);
|
||||
}
|
||||
if(detailFile.getSize() > FILE_SIZE_LIMIT){
|
||||
if (detailFile.getSize() > FILE_SIZE_LIMIT) {
|
||||
throw new BusinessException(ReportResponseEnum.FILE_SIZE_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -1639,4 +1641,95 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
}
|
||||
return "/";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMap(DevReportParam devReportParam) {
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
List<AdNonHarmonicResult> adNonHarmonicResultList = adNonHarmonicService.listAll(devReportParam.getScriptId(), "result_" + devReportParam.getPlanCode(), devReportParam.getDevId());
|
||||
List<AdHarmonicResult> adHarmonicResultList = adHarmonicService.listAll(devReportParam.getScriptId(), "result_" + devReportParam.getPlanCode(), devReportParam.getDevId());
|
||||
|
||||
Map<String, List<AdNonHarmonicResult>> monitorIdMap1 = adNonHarmonicResultList.stream()
|
||||
.sorted(Comparator.comparing(AdNonHarmonicResult::getMonitorId))
|
||||
.collect(Collectors.groupingBy(AdNonHarmonicResult::getMonitorId, LinkedHashMap::new, Collectors.toList()));
|
||||
Map<String, List<AdHarmonicResult>> monitorIdMap2 = adHarmonicResultList.stream()
|
||||
.sorted(Comparator.comparing(AdHarmonicResult::getMonitorId))
|
||||
.collect(Collectors.groupingBy(AdHarmonicResult::getMonitorId, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
String[] monitorIds = monitorIdMap1.keySet().stream().map(String::valueOf).toArray(String[]::new);
|
||||
|
||||
monitorIdMap1.get(monitorIds[0]).stream().forEach(adNonHarmonicResult -> {
|
||||
DictTree dictTree = dictTreeService.getById(adNonHarmonicResult.getAdType());
|
||||
|
||||
DetectionData detectionDataA = JSON.parseObject(adNonHarmonicResult.getAValue(), DetectionData.class);
|
||||
DetectionData detectionDataB = JSON.parseObject(adNonHarmonicResult.getBValue(), DetectionData.class);
|
||||
DetectionData detectionDataC = JSON.parseObject(adNonHarmonicResult.getCValue(), DetectionData.class);
|
||||
|
||||
DetectionData detectionDataT = JSON.parseObject(adNonHarmonicResult.getTValue(), DetectionData.class);
|
||||
// 标准值
|
||||
Double standardValue = null;
|
||||
if (ObjectUtil.isNotNull(detectionDataT)) {
|
||||
standardValue = detectionDataT.getResultData();
|
||||
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_T_Standard", detectionDataT.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_T_Test", detectionDataT.getData());
|
||||
} else {
|
||||
standardValue = detectionDataA.getResultData();
|
||||
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_A_Standard", detectionDataA.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_A_Test", detectionDataA.getData());
|
||||
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_B_Standard", detectionDataB.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_B_Test", detectionDataB.getData());
|
||||
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_C_Standard", detectionDataC.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_C_Test", detectionDataC.getData());
|
||||
}
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + standardValue + "_Result", getResultStr(adNonHarmonicResult.getResultFlag()));
|
||||
});
|
||||
|
||||
monitorIdMap2.get(monitorIds[0]).stream().forEach(adHarmonicResult -> {
|
||||
DictTree dictTree = dictTreeService.getById(adHarmonicResult.getAdType());
|
||||
|
||||
for (int i = 2; i <= 50; i++) {
|
||||
try {
|
||||
Field fieldA = adHarmonicResult.getClass().getDeclaredField("aValue" + i);
|
||||
fieldA.setAccessible(true);
|
||||
Object a = fieldA.get(adHarmonicResult);
|
||||
|
||||
Field fieldB = adHarmonicResult.getClass().getDeclaredField("bValue" + i);
|
||||
fieldB.setAccessible(true);
|
||||
Object b = fieldB.get(adHarmonicResult);
|
||||
|
||||
Field fieldC = adHarmonicResult.getClass().getDeclaredField("cValue" + i);
|
||||
fieldC.setAccessible(true);
|
||||
Object c = fieldC.get(adHarmonicResult);
|
||||
|
||||
List<Integer> isDataList = new ArrayList<>();
|
||||
if (ObjectUtil.isNotNull(a) && ObjectUtil.isNotNull(b) && ObjectUtil.isNotNull(c)) {
|
||||
DetectionData detectionData = JSON.parseObject(a.toString(), DetectionData.class);
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_A_Standard", detectionData.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_A_Test", detectionData.getData());
|
||||
isDataList.add(detectionData.getIsData());
|
||||
|
||||
detectionData = JSON.parseObject(b.toString(), DetectionData.class);
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_B_Standard", detectionData.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_B_Test", detectionData.getData());
|
||||
isDataList.add(detectionData.getIsData());
|
||||
|
||||
detectionData = JSON.parseObject(c.toString(), DetectionData.class);
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_C_Standard", detectionData.getResultData());
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + detectionData.getResultData() + "_" + i + "_C_Test", detectionData.getData());
|
||||
isDataList.add(detectionData.getIsData());
|
||||
}
|
||||
|
||||
resultMap.putIfAbsent(dictTree.getCode() + "_" + i + "_Result", getResultStr(isDataList.stream().allMatch(data -> data == 1) ? 1 : (isDataList.stream().anyMatch(data -> data == 2) ? 2 : 4)));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user