刘帅
2026-09-29 dcb96821f905f3fd93c059d8703517bdcac4d336
cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java
@@ -1279,6 +1279,12 @@
            }
        }
        if (request.getRank() == null && goods.size() > 0) {
            goods = goods.stream()
                    .sorted(Comparator.comparing(Goods::getGoodId, Comparator.reverseOrder()))
                    .collect(Collectors.toList());
        }
        //当前第几页
        int pageNo = request.getPageNum();
        //一页五条
@@ -1481,6 +1487,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 +1617,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);