package com.zy.asrs.task; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.zy.asrs.entity.BasJarMast; import com.zy.asrs.service.BasJarMastService; import com.zy.asrs.task.handler.WrkMastExecuteHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.List; /** * Created by Monkey D. Luffy on 2024.06.27 * 亳州煜星..............以下.............亳州煜星.............硫化罐区域执行任务 */ @Component public class WrkMastExecuteScheduler { private static final Logger log = LoggerFactory.getLogger(WrkMastExecuteScheduler.class); private static final int[][] execute = new int[][]{{1,5},{2,5},{3,5},{4,5},{5,7},{6,7},{7,5},{8,5},{9,4},{10,5},{11,5},{100,100}}; @Autowired private WrkMastExecuteHandler wrkMastExecuteHandler; @Autowired private BasJarMastService basJarMastService; @Scheduled(cron = "0/3 * * * * ? ") private void execute(){ for (int[] excuteNow : execute){ try{ wrkMastExecuteHandler.start(excuteNow); } catch (Exception e){ log.error("硫化罐任务转历史档案失败!!!"); } } } @Scheduled(cron = "0/3 * * * * ? ") private void executeJarMast(){ List basJarMastList = basJarMastService.selectList(new EntityWrapper().eq("status", 17)); for (BasJarMast basJarMast : basJarMastList){ try{ wrkMastExecuteHandler.start2(basJarMast); } catch (Exception e){ log.error("硫化罐任务转历史档案失败!!!"); } } } }