Browse Source

Pull request #7351: REPORT-64741 & REPORT-64811

Merge in DESIGN/design from ~STARRYI/design:final/10.0 to final/10.0

* commit 'eb17d1c17f3979829df1cdeb74094e8f3d98232c':
  REPORT-64811 保持设计器商城下载reu文件名中的版本信息
  REPORT-64741 【组件可更新提醒】组件复用-设计器端安装设计器版本高于当前设计器版本的组件的情况
final/10.0
starryi 3 years ago
parent
commit
8a9b753df6
  1. 13
      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
  3. 2
      designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java

13
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() { private void downLoadWidget() {
if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) { if (OnlineWidgetRepoPane.getInstance().isShowPackagePanel()) {
ComponentCollector.getInstance().collectDownloadPktNum(); ComponentCollector.getInstance().collectDownloadPktNum();
@ -170,7 +178,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;
@ -179,7 +188,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
//安装 //安装
File file = new File(filePath); File file = new File(filePath);
try { try {
if (file.exists() && getDefaultGroup().installModule(file)) { if (file.exists() && getDefaultGroup().installUniqueIdModule(file)) {
ShareUtils.recordInstallTime(file.getName(), System.currentTimeMillis()); ShareUtils.recordInstallTime(file.getName(), System.currentTimeMillis());
ComponentCollector.getInstance().collectCmpDownLoad(widget.getUuid()); ComponentCollector.getInstance().collectCmpDownLoad(widget.getUuid());
} }

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(); 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];

2
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) { private static boolean installReuFile(Group group, File chosenFile, long installTime) {
try { try {
if (!group.installModule(chosenFile)) { if (!group.installUniqueIdModule(chosenFile)) {
return false; return false;
} }
ShareUtils.recordInstallTime(chosenFile.getName(), installTime); ShareUtils.recordInstallTime(chosenFile.getName(), installTime);

Loading…
Cancel
Save