Browse Source

REPORT-64811 保持设计器商城下载reu文件名中的版本信息

【问题原因】
使用商城组件数据中的fileLoca字段值作为本地reu文件名,该字段与oss服务器中reu文件的
文件名保持一致.
设计器在下载安装组件时,不对reu文件进行重命名操作, 即本地安装组件时,使用原本地reu
文件名,在线安装商城组件时,使用原oss服务器中reu文件名.

【改动思路】
同上
bugfix/11.0
Starryi 3 years ago
parent
commit
1f6752d08f
  1. 11
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java
  2. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java

11
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java

@ -221,6 +221,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() { private void downLoadWidget() {
CarouselStateManger.getInstance().suspend(CarouselStateManger.DOWNLOAD_COMPONENT); CarouselStateManger.getInstance().suspend(CarouselStateManger.DOWNLOAD_COMPONENT);
if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) { if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) {
@ -242,7 +250,8 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
protected Boolean doInBackground() { protected Boolean doInBackground() {
String filePath; String filePath;
try { try {
filePath = DownloadUtils.download(widget.getId(), widget.getName() + "." + widget.getUuid(), process); String filename = createLocalReuFilename();
filePath = DownloadUtils.download(widget.getId(), filename, process);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false; return false;

2
designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java

@ -80,7 +80,7 @@ public class DownloadUtils {
long totalSize = entity.getContentLength(); long totalSize = entity.getContentLength();
InputStream content = entity.getContent(); InputStream content = entity.getContent();
filePath = StableUtils.pathJoin(realPath, fileName + ".reu"); filePath = StableUtils.pathJoin(realPath, fileName);
StableUtils.makesureFileExist(new File(filePath)); StableUtils.makesureFileExist(new File(filePath));
FileOutputStream writer = new FileOutputStream(filePath); FileOutputStream writer = new FileOutputStream(filePath);
byte[] data = new byte[PluginConstants.BYTES_NUM]; byte[] data = new byte[PluginConstants.BYTES_NUM];

Loading…
Cancel
Save