This commit is contained in:
wr
2024-12-26 16:24:56 +08:00
parent 413bc98526
commit 63831fc2d1
3 changed files with 32 additions and 19 deletions

View File

@@ -36,6 +36,12 @@ public class PqScriptDtls implements Serializable {
*/ */
private String scriptType; private String scriptType;
/**
* 表明指标类型例如Freq频率下的影响、Base额定下的影响、VOL电压下的影响
*/
@TableField("Script_SubType")
private String scriptSubType;
/** /**
* 表明指标类型例如VOL电压、CUR电流、Freq频率... * 表明指标类型例如VOL电压、CUR电流、Freq频率...
*/ */
@@ -60,7 +66,7 @@ public class PqScriptDtls implements Serializable {
* (间)谐波次数 * (间)谐波次数
*/ */
@TableField("HarmNum") @TableField("HarmNum")
private Integer harmNum; private Double harmNum;
/** /**
* 暂态幅度(% * 暂态幅度(%

View File

@@ -1,7 +1,6 @@
package com.njcn.gather.device.script.pojo.po; package com.njcn.gather.device.script.pojo.po;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@@ -22,6 +21,9 @@ public class SourceIssue {
@JSONField(name = "sourceId", ordinal = 1) @JSONField(name = "sourceId", ordinal = 1)
private String sourceId; private String sourceId;
@JSONField(serialize = false)
private Integer index;
/** /**
* 检测类型 * 检测类型
*/ */
@@ -173,7 +175,7 @@ public class SourceIssue {
* 间谐波次数 * 间谐波次数
*/ */
@JSONField(name = "inharm", ordinal = 1) @JSONField(name = "inharm", ordinal = 1)
private Integer inharm; private Double inharm;
/** /**
* 间谐波含有率 * 间谐波含有率

View File

@@ -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.PqScriptDtls;
import com.njcn.gather.device.script.pojo.po.SourceIssue; import com.njcn.gather.device.script.pojo.po.SourceIssue;
import com.njcn.gather.device.script.service.IPqScriptDtlsService; import com.njcn.gather.device.script.service.IPqScriptDtlsService;
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -136,11 +137,11 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
List<PqScriptDtls> freq = value.stream().filter(x -> FREQ.equals(x.getValueType())).collect(Collectors.toList()); List<PqScriptDtls> freq = value.stream().filter(x -> FREQ.equals(x.getValueType())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(freq)) { if (CollUtil.isNotEmpty(freq)) {
PqScriptDtls freqDtls = freq.get(0); PqScriptDtls freqDtls = freq.get(0);
String[] split = freqDtls.getScriptType().replace("Base", "NULL").split("-");
SourceIssue issue = new SourceIssue(); SourceIssue issue = new SourceIssue();
issue.setSourceId(param.getSourceId()); issue.setSourceId(param.getSourceId());
issue.setType(split[0]); issue.setType(freqDtls.getScriptType());
issue.setSubType(split[1]); issue.setIndex(freqDtls.getIndex());
issue.setSubType(freqDtls.getScriptSubType().replace("Base", "NULL"));
issue.setFUn(volt); issue.setFUn(volt);
issue.setFIn(curr); issue.setFIn(curr);
issue.setFFreq(freqDtls.getValue()); issue.setFFreq(freqDtls.getValue());
@@ -187,15 +188,19 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
private List<PqScriptDtls> pqScriptDtls(String scriptId, Boolean isPhaseSequence, Double volt, Double curr) { private List<PqScriptDtls> pqScriptDtls(String scriptId, Boolean isPhaseSequence, Double volt, Double curr) {
List<PqScriptDtls> pqScriptDtls; List<PqScriptDtls> pqScriptDtls;
MPJLambdaWrapper<PqScriptDtls> queryWrapper = new MPJLambdaWrapper<>();
queryWrapper.selectAll(PqScriptDtls.class)
.selectAs(DictTree::getCode, PqScriptDtls::getScriptType)
.leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType);
if (isPhaseSequence) { if (isPhaseSequence) {
pqScriptDtls = this.list(new MPJLambdaWrapper<PqScriptDtls>() queryWrapper.eq(PqScriptDtls::getIndex, -1)
.eq(PqScriptDtls::getIndex, -1) .eq(PqScriptDtls::getEnable, 1);
.eq(PqScriptDtls::getEnable, 1) pqScriptDtls = this.list(queryWrapper);
);
} else { } else {
//先获取检测脚本类型是否相对值 true相对值 false绝对值相对值要乘额定值,绝对值不需要处理) //先获取检测脚本类型是否相对值 true相对值 false绝对值相对值要乘额定值,绝对值不需要处理)
Boolean isValueType = pqScriptMapper.selectScriptIsValueType(scriptId); Boolean isValueType = pqScriptMapper.selectScriptIsValueType(scriptId);
pqScriptDtls = this.listPqScriptDtlByScriptId(scriptId); queryWrapper.eq(PqScriptDtls::getScriptId, scriptId);
pqScriptDtls = this.getBaseMapper().selectJoinList(PqScriptDtls.class, queryWrapper);
if (isValueType) { if (isValueType) {
for (PqScriptDtls pqScriptDtl : pqScriptDtls) { for (PqScriptDtls pqScriptDtl : pqScriptDtls) {
if (VOL.equals(pqScriptDtl.getValueType())) { if (VOL.equals(pqScriptDtl.getValueType())) {
@@ -327,7 +332,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
SourceIssue.ChannelListDTO.HarmModel harmModel; SourceIssue.ChannelListDTO.HarmModel harmModel;
for (PqScriptDtls pqScriptDtls : phaseHarmVList) { for (PqScriptDtls pqScriptDtls : phaseHarmVList) {
harmModel = new SourceIssue.ChannelListDTO.HarmModel(); harmModel = new SourceIssue.ChannelListDTO.HarmModel();
harmModel.setHarm(pqScriptDtls.getHarmNum()); harmModel.setHarm(pqScriptDtls.getHarmNum().intValue());
harmModel.setFApm(pqScriptDtls.getValue()); harmModel.setFApm(pqScriptDtls.getValue());
harmModel.setFPhase(pqScriptDtls.getAngle()); harmModel.setFPhase(pqScriptDtls.getAngle());
info.add(harmModel); info.add(harmModel);
@@ -348,7 +353,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
inHarmModel = new SourceIssue.ChannelListDTO.InharmModel(); inHarmModel = new SourceIssue.ChannelListDTO.InharmModel();
inHarmModel.setInharm(pqScriptDtls.getHarmNum()); inHarmModel.setInharm(pqScriptDtls.getHarmNum());
inHarmModel.setFApm(pqScriptDtls.getValue()); inHarmModel.setFApm(pqScriptDtls.getValue());
inHarmModel.setFPhase(pqScriptDtls.getChagValue()); inHarmModel.setFPhase(pqScriptDtls.getAngle());
info.add(inHarmModel); info.add(inHarmModel);
} }
return info; return info;