From 6fb57f8422bbbeeb526940d1c9129e31602d5db3 Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Mon, 24 Feb 2025 16:38:04 +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 --- .../pojo/param/PqScriptCheckDataParam.java | 6 ++ .../script/pojo/param/PqScriptDtlsParam.java | 11 ++- .../gather/script/pojo/po/SourceIssue.java | 10 +- .../service/IPqScriptCheckDataService.java | 1 + .../impl/PqScriptCheckDataServiceImpl.java | 20 +++- .../service/impl/PqScriptDtlsServiceImpl.java | 95 +++++++++++++------ 6 files changed, 106 insertions(+), 37 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptCheckDataParam.java b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptCheckDataParam.java index c16198d3..a08e7049 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptCheckDataParam.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptCheckDataParam.java @@ -14,6 +14,12 @@ public class PqScriptCheckDataParam { @ApiModelProperty("总检测脚本中的测试项序号") private Integer index; + @ApiModelProperty("检测指标类型,与数据字典关联(例如电压有效值、谐波电压含有率等)") + private String valueType; + + @ApiModelProperty("相别,字典表") + private String phase; + @ApiModelProperty("检测指标类型(true:code(I$real) ,false展示id ,默认false)") private Boolean isValueTypeName=false; diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptDtlsParam.java b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptDtlsParam.java index f7233c03..a406f3e3 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptDtlsParam.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptDtlsParam.java @@ -300,13 +300,20 @@ public class PqScriptDtlsParam { * 波动类型 */ @JSONField(name = "waveFluType", ordinal = 1) - private Object waveFluType; + private String waveFluType; /** * 闪变调制波形类型 */ @JSONField(name = "waveType", ordinal = 2) - private Object waveType; + private String waveType; + + /** + * 闪变标准值 + */ + @JSONField(name = "waveType", ordinal = 2) + private Double flickerValue; + /** * 占空比 diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/po/SourceIssue.java b/detection/src/main/java/com/njcn/gather/script/pojo/po/SourceIssue.java index 13a02b75..6e63fb63 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/po/SourceIssue.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/po/SourceIssue.java @@ -281,13 +281,19 @@ public class SourceIssue { * 波动类型 */ @JSONField(name = "waveFluType", ordinal = 1) - private Object waveFluType; + private String waveFluType; /** * 闪变调制波形类型 */ @JSONField(name = "waveType", ordinal = 2) - private Object waveType; + private String waveType; + + /** + * 闪变标准值 + */ + @JSONField(serialize = false) + private Double flickerValue; /** * 占空比 diff --git a/detection/src/main/java/com/njcn/gather/script/service/IPqScriptCheckDataService.java b/detection/src/main/java/com/njcn/gather/script/service/IPqScriptCheckDataService.java index 234c8059..f0052406 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/IPqScriptCheckDataService.java +++ b/detection/src/main/java/com/njcn/gather/script/service/IPqScriptCheckDataService.java @@ -34,4 +34,5 @@ public interface IPqScriptCheckDataService extends IService { */ List listCheckDataCode(PqScriptCheckDataParam param); + Double getCheckDataValue(PqScriptCheckDataParam param); } 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 5713fcec..0ff2e97c 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 @@ -19,9 +19,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; @@ -106,5 +104,21 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + .eq(PqScriptCheckData::getScriptId, param.getScriptId()) + .eq(ObjectUtil.isNotNull(param.getIndex()),PqScriptCheckData::getScriptIndex, param.getIndex()) + .eq(PqScriptCheckData::getValueType, param.getValueType()) + .eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode()); + + PqScriptCheckData data = this.getBaseMapper().selectOne(queryWrapper); + if(ObjectUtil.isNotNull(data)){ + return data.getValue(); + } + return null; + } + } diff --git a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java index 40314a49..43072be5 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java @@ -204,7 +204,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl curList = value.stream().filter(x -> CUR.equals(x.getValueType())) @@ -216,7 +216,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl ids = checkDataList.stream().map(PqScriptDtlsParam.CheckData::getValueType).collect(Collectors.toList()); List dictTreeById = dictTreeService.getDictTreeById(ids); - Map dicTreeMap = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId,Function.identity())); + Map dicTreeMap = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, Function.identity())); PqScriptDtlsParam.CheckData checkData; for (PqScriptDtlsParam.CheckData channelListDTO : checkDataList) { if (dicTreeMap.containsKey(channelListDTO.getValueType())) { @@ -417,7 +428,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl x.getChannelType().contains("U")).collect(Collectors.toList()); + for (PqScriptDtlsParam.ChannelListDTO listDTO : list) { + checkData = new PqScriptDtlsParam.CheckData(); + checkData.setErrorFlag(channelListDTO.getErrorFlag()); + checkData.setEnable(channelListDTO.getEnable()); + if (ObjectUtil.isNotNull(listDTO.getFlickerData())) { + checkData.setValue(listDTO.getFlickerData().getFlickerValue()); + } + checkData.setPhase(listDTO.getChannelType().substring(1, 2).toUpperCase()); + checkData.setDataType(channelListDTO.getDataType()); + checkData.setValueType(channelListDTO.getValueType()); + checkData.setPid(channelListDTO.getPid()); + info.add(checkData); + } + + } break; case I1: break; @@ -587,12 +615,12 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl indexList = list.stream().map(PqScriptDtls::getScriptIndex).distinct().collect(Collectors.toList()); - if(CollUtil.isNotEmpty(indexList)){ - return pqScriptCheckDataMapper.selectJoinList(PqScriptCheckData.class,new MPJLambdaWrapper() + if (CollUtil.isNotEmpty(indexList)) { + return pqScriptCheckDataMapper.selectJoinList(PqScriptCheckData.class, new MPJLambdaWrapper() .select(PqScriptCheckData::getValueType, PqScriptCheckData::getEnable, PqScriptCheckData::getErrorFlag) .distinct() .eq(PqScriptCheckData::getScriptId, param.getScriptId()) - .eq(PqScriptCheckData::getScriptId, indexList) + .in(PqScriptCheckData::getScriptIndex, indexList) ); } @@ -624,7 +652,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl channelListDTOS) { + List channelListDTOS, + PqScriptCheckDataParam checkDataParam) { for (PqScriptDtls dtls : dtlsList) { SourceIssue.ChannelListDTO channelListDTO = new SourceIssue.ChannelListDTO(); channelListDTO.setChannelFlag(true); @@ -832,6 +861,12 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl treeByCode = dictTreeService.getTreeByCode(DetectionCodeEnum.PST.getCode()); + if (CollUtil.isNotEmpty(treeByCode)) { + checkDataParam.setValueType(treeByCode.get(0).getId()); + checkDataParam.setPhase(dtls.getPhase()); + flickerDataDTO.setFlickerValue(pqScriptCheckDataService.getCheckDataValue(checkDataParam)); + } channelListDTO.setFlickerFlag(true); channelListDTO.setFlickerData(flickerDataDTO); }