Commit f032ea05 by lijingjing

对对比值添加默认值;

parent 06ecc877
......@@ -56,20 +56,22 @@ public class ItemComparisonServiceImpl extends BaseServiceImpl<ItemComparisonMap
Map<String, String> limitValueMap = materialItemService.listAlLimitItemMap();
Map<String, List<ItemComparison>> slotItemMap = new HashMap<>(16);
itemCompareVOList.forEach(item -> {
item.setLimitValue(limitValueMap.get(item.getSampleName() + item.getName()));
String limitValueStr = limitValueMap.get(item.getSampleName() + item.getName());
if (StringUtils.isBlank(limitValueStr)) {
limitValueStr = Objects.equals(item.getName(), "原铝Fe") ? "0.04" : "0.02";
}
item.setLimitValue(limitValueStr);
item.setReclaim(false);
try {
BigDecimal newVal = new BigDecimal(item.getTestValue());
BigDecimal oldVal = new BigDecimal(item.getPrevTestValue());
BigDecimal difVal = newVal.subtract(oldVal);
item.setDiffValue(difVal.doubleValue());
if (StringUtils.isNotBlank(item.getLimitValue())) {
BigDecimal limitValue = new BigDecimal(item.getLimitValue());
// 差值与限定值相比,大于0需要重取
if (difVal.abs().compareTo(limitValue) > 0) {
item.setReclaim(true);
}
}
} catch (Exception e) {
logger.error("数据转换错误!");
logger.error("data conversion exception---->: {}", e.getMessage());
......
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