潘志宝
2024-09-05 054fb90cd08c6e2fcc0df9a95f7247ee5870ca6d
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java
@@ -13,9 +13,11 @@
import com.iailab.module.model.mdk.predict.PredictItemHandler;
import com.iailab.module.model.mdk.predict.PredictModuleHandler;
import com.iailab.module.model.mdk.predict.PredictResultHandler;
import com.iailab.module.model.mdk.schedule.ScheduleModelHandler;
import com.iailab.module.model.mdk.vo.DataValueVO;
import com.iailab.module.model.mdk.vo.ItemVO;
import com.iailab.module.model.mdk.vo.PredictResultVO;
import com.iailab.module.model.mdk.vo.ScheduleResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
@@ -61,6 +63,9 @@
    @Autowired
    private PredictResultHandler predictResultHandler;
    @Autowired
    private ScheduleModelHandler scheduleModelHandler;
    /**
     * 按模块预测
@@ -169,7 +174,17 @@
    @Override
    public CommonResult<MdkScheduleRespDTO> doSchedule(@Valid @RequestBody MdkScheduleReqDTO reqDTO) {
        MdkScheduleRespDTO resp = new MdkScheduleRespDTO();
        resp.setScheduleCode(reqDTO.getScheduleCode());
        resp.setScheduleTime(reqDTO.getScheduleTime());
        try {
            log.info("调度计算开始: " + System.currentTimeMillis());
            ScheduleResultVO scheduleResult = scheduleModelHandler.doSchedule(reqDTO.getModelCode(), reqDTO.getScheduleTime());
            resp.setResult(scheduleResult.getResult());
            log.info("预测计算结束: " + System.currentTimeMillis());
        } catch (Exception ex) {
            log.info("调度计算异常: " + System.currentTimeMillis());
            ex.printStackTrace();
        }
        return success(resp);
    }
}