Pu Zhibing
2025-06-19 98b09eae533537dc9a5277aa6374bd7d35cfe5c4
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TAppUserVipDetailServiceImpl.java
@@ -3,22 +3,26 @@
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.dto.SendCouponDto;
import com.ruoyi.account.api.model.TAppCoupon;
import com.ruoyi.account.api.model.TAppUserVipDetail;
import com.ruoyi.account.mapper.TAppUserVipDetailMapper;
import com.ruoyi.account.service.TAppCouponService;
import com.ruoyi.account.service.TAppUserVipDetailService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.other.api.domain.TVip;
import com.ruoyi.other.api.domain.TCoupon;
import com.ruoyi.other.api.feignClient.OtherClient;
import com.ruoyi.other.api.feignClient.VipClient;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
 * <p>
 *  服务实现类
 * 服务实现类
 * </p>
 *
 * @author luodangjia
@@ -26,22 +30,36 @@
 */
@Service
public class TAppUserVipDetailServiceImpl extends ServiceImpl<TAppUserVipDetailMapper, TAppUserVipDetail> implements TAppUserVipDetailService {
    @Resource
    private VipClient vipClient;
    @Override
    public void giveVipCoupun(Long appUserId, Integer vipId) {
        //给这个用户发放对应vip的优惠卷以及充电次数加满 ,重置抵扣金额
        R<TVip> info = vipClient.getInfo(vipId);
        TVip data = info.getData();
        String coupon = data.getCoupon();
        if (coupon!=null) {
            List<SendCouponDto> sendList = JSON.parseArray(coupon).toJavaList(SendCouponDto.class);
            for (SendCouponDto sendCouponDto : sendList) {
            }
        }
    }
   @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);
   }
}