刘帅
2026-09-21 3f45e8fdfa31d7b764d60a7c0cb5dd11944ed418
cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
@@ -1481,6 +1481,10 @@
    @Override
    @Transactional
    public synchronized ResultUtil productRedemptionOperation(Integer userIdFormRedis, GoodsExchangeVo exchangeType) {
        // 兼容前端历史参数 chooseCouponId,内部统一使用 couponId。
        if (exchangeType.getCouponId() == null && exchangeType.getChooseCouponId() != null) {
            exchangeType.setCouponId(exchangeType.getChooseCouponId());
        }
        ReturnModel returnModel = new ReturnModel();
        Long returnId = null;
        //如果是兑换优惠卷
@@ -1607,9 +1611,10 @@
                            .divide(BigDecimal.valueOf(exchangeType.getNums() == null ? 1 : exchangeType.getNums()), 2, java.math.RoundingMode.HALF_UP);
                } else if (Integer.valueOf(2).equals(coupon.getType())) {
                    BigDecimal deduction = rule.getBigDecimal("conditionalAmount");
                    if (deduction == null || orderCash.compareTo(deduction) < 0) {
                    if (deduction == null || deduction.compareTo(BigDecimal.ZERO) <= 0) {
                        return ResultUtil.error("该优惠券无法使用");
                    }
                    // 代金券可覆盖全部订单金额,超出订单金额的部分不找零。
                    ticketPayableCashAmount = orderCash.subtract(deduction).max(BigDecimal.ZERO);
                    cashAmount = ticketPayableCashAmount
                            .divide(BigDecimal.valueOf(exchangeType.getNums() == null ? 1 : exchangeType.getNums()), 2, java.math.RoundingMode.HALF_UP);