Browse Source

Merge pull request #920 in DESIGN/design from release/10.0 to refactor/19.4.3

* commit 'c7bf29acc9684f2a53a5a12b2f414293e327abd7':
  REPORT-16012 populate展示需要使用快照对象,在原始对象上的任意修改都会映射到数据库上,导致卡顿
  update
  REPORT-17422 && REPORT-17460 更新升级 有jar包没更新
  REPORT-16567 添加台版教学视频链接
research/10.0
zheng 6 years ago
parent
commit
e537651315
  1. 39
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  2. 2
      designer-realize/src/main/java/com/fr/design/widget/ui/ParameterTreeComboBox.java

39
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -22,6 +22,7 @@ import com.fr.design.update.ui.widget.UpdateInfoTableCellRender;
import com.fr.design.update.ui.widget.UpdateInfoTableModel;
import com.fr.design.update.ui.widget.UpdateInfoTextAreaCellRender;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils;
import com.fr.general.GeneralContext;
@ -29,6 +30,7 @@ import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
@ -37,6 +39,7 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.third.org.apache.commons.codec.digest.DigestUtils;
import com.fr.workspace.WorkContext;
import com.sun.java.swing.plaf.motif.MotifProgressBarUI;
@ -371,9 +374,7 @@ public class UpdateMainDialog extends UIDialog {
new SwingWorker<JSONObject, Void>() {
@Override
protected JSONObject doInBackground() throws Exception {
HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("jar10.update"));
hc.setTimeout(UpdateConstants.CONNECTION_TIMEOUT);
return new JSONObject(hc.getResponseText());
return new JSONObject(HttpToolbox.get(CloudCenter.getInstance().acquireUrlByKind("jar10.update")));
}
@Override
@ -620,8 +621,11 @@ public class UpdateMainDialog extends UIDialog {
long downloadSize = jo.optLong("size");
if (ComparatorUtils.equals(category, "server")) {
File currentJAR = new File(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), ProjectConstants.LIB_NAME, downloadName));
if (currentJAR.exists() && ComparatorUtils.equals(currentJAR.length(), downloadSize)) {
//假如大小一样的jar包就不要下载了
String currentMD5 = getCurrentJarMD5(currentJAR);
String downloadMD5 = jo.optString("md5");
boolean exist = currentJAR.exists() && ComparatorUtils.equals(currentJAR.length(), downloadSize) && ComparatorUtils.equals(currentMD5, downloadMD5);
if (exist) {
// 如果jar包存在且MD5值和大小与oss上的一致 不下载
continue;
}
}
@ -630,6 +634,31 @@ public class UpdateMainDialog extends UIDialog {
}
}
/**
* 获取当前jar的md5
* @param currentJAR
* @return
*/
private String getCurrentJarMD5(File currentJAR) {
String md5 = StringUtils.EMPTY;
FileInputStream input = null;
try {
input = new FileInputStream(currentJAR);
md5 = DigestUtils.md5Hex(input);
} catch (Exception ignore) {
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
return md5;
}
/**
* jar包更新按钮监听器
*/

2
designer-realize/src/main/java/com/fr/design/widget/ui/ParameterTreeComboBox.java

@ -161,7 +161,7 @@ public class ParameterTreeComboBox extends FRTreeComboBox {
// 全局数据源参数
parameters = new Parameter[0];
Calculator c = Calculator.createCalculator();
TableDataConfig tableDataConfig = TableDataConfig.getInstance();
TableDataConfig tableDataConfig = TableDataConfig.getInstance().mirror();
Iterator<String> nameIt = tableDataConfig.getTableDatas().keySet().iterator();
while (nameIt.hasNext()) {
TableData tableData = tableDataConfig.getTableData(nameIt.next());

Loading…
Cancel
Save