From 97d38f7b7f7d95fe38cdbb79960106c15454b6ba Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期二, 19 十一月 2024 15:23:51 +0800
Subject: [PATCH] 预警信息

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/DllUtils.java |   18 ++++++++++++++++++
 1 files changed, 18 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..ae18b35 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,20 @@
         }
 
     }
+
+    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);
+            if (null == classLoader) {
+                throw new RuntimeException("dll未发布,classLoader为null");
+            }
+            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