Pu Zhibing
2025-04-22 fd7b8fb7c89832c28a838b0449bbb8a392433ee2
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
package com.ruoyi.account.util;
 
 
import com.ruoyi.account.service.AppUserService;
import com.ruoyi.account.service.VipSettingService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
 
 
/**
 * 定时任务工具类
 */
@Component
public class TaskUtil {
    
    @Resource
    private AppUserService appUserService;
 
    
 
 
    /**
     * 每隔一分钟去处理的定时任务
     */
    @Scheduled(fixedRate = 1000 * 60)
    public void sendVipCoupon(){
        //解绑推广人
        appUserService.unbindThePromoter();
        //关闭充值订单
        appUserService.closeOrder();
    }
 
    /**
     * 每天的凌晨执行的任务
     */
    @Scheduled(cron = "0 0 0 * * *")
    public void taskDay(){
        try {
            //降级检测
            appUserService.demotionDetection();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
 
 
 
}