puzhibing
2023-06-03 92e00dafd06ec748b51f565c7a4c98986a618de9
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/TaskUtil.java
@@ -1,6 +1,11 @@
package com.supersavedriving.driver.modular.system.util;
import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService;
import com.supersavedriving.driver.modular.system.service.IDriverService;
import com.supersavedriving.driver.modular.system.service.IOrderService;
import com.supersavedriving.driver.modular.system.service.IYouTuiDriverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -11,6 +16,18 @@
@Component
public class TaskUtil {
    @Autowired
    private IDriverService driverService;
    @Autowired
    private IAccountChangeDetailService accountChangeDetailService;
    @Autowired
    private IOrderService orderService;
    @Autowired
    private IYouTuiDriverService youTuiDriverService;
@@ -20,34 +37,50 @@
    @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();
//        }
//    }
    /**
     * 每天的凌晨执行的任务
     */
    @Scheduled(cron = "0 0 0 * * *")
    public void taskDay(){
        try {
            accountChangeDetailService.deductionInsurance();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
//
//    /**
//     * 每月第一天的1点执行的任务
//     */
//    @Scheduled(cron = "0 0 1 1 * *")
//    public void taskMonth(){
//        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();
        }
    }
}