From 57e1a8acbb672e49c0128a5206f84bb8a8b3aa01 Mon Sep 17 00:00:00 2001 From: huangfeng Date: Thu, 21 Nov 2024 10:30:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=80=E8=BD=AE=E9=87=87=E9=9B=86?= =?UTF-8?q?=E7=94=A8=E7=9B=B8=E5=90=8C=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xydl/cac/iec/IEDCollectService.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/xydl/cac/iec/IEDCollectService.java b/src/main/java/com/xydl/cac/iec/IEDCollectService.java index 9edaf11..308c974 100644 --- a/src/main/java/com/xydl/cac/iec/IEDCollectService.java +++ b/src/main/java/com/xydl/cac/iec/IEDCollectService.java @@ -34,6 +34,7 @@ public class IEDCollectService { BizConfig _bizConfig; String folder = "/record"; + String sameTime; public IEDCollectService(IcdConfigTypeRepository configRepository, IcdConfigTypeAttRepository attRepository, IcdConfigTypeInstRepository instRepository, RptparamindexRepository rptparamindexRepository, @@ -70,6 +71,7 @@ public class IEDCollectService { try { log.info("61850开始采集数据, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort()); this.connect(); + sameTime = null; if (!CollectionUtils.isEmpty(rptList)) { this.doCollectAndSave(configTypeList, rptList); } @@ -118,6 +120,7 @@ public class IEDCollectService { String time = iecClient.getValue(paramindexT, fc); log.info("采集到" + fc + " " + paramindexNew + "=" + value + ", t=" + time); time = DateUtil.fromZoneUTCToLocal(time); + time = this.makeSameTime(time); _dataService.insertData(rpt.getTablename(), rpt.getEqmid(), time, rpt.getColname(), value); // 更新最新数据缓存 @@ -132,6 +135,17 @@ public class IEDCollectService { StaticVariable.paramRelationMap.put(key, value); } + private String makeSameTime(String time) { + if (sameTime == null) { + sameTime = time; + } else { + if (!sameTime.equals(time)) { + + } + } + return sameTime; + } + private Rptparamindex findRpt(List rptList, String paramindex) { for (Rptparamindex rpt : rptList) { if (rpt.getParamindex().equals(paramindex)) {