fix: 核素分析规则 平均值保留5位小数

This commit is contained in:
xiaoguangbin 2025-01-13 16:23:35 +08:00
parent 14c1ee3468
commit ed9b999a3e
2 changed files with 2 additions and 4 deletions

View File

@ -219,8 +219,6 @@ public class AnalysisConsumer implements StreamListener<String, ObjectRecord<Str
if (ObjectUtil.isNotNull(sampleType)) if (ObjectUtil.isNotNull(sampleType))
logInfo.setSampleType(sampleType.getValue()); logInfo.setSampleType(sampleType.getValue());
logInfo.setAlarmInfo(messageDTO.getContent()); logInfo.setAlarmInfo(messageDTO.getContent());
if (CollUtil.isNotEmpty(moreThanAvg))
logInfo.setNuclideInfoList(moreThanAvg);
if (CollUtil.isNotEmpty(moreThanAvg)) if (CollUtil.isNotEmpty(moreThanAvg))
logInfo.setNuclideInfoList(moreThanAvg); logInfo.setNuclideInfoList(moreThanAvg);
logService.saveLog(logInfo); logService.saveLog(logInfo);

View File

@ -214,12 +214,12 @@ public class CalculateConcServiceImpl implements CalculateConcService {
sum += Double.valueOf(dto.getConc()); sum += Double.valueOf(dto.getConc());
} }
BigDecimal avg = index.multiply(new BigDecimal(sum / values.size())); BigDecimal avg = index.multiply(new BigDecimal(sum / values.size()));
result.put(nuclide, String.valueOf(avg.setScale(5, RoundingMode.HALF_UP).doubleValue()));
result.put(nuclide, String.valueOf(avg.doubleValue()));
} }
return result; return result;
} }
private List<ConcDto> concDto(List<ConcDtoXe> concDtoXes){ private List<ConcDto> concDto(List<ConcDtoXe> concDtoXes){
List<ConcDto> concDtos = new ArrayList<>(); List<ConcDto> concDtos = new ArrayList<>();
if (CollUtil.isEmpty(concDtoXes)) return concDtos; if (CollUtil.isEmpty(concDtoXes)) return concDtos;