yubo
2025-09-24 35cfaa7259f3d494e7bd03aec5c7e035049ee19b
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/task/ScheduledTask.java
@@ -3,11 +3,9 @@
import cc.mrbird.febs.server.hr.service.IEmpBaseInfoService;
import cc.mrbird.febs.server.hr.service.IEmpContractInfoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.CommandLineRunner;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -32,14 +30,14 @@
    /**
     *
     * 每天凌晨1点计算一次工龄
     *
     * <p>
     * date 2021-04-27 20:44
     * @author: luoyibo
     * @return void
     */
    @Scheduled(cron = "0 0 1 * * ?")
    public void calculateSeniority(){
        log.info("每天凌晨1点计算一次工龄");
        log.info("每天凌晨1点计算工龄");
        empBaseInfoService.updateSeniority();
    }
@@ -52,18 +50,22 @@
    public void autoStopContract(){
        log.info("每天凌晨3点检查到期合同");
        empContractInfoService.autoStopContract("32");
        log.info("设置合同间隔的天数");
        empContractInfoService.updateContractRemindDay();
    }
    @Scheduled(cron = "0 0 4 * * ?")
    public void autoCalculateAge(){
        log.info("每天凌晨4点自动更新年龄");
        String userId = "";
        empBaseInfoService.updateEmpAge(userId);
        log.info("每天凌晨4点自动更新年龄和年假");
        empBaseInfoService.updateEmpBaseKeyInfo();
    }
    @Override
    public void run(String... args) throws Exception {
        calculateSeniority();
        autoStopContract();
        autoCalculateAge();
        //empBaseInfoService.updateEmpBaseKeyInfo();
        //calculateSeniority();
//        autoStopContract();
        //autoCalculateAge();
        // updateDeptName();
        //autoStopContract();
    }
}