package org.linlinjava.jz.hm.job;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.linlinjava.jz.service.HmEmployClockService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 定时修改打卡状态job
 * 每天凌晨12:00 将昨日未打卡状态更新成缺勤状态
 *
 * @author fuxubing
 */
@Component
public class HmEmployClockJob {
    private final Log logger = LogFactory.getLog(HmEmployClockJob.class);
    @Resource
    private HmEmployClockService hmEmployClockService;

    @Scheduled(cron = "0 0 0 * * ?")
    public void updateClock() {
        logger.info("系统开始更新打卡状态");
        //工作日缺勤
        hmEmployClockService.updateAbsentOfWork();
        //休息日打了上班卡未打下班卡视为缺勤
        hmEmployClockService.updateAbsentOfRest();
    }
}
