Browse Source

REPORT-19834 设计器/APP回传服务器固化信息

* commit 'f4128aaef564b6188c27e39ad4c9279308421470':
  回传
  设计器回传
feature/big-screen
Alex.Sung 5 years ago
parent
commit
670f01e471
  1. 2
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java
  2. 39
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java

2
designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

@ -8,6 +8,7 @@ import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.errorinfo.ErrorInfoUploader; import com.fr.design.mainframe.errorinfo.ErrorInfoUploader;
import com.fr.design.mainframe.messagecollect.impl.FocusPointMessageUploader; import com.fr.design.mainframe.messagecollect.impl.FocusPointMessageUploader;
import com.fr.design.mainframe.messagecollect.solid.SolidCollector;
import com.fr.design.mainframe.template.info.TemplateInfoCollector; import com.fr.design.mainframe.template.info.TemplateInfoCollector;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -200,6 +201,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
service.schedule(new Runnable() { service.schedule(new Runnable() {
@Override @Override
public void run() { public void run() {
SolidCollector.getInstance().sendToCloudCenterAndDeleteFile();
sendUserInfo(); sendUserInfo();
FocusPointMessageUploader.getInstance().sendToCloudCenter(); FocusPointMessageUploader.getInstance().sendToCloudCenter();
TemplateInfoCollector.getInstance().sendTemplateInfo(); TemplateInfoCollector.getInstance().sendTemplateInfo();

39
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java

@ -1,7 +1,9 @@
package com.fr.design.mainframe.messagecollect.solid; package com.fr.design.mainframe.messagecollect.solid;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.CommonUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -12,9 +14,27 @@ import java.util.Map;
* 设计器固化信息回传类 * 设计器固化信息回传类
* Created by alex sung on 2019/8/22. * Created by alex sung on 2019/8/22.
*/ */
public class SolidCollector { public class SolidCollector {
private static final String CONTENT_URL = "/v10/collect/solid"; private static final String CONTENT_URL = "/v10/collect/solid";
private static final String DELETE_URL = "/v10/collect/solid/delete"; private static final String DELETE_URL = "/v10/collect/solid/delete";
private static final String ATTR_CIPHER_TEXT = "cipherText";
private static final String ATTR_SIGNATURE = "signature";
private static final String SOLID_UPLOAD_URL = CloudCenter.getInstance().acquireUrlByKind("design.solid");
private static volatile SolidCollector instance;
public static SolidCollector getInstance() {
if (instance == null) {
synchronized (SolidCollector.class) {
if (instance == null) {
instance = new SolidCollector();
}
}
}
return instance;
}
/** /**
* 回传文件给云中心并删除服务端本地文件 * 回传文件给云中心并删除服务端本地文件
@ -23,16 +43,16 @@ public class SolidCollector {
try { try {
String content = requestContent(); String content = requestContent();
if(StringUtils.isNotEmpty(content)){ if(StringUtils.isNotEmpty(content)){
String url = "";
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("content", requestContent()); params.put(ATTR_CIPHER_TEXT, requestContent());
HttpToolbox.post(url, params); params.put(ATTR_SIGNATURE, String.valueOf(CommonUtils.signature()));
HttpToolbox.post(SOLID_UPLOAD_URL, params);
String deleteUrl = WorkContext.getCurrent().getPath() + DELETE_URL; String deleteUrl = WorkContext.getCurrent().getPath() + DELETE_URL;
HttpToolbox.post(deleteUrl, new HashMap<String, Object>()); HttpToolbox.post(deleteUrl, new HashMap<String, Object>());
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().info(e.getMessage(), e);
} }
} }
@ -40,14 +60,7 @@ public class SolidCollector {
* 获取服务端固化文件内容 * 获取服务端固化文件内容
* @return 回传内容 * @return 回传内容
*/ */
public String requestContent() { public String requestContent() throws Exception{
String content = null; return HttpToolbox.get(WorkContext.getCurrent().getPath() + CONTENT_URL);
try {
String url = WorkContext.getCurrent().getPath() + CONTENT_URL;
content = HttpToolbox.get(url);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return content;
} }
} }

Loading…
Cancel
Save