package com.friday.custody.quartz;

import com.friday.custody.service.logicService.LogicInternalService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.quartz.QuartzJobBean;

@Slf4j
@DisallowConcurrentExecution
public class UpdateData1hJob extends QuartzJobBean {
    @Value("${custody.quartz.updateData1h.switch}")
    private Boolean updateData1hSwitch;
    @Autowired
    private LogicInternalService logicInternalService;
    @Override
    protected void executeInternal(JobExecutionContext context) {
        if (!updateData1hSwitch) {
            log.warn("每一小时更新数据开关:未开启!");
            return;
        }
        log.info("UpdateData1hJob开始执行");
        logicInternalService.updateData1h();
    }
}
