From 53750e77c5aa2af106de0bf2532b0febd08f4645 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Wed, 2 Jan 2019 17:00:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=8F=E9=A1=B5=E5=8F=91=E9=80=81=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E5=90=8E=E6=9B=B4=E6=96=B0=E4=B8=8B=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 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 e6ef66e00..49ad7d6a3 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 @@ -218,19 +218,14 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - boolean success; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); - success = queryAndSendOnePageFunctionContent(currentTime, lastTime, 0); + queryAndSendOnePageFunctionContent(currentTime, lastTime, 0); long page = (totalCount/PAGE_SIZE) + 1; for(int i=1; i focusPoints) { + private void sendThisPageFunctionContent(DataList focusPoints) { String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); try { JSONObject jsonObject = dealWithSendFunctionContent(focusPoints); - return sendFunctionRecord(url, jsonObject); + sendFunctionRecord(url, jsonObject); } catch (JSONException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - return false; } private JSONObject dealWithSendFunctionContent(DataList focusPoints) throws JSONException { @@ -319,7 +312,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { return jsonArray; } - private boolean sendFunctionRecord(String url, JSONObject record) { + private void sendFunctionRecord(String url, JSONObject record) { boolean success = false; try { HashMap para = new HashMap<>(); @@ -327,10 +320,14 @@ public class InformationCollector implements XMLReadable, XMLWriter { para.put("content", record); String res = HttpToolbox.post(url, para); success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); + if (success) { + this.lastTime = dateToString(); + } else { + FineLoggerFactory.getLogger().error("Error occured when sent function records to the cloud center."); + } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - return success; } private FunctionRecord getOneRecord(FocusPoint focusPoint) {