云
5 天以前 1d9cfc91e7255b9e139b20ff230cb19246f19193
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/finance/ErpFinanceReceiptServiceImpl.java
@@ -31,7 +31,7 @@
/**
 * ERP 收款单 Service 实现类
 *
 * @author 芋道源码
 * @author 超级管理员
 */
@Service
@Validated
@@ -73,10 +73,8 @@
            adminUserApi.validateUser(createReqVO.getFinanceUserId());
        }
        // 1.5 生成收款单号,并校验唯一性
        String no = noRedisDAO.generate(ErpNoRedisDAO.FINANCE_RECEIPT_NO_PREFIX);
        if (financeReceiptMapper.selectByNo(no) != null) {
            throw exception(FINANCE_RECEIPT_NO_EXISTS);
        }
        String no = noRedisDAO.generate(ErpNoRedisDAO.FINANCE_RECEIPT_NO_PREFIX,
                candidate -> financeReceiptMapper.selectByNo(candidate) != null);
        // 2.1 插入收款单
        ErpFinanceReceiptDO receipt = BeanUtils.toBean(createReqVO, ErpFinanceReceiptDO.class, in -> in
@@ -125,11 +123,7 @@
        // 2.2 更新收款单项
        updateFinanceReceiptItemList(updateReqVO.getId(), receiptItems);
        // 2.3 更新附件
        if (updateReqVO.getBlobIds() != null) {
            storageAttachmentApi.deleteAttachmentsByRecord("erp_finance_receipt", updateReqVO.getId());
            storageAttachmentApi.bindAttachments("file", "erp_finance_receipt",
                    updateReqVO.getId(), updateReqVO.getBlobIds());
        }
        storageAttachmentApi.updateAttachments("file", "erp_finance_receipt", updateReqVO.getId(), updateReqVO.getBlobIds());
    }
    private void calculateTotalPrice(ErpFinanceReceiptDO receipt, List<ErpFinanceReceiptItemDO> receiptItems) {