From a9413f69dd00ae9285bb6bd4d00855ad274a6552 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 16 七月 2025 19:25:18 +0800 Subject: [PATCH] 修改bug --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java | 79 ++++++++++++++++----------------------- 1 files changed, 33 insertions(+), 46 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java index b5907d9..ca490ed 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java @@ -22,7 +22,7 @@ /** * <p> - * 服务实现类 + * 服务实现类 * </p> * * @author luodangjia @@ -30,49 +30,36 @@ */ @Service public class TAppUserVipDetailServiceImpl extends ServiceImpl<TAppUserVipDetailMapper, TAppUserVipDetail> implements TAppUserVipDetailService { - @Resource - private VipClient vipClient; - @Resource - private OtherClient otherClient; - @Resource - private TAppCouponService appCouponService; - @Resource - private TAppUserVipDetailService tAppUserVipDetailService; - - - - @Override - public void giveVipCoupun(Long appUserId, Integer vipId,Long recordId,Integer monthNum) { - //如果不包含,则更新sendNum,并且赠送优惠卷 - TAppUserVipDetail byId = tAppUserVipDetailService.getById(recordId); - if (byId.getStartTime().plusMonths(byId.getSendMonth()).toLocalDate().compareTo(LocalDate.now())==0&&LocalDate.now().isBefore(byId.getEndTime().toLocalDate())){ - byId.setSendMonth(byId.getSendMonth()+1); - //给这个用户发放对应vip的优惠卷以及充电次数加满 - List<SendCouponDto> javaList = JSON.parseArray(byId.getCouponIds()).toJavaList(SendCouponDto.class); - 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(appUserId); - tAppCoupon.setCouponId(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)); - appCouponService.save(tAppCoupon); - } - } - - } - byId.setChargeNum(byId.getSendChargeNum()); - tAppUserVipDetailService.updateById(byId); - } - + @Resource + private VipClient vipClient; + @Resource + private OtherClient otherClient; + @Resource + private TAppCouponService appCouponService; + @Resource + private TAppUserVipDetailService tAppUserVipDetailService; + + + @Override + public void giveVipCoupun(TAppUserVipDetail recentDetail) { + Integer vipType = recentDetail.getVipType(); + Integer sendMonth = recentDetail.getSendMonth(); + //月卡 + if(1 == vipType && 1 == sendMonth){ + return; + } + //季卡 + if(2 == vipType && 3 == sendMonth){ + return; + } + //年卡 + if(3 == vipType && 12 == sendMonth){ + return; + } + recentDetail.setSendMonth(sendMonth + 1); + recentDetail.setChargeNum(recentDetail.getSendChargeNum()); + recentDetail.setMonthEndTime(LocalDateTime.now().plusMonths(1)); + tAppUserVipDetailService.updateById(recentDetail); + } + } -- Gitblit v1.7.1