|
@@ -72,21 +72,16 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
|
|
|
Map<Long, ContractProduct> contractProductMap = contractProductList
|
|
|
.stream()
|
|
|
- .peek(item -> {
|
|
|
- if (item.getId() == null) {
|
|
|
- throw new ServiceException("合同产品id不能为空");
|
|
|
- }
|
|
|
- })
|
|
|
+ .filter(item -> ObjectUtil.isNotEmpty(item.getId()))
|
|
|
.collect(Collectors.toMap(BaseIdPo::getId, Function.identity()));
|
|
|
|
|
|
|
|
|
for (ContractProduct item : list) {
|
|
|
ContractProduct contractProduct = contractProductMap.get(item.getId());
|
|
|
- if (contractProduct == null) {
|
|
|
- throw new ServiceException("产品id为" + item.getId() + "未上传");
|
|
|
+ if (ObjectUtil.isNotEmpty(contractProduct)) {
|
|
|
+ BigDecimal expendQuantity = item.getExpendQuantity().subtract(item.getQuantity().subtract(contractProduct.getQuantity()));
|
|
|
+ contractProduct.setExpendQuantity(expendQuantity);
|
|
|
}
|
|
|
- BigDecimal expendQuantity = item.getExpendQuantity().subtract(item.getQuantity().subtract(contractProduct.getQuantity()));
|
|
|
- contractProduct.setExpendQuantity(expendQuantity);
|
|
|
}
|
|
|
|
|
|
}
|