From d3aebf09c79bc63497d7050ae320213471439ab2 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 3 Sep 2019 15:39:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=9E?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../messagecollect/solid/SolidCollector.java | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java index 0b1110a6f5..eb5c05912c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/solid/SolidCollector.java @@ -1,7 +1,9 @@ package com.fr.design.mainframe.messagecollect.solid; +import com.fr.general.CloudCenter; import com.fr.general.http.HttpToolbox; import com.fr.log.FineLoggerFactory; +import com.fr.stable.CommonUtils; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; @@ -12,9 +14,27 @@ import java.util.Map; * 设计器固化信息回传类 * Created by alex sung on 2019/8/22. */ + + public class SolidCollector { private static final String CONTENT_URL = "/v10/collect/solid"; 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 { String content = requestContent(); if(StringUtils.isNotEmpty(content)){ - String url = ""; Map params = new HashMap<>(); - params.put("content", requestContent()); - HttpToolbox.post(url, params); + params.put(ATTR_CIPHER_TEXT, requestContent()); + params.put(ATTR_SIGNATURE, String.valueOf(CommonUtils.signature())); + HttpToolbox.post(SOLID_UPLOAD_URL, params); String deleteUrl = WorkContext.getCurrent().getPath() + DELETE_URL; HttpToolbox.post(deleteUrl, new HashMap()); } } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().info(e.getMessage(), e); } } @@ -40,14 +60,7 @@ public class SolidCollector { * 获取服务端固化文件内容 * @return 回传内容 */ - public String requestContent() { - String content = null; - try { - String url = WorkContext.getCurrent().getPath() + CONTENT_URL; - content = HttpToolbox.get(url); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return content; + public String requestContent() throws Exception{ + return HttpToolbox.get(WorkContext.getCurrent().getPath() + CONTENT_URL); } } From f4128aaef564b6188c27e39ad4c9279308421470 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 3 Sep 2019 15:41:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=9B=9E=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/mainframe/InformationCollector.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 83cb7dd335..0ec61e5e70 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/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.mainframe.errorinfo.ErrorInfoUploader; 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.general.CloudCenter; import com.fr.general.ComparatorUtils; @@ -200,6 +201,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { service.schedule(new Runnable() { @Override public void run() { + SolidCollector.getInstance().sendToCloudCenterAndDeleteFile(); sendUserInfo(); FocusPointMessageUploader.getInstance().sendToCloudCenter(); TemplateInfoCollector.getInstance().sendTemplateInfo();