From 1a2b62d8d2f56f6cd67f225fdc82bb29705d9286 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期五, 18 十月 2024 13:58:11 +0800
Subject: [PATCH] 模型运行方法 ItemStatus STATUS1(1, "启用"); 添加字段 mpkProjectId 模型运行api 其他bug调整

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/DllUtils.java |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/DllUtils.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/DllUtils.java
index 61cb7a8..947da19 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/DllUtils.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/DllUtils.java
@@ -1,6 +1,8 @@
 package com.iailab.module.model.mpk.common.utils;
 
 import cn.hutool.core.io.FileUtil;
+import com.iail.model.IAILModel;
+import com.iail.utils.RSAUtils;
 import com.iailab.module.model.mpk.common.MdkConstant;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -207,4 +209,17 @@
         }
 
     }
+
+    public static HashMap<String, Object> run(IAILModel model, Object[] paramsValueArray, String projectId) throws Exception {
+        if (RSAUtils.checkLisenceBean().getCode() != 1) {
+            throw new SecurityException("Lisence 不可用!");
+        } else if (model == null) {
+            throw new RuntimeException("模型文件不能为空!");
+        } else {
+            URLClassLoader classLoader = DllUtils.getClassLoader(projectId);
+            Class<?> clazz = classLoader.loadClass(model.getClassName());
+            Method method = clazz.getMethod(model.getMethodName(), model.getParamsArray());
+            return (HashMap)method.invoke(clazz.newInstance(), paramsValueArray);
+        }
+    }
 }

--
Gitblit v1.9.3