潘志宝
2025-02-28 dbd8a0de4b94f846a6beeccfaca3ed5cc08b0b9e
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/CalculateHandle.java
@@ -63,8 +63,10 @@
            log.info(JSON.toJSONString(listBad));
            dtos.forEach(dto -> {
                try {
                    Object value = singleCompute(dto, dataMap, listGood, listBad);
                    InfluxPointValuePOJO pojo = GenInfluxPointValueUtils.getByPoint(dto, value);
                    Object rawValue = singleCompute(dto, dataMap, listGood, listBad);
                    BigDecimal coefficient = dto.getUnittransfactor() == null ? BigDecimal.ONE : dto.getUnittransfactor();
                    BigDecimal calValue = new BigDecimal(rawValue.toString()).multiply(coefficient);
                    InfluxPointValuePOJO pojo = GenInfluxPointValueUtils.getByPoint(dto, calValue);
                    pojo.setTimestamp(collectTime.toInstant());
                    result.add(pojo);
                } catch (Exception ex) {
@@ -139,7 +141,9 @@
            if (redisTemplate.hasKey(PointCollector.PV + item.getPointNo())) {
                value = redisTemplate.opsForValue().get(PointCollector.PV + item.getPointNo());
            } else {
                value = singleCompute(item);
                Object rawValue = singleCompute(item);
                BigDecimal coefficient = item.getUnittransfactor() == null ? BigDecimal.ONE : item.getUnittransfactor();
                value = new BigDecimal(rawValue.toString()).multiply(coefficient);
            }
            data.put(item.getPointNo(), value);
        });