Browse Source

Merge pull request #7322 in DESIGN/design from feature/10.0 to feature/big-screen

* commit '40d1e938371a21fbb3fb9f4f32a0a0500eece9bd':
  REPORT-64811 保持设计器商城下载reu文件名中的版本信息
  REPORT-64741 【组件可更新提醒】组件复用-设计器端安装设计器版本高于当前设计器版本的组件的情况
feature/big-screen
superman 3 years ago
parent
commit
80a782061e
  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() {
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;
@ -179,7 +188,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
//安装
File file = new File(filePath);
try {
if (file.exists() && getDefaultGroup().installModule(file)) {
if (file.exists() && getDefaultGroup().installUniqueIdModule(file)) {
ShareUtils.recordInstallTime(file.getName(), System.currentTimeMillis());
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();
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];

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) {
try {
if (!group.installModule(chosenFile)) {
if (!group.installUniqueIdModule(chosenFile)) {
return false;
}
ShareUtils.recordInstallTime(chosenFile.getName(), installTime);

Loading…
Cancel
Save