| | |
| | | if (dto.getPaymentDate() == null) { |
| | | throw new ServiceException("请选择回款日期"); |
| | | } |
| | | if (dto.getPaymentAmount() == null || dto.getPaymentAmount().compareTo(BigDecimal.valueOf(0.01)) < 0) { |
| | | if (dto.getPaymentAmount() == null || dto.getPaymentAmount().compareTo(new BigDecimal("0.000001")) < 0) { |
| | | throw new ServiceException("请输入回款金额"); |
| | | } |
| | | if (StringUtils.isEmpty(dto.getSalesContractNo())) { |
| | |
| | | } |
| | | |
| | | 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()); |