From 75c07ca9482f40eea62ab67f9505cc0247393354 Mon Sep 17 00:00:00 2001
From: dongyukun <1208714201@qq.com>
Date: 星期一, 24 三月 2025 20:00:53 +0800
Subject: [PATCH] point天频率采集

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java
index f263bd2..0c4839a 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java
@@ -29,7 +29,6 @@
 import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
-import java.time.Duration;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 
@@ -77,7 +76,7 @@
 
     public static final String PV = "point_value:";
 
-    public static final long offset = 60 * 3L;
+    public static final long offset = 60 * 2L;
 
     /**
      * 采集
@@ -87,26 +86,30 @@
      */
     public void collect(Date collectTime, String minfreq) {
         try {
+            log.info("collectTime=" + collectTime.getTime());
             Map<String, Object> dataMap = new HashMap<>();
             List<InfluxPointValuePOJO> pointValues = new ArrayList<>();
-
+            // 记录点位状态
+            List<String> listGood = new ArrayList<>();
+            List<String> listBad = new ArrayList<>();
             log.info("读取常量点");
             List<DaPointDTO> pointConstantList = daPointService.getConstantPoint(minfreq);
-            pointValues.addAll(constantHandle.handle(collectTime, pointConstantList, dataMap));
+            pointValues.addAll(constantHandle.handle(collectTime, pointConstantList, dataMap, listGood, listBad));
 
             log.info("读取测量点");
             List<DaPointDTO> pointMeasureList = daPointService.getMeasurePoint(minfreq);
-            pointValues.addAll(measureHandle.handle(collectTime, pointMeasureList, dataMap));
+            pointValues.addAll(measureHandle.handle(collectTime, pointMeasureList, dataMap, listGood, listBad));
 
             log.info("读取计算点");
             List<DaPointDTO> pointCalculateList = daPointService.getMathPoint(minfreq);
-            pointValues.addAll(calculateHandle.handle(collectTime, pointCalculateList, dataMap));
+            pointValues.addAll(calculateHandle.handle(collectTime, pointCalculateList, dataMap, listGood, listBad));
 
             log.info("读取累计点");
             List<DaPointDTO> pointCumulateList = daPointService.getCumulatePoint(minfreq);
-            pointValues.addAll(cumulateHandle.handle(collectTime, pointCumulateList));
+            pointValues.addAll(cumulateHandle.handle(collectTime, pointCumulateList, listGood, listBad));
 
             log.info("存入时序库");
+            log.info("pointValueTimestamp=" + (pointValues.get(0) == null ? 0 : pointValues.get(0).getTimestamp().getNano()));
             influxDBService.asyncWritePointValues(pointValues);
 
             log.info("存入缓存");
@@ -123,7 +126,7 @@
                 }
             }
             log.info("更新采集状态");
-            daPointCollectStatusService.recordStatusList(pointValues, collectTime);
+            daPointCollectStatusService.recordStatusList(listGood, listBad, collectTime);
             log.info("采集完成");
         } catch (Exception ex) {
             log.info("采集异常!");
@@ -143,6 +146,7 @@
             data.putAll(cumulateHandle.getCurrent(pointNos));
             return data;
         } catch (Exception ex) {
+            ex.printStackTrace();
             return R.error(ex.getMessage());
         }
 

--
Gitblit v1.9.3