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;

/**
 * 每月1号和15号更新一次DataDicZxFndBasicInfoCy数据
 */
@Slf4j
@DisallowConcurrentExecution
public class UpdateDataDicZxFndBasicInfoCyJob extends QuartzJobBean {
    @Value("${custody.quartz.updateDataDicZxFndBasicInfoCyByScheduled.switch}")
    private Boolean updateDataDicZxFndBasicInfoCySwitch;
    @Autowired
    private LogicInternalService logicInternalService;
    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        if (!updateDataDicZxFndBasicInfoCySwitch) {
            log.warn("每15天更新数据开关:未开启!");
            return;
        }
        logicInternalService.updateDataDicZxFndBasicInfoCy();
    }
}
