This commit is contained in:
wr
2025-02-26 20:09:31 +08:00
parent 5ee33fabdf
commit bf94ed37d9
3 changed files with 151 additions and 101 deletions

View File

@@ -159,7 +159,6 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
for (Double i : harmNum) {
dataVO = new RawResultDataVO();
dataVO.setHarmNum(i);
dataVO.setIsData(harmonicResult.getResultFlag());
dataVO.setUnit(unit);
try {
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
@@ -179,6 +178,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
if (ObjectUtil.isNotNull(a)) {
dataVO.setRadius(a.getRadius());
}
dataVO.setIsData(setResultFlag(Arrays.asList(a,b,c)));
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
@@ -234,7 +234,23 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
}
return null;
}
private Integer setResultFlag(List<RawResultDataVO.DetectionData> numbers) {
List<Integer> isData = numbers.stream().filter(x -> ObjectUtil.isNotNull(x.getData())).filter(x -> 4 != x.getIsData()).map(RawResultDataVO.DetectionData::getIsData).distinct().collect(Collectors.toList());
return getInteger(isData);
}
private static Integer getInteger(List<Integer> isData) {
if (CollUtil.isNotEmpty(isData)) {
if (isData.size() > 1) {
if (isData.contains(2)) {
return 2;
}
}
return isData.get(0);
} else {
return 4;
}
}
public Double isHarmOrInHarm(Double value) {
if (value == value.longValue()) {