package com.hfkj.schedule;

import com.hfkj.channel.gas.newlink.NewLinkGasService;
import com.hfkj.channel.gas.newlink2.NewLink2GasService;
import com.hfkj.channel.gas.shell.CqShellPetroleumGasService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;


/**
 * @className: GasSchedule
 * @author: HuRui
 * @date: 2024/7/15
 **/
@Component
public class GasSchedule {
    @Resource
    private NewLinkGasService newLinkGasService;
    @Resource
    private NewLink2GasService newLink2GasService;
    @Resource
    private CqShellPetroleumGasService cqShellPetroleumGasService;

    @Scheduled(cron = "5 0 0 * * ?")   // 每日凌晨00:00:5执行一次
    public void newLinkGasSchedule() {
        try {
            newLinkGasService.refresh();
        } catch (Exception e) {
            System.out.println("能链【团油】油站获取失败！！！");
        }
    }

    @Scheduled(cron = "5 0 0 * * ?")   // 每日凌晨00:00:5执行一次
    public void newLink2GasSchedule() {
        try {
            newLink2GasService.refresh();
        } catch (Exception e) {
            System.out.println("能链【团油】油站获取失败！！！");
        }
    }

    @Scheduled(cron = "5 0 0 * * ?")   // 每日凌晨00:00:5执行一次
    public void cqGasSchedule() {
        try {
            cqShellPetroleumGasService.refresh();
        } catch (Exception e) {
            System.out.println("加好油【重庆壳牌】油站获取失败！！！");
        }
    }
}
