正式检测增加装置空数据判断

This commit is contained in:
wr
2025-01-08 09:54:04 +08:00
parent 28b8ca4ea7
commit be232d390f

View File

@@ -480,6 +480,8 @@ public class DetectionServiceImpl {
private Integer setResultFlag(List<Integer> numbers) { private Integer setResultFlag(List<Integer> numbers) {
numbers = numbers.stream().filter(x -> ObjectUtil.isNotNull(x)).collect(Collectors.toList());
if (CollUtil.isNotEmpty(numbers)) {
if (numbers.size() > 1) { if (numbers.size() > 1) {
if (numbers.contains(4)) { if (numbers.contains(4)) {
return 4; return 4;
@@ -488,6 +490,9 @@ public class DetectionServiceImpl {
} }
} }
return numbers.get(0); return numbers.get(0);
} else {
return 4;
}
} }
/** /**
@@ -668,7 +673,6 @@ public class DetectionServiceImpl {
.filter(x -> v == 0 ? x == v : x > 0 && NumberUtil.isIn(devSubtractChannelData(x, v, errSysDtl.getErrorValueType()), .filter(x -> v == 0 ? x == v : x > 0 && NumberUtil.isIn(devSubtractChannelData(x, v, errSysDtl.getErrorValueType()),
BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()), BigDecimal.valueOf(-errSysDtl.getMaxErrorValue()),
BigDecimal.valueOf(errSysDtl.getMaxErrorValue()))).collect(Collectors.toList()); BigDecimal.valueOf(errSysDtl.getMaxErrorValue()))).collect(Collectors.toList());
data.setRadius(-errSysDtl.getMaxErrorValue() + "~" + errSysDtl.getMaxErrorValue());
isData(dataRule, harmDataList, data, qualifiedList); isData(dataRule, harmDataList, data, qualifiedList);
} }
@@ -764,7 +768,6 @@ public class DetectionServiceImpl {
public DetectionData rangeComparisonList(List<Double> list, List<PqErrSysDtls> pqErrSysDtls, Double data, Double channelData, DictDataEnum dataRule) { public DetectionData rangeComparisonList(List<Double> list, List<PqErrSysDtls> pqErrSysDtls, Double data, Double channelData, DictDataEnum dataRule) {
DetectionData detectionData = new DetectionData(); DetectionData detectionData = new DetectionData();
detectionData.setIsData(4); detectionData.setIsData(4);
detectionData.setData(CollUtil.isNotEmpty(list) ? list.get(0) : null);
//先根据源所下发的数据,是否在误差体系范围内在则可以进行误差体系判断 //先根据源所下发的数据,是否在误差体系范围内在则可以进行误差体系判断
//获得误差体系 //获得误差体系
List<PqErrSysDtls> errSysDtls = pqErrSysDtls.stream().filter(x -> rangeComparison(multiply(x.getStartValue(), data, x.getConditionType()), List<PqErrSysDtls> errSysDtls = pqErrSysDtls.stream().filter(x -> rangeComparison(multiply(x.getStartValue(), data, x.getConditionType()),
@@ -775,23 +778,30 @@ public class DetectionServiceImpl {
if (CollUtil.isNotEmpty(errSysDtls)) { if (CollUtil.isNotEmpty(errSysDtls)) {
PqErrSysDtls errSysDtl = BeanUtil.copyProperties(errSysDtls.get(0), PqErrSysDtls.class); PqErrSysDtls errSysDtl = BeanUtil.copyProperties(errSysDtls.get(0), PqErrSysDtls.class);
if (DUR.equals(errSysDtl.getScriptType())) { if (DUR.equals(errSysDtl.getScriptType())) {
detectionData.setResultData(BigDecimal.valueOf(1.0 / data).doubleValue() * channelData);
detectionData.setRadius(BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue()))
+ "~" + BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue())));
if (CollUtil.isNotEmpty(list)) {
detectionData.setData(list.get(0));
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())),
BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue()))) BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue())))
).collect(Collectors.toList()); ).collect(Collectors.toList());
detectionData.setResultData(BigDecimal.valueOf(1.0 / data).doubleValue() * channelData);
detectionData.setRadius(BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue()))
+ "~" + BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue())));
isData(dataRule, qualifiedList, detectionData, qualifiedList); isData(dataRule, qualifiedList, detectionData, qualifiedList);
}
} else { } else {
if (0 == errSysDtl.getErrorValueType()) { if (0 == errSysDtl.getErrorValueType()) {
errSysDtl.setMaxErrorValue(multiply(errSysDtl.getMaxErrorValue(), data, 0)); errSysDtl.setMaxErrorValue(multiply(errSysDtl.getMaxErrorValue(), data, 0));
} }
detectionData.setResultData(channelData); detectionData.setResultData(channelData);
detectionData.setRadius(-errSysDtl.getMaxErrorValue() + "~" + errSysDtl.getMaxErrorValue());
if (CollUtil.isNotEmpty(list)) {
detectionData.setData(list.get(0));
setDetection(dataRule, list, errSysDtl, detectionData, channelData); setDetection(dataRule, list, errSysDtl, detectionData, channelData);
} }
} }
}
return detectionData; return detectionData;
} }