From 6d7389090263a2423b67d865ccc4d7ca6cd5b19a Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 22 Dec 2022 11:14:59 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E6=8F=92=E4=BB=B6):=20=E9=99=90=E5=88=B6?= =?UTF-8?q?=E5=AE=98=E6=96=B9=E6=8F=92=E4=BB=B6=E6=9B=B4=E6=96=B0=E5=8D=B8?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/service/sys/PluginService.java | 12 ++++++++++-- frontend/src/views/system/plugin/index.vue | 6 +++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/dataease/service/sys/PluginService.java b/backend/src/main/java/io/dataease/service/sys/PluginService.java index 9dd9f5ccd6..2f22d0d619 100644 --- a/backend/src/main/java/io/dataease/service/sys/PluginService.java +++ b/backend/src/main/java/io/dataease/service/sys/PluginService.java @@ -227,7 +227,7 @@ public class PluginService { LogUtil.error(msg); DEException.throwException(msg); } - deleteJarFile(myPlugin); + myPlugin = deleteJarFile(myPlugin); CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME); CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME); CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME); @@ -258,18 +258,26 @@ public class PluginService { return true; } - private void deleteJarFile(MyPlugin plugin) { + private MyPlugin deleteJarFile(MyPlugin plugin) { String version = plugin.getVersion(); String moduleName = plugin.getModuleName(); String fileName = moduleName + "-" + version + ".jar"; String path = pluginDir + plugin.getStore() + "/" + fileName; File jarFile = new File(path); + if (!StringUtils.equals("default", plugin.getStore()) && !jarFile.exists()) { + version = "1.0-SNAPSHOT"; + fileName = moduleName + "-" + version + ".jar"; + path = pluginDir + plugin.getStore() + "/" + fileName; + jarFile = new File(path); + plugin.setVersion(version); + } FileUtil.del(jarFile); if (plugin.getCategory().equalsIgnoreCase("datasource")) { File driverFile = new File(pluginDir + plugin.getStore() + "/" + plugin.getDsType() + "Driver"); FileUtil.del(driverFile); } + return plugin; } /** diff --git a/frontend/src/views/system/plugin/index.vue b/frontend/src/views/system/plugin/index.vue index ec1a8c165c..88d169b7c2 100644 --- a/frontend/src/views/system/plugin/index.vue +++ b/frontend/src/views/system/plugin/index.vue @@ -228,7 +228,7 @@ export default { ] } pluginLists(0, 0, param).then((response) => { - this.data = response.data.listObject + this.data = response.data.listObject.filter(item => item.pluginId > 1) this.data.forEach((ele) => { if (ele.cost) { ele.cost = ele.cost.toLocaleString() @@ -283,10 +283,10 @@ export default { this.handlerConfirm(options) }, btnDisabled(row) { - return row.pluginId < 4 + return row.store === 'default' }, updateDisabled(row) { - return row.pluginId === 1 + return row.store === 'default' } } }