From 49bd72038d6bae30a34c096f2cba8c5b11dbad8c Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期五, 06 二月 2026 08:16:05 +0800
Subject: [PATCH] 1
---
zy-acs-hex/src/main/java/com/zy/acs/hex/controller/TestController.java | 19 +++++++++
/dev/null | 36 ------------------
zy-acs-hex/src/main/resources/application.yml | 4 +
component/component-Influxdb/target/classes/com/zy/component/influxdb/service/InfluxDBService.class | 0
component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst | 3 -
component/component-Influxdb/target/component-Influxdb-1.0.0.jar | 0
component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java | 24 ++++++------
component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst | 6 +-
8 files changed, 37 insertions(+), 55 deletions(-)
diff --git a/component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java b/component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java
index c3f5ad4..32e71c6 100644
--- a/component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java
+++ b/component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java
@@ -9,7 +9,6 @@
import org.springframework.stereotype.Service;
import java.time.Instant;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -55,18 +54,19 @@
public List<Map<String, Object>> queryData(String sql) {
try {
// 鎵ц鏌ヨ
- Stream<Object[]> query = influxDBClient.query(sql);
- logger.info("鏌ヨ鏁版嵁锛歿}", query);
+ Stream<Map<String, Object>> mapStream = influxDBClient.queryRows(sql);
+ logger.info("鏌ヨ鏁版嵁锛歿}", mapStream.collect(Collectors.toList()));
+ //query.forEach(row -> System.out.printf("| %-8s | %-8s | %-30s |%n", row[1], row[2], row[0]));
// 杞崲涓� Map 鍒楄〃锛堜究浜庡悗缁鐞嗭級
- List<Map<String, Object>> collect = query.map(record -> {
- Map<String, Object> map = new LinkedHashMap<>();
- for (int i = 0; i < record.length; i += 2) {
- map.put((String) record[i], record[i + 1]);
- }
- return map;
- })
- .collect(Collectors.toList());
- return collect;
+// List<Map<String, Object>> collect = query.map(record -> {
+// Map<String, Object> map = new LinkedHashMap<>();
+// for (int i = 0; i < record.length; i += 2) {
+// map.put((String) record[i], record[i + 1]);
+// }
+// return map;
+// })
+// .collect(Collectors.toList());
+ return null;
} catch (Exception e) {
logger.error("Failed to query data from the database.");
e.printStackTrace();
diff --git a/component/component-Influxdb/target/classes/META-INF/spring-configuration-metadata.json b/component/component-Influxdb/target/classes/META-INF/spring-configuration-metadata.json
deleted file mode 100644
index bbfcdbc..0000000
--- a/component/component-Influxdb/target/classes/META-INF/spring-configuration-metadata.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "groups": [
- {
- "name": "influxdb3",
- "type": "com.zy.influxdb.config.InfluxDBProperties",
- "sourceType": "com.zy.influxdb.config.InfluxDBProperties"
- }
- ],
- "properties": [
- {
- "name": "influxdb3.database",
- "type": "java.lang.String",
- "description": "database for http",
- "sourceType": "com.zy.influxdb.config.InfluxDBProperties"
- },
- {
- "name": "influxdb3.enabled",
- "type": "java.lang.Boolean",
- "description": "Enables mqtt functionality.",
- "defaultValue": "true"
- },
- {
- "name": "influxdb3.token",
- "type": "java.lang.String",
- "description": "token",
- "sourceType": "com.zy.influxdb.config.InfluxDBProperties"
- },
- {
- "name": "influxdb3.url",
- "type": "java.lang.String",
- "description": "InfluxDB http url",
- "sourceType": "com.zy.influxdb.config.InfluxDBProperties"
- }
- ],
- "hints": []
-}
\ No newline at end of file
diff --git a/component/component-Influxdb/target/classes/com/zy/component/influxdb/service/InfluxDBService.class b/component/component-Influxdb/target/classes/com/zy/component/influxdb/service/InfluxDBService.class
index 5182549..30faf5d 100644
--- a/component/component-Influxdb/target/classes/com/zy/component/influxdb/service/InfluxDBService.class
+++ b/component/component-Influxdb/target/classes/com/zy/component/influxdb/service/InfluxDBService.class
Binary files differ
diff --git a/component/component-Influxdb/target/component-Influxdb-1.0.0.jar b/component/component-Influxdb/target/component-Influxdb-1.0.0.jar
index b611964..3326631 100644
--- a/component/component-Influxdb/target/component-Influxdb-1.0.0.jar
+++ b/component/component-Influxdb/target/component-Influxdb-1.0.0.jar
Binary files differ
diff --git a/component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
index b1930b9..e69de29 100644
--- a/component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
+++ b/component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -1,3 +0,0 @@
-com\zy\component\influxdb\service\InfluxDBService.class
-com\zy\component\influxdb\config\InfluxDBAutoConfiguration.class
-com\zy\component\influxdb\properties\InfluxDBProperties.class
diff --git a/component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
index 548806c..cf02f78 100644
--- a/component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
+++ b/component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -1,3 +1,3 @@
-D:\office\code\rcs-flow\component\component-Influxdb\src\main\java\com\zy\influxdb\config\InfluxDBProperties.java
-D:\office\code\rcs-flow\component\component-Influxdb\src\main\java\com\zy\influxdb\service\InfluxDBService.java
-D:\office\code\rcs-flow\component\component-Influxdb\src\main\java\com\zy\influxdb\config\InfluxDBAutoConfiguration.java
+D:\office\code\rcs-flow\component\component-Influxdb\src\main\java\com\zy\component\influxdb\config\InfluxDBAutoConfiguration.java
+D:\office\code\rcs-flow\component\component-Influxdb\src\main\java\com\zy\component\influxdb\properties\InfluxDBProperties.java
+D:\office\code\rcs-flow\component\component-Influxdb\src\main\java\com\zy\component\influxdb\service\InfluxDBService.java
diff --git a/zy-acs-hex/src/main/java/com/zy/acs/hex/controller/TestController.java b/zy-acs-hex/src/main/java/com/zy/acs/hex/controller/TestController.java
index 1744e66..b1a1ee2 100644
--- a/zy-acs-hex/src/main/java/com/zy/acs/hex/controller/TestController.java
+++ b/zy-acs-hex/src/main/java/com/zy/acs/hex/controller/TestController.java
@@ -2,11 +2,13 @@
import com.zy.acs.hex.constant.RabbitConstant;
import com.zy.acs.hex.domain.Device;
+import com.zy.component.influxdb.service.InfluxDBService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@@ -16,6 +18,11 @@
@Autowired
private RabbitTemplate rabbitTemplate;
+
+
+ @Autowired
+ private InfluxDBService influxDBService;
+
/**
* 鍙戦�佹秷鎭痶est1
@@ -42,4 +49,16 @@
rabbitTemplate.convertAndSend(RabbitConstant.TOPIC_EXCHANGE, RabbitConstant.ROUTING_KEY_DOWN, "qswaqsaasas");
}
+
+ /**
+ * 鍙戦�佹秷鎭痶est2
+ *
+ * @return
+ */
+ @GetMapping(value = "/query")
+ @ResponseBody
+ public Object queryTest() {
+ return influxDBService.queryData("select * from device order by time desc limit 10");
+ }
+
}
diff --git a/zy-acs-hex/src/main/resources/application.yml b/zy-acs-hex/src/main/resources/application.yml
index d2bd267..efe00ae 100644
--- a/zy-acs-hex/src/main/resources/application.yml
+++ b/zy-acs-hex/src/main/resources/application.yml
@@ -1,3 +1,5 @@
+server:
+ port: 8555
spring:
application:
name: rcs-hex
@@ -17,7 +19,7 @@
# direct:
# 纭鏈哄埗
# acknowledge-mode: manual
-
+# --add-opens java.base/java.nio=ALL-UNNAMED
influxdb3:
enabled: true
url: http://127.0.0.1:8181
--
Gitblit v1.9.1