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;
/**
* 表明指标类型例如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;
/**
* 暂态幅度(%

View File

@@ -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;
/**
* 间谐波含有率

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.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<PqScriptDtlsMapper, PqS
if (voltSet.size() == 1 && currSet.size() == 1) {
Double volt = voltSet.stream().collect(Collectors.toList()).stream().findFirst().get();
Double curr = currSet.stream().collect(Collectors.toList()).stream().findFirst().get();
List<PqScriptDtls> pqScriptDtls = this.pqScriptDtls(param.getScriptId(),param.getIsPhaseSequence(), volt, curr);
List<PqScriptDtls> pqScriptDtls = this.pqScriptDtls(param.getScriptId(), param.getIsPhaseSequence(), volt, curr);
if (CollUtil.isNotEmpty(pqScriptDtls)) {
/**
* 1.获取全部检测点脚本
@@ -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());
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<PqScriptDtlsMapper, PqS
.collect(Collectors.toList());
//谐波电流,间谐波电流
List<PqScriptDtls> 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<PqScriptDtlsMapper, PqS
return sourceIssues;
}
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;
if(isPhaseSequence){
pqScriptDtls = this.list(new MPJLambdaWrapper<PqScriptDtls>()
.eq(PqScriptDtls::getIndex, -1)
.eq(PqScriptDtls::getEnable, 1)
);
}else{
MPJLambdaWrapper<PqScriptDtls> 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<PqScriptDtlsMapper, PqS
* @param dtlsList 检测集合
* @param dtlsList 其他类型检测集合(谐波,间谐波等)
* @param harm 谐波
* @param inHarm 间谐波
* @param inHarm 间谐波
* @param fFreq 频率
* @param code U,I
* @param channelListDTOS 通道信息
@@ -327,7 +332,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
SourceIssue.ChannelListDTO.HarmModel harmModel;
for (PqScriptDtls pqScriptDtls : phaseHarmVList) {
harmModel = new SourceIssue.ChannelListDTO.HarmModel();
harmModel.setHarm(pqScriptDtls.getHarmNum());
harmModel.setHarm(pqScriptDtls.getHarmNum().intValue());
harmModel.setFApm(pqScriptDtls.getValue());
harmModel.setFPhase(pqScriptDtls.getAngle());
info.add(harmModel);
@@ -348,7 +353,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
inHarmModel = new SourceIssue.ChannelListDTO.InharmModel();
inHarmModel.setInharm(pqScriptDtls.getHarmNum());
inHarmModel.setFApm(pqScriptDtls.getValue());
inHarmModel.setFPhase(pqScriptDtls.getChagValue());
inHarmModel.setFPhase(pqScriptDtls.getAngle());
info.add(inHarmModel);
}
return info;