package com.iailab.module.job.task; import com.iailab.module.mcs.dto.StModelDTO; import com.iailab.module.mcs.service.StModelService; import com.iailab.module.model.handler.ModelHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.annotation.Resource; import org.springframework.stereotype.Component; import java.util.Calendar; /** * 仓储可靠性分析 * 每天08:00运行 * 0 0 8 * * ? * * @author PanZhibao * @Description * @createTime 2024年06月02日 */ @Component("modelStorageReliabilityTask") public class ModelStorageReliabilityTask implements ITask { private Logger logger = LoggerFactory.getLogger(getClass()); private final String MODEL_CODE = "storage_reliability"; @Resource private StModelService stModelService; @Resource private ModelHandler modelHandler; @Override public void run(String params) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MILLISECOND, 0); calendar.set(Calendar.SECOND, 0); try { StModelDTO stModel = stModelService.getByCode(MODEL_CODE); logger.info("运行模型:" + MODEL_CODE); modelHandler.run(stModel.getModelCode(), calendar.getTime()); } catch (Exception ex) { logger.info("运行模型异常"); ex.printStackTrace(); } } }