From eb17d1c17f3979829df1cdeb74094e8f3d98232c Mon Sep 17 00:00:00 2001 From: Starryi Date: Thu, 23 Dec 2021 11:12:07 +0800 Subject: [PATCH] =?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];