From 4914eb0801ebb02e945b888bc3711981b3ce89d6 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期三, 02 四月 2025 01:10:13 +0800
Subject: [PATCH] 结束时间默认追加10s

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/influxdb/service/impl/InfluxDBServiceImpl.java |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/influxdb/service/impl/InfluxDBServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/influxdb/service/impl/InfluxDBServiceImpl.java
index 5bdc50a..06ab102 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/influxdb/service/impl/InfluxDBServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/influxdb/service/impl/InfluxDBServiceImpl.java
@@ -56,7 +56,12 @@
             // 如果相等,则engTime加1毫秒,否则influxdb报错(因为influxdb的range函数是左闭右开区间,所以将engTime加一毫秒,才可以查到startTime时间点的数据)
             endTime.setTime(endTime.getTime() + 1);
         }
-        String stop = endTime.toInstant().toString();
+
+        // 结束时间默认追加10s
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(endTime);
+        calendar.add(Calendar.MILLISECOND, 10 * 1000 + 1);
+        String stop = calendar.getTime().toInstant().toString();
 
         List<InfluxModelResultVO> dataList = new ArrayList<>();
         String measurement = MeasurementUtils.getMeasurement(pojo.getType());

--
Gitblit v1.9.3