From df99e46312fdd5ee830f1451e478f6658e09f9ed Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期一, 16 十二月 2024 13:41:41 +0800
Subject: [PATCH] 导出测点数据 修改

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 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 9d5359b..e8a9142 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
@@ -16,12 +16,16 @@
 import com.iailab.module.model.mdk.sample.SampleConstructor;
 import com.iailab.module.model.mdk.sample.dto.SampleData;
 import com.iailab.module.model.mdk.vo.PredictResultVO;
+import com.iailab.module.model.mpk.common.MdkConstant;
 import com.iailab.module.model.mpk.common.utils.DllUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.*;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author PanZhibao
@@ -65,6 +69,11 @@
             }
             IAILModel newModelBean = composeNewModelBean(predictModel);
             HashMap<String, Object> settings = getPredictSettingsByModelId(modelId);
+            // 校验setting必须有pyFile,否则可能导致程序崩溃
+            if (!settings.containsKey(MdkConstant.PY_FILE_KEY)) {
+                throw new RuntimeException("模型设置参数缺少必要信息【" + MdkConstant.PY_FILE_KEY +  "】,请重新上传模型!");
+            }
+
             if (settings == null) {
                 log.error("模型setting不存在,modelId=" + modelId);
                 return null;
@@ -93,7 +102,7 @@
             }
             modelResult = (HashMap<String, Object>) modelResult.get(CommonConstant.MDK_RESULT);
             //打印结果
-            log.info("模型计算完成:modelId=" + modelId + modelResult);
+            log.info("预测模型计算完成:modelId=" + modelId + modelResult);
             JSONObject jsonObjResult = new JSONObject();
             jsonObjResult.put("result", modelResult);
             log.info(String.valueOf(jsonObjResult));

--
Gitblit v1.9.3