|
|
|
@ -57,8 +57,8 @@ public class BatchScoreCalculator { |
|
|
|
for (SampleValue vo : indexValueVOs) { |
|
|
|
String sampleId = vo.getSampleId(); |
|
|
|
//归一后的值
|
|
|
|
BigDecimal normalizeValue = getFinalSampleValue(vo.getSampleValue(), threshold); |
|
|
|
BigDecimal score = scoreCalculator.normalize(normalizeValue, weight).setScale(6, RoundingMode.HALF_UP); |
|
|
|
BigDecimal normalizeValue = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold)); |
|
|
|
BigDecimal score = normalizeValue.multiply(weight).setScale(6, RoundingMode.HALF_UP); |
|
|
|
CalculateResult result = scoreCountOfSamples.get(sampleId); |
|
|
|
|
|
|
|
if (result == null) { |
|
|
|
@ -78,40 +78,6 @@ public class BatchScoreCalculator { |
|
|
|
return scoreCountOfSamples; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 执行计算,以样本的所有指标总得分 |
|
|
|
* |
|
|
|
* @param indexInputVOS |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public HashMap<String, BigDecimal> getScoreCountOfSampleId(List<IndexInputVO> indexInputVOS) { |
|
|
|
|
|
|
|
// 每个样本的总得分
|
|
|
|
HashMap<String, BigDecimal> scoreCountOfSamples = new HashMap<>(); |
|
|
|
|
|
|
|
for (IndexInputVO idx : indexInputVOS) { |
|
|
|
// 每个指标循环一次
|
|
|
|
List<SampleValue> indexValueVOs = idx.getIndexValueVOs(); |
|
|
|
BigDecimal weight = idx.getWeight(); |
|
|
|
ScoreCalculator scoreCalculator = idx.getScoreCalculator(); |
|
|
|
BigDecimal threshold = idx.getThreshold(); |
|
|
|
|
|
|
|
for (SampleValue vo : indexValueVOs) { |
|
|
|
String sampleId = vo.getSampleId(); |
|
|
|
BigDecimal score = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold), weight); |
|
|
|
if (scoreCountOfSamples.containsKey(sampleId)) { |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return scoreCountOfSamples; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取最终样本值 |
|
|
|
* |
|
|
|
@ -128,5 +94,4 @@ public class BatchScoreCalculator { |
|
|
|
return (bdRealValue.compareTo(threshold) < 0) || (bdRealValue.equals(threshold)) |
|
|
|
? bdRealValue |
|
|
|
: threshold; |
|
|
|
} |
|
|
|
} |
|
|
|
|