From f7e880deb0612ba5efe96e6ce229abd8c19bc6e7 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期二, 03 九月 2024 09:08:23 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/influxdb/service/impl/InfluxDBServiceImpl.java | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/influxdb/service/impl/InfluxDBServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/influxdb/service/impl/InfluxDBServiceImpl.java index f7c0075..5470286 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/influxdb/service/impl/InfluxDBServiceImpl.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/influxdb/service/impl/InfluxDBServiceImpl.java @@ -66,7 +66,7 @@ point.addTag("point", pointNo); point.addField("value", Double.parseDouble(dataValue)); point.time(time, WritePrecision.MS); - writeApiBlocking.writePoint(influxDBInstance.bucket, influxDBInstance.org, point); + writeApiBlocking.writePoint(influxDBInstance.getBucket(), influxDBInstance.org, point); } @Override @@ -78,7 +78,7 @@ point.addTag("point", pointNo); point.addField("value", Integer.parseInt(dataValue)); point.time(time, WritePrecision.MS); - writeApiBlocking.writePoint(influxDBInstance.bucket, influxDBInstance.org, point); + writeApiBlocking.writePoint(influxDBInstance.getBucket(), influxDBInstance.org, point); } @Override @@ -90,7 +90,7 @@ point.addTag("point", pointNo); point.addField("value", Boolean.parseBoolean(dataValue)); point.time(time, WritePrecision.MS); - writeApiBlocking.writePoint(influxDBInstance.bucket, influxDBInstance.org, point); + writeApiBlocking.writePoint(influxDBInstance.getBucket(), influxDBInstance.org, point); } @Override @@ -100,7 +100,7 @@ } if (!CollectionUtils.isEmpty(pointValues)) { pointValues.forEach(item -> { - writeApi.writeMeasurement(influxDBInstance.bucket, influxDBInstance.org, WritePrecision.MS, item); + writeApi.writeMeasurement(influxDBInstance.getBucket(), influxDBInstance.org, WritePrecision.MS, item); }); } writeApi.flush(); @@ -113,7 +113,7 @@ } if (!CollectionUtils.isEmpty(tagValues)) { tagValues.forEach(item -> { - writeApi.writeMeasurement(influxDBInstance.bucket, influxDBInstance.org, WritePrecision.MS, item); + writeApi.writeMeasurement(influxDBInstance.getBucket(), influxDBInstance.org, WritePrecision.MS, item); }); } writeApi.flush(); @@ -142,7 +142,7 @@ InfluxTagValuePOJO tag = influxParams.get(i); String measurement = TagValueUtils.getMeasurement(tag.getType()); StringBuilder sb = new StringBuilder(); - sb.append("from(bucket:\"" + influxDBInstance.bucket + "\") "); + sb.append("from(bucket:\"" + influxDBInstance.getBucket() + "\") "); sb.append("|> range(start: ").append(start).append(", stop: ").append(stop).append(") "); sb.append("|> filter(fn: (r) => r[\"_measurement\"] == \"" + measurement + "\")"); sb.append("|> filter(fn: (r) => r[\"_field\"] == \"value\")"); @@ -179,7 +179,7 @@ String measurement = TagValueUtils.getMeasurement(tag.getType()); StringBuilder sb = new StringBuilder(); - sb.append("from(bucket:\"" + influxDBInstance.bucket + "\") "); + sb.append("from(bucket:\"" + influxDBInstance.getBucket() + "\") "); sb.append("|> range(start: ").append(start).append(", stop: ").append(stop).append(") "); sb.append("|> filter(fn: (r) => r[\"_measurement\"] == \"" + measurement + "\")"); sb.append("|> filter(fn: (r) => r[\"_field\"] == \"value\")"); @@ -232,7 +232,7 @@ sql.append(" WHERE point = '"); sql.append(point.getPoint()); sql.append("'"); - InfluxQLQueryResult data = influxQLQueryApi.query(new InfluxQLQuery(sql.toString(), influxDBInstance.bucket)); + InfluxQLQueryResult data = influxQLQueryApi.query(new InfluxQLQuery(sql.toString(), influxDBInstance.getBucket())); Object value = data.getResults().get(0).getSeries().get(0).getValues().get(0).getValueByKey("last"); result.put(point.getPoint(), value); } @@ -254,7 +254,7 @@ sql.append(" WHERE point = '"); sql.append(point.getPoint()); sql.append("' AND time >= '" + utsStart +"'"); - InfluxQLQueryResult data = influxQLQueryApi.query(new InfluxQLQuery(sql.toString(), influxDBInstance.bucket)); + InfluxQLQueryResult data = influxQLQueryApi.query(new InfluxQLQuery(sql.toString(), influxDBInstance.getBucket())); if (data == null) { return null; } @@ -291,7 +291,7 @@ InfluxPointValuePOJO point = influxParams.get(i); String measurement = PointValueUtils.getMeasurement(point.getType()); StringBuilder sb = new StringBuilder(); - sb.append("from(bucket:\"" + influxDBInstance.bucket + "\") "); + sb.append("from(bucket:\"" + influxDBInstance.getBucket() + "\") "); sb.append("|> range(start: ").append(start).append(", stop: ").append(stop).append(") "); sb.append("|> filter(fn: (r) => r[\"_measurement\"] == \"" + measurement + "\")"); sb.append("|> filter(fn: (r) => r[\"_field\"] == \"value\")"); -- Gitblit v1.9.3