Pu Zhibing
2025-03-31 db2d7720496c66c2007e7e3a0be88dbff81148ad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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
 * @since 2024-08-08
 */
@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(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);
    }
    
}