From 558ffc4bcaf7aa5c683e7c9ce01e971feb9e4d95 Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期一, 14 十月 2024 14:11:48 +0800 Subject: [PATCH] 模型打包租户隔离 备份文件租户隔离 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MdkController.java | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MdkController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MdkController.java index 81ae60c..65a2438 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MdkController.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MdkController.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray; import com.iailab.framework.common.exception.enums.GlobalErrorCodeConstants; import com.iailab.framework.common.pojo.CommonResult; +import com.iailab.framework.tenant.core.context.TenantContextHolder; import com.iailab.module.model.mpk.common.MdkConstant; import com.iailab.module.model.mpk.common.utils.DllUtils; import com.iailab.module.model.mpk.common.utils.Readtxt; @@ -39,14 +40,18 @@ @PostMapping("run") public CommonResult<String> run(@RequestBody MdkDTO dto) { + Long tenantId = TenantContextHolder.getTenantId(); + // 备份文件 租户隔离 + String mpkTenantBakFilePath = mpkBakFilePath + File.separator + tenantId; + Class<?> clazz; URLClassLoader classLoader; try { - File jarFile = new File(mpkBakFilePath + File.separator + MdkConstant.JAR + File.separator + dto.getPyName() + ".jar"); + File jarFile = new File(mpkTenantBakFilePath + File.separator + MdkConstant.JAR + File.separator + dto.getPyName() + ".jar"); if (!jarFile.exists()) { throw new RuntimeException("jar包不存在,请先生成代码。jarPath:" + jarFile.getAbsolutePath()); } - File dllFile = new File(mpkBakFilePath + File.separator + MdkConstant.DLL + File.separator + dto.getPyName() + ".dll"); + File dllFile = new File(mpkTenantBakFilePath + File.separator + MdkConstant.DLL + File.separator + dto.getPyName() + ".dll"); if (!dllFile.exists()) { throw new RuntimeException("dll文件不存在,请先生成代码。dllPath:" + dllFile.getAbsolutePath()); } -- Gitblit v1.9.3