浏览代码

数据时间不以原始数据中的时间为准,改为使用采集程序执行时的时间

欧阳劲驰 4 天之前
父节点
当前提交
52f7d53d42

+ 4 - 2
custom-gateway-zhscada/src/main/java/com/shkpr/service/customgateway/zhscada/domain/ScadaPlatformData.java

@@ -11,6 +11,8 @@ import org.apache.commons.lang3.math.NumberUtils;
 import org.influxdb.dto.Point;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.time.LocalDateTime;
+import java.time.ZoneId;
 import java.time.ZonedDateTime;
 import java.time.temporal.ChronoUnit;
 import java.util.List;
@@ -67,11 +69,11 @@ public class ScadaPlatformData {
                 .findFirst().orElse(null);
         if (tag == null) return null;
         //获取时间戳
-        long timestamp = this.t
+        long timestamp = LocalDateTime.now()
                 .truncatedTo(ChronoUnit.MINUTES)
+                .atZone(ZoneId.systemDefault())
                 .toInstant()
                 .toEpochMilli();
-
         //构建influxdb
         return Point
                 //表名