解决暂态测试项,icd分项和不分项功能优化
This commit is contained in:
@@ -20,7 +20,7 @@ public class DetectionData {
|
|||||||
private Double num;
|
private Double num;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是符合数据
|
* 是否是符合数据(1.合格 2.不合格 3.网络超时 4.无法处理 5.不参与误差比较)
|
||||||
*/
|
*/
|
||||||
private Integer isData;
|
private Integer isData;
|
||||||
|
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ public class DetectionServiceImpl {
|
|||||||
if (devIndex.contains("P")) {
|
if (devIndex.contains("P")) {
|
||||||
type = P;
|
type = P;
|
||||||
harmCode = DetectionCodeEnum.P2_50.getCode();
|
harmCode = DetectionCodeEnum.P2_50.getCode();
|
||||||
fData = sourceIssue.getFIn() * sourceIssue.getFUn() * 0.01;
|
fData = (sourceIssue.getFIn() * sourceIssue.getFUn()) * 0.01;
|
||||||
}
|
}
|
||||||
Map<String, Map<Double, List<Double>>> devHarmMap = devHarmListMap(dev, sourceIssue, dataRule, fundCode, harmCode, num);
|
Map<String, Map<Double, List<Double>>> devHarmMap = devHarmListMap(dev, sourceIssue, dataRule, fundCode, harmCode, num);
|
||||||
if (CollUtil.isNotEmpty(devHarmMap)) {
|
if (CollUtil.isNotEmpty(devHarmMap)) {
|
||||||
@@ -487,7 +487,7 @@ public class DetectionServiceImpl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (P.equals(type)) {
|
if (P.equals(type)) {
|
||||||
fData = sourceIssue.getFIn() * sourceIssue.getFUn() * 0.01;
|
fData = (sourceIssue.getFIn() * sourceIssue.getFUn()) * 0.01;
|
||||||
harmCode = DetectionCodeEnum.P2_50.getCode();
|
harmCode = DetectionCodeEnum.P2_50.getCode();
|
||||||
}
|
}
|
||||||
Map<String, Map<Double, List<Double>>> devMap = devHarmListMap(dev, sourceIssue, dataRule, fundCode, harmCode, num);
|
Map<String, Map<Double, List<Double>>> devMap = devHarmListMap(dev, sourceIssue, dataRule, fundCode, harmCode, num);
|
||||||
@@ -613,6 +613,14 @@ public class DetectionServiceImpl {
|
|||||||
/**
|
/**
|
||||||
* 判断值是否在误差范围内,有则进行判断否则则不进行计算(暂态)
|
* 判断值是否在误差范围内,有则进行判断否则则不进行计算(暂态)
|
||||||
*
|
*
|
||||||
|
* (假如都符合,则选取最开始合格的,都不合格,取最开始不合格的)
|
||||||
|
* 方案一 分项问题
|
||||||
|
* 分别计算各个相别是否合格
|
||||||
|
* 不合格电压幅值的层级最高
|
||||||
|
*
|
||||||
|
* 方案二 不分项问题
|
||||||
|
* 以电压幅值最低的作为比较相别
|
||||||
|
*
|
||||||
* @param dev 处理过后的数据
|
* @param dev 处理过后的数据
|
||||||
* @param errDtlsCheckData 误差体系
|
* @param errDtlsCheckData 误差体系
|
||||||
* @param sourceIssue 源下发所对应的参数
|
* @param sourceIssue 源下发所对应的参数
|
||||||
@@ -635,14 +643,80 @@ public class DetectionServiceImpl {
|
|||||||
//暂态电压下多少就是多少
|
//暂态电压下多少就是多少
|
||||||
List<ErrDtlsCheckDataVO> magErrList = errDtlsCheckData.stream().filter(x -> MAG.equals(x.getValueTypeCode())).collect(Collectors.toList());
|
List<ErrDtlsCheckDataVO> magErrList = errDtlsCheckData.stream().filter(x -> MAG.equals(x.getValueTypeCode())).collect(Collectors.toList());
|
||||||
List<ErrDtlsCheckDataVO> durErrList = errDtlsCheckData.stream().filter(x -> DUR.equals(x.getValueTypeCode())).collect(Collectors.toList());
|
List<ErrDtlsCheckDataVO> durErrList = errDtlsCheckData.stream().filter(x -> DUR.equals(x.getValueTypeCode())).collect(Collectors.toList());
|
||||||
|
|
||||||
AdNonHarmonicResult magResult = voltageResult(dev.get(0).getId(), devIdMapComm, sourceIssue, dataRule, mag, magErrList, sourceIssue.getFUn(), MAG);
|
AdNonHarmonicResult magResult = voltageResult(dev.get(0).getId(), devIdMapComm, sourceIssue, dataRule, mag, magErrList, sourceIssue.getFUn(), MAG);
|
||||||
AdNonHarmonicResult durResult = voltageResult(dev.get(0).getId(), devIdMapComm, sourceIssue, dataRule, dur, durErrList, sourceIssue.getFFreq(), DUR);
|
AdNonHarmonicResult durResult = voltageResult(dev.get(0).getId(), devIdMapComm, sourceIssue, dataRule, dur, durErrList, sourceIssue.getFFreq(), DUR);
|
||||||
|
if (CollUtil.isNotEmpty(mag.get(TYPE_B)) && CollUtil.isNotEmpty(mag.get(TYPE_C))) {
|
||||||
|
conclusion(magResult, durResult);
|
||||||
|
}
|
||||||
detectionDataDealService.acceptAdNonResult(Arrays.asList(magResult, durResult), code);
|
detectionDataDealService.acceptAdNonResult(Arrays.asList(magResult, durResult), code);
|
||||||
List<Integer> numbers = Arrays.asList(magResult.getResultFlag(), durResult.getResultFlag()).stream().distinct().collect(Collectors.toList());
|
List<Integer> numbers = Arrays.asList(magResult.getResultFlag(), durResult.getResultFlag()).stream().distinct().collect(Collectors.toList());
|
||||||
return getInteger(numbers);
|
return getInteger(numbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param magResult 电压幅值结果
|
||||||
|
* @param durResult 持续时间结果
|
||||||
|
* @Description:
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2025/4/9 18:54
|
||||||
|
*/
|
||||||
|
private void conclusion(AdNonHarmonicResult magResult, AdNonHarmonicResult durResult) {
|
||||||
|
if (magResult.getResultFlag() == 1) {
|
||||||
|
if (durResult.getResultFlag() != 2) {
|
||||||
|
setTValueBasedOnAValue(magResult, durResult);
|
||||||
|
} else {
|
||||||
|
setTValueBasedOnAValue(magResult, durResult, false);
|
||||||
|
}
|
||||||
|
} else if (magResult.getResultFlag() == 2) {
|
||||||
|
setTValueBasedOnAValue(magResult, durResult, true);
|
||||||
|
} else {
|
||||||
|
setTValueBasedOnAValue(magResult, durResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTValueBasedOnAValue(AdNonHarmonicResult magResult, AdNonHarmonicResult durResult, Boolean isMag) {
|
||||||
|
DetectionData a;
|
||||||
|
DetectionData b;
|
||||||
|
DetectionData c;
|
||||||
|
if (isMag) {
|
||||||
|
a = JSON.parseObject(magResult.getAValue(), DetectionData.class);
|
||||||
|
b = JSON.parseObject(magResult.getBValue(), DetectionData.class);
|
||||||
|
c = JSON.parseObject(magResult.getCValue(), DetectionData.class);
|
||||||
|
} else {
|
||||||
|
a = JSON.parseObject(durResult.getAValue(), DetectionData.class);
|
||||||
|
b = JSON.parseObject(durResult.getBValue(), DetectionData.class);
|
||||||
|
c = JSON.parseObject(durResult.getCValue(), DetectionData.class);
|
||||||
|
}
|
||||||
|
if (a.getIsData() == 2) {
|
||||||
|
setTValueBasedOnAValue(magResult, durResult);
|
||||||
|
} else if (b.getIsData() == 2) {
|
||||||
|
setTValueBasedOnBValue(magResult, durResult);
|
||||||
|
} else if (c.getIsData() == 2) {
|
||||||
|
setTValueBasedOnCValue(magResult, durResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param magResult 电压幅值结果
|
||||||
|
* @param durResult 持续时间结果
|
||||||
|
* @Description:
|
||||||
|
* @Author: wr
|
||||||
|
*/
|
||||||
|
private void setTValueBasedOnAValue(AdNonHarmonicResult magResult, AdNonHarmonicResult durResult) {
|
||||||
|
magResult.setTValue(magResult.getAValue());
|
||||||
|
durResult.setTValue(durResult.getAValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTValueBasedOnBValue(AdNonHarmonicResult magResult, AdNonHarmonicResult durResult) {
|
||||||
|
magResult.setTValue(magResult.getBValue());
|
||||||
|
durResult.setTValue(durResult.getBValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTValueBasedOnCValue(AdNonHarmonicResult magResult, AdNonHarmonicResult durResult) {
|
||||||
|
magResult.setTValue(magResult.getCValue());
|
||||||
|
durResult.setTValue(durResult.getCValue());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param devId 装置监测点id(ip_通道)
|
* @param devId 装置监测点id(ip_通道)
|
||||||
* @param devIdMapComm ip_通道,装置名称
|
* @param devIdMapComm ip_通道,装置名称
|
||||||
@@ -683,13 +757,6 @@ public class DetectionServiceImpl {
|
|||||||
magErrList = errDtlsCheckData.get(0).getErrSysDtls();
|
magErrList = errDtlsCheckData.get(0).getErrSysDtls();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//取出源所对应的相别信息
|
|
||||||
List<SourceIssue.ChannelListDTO> channelTypeAList = sourceIssue.getChannelList().stream()
|
|
||||||
.filter(x -> ("Ua").equals(x.getChannelType()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
DetectionData a = setDetectionData(isQualified, valueTypeCode, dataRule, mag, fData, dur, magErrList, channelTypeAList, TYPE_A);
|
|
||||||
result.setAValue(JSON.toJSONString(a));
|
|
||||||
|
|
||||||
List<SourceIssue.ChannelListDTO> channelTypeBList = sourceIssue.getChannelList().stream()
|
List<SourceIssue.ChannelListDTO> channelTypeBList = sourceIssue.getChannelList().stream()
|
||||||
.filter(x -> ("Ub").equals(x.getChannelType()))
|
.filter(x -> ("Ub").equals(x.getChannelType()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@@ -703,18 +770,47 @@ public class DetectionServiceImpl {
|
|||||||
DetectionData c = setDetectionData(isQualified, valueTypeCode, dataRule, mag, fData, dur, magErrList, channelTypeCList, TYPE_C);
|
DetectionData c = setDetectionData(isQualified, valueTypeCode, dataRule, mag, fData, dur, magErrList, channelTypeCList, TYPE_C);
|
||||||
result.setCValue(JSON.toJSONString(c));
|
result.setCValue(JSON.toJSONString(c));
|
||||||
|
|
||||||
result.setResultFlag(setResultFlag(Arrays.asList(a, b, c)));
|
if (CollUtil.isNotEmpty(mag.get(TYPE_B)) &&CollUtil.isNotEmpty(mag.get(TYPE_C))) {
|
||||||
|
//取出源所对应的相别信息
|
||||||
|
List<SourceIssue.ChannelListDTO> channelTypeAList = sourceIssue.getChannelList().stream()
|
||||||
|
.filter(x -> ("Ua").equals(x.getChannelType()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
DetectionData a = setDetectionData(isQualified, valueTypeCode, dataRule, mag, fData, dur, magErrList, channelTypeAList, TYPE_A);
|
||||||
|
result.setAValue(JSON.toJSONString(a));
|
||||||
|
result.setResultFlag(setResultFlag(Arrays.asList(a, b, c)));
|
||||||
|
}else {
|
||||||
|
List<SourceIssue.ChannelListDTO> channelTypeAList = sourceIssue.getChannelList().stream()
|
||||||
|
.filter(x -> x.getChannelType().contains("U"))
|
||||||
|
.sorted(Comparator.comparing(
|
||||||
|
x -> Optional.ofNullable(x.getDipData())
|
||||||
|
.map(SourceIssue.ChannelListDTO.DipDataDTO::getFTransValue)
|
||||||
|
.orElse(Double.NaN)
|
||||||
|
))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
DetectionData a = setDetectionData(isQualified, valueTypeCode, dataRule, mag, fData, dur, magErrList, channelTypeAList, TYPE_A);
|
||||||
|
result.setAValue(JSON.toJSONString(a));
|
||||||
|
result.setTValue(JSON.toJSONString(a));
|
||||||
|
result.setResultFlag(a.getIsData());
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DetectionData setDetectionData(Integer isQualified, String valueTypeCode, DictDataEnum dataRule, Map<String, List<Double>> mag, Double fData, String dur, List<PqErrSysDtls> magErrList, List<SourceIssue.ChannelListDTO> channelTypeCList, String typeC) {
|
private DetectionData setDetectionData(Integer isQualified,
|
||||||
|
String valueTypeCode,
|
||||||
|
DictDataEnum dataRule,
|
||||||
|
Map<String, List<Double>> mag,
|
||||||
|
Double fData,
|
||||||
|
String dur,
|
||||||
|
List<PqErrSysDtls> magErrList,
|
||||||
|
List<SourceIssue.ChannelListDTO> channelTypeCList,
|
||||||
|
String typeC) {
|
||||||
DetectionData c;
|
DetectionData c;
|
||||||
if (DUR.equals(dur)) {
|
if (DUR.equals(dur)) {
|
||||||
c = rangeDURComparisonList(mag.get(typeC), isQualified, valueTypeCode, magErrList, fData, channelTypeCList.get(0).getDipData().getRetainTime(), dataRule);
|
c = rangeDURComparisonList(mag.get(typeC), isQualified, valueTypeCode, magErrList, fData, channelTypeCList.get(0).getDipData().getRetainTime(), dataRule);
|
||||||
} else {
|
} else {
|
||||||
List<Double> ampData = mag.get(typeC).stream()
|
List<Double> ampData = mag.get(typeC).stream()
|
||||||
.filter(x -> ObjectUtil.isNotNull(x))
|
.filter(x -> ObjectUtil.isNotNull(x))
|
||||||
.map(x -> x * channelTypeCList.get(0).getFAmp() * 0.01)
|
.map(x -> NumberUtil.round(x * channelTypeCList.get(0).getFAmp() * 0.01, 4).doubleValue())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
c = rangeComparisonList(ampData, isQualified, valueTypeCode, magErrList, fData, channelTypeCList.get(0).getDipData().getFTransValue(), dataRule);
|
c = rangeComparisonList(ampData, isQualified, valueTypeCode, magErrList, fData, channelTypeCList.get(0).getDipData().getFTransValue(), dataRule);
|
||||||
}
|
}
|
||||||
@@ -1125,8 +1221,8 @@ public class DetectionServiceImpl {
|
|||||||
nf.setMaximumFractionDigits(6);
|
nf.setMaximumFractionDigits(6);
|
||||||
nf.setGroupingUsed(false);
|
nf.setGroupingUsed(false);
|
||||||
detectionData.setUnit(unit(valueTypeCode, errSysDtl.getErrorValueType()));
|
detectionData.setUnit(unit(valueTypeCode, errSysDtl.getErrorValueType()));
|
||||||
detectionData.setRadius(nf.format(BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())))
|
detectionData.setRadius(nf.format(BigDecimal.valueOf(-1.0 / data))
|
||||||
+ "~" + nf.format(BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue()))));
|
+ "~" + nf.format(BigDecimal.valueOf(1.0 / data)));
|
||||||
List<Double> qualifiedList = list.stream()
|
List<Double> qualifiedList = list.stream()
|
||||||
.filter(x -> NumberUtil.isIn(BigDecimal.valueOf(x.doubleValue()),
|
.filter(x -> NumberUtil.isIn(BigDecimal.valueOf(x.doubleValue()),
|
||||||
BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())),
|
BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())),
|
||||||
@@ -1134,14 +1230,14 @@ public class DetectionServiceImpl {
|
|||||||
).collect(Collectors.toList());
|
).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(qualifiedList)) {
|
if (CollUtil.isNotEmpty(qualifiedList)) {
|
||||||
BigDecimal subtract = BigDecimal.valueOf(qualifiedList.get(0))
|
BigDecimal subtract = BigDecimal.valueOf(qualifiedList.get(0))
|
||||||
.subtract(BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())));
|
.subtract(BigDecimal.valueOf(1.0 / data * (channelData)));
|
||||||
detectionData.setErrorData(subtract);
|
detectionData.setErrorData(subtract);
|
||||||
} else {
|
} else {
|
||||||
BigDecimal subtract = BigDecimal.valueOf(list.get(0))
|
BigDecimal subtract = BigDecimal.valueOf(list.get(0))
|
||||||
.subtract(BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())));
|
.subtract(BigDecimal.valueOf(1.0 / data * (channelData)));
|
||||||
detectionData.setErrorData(subtract);
|
detectionData.setErrorData(subtract);
|
||||||
}
|
}
|
||||||
isData(dataRule, qualifiedList, detectionData, qualifiedList);
|
isData(dataRule, list, detectionData, qualifiedList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return detectionData;
|
return detectionData;
|
||||||
@@ -1157,7 +1253,8 @@ public class DetectionServiceImpl {
|
|||||||
* @param devData 装置上送值
|
* @param devData 装置上送值
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Boolean rangeComparison(Double startValue, Integer startFlag, Double endValue, Integer endFlag, Double devData) {
|
public Boolean rangeComparison(Double startValue, Integer startFlag, Double endValue, Integer endFlag, Double
|
||||||
|
devData) {
|
||||||
Boolean minBool = null;
|
Boolean minBool = null;
|
||||||
Boolean maxBool = null;
|
Boolean maxBool = null;
|
||||||
if (ObjectUtil.isNotNull(startValue)) {
|
if (ObjectUtil.isNotNull(startValue)) {
|
||||||
@@ -1288,7 +1385,9 @@ public class DetectionServiceImpl {
|
|||||||
* @param harm 基波信息
|
* @param harm 基波信息
|
||||||
* @param fund 2-50次谐波信息
|
* @param fund 2-50次谐波信息
|
||||||
*/
|
*/
|
||||||
public void harmPut(String type, Map<String, Map<Double, List<Double>>> map, List<Double> harmNum, DevData.SqlDataHarmDTO harm, String fund, Integer num) {
|
public void harmPut(String
|
||||||
|
type, Map<String, Map<Double, List<Double>>> map, List<Double> harmNum, DevData.SqlDataHarmDTO
|
||||||
|
harm, String fund, Integer num) {
|
||||||
if (map.containsKey(type)) {
|
if (map.containsKey(type)) {
|
||||||
Map<Double, List<Double>> integerListMap = map.get(type);
|
Map<Double, List<Double>> integerListMap = map.get(type);
|
||||||
for (Double i : harmNum) {
|
for (Double i : harmNum) {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class UnitUtil {
|
|||||||
unit = "P";
|
unit = "P";
|
||||||
}
|
}
|
||||||
if (DetectionCodeEnum.MAG.getCode().equals(code)) {
|
if (DetectionCodeEnum.MAG.getCode().equals(code)) {
|
||||||
unit = "%";
|
unit = "V";
|
||||||
}
|
}
|
||||||
if (DetectionCodeEnum.DUR.getCode().equals(code)) {
|
if (DetectionCodeEnum.DUR.getCode().equals(code)) {
|
||||||
unit = "s";
|
unit = "s";
|
||||||
|
|||||||
@@ -1039,7 +1039,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
|||||||
dipDataDTO.setFTransValue(dip.getTransValue());
|
dipDataDTO.setFTransValue(dip.getTransValue());
|
||||||
if (devFly) {
|
if (devFly) {
|
||||||
if (isValueType) {
|
if (isValueType) {
|
||||||
dipDataDTO.setFTransValue(dip.getTransValue() * dtls.getValue() * 0.01);
|
dipDataDTO.setFTransValue(dip.getTransValue() * (dtls.getValue() * 0.01));
|
||||||
} else {
|
} else {
|
||||||
dipDataDTO.setFTransValue(dip.getTransValue());
|
dipDataDTO.setFTransValue(dip.getTransValue());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@@ -23,7 +24,6 @@ import com.njcn.gather.storage.service.AdHarmonicService;
|
|||||||
import com.njcn.gather.system.dictionary.mapper.DictTreeMapper;
|
import com.njcn.gather.system.dictionary.mapper.DictTreeMapper;
|
||||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -43,7 +43,6 @@ import java.util.stream.Collectors;
|
|||||||
public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarmonicResult> implements AdHarmonicService {
|
public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarmonicResult> implements AdHarmonicService {
|
||||||
|
|
||||||
private final AdNonHarmonicMapper adNonHarmonicMapper;
|
private final AdNonHarmonicMapper adNonHarmonicMapper;
|
||||||
private final IDictDataService dictDataService;
|
|
||||||
private final DictTreeMapper dictTreeMapper;
|
private final DictTreeMapper dictTreeMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -101,15 +100,15 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
|||||||
|
|
||||||
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
|
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
|
||||||
fieldA.setAccessible(true);
|
fieldA.setAccessible(true);
|
||||||
dataVO.setDataA(ObjectUtil.isNotNull(fieldA.get(harmonicResult)) ? new BigDecimal(fieldA.get(harmonicResult) + "").toPlainString() : null);
|
dataVO.setDataA(StrUtil.isNotBlank(fieldA.get(harmonicResult) + "") ? new BigDecimal(fieldA.get(harmonicResult) + "").toPlainString() : null);
|
||||||
|
|
||||||
Field fieldB = harmonicResult.getClass().getDeclaredField("bValue" + isHarmOrInHarm(i).intValue());
|
Field fieldB = harmonicResult.getClass().getDeclaredField("bValue" + isHarmOrInHarm(i).intValue());
|
||||||
fieldB.setAccessible(true);
|
fieldB.setAccessible(true);
|
||||||
dataVO.setDataB(ObjectUtil.isNotNull(fieldB.get(harmonicResult)) ? new BigDecimal(fieldB.get(harmonicResult) + "").toPlainString() : null);
|
dataVO.setDataB(StrUtil.isNotBlank(fieldB.get(harmonicResult) + "") ? new BigDecimal(fieldB.get(harmonicResult) + "").toPlainString() : null);
|
||||||
|
|
||||||
Field fieldC = harmonicResult.getClass().getDeclaredField("cValue" + isHarmOrInHarm(i).intValue());
|
Field fieldC = harmonicResult.getClass().getDeclaredField("cValue" + isHarmOrInHarm(i).intValue());
|
||||||
fieldC.setAccessible(true);
|
fieldC.setAccessible(true);
|
||||||
dataVO.setDataC(ObjectUtil.isNotNull(fieldC.get(harmonicResult)) ? new BigDecimal(fieldC.get(harmonicResult) + "").toPlainString() : null);
|
dataVO.setDataC(StrUtil.isNotBlank(fieldC.get(harmonicResult) + "") ? new BigDecimal(fieldC.get(harmonicResult) + "").toPlainString() : null);
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
@@ -251,10 +250,10 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
|||||||
|
|
||||||
private Integer setResultFlag(List<RawResultDataVO.DetectionData> numbers) {
|
private Integer setResultFlag(List<RawResultDataVO.DetectionData> numbers) {
|
||||||
List<Integer> isData = numbers.stream().filter(Objects::nonNull)
|
List<Integer> isData = numbers.stream().filter(Objects::nonNull)
|
||||||
.filter(x -> ObjectUtil.isNotNull(x.getData()))
|
.filter(x -> ObjectUtil.isNotNull(x.getData()))
|
||||||
.map(RawResultDataVO.DetectionData::getIsData)
|
.map(RawResultDataVO.DetectionData::getIsData)
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
return getInteger(isData);
|
return getInteger(isData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
@@ -24,10 +25,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -77,12 +75,12 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
|||||||
List<RawDataVO> rawDataVOS = new ArrayList<>();
|
List<RawDataVO> rawDataVOS = new ArrayList<>();
|
||||||
for (AdNonHarmonicResult result : value) {
|
for (AdNonHarmonicResult result : value) {
|
||||||
RawDataVO dataVO = new RawDataVO();
|
RawDataVO dataVO = new RawDataVO();
|
||||||
dataVO.setUnit(unit(dictTree.getCode()));
|
dataVO.setUnit(dictTree.getCode().equals("MAG")?"%":unit(dictTree.getCode()));
|
||||||
dataVO.setTime(result.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
dataVO.setTime(result.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
||||||
dataVO.setDataA(ObjectUtil.isNotNull(result.getAValue()) ? new BigDecimal(result.getAValue()).toPlainString() : null);
|
dataVO.setDataA(StrUtil.isNotBlank(result.getAValue()) ? new BigDecimal(result.getAValue()).toPlainString() : null);
|
||||||
dataVO.setDataB(ObjectUtil.isNotNull(result.getBValue()) ? new BigDecimal(result.getBValue()).toPlainString() : null);
|
dataVO.setDataB(StrUtil.isNotBlank(result.getBValue()) ? new BigDecimal(result.getBValue()).toPlainString() : null);
|
||||||
dataVO.setDataC(ObjectUtil.isNotNull(result.getCValue()) ? new BigDecimal(result.getCValue()).toPlainString() : null);
|
dataVO.setDataC(StrUtil.isNotBlank(result.getCValue()) ? new BigDecimal(result.getCValue()).toPlainString() : null);
|
||||||
dataVO.setDataT(ObjectUtil.isNotNull(result.getTValue()) ? new BigDecimal(result.getTValue()).toPlainString() : null);
|
dataVO.setDataT(StrUtil.isNotBlank(result.getTValue()) ? new BigDecimal(result.getTValue()).toPlainString() : null);
|
||||||
rawDataVOS.add(dataVO);
|
rawDataVOS.add(dataVO);
|
||||||
}
|
}
|
||||||
info.put(dictTree.getName(), rawDataVOS);
|
info.put(dictTree.getName(), rawDataVOS);
|
||||||
@@ -104,11 +102,11 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
|||||||
List<AdNonHarmonicResult> adHarmonicResults = this.getBaseMapper().selectJoinList(AdNonHarmonicResult.class, wrapper);
|
List<AdNonHarmonicResult> adHarmonicResults = this.getBaseMapper().selectJoinList(AdNonHarmonicResult.class, wrapper);
|
||||||
|
|
||||||
Map<String, RawResultDataVO> info = new LinkedHashMap<>(2);
|
Map<String, RawResultDataVO> info = new LinkedHashMap<>(2);
|
||||||
Map<String, AdNonHarmonicResult> adTypeMap = adHarmonicResults.stream().collect(Collectors.toMap(AdNonHarmonicResult::getAdType, Function.identity()));
|
Map<String, AdNonHarmonicResult> adTypeMap = adHarmonicResults.stream()
|
||||||
|
.sorted(Comparator.comparing(AdNonHarmonicResult::getResultFlag))
|
||||||
|
.collect(Collectors.toMap(AdNonHarmonicResult::getAdType, Function.identity(), (a, b) -> a, LinkedHashMap::new));
|
||||||
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adTypeMap.keySet()));
|
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adTypeMap.keySet()));
|
||||||
|
|
||||||
Map<String, DictTree> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, Function.identity()));
|
Map<String, DictTree> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, Function.identity()));
|
||||||
|
|
||||||
adTypeMap.forEach((key, result) -> {
|
adTypeMap.forEach((key, result) -> {
|
||||||
if (dictTreeByName.containsKey(key)) {
|
if (dictTreeByName.containsKey(key)) {
|
||||||
DictTree treeName = dictTreeByName.get(key);
|
DictTree treeName = dictTreeByName.get(key);
|
||||||
@@ -234,7 +232,7 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
|||||||
* 暂态-电压幅值
|
* 暂态-电压幅值
|
||||||
*/
|
*/
|
||||||
case "MAG":
|
case "MAG":
|
||||||
unit = "%";
|
unit = "V";
|
||||||
break;
|
break;
|
||||||
/**
|
/**
|
||||||
* 暂态-持续时间
|
* 暂态-持续时间
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.gather.system.log.pojo.param.SysLogParam;
|
import com.njcn.gather.system.log.pojo.param.SysLogParam;
|
||||||
import com.njcn.gather.system.log.pojo.po.SysLogAudit;
|
import com.njcn.gather.system.log.pojo.po.SysLogAudit;
|
||||||
import com.njcn.gather.system.log.pojo.vo.SysLogVO;
|
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import org.aspectj.lang.JoinPoint;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
|
|||||||
Reference in New Issue
Block a user