| | |
| | | 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; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | |
| | | @Autowired |
| | | private PredictResultHandler predictResultHandler; |
| | | |
| | | @Autowired |
| | | private ScheduleModelHandler scheduleModelHandler; |
| | | |
| | | /** |
| | | * 按模块预测 |
| | | * |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CommonResult<MdkPredictModuleRespDTO> predictModule(MdkPredictReqDTO reqDTO) { |
| | | public MdkPredictModuleRespDTO predictModule(MdkPredictReqDTO reqDTO) { |
| | | MdkPredictModuleRespDTO resp = new MdkPredictModuleRespDTO(); |
| | | Map<String, MdkPredictItemRespDTO> predictItemRespMap = new HashMap<>(); |
| | | try { |
| | |
| | | } |
| | | log.info("预测计算结束: " + System.currentTimeMillis()); |
| | | } catch (Exception ex) { |
| | | return error(999, ex.getMessage()); |
| | | ex.printStackTrace(); |
| | | return resp; |
| | | } |
| | | resp.setPredictItemRespMap(predictItemRespMap); |
| | | return success(resp); |
| | | return resp; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CommonResult<MdkPredictItemRespDTO> predictItem(@Valid @RequestBody MdkPredictReqDTO reqDTO) { |
| | | public MdkPredictItemRespDTO predictItem(MdkPredictReqDTO reqDTO) { |
| | | MdkPredictItemRespDTO resp = new MdkPredictItemRespDTO(); |
| | | |
| | | try { |
| | |
| | | log.info("预测计算结束: " + System.currentTimeMillis()); |
| | | } catch (Exception ex) { |
| | | log.info("预测计算异常: " + System.currentTimeMillis()); |
| | | ex.printStackTrace(); |
| | | return resp; |
| | | } |
| | | |
| | | return success(resp); |
| | | return resp; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CommonResult<Boolean> predictAutoAdjust(@Valid @RequestBody MdkPredictReqDTO reqDTO) { |
| | | public Boolean predictAutoAdjust(MdkPredictReqDTO reqDTO) { |
| | | |
| | | |
| | | return success(true); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CommonResult<MdkScheduleRespDTO> doSchedule(@Valid @RequestBody MdkScheduleReqDTO reqDTO) { |
| | | public MdkScheduleRespDTO doSchedule(MdkScheduleReqDTO reqDTO) { |
| | | MdkScheduleRespDTO resp = new MdkScheduleRespDTO(); |
| | | |
| | | return success(resp); |
| | | 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 resp; |
| | | } |
| | | return resp; |
| | | } |
| | | } |