From 63831fc2d142447e51a3f53d3430b459659471a1 Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Thu, 26 Dec 2024 16:24:56 +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 --- .../device/script/pojo/po/PqScriptDtls.java | 8 +++- .../device/script/pojo/po/SourceIssue.java | 6 ++- .../service/impl/PqScriptDtlsServiceImpl.java | 37 +++++++++++-------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/device/src/main/java/com/njcn/gather/device/script/pojo/po/PqScriptDtls.java b/device/src/main/java/com/njcn/gather/device/script/pojo/po/PqScriptDtls.java index 994f5f98..1acc6aca 100644 --- a/device/src/main/java/com/njcn/gather/device/script/pojo/po/PqScriptDtls.java +++ b/device/src/main/java/com/njcn/gather/device/script/pojo/po/PqScriptDtls.java @@ -36,6 +36,12 @@ public class PqScriptDtls implements Serializable { */ private String scriptType; + /** + * 表明指标类型(例如:Freq频率下的影响、Base额定下的影响、VOL电压下的影响) + */ + @TableField("Script_SubType") + private String scriptSubType; + /** * 表明指标类型(例如:VOL电压、CUR电流、Freq频率...) */ @@ -60,7 +66,7 @@ public class PqScriptDtls implements Serializable { * (间)谐波次数 */ @TableField("HarmNum") - private Integer harmNum; + private Double harmNum; /** * 暂态幅度(%) diff --git a/device/src/main/java/com/njcn/gather/device/script/pojo/po/SourceIssue.java b/device/src/main/java/com/njcn/gather/device/script/pojo/po/SourceIssue.java index 89aabd84..ee9b35de 100644 --- a/device/src/main/java/com/njcn/gather/device/script/pojo/po/SourceIssue.java +++ b/device/src/main/java/com/njcn/gather/device/script/pojo/po/SourceIssue.java @@ -1,7 +1,6 @@ package com.njcn.gather.device.script.pojo.po; import com.alibaba.fastjson.annotation.JSONField; -import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lombok.NoArgsConstructor; @@ -22,6 +21,9 @@ public class SourceIssue { @JSONField(name = "sourceId", ordinal = 1) private String sourceId; + @JSONField(serialize = false) + private Integer index; + /** * 检测类型 */ @@ -173,7 +175,7 @@ public class SourceIssue { * 间谐波次数 */ @JSONField(name = "inharm", ordinal = 1) - private Integer inharm; + private Double inharm; /** * 间谐波含有率 diff --git a/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptDtlsServiceImpl.java b/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptDtlsServiceImpl.java index 6dc23e65..14007ea8 100644 --- a/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptDtlsServiceImpl.java +++ b/device/src/main/java/com/njcn/gather/device/script/service/impl/PqScriptDtlsServiceImpl.java @@ -15,6 +15,7 @@ import com.njcn.gather.device.script.pojo.po.PqScript; import com.njcn.gather.device.script.pojo.po.PqScriptDtls; import com.njcn.gather.device.script.pojo.po.SourceIssue; import com.njcn.gather.device.script.service.IPqScriptDtlsService; +import com.njcn.gather.system.dictionary.pojo.po.DictTree; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -115,7 +116,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl pqScriptDtls = this.pqScriptDtls(param.getScriptId(),param.getIsPhaseSequence(), volt, curr); + List pqScriptDtls = this.pqScriptDtls(param.getScriptId(), param.getIsPhaseSequence(), volt, curr); if (CollUtil.isNotEmpty(pqScriptDtls)) { /** * 1.获取全部检测点脚本 @@ -136,11 +137,11 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl freq = value.stream().filter(x -> FREQ.equals(x.getValueType())).collect(Collectors.toList()); if (CollUtil.isNotEmpty(freq)) { PqScriptDtls freqDtls = freq.get(0); - String[] split = freqDtls.getScriptType().replace("Base", "NULL").split("-"); SourceIssue issue = new SourceIssue(); issue.setSourceId(param.getSourceId()); - issue.setType(split[0]); - issue.setSubType(split[1]); + issue.setType(freqDtls.getScriptType()); + issue.setIndex(freqDtls.getIndex()); + issue.setSubType(freqDtls.getScriptSubType().replace("Base", "NULL")); issue.setFUn(volt); issue.setFIn(curr); issue.setFFreq(freqDtls.getValue()); @@ -166,7 +167,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl dtlsIList = value.stream().filter(x -> HARM_I.equals(x.getValueType()) || - INHARM_I.equals(x.getValueType())|| + INHARM_I.equals(x.getValueType()) || DIP.equals(x.getValueType()) || FLICKER.equals(x.getValueType()) ) @@ -185,17 +186,21 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl pqScriptDtls(String scriptId,Boolean isPhaseSequence,Double volt, Double curr) { + private List pqScriptDtls(String scriptId, Boolean isPhaseSequence, Double volt, Double curr) { List pqScriptDtls; - if(isPhaseSequence){ - pqScriptDtls = this.list(new MPJLambdaWrapper() - .eq(PqScriptDtls::getIndex, -1) - .eq(PqScriptDtls::getEnable, 1) - ); - }else{ + MPJLambdaWrapper queryWrapper = new MPJLambdaWrapper<>(); + queryWrapper.selectAll(PqScriptDtls.class) + .selectAs(DictTree::getCode, PqScriptDtls::getScriptType) + .leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType); + if (isPhaseSequence) { + queryWrapper.eq(PqScriptDtls::getIndex, -1) + .eq(PqScriptDtls::getEnable, 1); + pqScriptDtls = this.list(queryWrapper); + } else { //先获取检测脚本类型是否相对值 true相对值 false绝对值(相对值要乘额定值,绝对值不需要处理) Boolean isValueType = pqScriptMapper.selectScriptIsValueType(scriptId); - pqScriptDtls = this.listPqScriptDtlByScriptId(scriptId); + queryWrapper.eq(PqScriptDtls::getScriptId, scriptId); + pqScriptDtls = this.getBaseMapper().selectJoinList(PqScriptDtls.class, queryWrapper); if (isValueType) { for (PqScriptDtls pqScriptDtl : pqScriptDtls) { if (VOL.equals(pqScriptDtl.getValueType())) { @@ -216,7 +221,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl