Commit bdc3f78a by lijingjing

计算组合判定合计值修约

parent e3af9db7
...@@ -962,7 +962,7 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI ...@@ -962,7 +962,7 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
// 是否组合判定 // 是否组合判定
boolean isComposeJudgment = null != standard.getComposeJudge() && 1 == standard.getComposeJudge().intValue(); boolean isComposeJudgment = null != standard.getComposeJudge() && 1 == standard.getComposeJudge().intValue();
// 计算合计-组合判定合计值 // 计算合计-组合判定合计值
double totalValue = sampleItemList.stream().filter(t -> StringUtils.isNotBlank(t.getTestValue())).map(t -> { BigDecimal totalDecimal = sampleItemList.stream().filter(t -> StringUtils.isNotBlank(t.getTestValue())).map(t -> {
// 符合此条件,需要判断是否此标准且为稀有元素且值小于0.01即可忽略为0 // 符合此条件,需要判断是否此标准且为稀有元素且值小于0.01即可忽略为0
String testValue = t.getTestValue().trim(); String testValue = t.getTestValue().trim();
RestAssert.fail(!isNumber(testValue), String.format("样品编号【%s】存在错误检测值【%s】", sample.getCode(), testValue)); RestAssert.fail(!isNumber(testValue), String.format("样品编号【%s】存在错误检测值【%s】", sample.getCode(), testValue));
...@@ -970,8 +970,10 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI ...@@ -970,8 +970,10 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
return BigDecimal.ZERO; return BigDecimal.ZERO;
} }
return new BigDecimal(testValue); return new BigDecimal(testValue);
}).reduce(BigDecimal.ZERO, BigDecimal::add).doubleValue(); }).reduce(BigDecimal.ZERO, BigDecimal::add);
// 杂质合计值修约
double totalValue = totalDecimal.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
// 获取检测项目值对象 // 获取检测项目值对象
Map<String, Double> itemDataMap = sampleItemList.stream().collect(Collectors.toMap(EntrustSampleItemVO::getName, t -> Double.parseDouble(t.getTestValue()))); Map<String, Double> itemDataMap = sampleItemList.stream().collect(Collectors.toMap(EntrustSampleItemVO::getName, t -> Double.parseDouble(t.getTestValue())));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment