From aa0382e44311f9f7e62a688c8fcaa9c69a512e0f Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期二, 24 十二月 2024 15:15:10 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java | 12 +++++++----- 1 files changed, 7 insertions(+), 5 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 c7475c9..f263bd2 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,9 @@ import org.springframework.util.CollectionUtils; import java.math.BigDecimal; +import java.time.Duration; import java.util.*; +import java.util.concurrent.TimeUnit; /** * @author PanZhibao @@ -73,9 +75,9 @@ @Autowired private RedisTemplate<String, Object> redisTemplate; - public static final String PV = "PV_"; + public static final String PV = "point_value:"; - public static final int offset = 60 * 3; + public static final long offset = 60 * 3L; /** * 采集 @@ -111,13 +113,13 @@ for (InfluxPointValuePOJO pointValue : pointValues) { if (pointValue instanceof InfluxPointValueSimPOJO) { InfluxPointValueSimPOJO simPOJO = (InfluxPointValueSimPOJO) pointValue; - redisTemplate.opsForValue().set(PV + simPOJO.getPoint(), simPOJO.getValue(), offset); + redisTemplate.opsForValue().set(PV + simPOJO.getPoint(), simPOJO.getValue().doubleValue(), offset, TimeUnit.SECONDS); } else if (pointValue instanceof InfluxPointValueDigPOJO) { InfluxPointValueDigPOJO digPOJO = (InfluxPointValueDigPOJO) pointValue; - redisTemplate.opsForValue().set(PV + digPOJO.getPoint(), digPOJO.getValue(), offset); + redisTemplate.opsForValue().set(PV + digPOJO.getPoint(), digPOJO.getValue().intValue(), offset, TimeUnit.SECONDS); } else if (pointValue instanceof InfluxPointValueBoolPOJO) { InfluxPointValueBoolPOJO boolPOJO = (InfluxPointValueBoolPOJO) pointValue; - redisTemplate.opsForValue().set(PV + boolPOJO.getPoint(), boolPOJO.getValue(), offset); + redisTemplate.opsForValue().set(PV + boolPOJO.getPoint(), boolPOJO.getValue().booleanValue(), offset, TimeUnit.SECONDS); } } log.info("更新采集状态"); -- Gitblit v1.9.3