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;
|
@Resource
|
private VipSettingService vipSettingService;
|
|
|
|
|
/**
|
* 每隔一分钟去处理的定时任务
|
*/
|
@Scheduled(fixedRate = 1000 * 60)
|
public void sendVipCoupon(){
|
//解绑推广人
|
appUserService.unbindThePromoter();
|
}
|
|
/**
|
* 每天的凌晨执行的任务
|
*/
|
@Scheduled(cron = "0 0 0 * * *")
|
public void taskDay(){
|
try {
|
|
|
vipSettingService.downUsers();
|
}catch (Exception e){
|
e.printStackTrace();
|
}
|
}
|
|
|
|
}
|