From de1b3b3b3820830f9a6e853e25884ab8085e57e3 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期五, 20 十二月 2024 13:57:29 +0800
Subject: [PATCH] mergeItem结果存入output

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemMergeHandlerImpl.java |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemMergeHandlerImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemMergeHandlerImpl.java
index 2d412ec..7ea01d2 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemMergeHandlerImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemMergeHandlerImpl.java
@@ -19,6 +19,7 @@
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
 
 import java.sql.Timestamp;
 import java.util.*;
@@ -68,7 +69,7 @@
         try {
             String expression = itemEntityFactory.getMergeItem(itemId).getExpression();
             int predictLength = itemEntityFactory.getItemById(itemId).getPredictLength();
-            double[][] predictResultMat = new double[predictLength][1];
+            double[] predictResultMat = new double[predictLength];
             String[] mathOutPutId = expression.split("[\\+ \\-]");
             ArrayList<Character> operator = new ArrayList<>();
             for (int i = 0; i < expression.length(); i++) {
@@ -111,7 +112,7 @@
                         if (operator.get(j-1)=='-')
                         {sum -= predictValueMap.get(mathOutPutId[j])[i];}
                     }
-                    predictResultMat[i][0] = sum;
+                    predictResultMat[i] = sum;
                 }
             }
             //是否为组合预测项
@@ -137,7 +138,12 @@
 //            }
             log.info("计算预测模型结果:" + predictResultMat);
             predictResult.setPredictId(itemId);
-            predictResult.setPredictMatrix(predictResultMat);
+            List<MmItemOutputEntity> outputServiceByItemid = mmItemOutputService.getByItemid(itemId);
+            if (CollectionUtils.isEmpty(outputServiceByItemid)) {
+                Map<MmItemOutputEntity, double[]> predictMatrixs = new HashMap<>();
+                predictMatrixs.put(outputServiceByItemid.get(0),predictResultMat);
+                predictResult.setPredictMatrixs(predictMatrixs);
+            }
             predictResult.setPredictTime(predictTime);
             //预测项预测成功的状态
             itemStatus = ItemPredictStatus.SUCCESS;

--
Gitblit v1.9.3