| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | 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.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 |
| | |
| | | */ |
| | | @Service |
| | | public class TAppUserVipDetailServiceImpl extends ServiceImpl<TAppUserVipDetailMapper, TAppUserVipDetail> implements TAppUserVipDetailService { |
| | | |
| | | @Override |
| | | public void giveVipCoupun(Long appUserId, Integer vipId) { |
| | | //给这个用户发放对应vip的优惠卷以及充电次数加满 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | @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); |
| | | } |
| | | |
| | | } |