| | |
| | | package com.iailab.module.shasteel.job.task; |
| | | |
| | | import com.iailab.module.model.api.mdk.MdkApi; |
| | | import com.iailab.module.model.api.mdk.dto.MdkPredictModuleRespDTO; |
| | | import com.iailab.module.model.api.mdk.dto.MdkPredictReqDTO; |
| | | import com.iailab.module.shasteel.mq.common.constant.RoutingConstant; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | /** |
| | | * 执行模块预测定时任务 |
| | | * |
| | | */ |
| | | @Component("runPredictModuleTask") |
| | | public class RunPredictModuleTask implements ITask { |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | @Autowired |
| | | MdkApi mdkApi; |
| | | private MdkApi mdkApi; |
| | | |
| | | @Autowired |
| | | private RabbitTemplate rabbitTemplate; |
| | | |
| | | @Override |
| | | public void run(String params) { |
| | | logger.info("runPredictModuleTask定时任务正在执行,参数为:{}",params ); |
| | | logger.info("runPredictModuleTask定时任务正在执行,参数为:{}", params); |
| | | try { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.SECOND,0); |
| | | calendar.set(Calendar.MILLISECOND,0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | |
| | | MdkPredictReqDTO dto = new MdkPredictReqDTO(); |
| | | dto.setPredictTime(calendar.getTime()); |
| | | dto.setModuleType(params); |
| | | mdkApi.predictModule(dto); |
| | | logger.info(params + "模块预测完成"); |
| | | |
| | | MdkPredictModuleRespDTO mdkPredictModuleRespDTO = mdkApi.predictModule(dto); |
| | | logger.info(params + "模块预测完成," + mdkPredictModuleRespDTO); |
| | | rabbitTemplate.convertAndSend(RoutingConstant.EXCHANGE, RoutingConstant.Iailab_Model_PredictFinish, mdkPredictModuleRespDTO); |
| | | |
| | | } catch (Exception ex) { |
| | | logger.error("runPredictModuleTask运行异常"); |