package com.jiayue.insu.incloud.job.permission;

import com.jiayue.insu.incloud.compermisson.BJZYYJYSDComPermisson;
import com.jiayue.insu.incloud.entity.Station;
import com.jiayue.insu.incloud.service.StationService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 北京中央研究院（山东）通讯token Job
 *
 * @Author: tl
 * @Date: 2023/12/14 9:56
 */
@Slf4j
public class BJZYYJYPSDermissonJob implements Job {
    @Autowired
    private BJZYYJYSDComPermisson bJZYYJYComPermisson;
    @Autowired
    private StationService stationService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        String code = jobExecutionContext.getTrigger().getJobKey().getName();
        // 校验并获取场站信息
        Station station = stationService.checkAndFindStation(code,null);
        if (station == null) {
            log.error("========== 一体化定时任务异常:  场站不存在  {}==========",code);
        }
        bJZYYJYComPermisson.generateKey(station);
    }
}
