package cn.iocoder.yudao.module.rescue.task;


import cn.iocoder.yudao.module.rescue.service.IRescueInfoService;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

@Component("RescueTask")
public class RescueTask{
    //关键代码，设置一个静态上下文属性appcontext
    private static ApplicationContext appcontext;
    public static void setAppcontext(ApplicationContext appcontext) {
        RescueTask.appcontext = appcontext;
    }
    public static ApplicationContext getAppcontext() {
        return appcontext;
    }
    public void rescueOrderTask()
    {
        IRescueInfoService rescueInfoService = appcontext.getBean(IRescueInfoService.class);
        System.out.println("救援定时任务");
        //救援超过五分钟以上的都交给系统处理
        rescueInfoService.dealOverTimeRescue();
    }
}
