维修管理优化 逻辑处理优化
This commit is contained in:
parent
8925b54d9c
commit
7b782583d4
|
|
@ -103,7 +103,9 @@ public class RepairServiceImpl implements RepairService {
|
|||
resultMap.computeIfAbsent(item.getTypeNameId(), origin -> item).getRepairDeviceList().add(repairDeviceVO);
|
||||
|
||||
resultMap.computeIfPresent(item.getTypeNameId(), (origin, novel) -> {
|
||||
novel.setTotalCost(novel.getTotalCost().add(Optional.ofNullable(item.getTotalCost()).orElse(BigDecimal.ZERO)));
|
||||
novel.setTotalCost(Optional.ofNullable(novel.getTotalCost()).orElse(BigDecimal.ZERO)
|
||||
.add(Optional.ofNullable(item.getTotalCost()).orElse(BigDecimal.ZERO))
|
||||
);
|
||||
return novel;
|
||||
});
|
||||
});
|
||||
|
|
@ -158,9 +160,9 @@ public class RepairServiceImpl implements RepairService {
|
|||
}, ConcurrentHashMap::new)
|
||||
);
|
||||
List<RepairPart> list = new ArrayList<>(map.values());
|
||||
list.forEach(item -> {
|
||||
item.setPartCost(Optional.ofNullable(item.getPartPrice()).orElse(BigDecimal.ZERO).multiply(new BigDecimal(item.getPartNum())));
|
||||
});
|
||||
list.forEach(item -> item.setPartCost(Optional.ofNullable(item.getPartPrice()).orElse(BigDecimal.ZERO)
|
||||
.multiply(new BigDecimal(Optional.ofNullable(item.getPartNum()).orElse(0))))
|
||||
);
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("Error merging parts" + e.getMessage());
|
||||
|
|
|
|||
Loading…
Reference in New Issue