From 2c50f3d1dd33482648882b64543c3c4b895d9531 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Fri, 14 Dec 2018 15:52:34 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-13431=20=E5=8A=9F=E8=83=BD=E7=82=B9?= =?UTF-8?q?=E8=AE=B0=E5=BD=95,=20=E9=9C=80=E8=A6=81=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E5=8F=91=E9=80=81=201.=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=8E=9F=E5=85=88=E6=94=B6=E9=9B=86=E5=9C=A8feedback=EF=BC=8C1?= =?UTF-8?q?0.0=E9=9C=80=E8=A6=81=E9=80=82=E9=85=8D=202.=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9=E4=BB=8Emetric=E5=8F=96=E6=95=B0=EF=BC=8C=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E4=BC=A0=E5=85=A5Date=E4=BB=8E12=E6=9C=8810=E5=8F=B7?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E5=B0=B1=E6=8B=BF=E4=B8=8D=E5=88=B0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BA=86=EF=BC=8C=E6=8D=A2=E7=94=A8long=E6=98=AF?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) 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 047ffc671..0398189d9 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 @@ -170,7 +170,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { } - private byte[] getJSONContentAsByte(){ + private JSONObject getJSONContentAsByte(){ JSONObject content = new JSONObject(); JSONArray startStopArray = new JSONArray(); @@ -192,13 +192,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { FRContext.getLogger().error(e.getMessage(), e); } } - - try { - return content.toString().getBytes(EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e) { - FRContext.getLogger().error(e.getMessage(), e); - return ArrayUtils.EMPTY_BYTE_ARRAY; - } + return content; } private void sendUserInfo(){ @@ -208,19 +202,17 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - byte[] content = getJSONContentAsByte(); - HttpClient hc = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("user.info")); - hc.setContent(content); - if (!hc.isServerAlive()) { - return; - } - String res = hc.getResponseText(); - //服务器返回true,说明已经取得成功,清空当前记录的信息 + JSONObject content = getJSONContentAsByte(); + String url = CloudCenter.getInstance().acquireUrlByKind("user.info.v10"); boolean success = false; try { + HashMap para = new HashMap<>(); + para.put("token", SiteCenterToken.generateToken()); + para.put("content", content); + String res = HttpToolbox.post(url, para); success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); - } catch (JSONException e) { - FRContext.getLogger().error(e.getMessage(), e); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (success){ this.reset(); @@ -236,7 +228,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { } JSONArray content = null; try { - content = getFunctionsContent(current, new Date(lastTime)); + content = getFunctionsContent(currentTime, lastTime); } catch (JSONException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -451,7 +443,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static JSONArray getFunctionsContent(Date current, Date last) throws JSONException{ + public static JSONArray getFunctionsContent(long current, long last) throws JSONException{ //记录当前条数,达到200条合并成一个请求 int count = 0; JSONArray functionArray = new JSONArray();