1.代码优化
2.正式检测三相不平衡业务编写
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
package com.njcn.gather.device.err.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.gather.device.err.mapper.PqErrSysDtlsMapper;
|
||||
import com.njcn.gather.device.err.pojo.param.PqErrSysDtlsParam;
|
||||
import com.njcn.gather.device.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.device.err.pojo.po.PqErrSysDtls;
|
||||
import com.njcn.gather.device.err.service.IPqErrSysDtlsService;
|
||||
import com.njcn.gather.device.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -71,7 +72,9 @@ public class PqErrSysDtlsServiceImpl extends ServiceImpl<PqErrSysDtlsMapper, PqE
|
||||
|
||||
@Override
|
||||
public List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param) {
|
||||
return this.list(new LambdaQueryWrapper<PqErrSysDtls>()
|
||||
return this.list(new MPJLambdaWrapper<PqErrSysDtls>()
|
||||
.selectAs(DictTree::getCode, PqErrSysDtls::getScriptType)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType)
|
||||
.in(PqErrSysDtls::getId, Arrays.asList("ae86b657f37151d78b7c34ec64eefa10"))
|
||||
// .eq(PqErrSysDtls::getErrorSysId, param.getErrorSysId())
|
||||
// .in(PqErrSysDtls::getErrorSysId, param.getType())
|
||||
@@ -82,7 +85,9 @@ public class PqErrSysDtlsServiceImpl extends ServiceImpl<PqErrSysDtlsMapper, PqE
|
||||
// script.setIsValueTypeName(false);
|
||||
// List<String> valueType = pqScriptCheckDataService.getValueType(script);
|
||||
// //根据检测脚本id和检测序号,查询出检测子项目
|
||||
// return this.list(new LambdaQueryWrapper<PqErrSysDtls>()
|
||||
// return this.list(new MPJLambdaWrapper<PqErrSysDtls>()
|
||||
// .selectAs(DictTree::getCode, PqScriptDtls::getScriptCode)
|
||||
// .leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType)
|
||||
// .eq(PqErrSysDtls::getErrorSysId, param.getErrorSysId())
|
||||
// .in(PqErrSysDtls::getScriptType, valueType)
|
||||
// );
|
||||
|
||||
@@ -36,6 +36,12 @@ public class PqScriptDtls implements Serializable {
|
||||
*/
|
||||
private String scriptType;
|
||||
|
||||
/**
|
||||
* 检测脚本类型
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String scriptCode;
|
||||
|
||||
/**
|
||||
* 表明指标类型(例如:Freq频率下的影响、Base额定下的影响、VOL电压下的影响)
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,7 @@ public class SourceIssue {
|
||||
/**
|
||||
* 总检测下的检测脚本序号
|
||||
*/
|
||||
@JSONField(serialize = true)
|
||||
@JSONField(serialize = false)
|
||||
private Integer index;
|
||||
|
||||
/**
|
||||
@@ -238,6 +238,9 @@ public class SourceIssue {
|
||||
@JSONField(name = "fRetainTime", ordinal = 4)
|
||||
private Double fRetainTime;
|
||||
|
||||
@JSONField(serialize = false)
|
||||
private Double retainTime;
|
||||
|
||||
/**
|
||||
* 写出时间(s)
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,10 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataMapper, PqScriptCheckData> implements IPqScriptCheckDataService {
|
||||
|
||||
private final String V="V2-50$real";
|
||||
private final String SV="SV_1-49$real";
|
||||
private final String I="I2-50$real";
|
||||
private final String IV="SI_1-49$real";
|
||||
|
||||
@Override
|
||||
public List<String> getValueType(PqScriptCheckDataParam param) {
|
||||
@@ -43,7 +47,14 @@ public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataM
|
||||
List<PqScriptCheckData> pqScriptCheckData = this.getBaseMapper().selectJoinList(PqScriptCheckData.class, queryWrapper);
|
||||
if(CollUtil.isNotEmpty(pqScriptCheckData)){
|
||||
if (param.getIsValueTypeName()) {
|
||||
return pqScriptCheckData.stream().map(x -> x.getDataType() + "$" + x.getValueType()).distinct().collect(Collectors.toList());
|
||||
List<String> checkData = pqScriptCheckData.stream().map(x -> x.getDataType() + "$" + x.getValueType()).distinct().collect(Collectors.toList());
|
||||
if(checkData.contains(V)||checkData.contains(SV)){
|
||||
checkData.add("U1$real");
|
||||
}
|
||||
if(checkData.contains(I)||checkData.contains(IV)){
|
||||
checkData.add("I1$real");
|
||||
}
|
||||
return checkData;
|
||||
} else {
|
||||
return pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -139,17 +139,14 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
* VOL-Harm:谐波对电压测量的影响
|
||||
*/
|
||||
List<PqScriptDtls> freq = value.stream().filter(x -> FREQ.equals(x.getValueType())).collect(Collectors.toList());
|
||||
if(key==6){
|
||||
System.out.println();
|
||||
}
|
||||
if (CollUtil.isNotEmpty(freq)) {
|
||||
PqScriptDtls freqDtls = freq.get(0);
|
||||
SourceIssue issue = new SourceIssue();
|
||||
issue.setSourceId(param.getSourceId());
|
||||
issue.setType(freqDtls.getScriptType());
|
||||
issue.setType(freqDtls.getScriptCode());
|
||||
issue.setIndex(freqDtls.getIndex());
|
||||
String scriptSubType = freqDtls.getScriptSubType();
|
||||
issue.setSubType(StrUtil.isBlank(scriptSubType)?scriptSubType:scriptSubType.replace("Base", "NULL"));
|
||||
issue.setSubType(StrUtil.isBlank(scriptSubType) ? scriptSubType : scriptSubType.replace("Base", "NULL"));
|
||||
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
||||
checkDataParam.setScriptId(freqDtls.getScriptId());
|
||||
checkDataParam.setIndex(freqDtls.getIndex());
|
||||
@@ -204,7 +201,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
List<PqScriptDtls> pqScriptDtls;
|
||||
MPJLambdaWrapper<PqScriptDtls> queryWrapper = new MPJLambdaWrapper<>();
|
||||
queryWrapper.selectAll(PqScriptDtls.class)
|
||||
.selectAs(DictTree::getCode, PqScriptDtls::getScriptType)
|
||||
.selectAs(DictTree::getCode, PqScriptDtls::getScriptCode)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType);
|
||||
if (isPhaseSequence) {
|
||||
queryWrapper.eq(PqScriptDtls::getIndex, -1)
|
||||
@@ -313,6 +310,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
dipDataDTO.setFTransValue(dip.getTransValue());
|
||||
// 1.0/频率*持续时间(周波)= 暂态持续时间(s)
|
||||
dipDataDTO.setFRetainTime(NumberUtil.round(1.0 / fFreq * dip.getRetainTime(), 3).doubleValue());
|
||||
dipDataDTO.setRetainTime(dip.getRetainTime());
|
||||
channelListDTO.setDipFlag(true);
|
||||
channelListDTO.setDipData(dipDataDTO);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user