From 4f171763ce5ee065a704e5d08fcbd5a3379dec85 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期三, 13 十一月 2024 14:22:31 +0800
Subject: [PATCH] 返回预测结果

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemNormalHandlerImpl.java |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 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 5131d2a..d32884b 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
@@ -34,13 +34,20 @@
     @Autowired
     private PredictModelHandler predictModelHandler;
 
+    /**
+     * NormalItem预测
+     *
+     * @param predictTime
+     * @param predictItemDto
+     * @return
+     * @throws ItemInvokeException
+     */
     @Override
     public PredictResultVO predict(Date predictTime, ItemVO predictItemDto)
             throws ItemInvokeException{
-        String itemId = predictItemDto.getId();
-        PredictResultVO finalResult = new PredictResultVO();
         PredictResultVO predictResult = new PredictResultVO();
-        List<PredictResultVO> predictResultList = new ArrayList<>();
+        String itemId = predictItemDto.getId();
+        predictResult.setPredictId(itemId);
         try {
             // 获取预测项模型
             List<MmPredictModelEntity> predictModelList = mmPredictModelService.getActiveModelByItemId(itemId);
@@ -48,17 +55,8 @@
                 throw new ModelInvokeException(MessageFormat.format("{0},itemId={1}",
                         ModelInvokeException.errorGetModelEntity, itemId));
             }
-            for (MmPredictModelEntity predictModel : predictModelList) {
-                predictResult = predictModelHandler.predictByModel(predictTime, predictModel);
-                predictResult.setPredictId(itemId);
-                predictResultList.add(predictResult);
-            }
-            /*Calendar calendar = Calendar.getInstance();
-            calendar.setTime(predictTime);
-            calendar.add(Calendar.MINUTE, predictResult.getPredictMatrix().length - 1);
-            Timestamp endTime = new Timestamp(calendar.getTime().getTime());*/
-            finalResult = predictResultList.get(0);
-
+            MmPredictModelEntity predictModel = predictModelList.get(0);
+            predictResult = predictModelHandler.predictByModel(predictTime, predictModel);
         } catch (Exception ex) {
             ex.printStackTrace();
             //预测项预测失败的状态
@@ -66,6 +64,6 @@
                     ItemInvokeException.errorItemFailed, itemId));
         }
 
-        return finalResult;
+        return predictResult;
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3