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.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.quartz.QuartzJobBean;

@Slf4j
@DisallowConcurrentExecution
public class UpdateData20minJob extends QuartzJobBean {
    @Value("${custody.quartz.updateData20min.switch}")
    private Boolean updateData20minSwitch;
    @Autowired
    private LogicInternalService logicInternalService;
    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        if (!updateData20minSwitch) {
            log.warn("每20min更新数据开关:未开启!");
            return;
        }
        logicInternalService.updateData20min();
    }
}
