puzhibing
2023-05-18 26173f341341e360dd55e2739be4686070e7ed9d
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/TaskUtil.java
@@ -1,6 +1,9 @@
package com.supersavedriving.driver.modular.system.util;
import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService;
import com.supersavedriving.driver.modular.system.service.IDriverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -10,6 +13,12 @@
 */
@Component
public class TaskUtil {
    @Autowired
    private IDriverService driverService;
    @Autowired
    private IAccountChangeDetailService accountChangeDetailService;
@@ -27,28 +36,42 @@
    }
//    /**
//     * 每天的凌晨执行的任务
//     */
//    @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();
        }
    }
}