From ae21bf16b1dd34cc140cdf177324ae78aee04704 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Fri, 9 Nov 2018 10:26:10 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-12520=20@Alex.Sung:=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=8A=9F=E8=83=BD=E7=82=B9=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E5=BA=94=E8=AF=A5=E5=88=A0=E9=99=A4swift=E8=A1=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=20=E5=8E=BB=E6=8E=89=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E6=94=B9=E4=B8=BA=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E6=9C=80=E5=90=8E=E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4=E5=8F=91?= =?UTF-8?q?=E9=80=81=E7=BB=99=E4=BA=91=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 96 +++++++++---------- 1 file changed, 46 insertions(+), 50 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 003a482b7..6f3c9bdea 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 @@ -226,20 +226,27 @@ public class InformationCollector implements XMLReadable, XMLWriter { } private void sendFunctionsInfo(){ - long currentTime = new Date().getTime(); - ArrayList> content = null; - content = getFunctionsContentAsByte(currentTime); - boolean success = false; - String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); - if(content.size() > 0){ - for(int i=0; i> content = null; + content = getFunctionsContent(current, new Date(lastTime)); + boolean success = false; + FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); + String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); + if(content.size() > 0){ + for(int i=0; i> records = new ArrayList>(); - QueryCondition condition = QueryFactory.create().addRestriction( - RestrictionFactory.lte(COLUMN_TIME, currentTime) - ); - try { - DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); - String bbsUserName = MarketConfig.getInstance().getBbsUsername(); - String uuid = envManager.getUUID(); - if(!focusPoints.isEmpty()){ - for(FocusPoint focusPoint : focusPoints.getList()){ - Map record = new HashMap<>(); - record.put(ATTR_ID, focusPoint.getId()); - record.put(ATTR_TEXT, focusPoint.getText()); - record.put(ATTR_SOURCE, focusPoint.getSource()); - record.put(ATTR_TIME, focusPoint.getTime().getTime()); - record.put(ATTR_TITLE, focusPoint.getTitle()); - record.put(ATTR_USER_NAME, bbsUserName); - record.put(ATTR_UUID, uuid); - records.add(record); - } - } - } catch (MetricException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - return records; - } - - private void deleteFunctionRecords(long currentTime) { - QueryCondition condition = QueryFactory.create().addRestriction( - RestrictionFactory.lte(COLUMN_TIME, currentTime) - ); + public static ArrayList getFunctionsContent(Date current, Date last){ + ArrayList> records = new ArrayList>(); + QueryCondition condition = QueryFactory.create() + .addRestriction(RestrictionFactory.lte(COLUMN_TIME, current)) + .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); try { - MetricRegistry.getMetric().clean(condition); - }catch (Exception e){ - FineLoggerFactory.getLogger().error(e.getMessage(), e); + DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); + DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); + String bbsUserName = MarketConfig.getInstance().getBbsUsername(); + String uuid = envManager.getUUID(); + if(!focusPoints.isEmpty()){ + for(FocusPoint focusPoint : focusPoints.getList()){ + Map record = new HashMap<>(); + record.put(ATTR_ID, focusPoint.getId()); + record.put(ATTR_TEXT, focusPoint.getText()); + record.put(ATTR_SOURCE, focusPoint.getSource()); + record.put(ATTR_TIME, focusPoint.getTime().getTime()); + record.put(ATTR_TITLE, focusPoint.getTitle()); + record.put(ATTR_USER_NAME, bbsUserName); + record.put(ATTR_UUID, uuid); + records.add(record); + } + } + } catch (MetricException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } + return records; } private class StartStopTime implements XMLReadable, XMLWriter {