| | |
| | | } |
| | | |
| | | List<Long> stockOutRecordIds = accountSalesCollectionMapper.selectStockOutRecordIdsBySalesLedgerId(salesLedger.getId()); |
| | | if (CollectionUtils.isEmpty(stockOutRecordIds)) { |
| | | throw new ServiceException("该合同暂无可回款的销售出库记录"); |
| | | } |
| | | |
| | | AccountSalesCollection collection = new AccountSalesCollection(); |
| | | collection.setCustomerId(dto.getCustomerId().intValue()); |
| | | collection.setStockOutRecordIds(stockOutRecordIds.stream().map(String::valueOf).collect(Collectors.joining(","))); |
| | | collection.setSalesLedgerId(salesLedger.getId()); |
| | | // 合同未发货时没有出库记录,此时仍允许回款,出库单关联留空 |
| | | collection.setStockOutRecordIds(CollectionUtils.isEmpty(stockOutRecordIds) |
| | | ? null |
| | | : stockOutRecordIds.stream().map(String::valueOf).collect(Collectors.joining(","))); |
| | | collection.setCollectionDate(dto.getPaymentDate()); |
| | | collection.setCollectionAmount(dto.getPaymentAmount()); |
| | | collection.setCollectionMethod(dto.getPaymentMethod()); |