| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | } |