Browse Source

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

Merge in DESIGN/design from ~STARRYI/design:release/11.0 to release/11.0

* commit '1f6752d08f1a173b3cfb384a1d29d4dd970f1372':
  REPORT-64811 保持设计器商城下载reu文件名中的版本信息
bugfix/11.0
starryi 3 years ago
parent
commit
c90a5e4900
  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() {
CarouselStateManger.getInstance().suspend(CarouselStateManger.DOWNLOAD_COMPONENT);
if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) {
@ -242,7 +250,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

@ -80,7 +80,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