package com.tax.sign.job;


import com.tax.sign.service.api.SignDateInfoService;
import com.yxcheng.token.common.cache.distributelock.ScheduledControll;
import com.yxcheng.token.constants.RedisContants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class SynDateInfoJob {
    private static final Logger logger = LoggerFactory.getLogger(SynDateInfoJob.class);

    @Autowired
    private SignDateInfoService signDateInfoService;


    @Autowired
    private ScheduledControll scheduledControll;

    @Scheduled(cron = "${service.sync.SynDateInfoJob}")
    public void doJob() {

        if(!scheduledControll.getScheduledLock(RedisContants.SYNC_DATE_INFO_LOCK,RedisContants.SYNC_DATE_INFO_SCHEDULED_EXPIRE)){
            logger.info("SynDateInfoJob，不执行");
            return;
        }

        logger.info("SynDateInfoJob，开始执行任务");

        signDateInfoService.synDateInfo();

        logger.info("SynDateInfoJob，执行结束");

    }
}
