云
6 天以前 1d9cfc91e7255b9e139b20ff230cb19246f19193
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/finance/ErpFinancePaymentServiceImpl.java
@@ -105,10 +105,8 @@
                getSumValue(paymentItems, ErpFinancePaymentItemDO::getPaymentPrice, BigDecimal::add, BigDecimal.ZERO)
                        .subtract(createReqVO.getDiscountPrice()), null);
        // 1.7 生成付款单号,并校验唯一性
        String no = noRedisDAO.generate(ErpNoRedisDAO.FINANCE_PAYMENT_NO_PREFIX);
        if (financePaymentMapper.selectByNo(no) != null) {
            throw exception(FINANCE_PAYMENT_NO_EXISTS);
        }
        String no = noRedisDAO.generate(ErpNoRedisDAO.FINANCE_PAYMENT_NO_PREFIX,
                candidate -> financePaymentMapper.selectByNo(candidate) != null);
        // 2.1 插入付款单
        ErpFinancePaymentDO payment = BeanUtils.toBean(createReqVO, ErpFinancePaymentDO.class, in -> in
@@ -433,10 +431,8 @@
        }
        // 2.1 生成付款单号
        String no = noRedisDAO.generate(ErpNoRedisDAO.FINANCE_PAYMENT_NO_PREFIX);
        if (financePaymentMapper.selectByNo(no) != null) {
            throw exception(FINANCE_PAYMENT_NO_EXISTS);
        }
        String no = noRedisDAO.generate(ErpNoRedisDAO.FINANCE_PAYMENT_NO_PREFIX,
                candidate -> financePaymentMapper.selectByNo(candidate) != null);
        // 2.2 金额按负数入账
        BigDecimal negativeAmount = reqDTO.getRefundAmount().negate();
        ErpFinancePaymentDO payment = new ErpFinancePaymentDO()