1
zhang
18 小时以前 49bd72038d6bae30a34c096f2cba8c5b11dbad8c
1
1个文件已删除
7个文件已修改
92 ■■■■■ 已修改文件
component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
component/component-Influxdb/target/classes/META-INF/spring-configuration-metadata.json 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
component/component-Influxdb/target/classes/com/zy/component/influxdb/service/InfluxDBService.class 补丁 | 查看 | 原始文档 | blame | 历史
component/component-Influxdb/target/component-Influxdb-1.0.0.jar 补丁 | 查看 | 原始文档 | blame | 历史
component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-hex/src/main/java/com/zy/acs/hex/controller/TestController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-hex/src/main/resources/application.yml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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();
component/component-Influxdb/target/classes/META-INF/spring-configuration-metadata.json
File was deleted
component/component-Influxdb/target/classes/com/zy/component/influxdb/service/InfluxDBService.class
Binary files differ
component/component-Influxdb/target/component-Influxdb-1.0.0.jar
Binary files differ
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
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
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;
    /**
     * 发送消息test1
@@ -42,4 +49,16 @@
        rabbitTemplate.convertAndSend(RabbitConstant.TOPIC_EXCHANGE, RabbitConstant.ROUTING_KEY_DOWN, "qswaqsaasas");
    }
    /**
     * 发送消息test2
     *
     * @return
     */
    @GetMapping(value = "/query")
    @ResponseBody
    public Object queryTest() {
       return influxDBService.queryData("select * from device order by time desc limit 10");
    }
}
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