From 79e42b26a4d35178ea088222bf5c43f0ff7328d3 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 23 Dec 2021 14:03:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-64741=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E6=9B=B4=E6=96=B0=E6=8F=90=E9=86=92=E3=80=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A4=8D=E7=94=A8-=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=AB=AF=E5=AE=89=E8=A3=85=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E9=AB=98=E4=BA=8E=E5=BD=93=E5=89=8D=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=89=88=E6=9C=AC=E7=9A=84=E7=BB=84=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 重新确定了组件是否可以被安装的规则。 安装新组件时,如果之前没有安装过该UID的组件,则允许安装; 否则将会比较新旧组件的兼容性和版本高低,以确定是否安装新组件。 优先满足兼容性需求,兼容性相同时,再考虑组件版本. 兼容 + 高版本 > 兼容 + 低版本 > 不兼容 + 高版本 > 不兼容 + 低版本 2. 安装新的组件reu时,删除组内旧的组件reu文件 【改动思路】 同上 --- .../fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java | 2 +- .../java/com/fr/design/mainframe/share/util/InstallUtils.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java index b8cb0e678..646a4c863 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java @@ -179,7 +179,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { //安装 File file = new File(filePath); try { - if (file.exists() && getDefaultGroup().installModule(file)) { + if (file.exists() && getDefaultGroup().installUniqueIdModule(file)) { ShareUtils.recordInstallTime(file.getName(), System.currentTimeMillis()); ComponentCollector.getInstance().collectCmpDownLoad(widget.getUuid()); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java index 610f688a4..b3c711c01 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java @@ -112,7 +112,7 @@ public class InstallUtils { private static boolean installReuFile(Group group, File chosenFile, long installTime) { try { - if (!group.installModule(chosenFile)) { + if (!group.installUniqueIdModule(chosenFile)) { return false; } ShareUtils.recordInstallTime(chosenFile.getName(), installTime); From 0376e4742a8a7cbcf05f458c640e39d2a7d5b603 Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 23 Dec 2021 11:12:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-64811=20=E4=BF=9D=E6=8C=81=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=95=86=E5=9F=8E=E4=B8=8B=E8=BD=BDreu?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E4=B8=AD=E7=9A=84=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 使用商城组件数据中的fileLoca字段值作为本地reu文件名,该字段与oss服务器中reu文件的 文件名保持一致. 设计器在下载安装组件时,不对reu文件进行重命名操作, 即本地安装组件时,使用原本地reu 文件名,在线安装商城组件时,使用原oss服务器中reu文件名. 【改动思路】 同上 --- .../mainframe/share/ui/block/OnlineWidgetBlock.java | 11 ++++++++++- .../fr/design/mainframe/share/util/DownloadUtils.java | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java index 646a4c863..74651ccae 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java @@ -150,6 +150,14 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { } } + private String createLocalReuFilename() { + String filename = widget.getFileLoca(); + if (StringUtils.isEmpty(filename) || !filename.endsWith(".reu")) { + filename = widget.getName() + "." + widget.getUuid() + ".reu"; + } + return filename; + } + private void downLoadWidget() { if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) { ComponentCollector.getInstance().collectDownloadPktNum(); @@ -170,7 +178,8 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock { protected Boolean doInBackground() { String filePath; try { - filePath = DownloadUtils.download(widget.getId(), widget.getName() + "." + widget.getUuid(), process); + String filename = createLocalReuFilename(); + filePath = DownloadUtils.download(widget.getId(), filename, process); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); return false; diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java index 96c2cc28c..18cb93838 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java @@ -67,7 +67,7 @@ public class DownloadUtils { long totalSize = entity.getContentLength(); InputStream content = entity.getContent(); - filePath = StableUtils.pathJoin(realPath, fileName + ".reu"); + filePath = StableUtils.pathJoin(realPath, fileName); StableUtils.makesureFileExist(new File(filePath)); FileOutputStream writer = new FileOutputStream(filePath); byte[] data = new byte[PluginConstants.BYTES_NUM];