puzhibing
2026-08-10 a8f0bac0c2f11c5d5d2a9d5510b27c35cce66cc9
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/GiveVipUtil.java
@@ -62,24 +62,22 @@
            for (SendCouponDto sendCouponDto : javaList) {
                Integer number = sendCouponDto.getNumber();
                for (Integer i = 0; i < number; i++) {
                R<TCoupon> couponById = otherClient.getCouponById(sendCouponDto.getId());
                TCoupon coupon = couponById.getData();
                //将该优惠卷添加到用户优惠卷中
                TAppCoupon tAppCoupon = new TAppCoupon();
                tAppCoupon.setAppUserId(nowUser.getId());
                tAppCoupon.setCouponId(Integer.valueOf(sendCouponDto.getId()));
                if (coupon.getValidityPeriodMode() == 1) {
                    tAppCoupon.setEndTime(coupon.getEndTime());
                } else {
                    tAppCoupon.setEndTime(LocalDateTime.now().plusDays(coupon.getDays()));
                }
                tAppCoupon.setWaysToObtain(4);
                tAppCoupon.setStatus(1);
                tAppCoupon.setCouponJson(JSON.toJSONString(coupon));
                    tAppCoupon.setDetailId(tAppUserVipDetail.getId());
                appCouponService.save(tAppCoupon);
                    R<TCoupon> couponById = otherClient.getCouponById(sendCouponDto.getId());
                    TCoupon coupon = couponById.getData();
                    //将该优惠卷添加到用户优惠卷中
                    TAppCoupon tAppCoupon = new TAppCoupon();
                    tAppCoupon.setAppUserId(nowUser.getId());
                    tAppCoupon.setCouponId(Integer.valueOf(sendCouponDto.getId()));
                    if (coupon.getValidityPeriodMode() == 1) {
                        tAppCoupon.setEndTime(coupon.getEndTime());
                    } else {
                        tAppCoupon.setEndTime(LocalDateTime.now().plusDays(coupon.getDays()));
                    }
                    tAppCoupon.setWaysToObtain(4);
                    tAppCoupon.setStatus(1);
                    tAppCoupon.setCouponJson(JSON.toJSONString(coupon));
                        tAppCoupon.setDetailId(tAppUserVipDetail.getId());
                    appCouponService.save(tAppCoupon);
                }
            }
        }else {
@@ -104,4 +102,9 @@
        }
    }
}