From efdc380e66bbc3112eb87d7522f0a37d082082e1 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期四, 26 十二月 2024 09:42:07 +0800
Subject: [PATCH] double类型特殊处理 异常处理

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java |    6 ++++--
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java             |    5 +++--
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java  |    2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java
index cc8681b..6d1ebbd 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java
@@ -142,11 +142,13 @@
             result.setModelResult(modelResult);
             result.setPredictTime(predictTime);
         } catch (ModelResultErrorException ex) {
-            ex.printStackTrace();
+//            ex.printStackTrace();
+            log.error("模型结果异常", ex);
             throw ex;
         } catch (Exception ex) {
 //            log.error("调用发生异常,异常信息为:{0}", ex.getMessage());
-            ex.printStackTrace();
+//            ex.printStackTrace();
+            log.error("模型运行异常", ex);
             throw new ModelInvokeException(ex.getMessage());
         }
         return result;
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
index 6b61389..e4539bf 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
@@ -152,7 +152,7 @@
                 List<DataValueVO> predictValue = new ArrayList<>();
 
                 // double类型特殊处理
-                if (outResultType.equals(OutResultType.D)) {
+                if (OutResultType.D.equals(outResultType)) {
                     // columnItem.getStartTime()就是预测时间
                     String doubleData = mmItemResultJsonService.getDoubleData(outPut.getId(), columnItem.getStartTime());
                     if (StringUtils.isNotBlank(doubleData)) {
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java
index 0ce89d0..e42c921 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java
@@ -1,13 +1,12 @@
 package com.iailab.module.model.mdk.sample;
 
-import com.iailab.module.model.mdk.common.exceptions.DataAccessException;
 import com.iailab.module.model.mdk.common.exceptions.ModelInvokeException;
 import com.iailab.module.model.mdk.sample.dto.SampleData;
 import com.iailab.module.model.mdk.sample.dto.SampleInfo;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.sql.Timestamp;
 import java.text.MessageFormat;
 import java.util.Date;
 import java.util.List;
@@ -19,6 +18,7 @@
  * @Description
  * @createTime 2024年09月03日
  */
+@Slf4j
 @Component
 public class SampleConstructor {
 
@@ -33,6 +33,7 @@
             return sampleDataConstructor.prepareSampleData(sampleInfo);
         } catch (Exception e) {
             e.printStackTrace();
+            log.error("获取模型的算法参数异常",e);
             throw new ModelInvokeException(MessageFormat.format("{0},Name:{1}",
                     ModelInvokeException.errorGetModelArithParam, itemName));
         }

--
Gitblit v1.9.3