This commit is contained in:
wr
2025-01-16 11:14:44 +08:00
parent 4e0b16fad1
commit 46948118dd

View File

@@ -472,44 +472,36 @@ public class DetectionServiceImpl {
List<SourceIssue.ChannelListDTO> channelTypeAList = sourceIssue.getChannelList().stream() List<SourceIssue.ChannelListDTO> channelTypeAList = sourceIssue.getChannelList().stream()
.filter(x -> ("Ua").equals(x.getChannelType())) .filter(x -> ("Ua").equals(x.getChannelType()))
.collect(Collectors.toList()); .collect(Collectors.toList());
Double retainATime; DetectionData a = setDetectionData(dataRule, mag, fData, dur, magErrList, channelTypeAList, TYPE_A);
if (DUR.equals(dur)) {
retainATime = channelTypeAList.get(0).getDipData().getRetainTime();
} else {
retainATime = channelTypeAList.get(0).getDipData().getFTransValue();
}
DetectionData a = rangeComparisonList(mag.get(TYPE_A), magErrList, fData, retainATime, dataRule);
result.setAValue(JSON.toJSONString(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());
Double retainBTime;
if (DUR.equals(dur)) { DetectionData b = setDetectionData(dataRule, mag, fData, dur, magErrList, channelTypeBList, TYPE_B);
retainBTime = channelTypeBList.get(0).getDipData().getRetainTime();
} else {
retainBTime = channelTypeBList.get(0).getDipData().getFTransValue();
}
DetectionData b = rangeComparisonList(mag.get(TYPE_B), magErrList, fData, retainBTime, dataRule);
result.setBValue(JSON.toJSONString(b)); result.setBValue(JSON.toJSONString(b));
List<SourceIssue.ChannelListDTO> channelTypeCList = sourceIssue.getChannelList().stream() List<SourceIssue.ChannelListDTO> channelTypeCList = sourceIssue.getChannelList().stream()
.filter(x -> ("Uc").equals(x.getChannelType())) .filter(x -> ("Uc").equals(x.getChannelType()))
.collect(Collectors.toList()); .collect(Collectors.toList());
Double retainCTime; DetectionData c = setDetectionData(dataRule, mag, fData, dur, magErrList, channelTypeCList, TYPE_C);
if (DUR.equals(dur)) {
retainCTime = channelTypeCList.get(0).getDipData().getRetainTime();
} else {
retainCTime = channelTypeCList.get(0).getDipData().getFTransValue();
}
DetectionData c = rangeComparisonList(mag.get(TYPE_C), magErrList, fData, retainCTime, dataRule);
result.setCValue(JSON.toJSONString(c)); result.setCValue(JSON.toJSONString(c));
result.setResultFlag(setResultFlag(Arrays.asList(a, b, c))); result.setResultFlag(setResultFlag(Arrays.asList(a, b, c)));
return result; return result;
} }
private DetectionData setDetectionData(DictDataEnum dataRule, Map<String, List<Double>> mag, Double fData, String dur, List<PqErrSysDtls> magErrList, List<SourceIssue.ChannelListDTO> channelTypeCList, String typeC) {
DetectionData c;
if (DUR.equals(dur)) {
c = rangeDURComparisonList(mag.get(typeC), magErrList, fData, channelTypeCList.get(0).getDipData().getRetainTime(), dataRule);
} else {
c = rangeDURComparisonList(mag.get(typeC), magErrList, fData, channelTypeCList.get(0).getDipData().getFTransValue(), dataRule);
}
return c;
}
private Integer setResultFlag(List<DetectionData> numbers) { private Integer setResultFlag(List<DetectionData> numbers) {
List<Integer> isData = numbers.stream().filter(x -> ObjectUtil.isNotNull(x.getData())).filter(x -> 4 != x.getIsData()).map(DetectionData::getIsData).distinct().collect(Collectors.toList()); List<Integer> isData = numbers.stream().filter(x -> ObjectUtil.isNotNull(x.getData())).filter(x -> 4 != x.getIsData()).map(DetectionData::getIsData).distinct().collect(Collectors.toList());
@@ -678,16 +670,14 @@ public class DetectionServiceImpl {
data.setIsData(4); data.setIsData(4);
data.setNum(harm); data.setNum(harm);
data.setData(harmDataList.get(0)); data.setData(harmDataList.get(0));
Double v = issueHarmMap.get(harm);
data.setResultData(v);
if (ObjectUtil.isNotNull(errSysDtl)) { if (ObjectUtil.isNotNull(errSysDtl)) {
PqErrSysDtls errSys = BeanUtil.copyProperties(errSysDtl, PqErrSysDtls.class); PqErrSysDtls errSys = BeanUtil.copyProperties(errSysDtl, PqErrSysDtls.class);
errSys.setMaxErrorValue(maxErrorMultiply(errSys.getMaxErrorValue(), fData, issueHarmMap.get(harm), errSys.getErrorValueType())); errSys.setMaxErrorValue(maxErrorMultiply(errSys.getMaxErrorValue(), fData, issueHarmMap.get(harm), errSys.getErrorValueType()));
Double v = issueHarmMap.get(harm);
data.setResultData(v);
NumberFormat nf = NumberFormat.getInstance(); NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(6); nf.setMaximumFractionDigits(6);
nf.setGroupingUsed(false); nf.setGroupingUsed(false);
data.setRadius(nf.format(-errSys.getMaxErrorValue()) + "~" + nf.format(-errSys.getMaxErrorValue())); data.setRadius(nf.format(-errSys.getMaxErrorValue()) + "~" + nf.format(-errSys.getMaxErrorValue()));
setDetection(dataRule, harmDataList, errSys, data, v); setDetection(dataRule, harmDataList, errSys, data, v);
} }
@@ -813,7 +803,7 @@ public class DetectionServiceImpl {
detectionData.setIsData(4); detectionData.setIsData(4);
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
detectionData.setData(list.get(0)); detectionData.setData(list.get(0));
} detectionData.setResultData(channelData);
//先根据源所下发的数据,是否在误差体系范围内在则可以进行误差体系判断 //先根据源所下发的数据,是否在误差体系范围内在则可以进行误差体系判断
//获得误差体系 //获得误差体系
List<PqErrSysDtls> errSysDtls = pqErrSysDtls.stream().filter(x -> rangeComparison(startRadiusEnd(x.getStartValue(), data, channelData, x.getConditionType()), List<PqErrSysDtls> errSysDtls = pqErrSysDtls.stream().filter(x -> rangeComparison(startRadiusEnd(x.getStartValue(), data, channelData, x.getConditionType()),
@@ -826,12 +816,35 @@ public class DetectionServiceImpl {
NumberFormat nf = NumberFormat.getInstance(); NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(6); nf.setMaximumFractionDigits(6);
nf.setGroupingUsed(false); nf.setGroupingUsed(false);
if (DUR.equals(errSysDtl.getScriptCode())) { errSysDtl.setMaxErrorValue(maxErrorMultiply(errSysDtl.getMaxErrorValue(), data, channelData, errSysDtl.getErrorValueType()));
detectionData.setRadius(nf.format(-errSysDtl.getMaxErrorValue()) + "~" + nf.format(-errSysDtl.getMaxErrorValue()));
setDetection(dataRule, list, errSysDtl, detectionData, channelData);
}
}
return detectionData;
}
public DetectionData rangeDURComparisonList(List<Double> list, List<PqErrSysDtls> pqErrSysDtls, Double data, Double channelData, DictDataEnum dataRule) {
DetectionData detectionData = new DetectionData();
detectionData.setIsData(4);
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
detectionData.setData(list.get(0));
detectionData.setResultData(BigDecimal.valueOf(1.0 / data).doubleValue() * channelData); detectionData.setResultData(BigDecimal.valueOf(1.0 / data).doubleValue() * channelData);
//先根据源所下发的数据,是否在误差体系范围内在则可以进行误差体系判断
//获得误差体系
List<PqErrSysDtls> errSysDtls = pqErrSysDtls.stream().filter(x -> rangeComparison(startRadiusEnd(x.getStartValue(), data, channelData, x.getConditionType()),
x.getStartFlag(),
startRadiusEnd(x.getEndValue(), data, channelData, x.getConditionType()),
x.getEndFlag(),
channelData)).collect(Collectors.toList());
if (CollUtil.isNotEmpty(errSysDtls)) {
PqErrSysDtls errSysDtl = BeanUtil.copyProperties(errSysDtls.get(0), PqErrSysDtls.class);
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(6);
nf.setGroupingUsed(false);
detectionData.setRadius(nf.format(BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue()))) detectionData.setRadius(nf.format(BigDecimal.valueOf(1.0 / data * (channelData - errSysDtl.getMaxErrorValue())))
+ "~" + nf.format(BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue())))); + "~" + nf.format(BigDecimal.valueOf(1.0 / data * (channelData + errSysDtl.getMaxErrorValue()))));
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())),
@@ -839,16 +852,6 @@ public class DetectionServiceImpl {
).collect(Collectors.toList()); ).collect(Collectors.toList());
isData(dataRule, qualifiedList, detectionData, qualifiedList); isData(dataRule, qualifiedList, detectionData, qualifiedList);
} }
} else {
if (CollUtil.isNotEmpty(list)) {
errSysDtl.setMaxErrorValue(maxErrorMultiply(errSysDtl.getMaxErrorValue(), data, channelData, errSysDtl.getErrorValueType()));
detectionData.setResultData(channelData);
detectionData.setRadius(nf.format(-errSysDtl.getMaxErrorValue()) + "~" + nf.format(-errSysDtl.getMaxErrorValue()));
detectionData.setData(list.get(0));
setDetection(dataRule, list, errSysDtl, detectionData, channelData);
}
}
} }
return detectionData; return detectionData;
} }
@@ -1000,7 +1003,7 @@ public class DetectionServiceImpl {
if (integerListMap.containsKey(i)) { if (integerListMap.containsKey(i)) {
if (i.equals(1.0)) { if (i.equals(1.0)) {
integerListMap.get(1.0).add(multiply(fund, fund)); integerListMap.get(1.0).add(multiply(fund, fund));
}else{ } else {
if (type.equals("A")) { if (type.equals("A")) {
integerListMap.get(i).add(multiply(harm.getList().getA().get((int) (i - num)), fund)); integerListMap.get(i).add(multiply(harm.getList().getA().get((int) (i - num)), fund));
} }