package com.zjrs.ggfw.rlzysc.bpo.schedule.task;

import com.zjrs.ggfw.rlzysc.bpo.schedule.ScheduledOfTask;
import com.zjrs.ggfw.rlzysc.bpo.schedule.execute.ZjsjsbTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

@Service
public class ZjsjsbScheduleTask implements ScheduledOfTask {
    private static final Logger LOG = LoggerFactory.getLogger(ZjsjsbScheduleTask.class);
    @Autowired
    private ZjsjsbTask task;

    @Value("${zjrs.taskSwitch:true}")
    private String zjrs_taskSwitch;

    @Override
    public void execute(String cronid) {
        LOG.info("ZjsjsbScheduleTask...............配置文件执行开关zjrs_taskSwitch=====>" + zjrs_taskSwitch);
        if ("true".equals(zjrs_taskSwitch)){
            LOG.info("ZjsjsbScheduleTask...............开始执行时间=====>" + LocalDateTime.now());
            task.excute(cronid);
            LOG.info("ZjsjsbScheduleTask...............结束执行时间=====>" + LocalDateTime.now());
        }
    }

}

