dongyukun
7 天以前 d79c5f396b23520e6370e9d9b6abc31938a0e83f
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MdkController.java
@@ -38,6 +38,7 @@
import java.util.*;
import java.util.stream.Collectors;
import static com.iailab.framework.common.exception.enums.GlobalErrorCodeConstants.NOT_GENERAT;
import static com.iailab.framework.common.pojo.CommonResult.error;
import static com.iailab.framework.common.pojo.CommonResult.success;
@@ -72,11 +73,13 @@
        try {
            File jarFile = new File(mpkTenantBakFilePath + File.separator + MdkConstant.JAR + File.separator + dto.getPyName() + ".jar");
            if (!jarFile.exists()) {
                throw new RuntimeException("jar包不存在,请先生成代码。jarPath:" + jarFile.getAbsolutePath());
                log.error("jar包不存在,请先生成代码。jarPath:" + jarFile.getAbsolutePath());
                return CommonResult.error(NOT_GENERAT.getCode(),NOT_GENERAT.getMsg());
            }
            File dllFile = new File(mpkTenantBakFilePath + File.separator + MdkConstant.DLL + File.separator + dto.getPyName() + ".dll");
            if (!dllFile.exists()) {
                throw new RuntimeException("dll文件不存在,请先生成代码。dllPath:" + dllFile.getAbsolutePath());
                log.error("dll文件不存在,请先生成代码。dllPath:" + dllFile.getAbsolutePath());
                return CommonResult.error(NOT_GENERAT.getCode(),NOT_GENERAT.getMsg());
            }
            // 加载jar包
            classLoader = DllUtils.loadJar(jarFile.getAbsolutePath());
@@ -152,7 +155,6 @@
                DllUtils.unloadDll(classLoader);
                DllUtils.unloadJar(classLoader);
            }
            System.gc();
        }
    }