|
|
@ -3,6 +3,7 @@ package com.epmet.support.normalizing.batch; |
|
|
|
import com.epmet.support.normalizing.ScoreCalculator; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -24,7 +25,7 @@ public class BatchScoreCalculator { |
|
|
|
|
|
|
|
// 循环同一个指标内的多个样本值的SampleValue列表
|
|
|
|
List<SampleScore> scores4OneIndex = indexValueVOs.stream().map(vo -> { |
|
|
|
BigDecimal score = scoreCalculator.normalize(vo.getSampleValue(), weight); |
|
|
|
BigDecimal score = scoreCalculator.normalize(vo.getSampleValue(), weight).setScale(6, RoundingMode.HALF_UP);; |
|
|
|
return new SampleScore(vo.getSampleId(), score); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
@ -52,9 +53,10 @@ public class BatchScoreCalculator { |
|
|
|
String sampleId = vo.getSampleId(); |
|
|
|
BigDecimal score = scoreCalculator.normalize(vo.getSampleValue(), weight); |
|
|
|
if (scoreCountOfSamples.containsKey(sampleId)) { |
|
|
|
BigDecimal newScore = scoreCountOfSamples.get(sampleId).add(score); |
|
|
|
BigDecimal newScore = scoreCountOfSamples.get(sampleId).add(score).setScale(6, RoundingMode.HALF_UP); |
|
|
|
scoreCountOfSamples.put(sampleId, newScore); |
|
|
|
} else { |
|
|
|
score.setScale(6, RoundingMode.HALF_UP); |
|
|
|
scoreCountOfSamples.put(sampleId, score); |
|
|
|
} |
|
|
|
} |
|
|
|