package com.agentdriving.driver.modular.system.util;
|
|
|
import com.agentdriving.driver.modular.system.service.IAccountChangeDetailService;
|
import com.agentdriving.driver.modular.system.service.IDriverService;
|
import com.agentdriving.driver.modular.system.service.IOrderService;
|
import com.agentdriving.driver.modular.system.service.IYouTuiDriverService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
|
|
/**
|
* 定时任务工具类
|
*/
|
@Component
|
public class TaskUtil {
|
|
@Autowired
|
private IDriverService driverService;
|
|
@Autowired
|
private IAccountChangeDetailService accountChangeDetailService;
|
|
@Autowired
|
private IOrderService orderService;
|
|
@Autowired
|
private IYouTuiDriverService youTuiDriverService;
|
|
|
|
|
/**
|
* 每隔一分钟去处理的定时任务
|
*/
|
@Scheduled(fixedRate = 1000 * 60)
|
public void taskMinute(){
|
try {
|
orderService.completeCollection();
|
youTuiDriverService.editState();
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
}
|
|
|
/**
|
* 每天的凌晨执行的任务
|
*/
|
@Scheduled(cron = "0 0 0 * * *")
|
public void taskDay(){
|
try {
|
|
}catch (Exception e){
|
e.printStackTrace();
|
}
|
}
|
|
|
|
/**
|
* 每月1日凌晨执行的任务
|
*/
|
@Scheduled(cron = "0 0 0 1 * *")
|
public void taskMonth1(){
|
try {
|
driverService.emptyIntegral();
|
}catch (Exception e){
|
e.printStackTrace();
|
}
|
}
|
|
|
/**
|
* 每月16日凌晨执行的任务
|
*/
|
@Scheduled(cron = "0 0 0 16 * *")
|
public void taskMonth16(){
|
try {
|
driverService.emptyIntegral();
|
}catch (Exception e){
|
e.printStackTrace();
|
}
|
}
|
}
|