Pu Zhibing
5 天以前 ffe705d1fe2c4fa60d457f94b3e2be0cfeaf24c0
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
package com.stylefeng.guns.modular.system.util;
 
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.modular.system.model.TDriver;
import com.stylefeng.guns.modular.system.service.ITDriverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import java.util.List;
 
 
/**
 * 定时任务工具类
 */
@Component
public class TaskUtil {
 
    @Autowired
    private PushMinistryOfTransportUtil pushMinistryOfTransportUtil;
 
    @Value("${pushMinistryOfTransport}")
    private boolean pushMinistryOfTransport;
 
    @Autowired
    private ITDriverService driverService;
    
    
    /**
     * 每月第一天的1点执行的任务
     */
    @Scheduled(cron = "0 0 1 1 * *")
    public void taskMonth(){
        try {
            if(pushMinistryOfTransport){
                List<TDriver> tDrivers = driverService.selectList(new EntityWrapper<TDriver>().eq("authState", 2).ne("flag", 3));
                for(TDriver driver : tDrivers){
                    pushMinistryOfTransportUtil.baseInfoDriverStat(driver.getId());
                }
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}