From 28c2db9d5ede90b0670446344084eb6169b6c65e Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期二, 24 十二月 2024 14:08:50 +0800 Subject: [PATCH] 日志 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemNormalHandlerImpl.java | 27 ++++++++++----------------- 1 files changed, 10 insertions(+), 17 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemNormalHandlerImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemNormalHandlerImpl.java index d32884b..6d5a0bb 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemNormalHandlerImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemNormalHandlerImpl.java @@ -1,9 +1,9 @@ package com.iailab.module.model.mdk.predict.impl; -import com.iailab.framework.common.util.collection.CollectionUtils; +import com.iailab.module.model.common.exception.ModelResultErrorException; import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; +import com.iailab.module.model.mcs.pre.enums.ItemRunStatusEnum; import com.iailab.module.model.mcs.pre.service.MmPredictModelService; -import com.iailab.module.model.mdk.common.enums.ItemPredictStatus; import com.iailab.module.model.mdk.common.exceptions.ItemInvokeException; import com.iailab.module.model.mdk.common.exceptions.ModelInvokeException; import com.iailab.module.model.mdk.predict.PredictItemHandler; @@ -13,12 +13,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.sql.Timestamp; import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Calendar; import java.util.Date; -import java.util.List; +import java.util.Map; /** * @author PanZhibao @@ -43,27 +40,23 @@ * @throws ItemInvokeException */ @Override - public PredictResultVO predict(Date predictTime, ItemVO predictItemDto) - throws ItemInvokeException{ + public PredictResultVO predict(Date predictTime, ItemVO predictItemDto, Map<String, double[]> predictValueMap) throws ItemInvokeException,ModelResultErrorException { PredictResultVO predictResult = new PredictResultVO(); String itemId = predictItemDto.getId(); - predictResult.setPredictId(itemId); try { - // 获取预测项模型 - List<MmPredictModelEntity> predictModelList = mmPredictModelService.getActiveModelByItemId(itemId); - if (CollectionUtils.isAnyEmpty(predictModelList)) { + MmPredictModelEntity predictModel = mmPredictModelService.getActiveModelByItemId(itemId); + if (predictModel == null) { throw new ModelInvokeException(MessageFormat.format("{0},itemId={1}", ModelInvokeException.errorGetModelEntity, itemId)); } - MmPredictModelEntity predictModel = predictModelList.get(0); - predictResult = predictModelHandler.predictByModel(predictTime, predictModel); + predictResult = predictModelHandler.predictByModel(predictTime, predictModel,predictItemDto.getItemName(),predictItemDto.getItemNo()); + predictResult.setPredictId(itemId); + } catch (ModelResultErrorException ex) { + throw ex; } catch (Exception ex) { - ex.printStackTrace(); - //预测项预测失败的状态 throw new ItemInvokeException(MessageFormat.format("{0},itemId={1}", ItemInvokeException.errorItemFailed, itemId)); } - return predictResult; } } \ No newline at end of file -- Gitblit v1.9.3