刘帅
2026-09-20 8a85fc834d98b2c14c5b886a957ccf3197aad293
cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
@@ -827,8 +827,8 @@
        if (couponId != null && couponId != 0) {
            if (null != couponId && reservationSite.getPayType() != 3) {
                UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(reservationSite.getCouponId(), uid));
                if (userCoupon != null && userCoupon.getStatus() == 2) {
                    return ResultUtil.error("优惠券已被核销");
                if (userCoupon == null || userCoupon.getStatus() == null || userCoupon.getStatus() != 1) {
                    return ResultUtil.error("优惠券不可用");
                }
                Coupon coupon = couponClient.queryCouponById(userCoupon.getCouponId());
                long time = coupon.getEndTime().getTime();
@@ -843,7 +843,7 @@
                        return ResultUtil.error("该优惠券无法使用");
                    }
                    money = money.subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN);
                    money = money.subtract(new BigDecimal(num2)).max(BigDecimal.ZERO).setScale(2, RoundingMode.HALF_EVEN);
                }
                if (userCoupon != null && coupon.getType() == 2) {//代金券
                    JSONObject jsonObject = JSON.parseObject(coupon.getContent());
@@ -851,7 +851,7 @@
                    if (money.compareTo(new BigDecimal(num1)) <= 0) {
                        return ResultUtil.error("该优惠券无法使用");
                    }
                    money = money.subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN);
                    money = money.subtract(new BigDecimal(num1)).max(BigDecimal.ZERO).setScale(2, RoundingMode.HALF_EVEN);
                }
                userCoupon.setStatus(2);
                userCouponClient.updateUserCoupon(userCoupon);