Browse Source

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

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

【改动思路】
同上
final/10.0
Starryi 3 years ago
parent
commit
eb17d1c17f
  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

@ -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;

2
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];

Loading…
Cancel
Save