From d35e2accdca4b3762359231f4fe479c9538b6f6f Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期四, 05 二月 2026 14:03:31 +0800
Subject: [PATCH] 1
---
zy-acs-hex/src/main/java/com/zy/acs/hex/controller/TestController.java | 36 ++++++
zy-acs-hex/src/main/java/com/zy/acs/hex/config/RabbitConfig.java | 31 +++++
zy-acs-hex/pom.xml | 7 +
component/component-Influxdb/target/classes/META-INF/spring-configuration-metadata.json | 6 +
component/component-Influxdb/src/main/java/com/zy/component/influxdb/properties/InfluxDBProperties.java | 2
component/component-Influxdb/target/classes/com/zy/component/influxdb/properties/InfluxDBProperties.class | 0
component/component-Influxdb/target/classes/com/zy/component/influxdb/config/InfluxDBAutoConfiguration.class | 0
component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java | 4
zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/UpMessageListener.java | 56 +++++++++
component/component-Influxdb/src/main/java/com/zy/component/influxdb/config/InfluxDBAutoConfiguration.java | 3
component/component-Influxdb/src/main/resources/META-INF/spring.factories | 3
zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/DownMessageListener.java | 44 +++++++
component/component-Influxdb/target/classes/META-INF/spring.factories | 3
zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/listener/AbstractListener.java | 9 +
component/component-Influxdb/target/maven-archiver/pom.properties | 3
zy-acs-hex/src/main/java/com/zy/acs/hex/HexApplication.java | 2
component/component-Influxdb/target/classes/META-INF/additional-spring-configuration-metadata.json | 10 +
component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst | 3
component/component-Influxdb/src/main/resources/META-INF/additional-spring-configuration-metadata.json | 10 +
component/component-Influxdb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst | 0
zy-acs-hex/src/main/java/com/zy/acs/hex/constant/RabbitConstant.java | 14 +-
/dev/null | 49 --------
zy-acs-hex/src/main/resources/application.yml | 20 +-
component/component-Influxdb/target/classes/com/zy/component/influxdb/service/InfluxDBService.class | 0
component/component-Influxdb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst | 0
zy-acs-cv/src/main/java/com/zy/core/operation/handler/InOperationHandler.java | 8
component/component-Influxdb/target/component-Influxdb-1.0.0.jar | 0
component/component-Influxdb/pom.xml | 5
component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst | 3
29 files changed, 246 insertions(+), 85 deletions(-)
diff --git a/component/component-Influxdb/pom.xml b/component/component-Influxdb/pom.xml
index c800944..909a0f6 100644
--- a/component/component-Influxdb/pom.xml
+++ b/component/component-Influxdb/pom.xml
@@ -42,11 +42,6 @@
<scope>runtime</scope>
<optional>true</optional>
</dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-configuration-processor</artifactId>
- <optional>true</optional>
- </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
diff --git a/component/component-Influxdb/src/main/java/com/zy/influxdb/config/InfluxDBAutoConfiguration.java b/component/component-Influxdb/src/main/java/com/zy/component/influxdb/config/InfluxDBAutoConfiguration.java
similarity index 90%
rename from component/component-Influxdb/src/main/java/com/zy/influxdb/config/InfluxDBAutoConfiguration.java
rename to component/component-Influxdb/src/main/java/com/zy/component/influxdb/config/InfluxDBAutoConfiguration.java
index 0daa6fc..33007d5 100644
--- a/component/component-Influxdb/src/main/java/com/zy/influxdb/config/InfluxDBAutoConfiguration.java
+++ b/component/component-Influxdb/src/main/java/com/zy/component/influxdb/config/InfluxDBAutoConfiguration.java
@@ -1,6 +1,7 @@
-package com.zy.influxdb.config;
+package com.zy.component.influxdb.config;
import com.influxdb.v3.client.InfluxDBClient;
+import com.zy.component.influxdb.properties.InfluxDBProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
diff --git a/component/component-Influxdb/src/main/java/com/zy/influxdb/config/InfluxDBProperties.java b/component/component-Influxdb/src/main/java/com/zy/component/influxdb/properties/InfluxDBProperties.java
similarity index 89%
rename from component/component-Influxdb/src/main/java/com/zy/influxdb/config/InfluxDBProperties.java
rename to component/component-Influxdb/src/main/java/com/zy/component/influxdb/properties/InfluxDBProperties.java
index 18f3259..5c0c693 100644
--- a/component/component-Influxdb/src/main/java/com/zy/influxdb/config/InfluxDBProperties.java
+++ b/component/component-Influxdb/src/main/java/com/zy/component/influxdb/properties/InfluxDBProperties.java
@@ -1,4 +1,4 @@
-package com.zy.influxdb.config;
+package com.zy.component.influxdb.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
diff --git a/component/component-Influxdb/src/main/java/com/zy/influxdb/service/InfluxDBService.java b/component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java
similarity index 95%
rename from component/component-Influxdb/src/main/java/com/zy/influxdb/service/InfluxDBService.java
rename to component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java
index df7edff..9010073 100644
--- a/component/component-Influxdb/src/main/java/com/zy/influxdb/service/InfluxDBService.java
+++ b/component/component-Influxdb/src/main/java/com/zy/component/influxdb/service/InfluxDBService.java
@@ -1,9 +1,8 @@
-package com.zy.influxdb.service;
+package com.zy.component.influxdb.service;
import com.influxdb.v3.client.InfluxDBClient;
import com.influxdb.v3.client.Point;
import com.influxdb.v3.client.write.WritePrecision;
-import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -58,6 +57,7 @@
try {
// 鎵ц鏌ヨ
Stream<Object[]> query = influxDBClient.query(sql);
+ logger.info("鏌ヨ鏁版嵁锛歿}", query);
// 杞崲涓� Map 鍒楄〃锛堜究浜庡悗缁鐞嗭級
List<Map<String, Object>> collect = query.map(record -> {
Map<String, Object> map = new LinkedHashMap<>();
diff --git a/component/component-Influxdb/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/component/component-Influxdb/src/main/resources/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000..878690e
--- /dev/null
+++ b/component/component-Influxdb/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "influxdb3.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Enables influxdb functionality.",
+ "defaultValue": "true"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/component/component-Influxdb/src/main/resources/META-INF/spring.factories b/component/component-Influxdb/src/main/resources/META-INF/spring.factories
index 4273c8f..d09d697 100644
--- a/component/component-Influxdb/src/main/resources/META-INF/spring.factories
+++ b/component/component-Influxdb/src/main/resources/META-INF/spring.factories
@@ -1,2 +1 @@
-com.zy.influxdb.service.InfluxDBService
-
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.zy.component.influxdb.service.InfluxDBService
diff --git a/component/component-Influxdb/target/classes/META-INF/additional-spring-configuration-metadata.json b/component/component-Influxdb/target/classes/META-INF/additional-spring-configuration-metadata.json
new file mode 100644
index 0000000..878690e
--- /dev/null
+++ b/component/component-Influxdb/target/classes/META-INF/additional-spring-configuration-metadata.json
@@ -0,0 +1,10 @@
+{
+ "properties": [
+ {
+ "name": "influxdb3.enabled",
+ "type": "java.lang.Boolean",
+ "description": "Enables influxdb functionality.",
+ "defaultValue": "true"
+ }
+ ]
+}
\ No newline at end of file
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
index b3ce3b2..bbfcdbc 100644
--- a/component/component-Influxdb/target/classes/META-INF/spring-configuration-metadata.json
+++ b/component/component-Influxdb/target/classes/META-INF/spring-configuration-metadata.json
@@ -14,6 +14,12 @@
"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",
diff --git a/component/component-Influxdb/target/classes/META-INF/spring.factories b/component/component-Influxdb/target/classes/META-INF/spring.factories
index 4273c8f..d09d697 100644
--- a/component/component-Influxdb/target/classes/META-INF/spring.factories
+++ b/component/component-Influxdb/target/classes/META-INF/spring.factories
@@ -1,2 +1 @@
-com.zy.influxdb.service.InfluxDBService
-
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.zy.component.influxdb.service.InfluxDBService
diff --git a/component/component-Influxdb/target/classes/com/zy/component/influxdb/config/InfluxDBAutoConfiguration.class b/component/component-Influxdb/target/classes/com/zy/component/influxdb/config/InfluxDBAutoConfiguration.class
new file mode 100644
index 0000000..165263d
--- /dev/null
+++ b/component/component-Influxdb/target/classes/com/zy/component/influxdb/config/InfluxDBAutoConfiguration.class
Binary files differ
diff --git a/component/component-Influxdb/target/classes/com/zy/component/influxdb/properties/InfluxDBProperties.class b/component/component-Influxdb/target/classes/com/zy/component/influxdb/properties/InfluxDBProperties.class
new file mode 100644
index 0000000..0350a05
--- /dev/null
+++ b/component/component-Influxdb/target/classes/com/zy/component/influxdb/properties/InfluxDBProperties.class
Binary files differ
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
new file mode 100644
index 0000000..e45e65f
--- /dev/null
+++ b/component/component-Influxdb/target/classes/com/zy/component/influxdb/service/InfluxDBService.class
Binary files differ
diff --git a/component/component-Influxdb/target/classes/com/zy/influxdb/base/BaseTemperature.class b/component/component-Influxdb/target/classes/com/zy/influxdb/base/BaseTemperature.class
deleted file mode 100644
index ecb6d81..0000000
--- a/component/component-Influxdb/target/classes/com/zy/influxdb/base/BaseTemperature.class
+++ /dev/null
Binary files differ
diff --git a/component/component-Influxdb/target/classes/com/zy/influxdb/config/InfluxDBAutoConfiguration.class b/component/component-Influxdb/target/classes/com/zy/influxdb/config/InfluxDBAutoConfiguration.class
deleted file mode 100644
index b9d457f..0000000
--- a/component/component-Influxdb/target/classes/com/zy/influxdb/config/InfluxDBAutoConfiguration.class
+++ /dev/null
Binary files differ
diff --git a/component/component-Influxdb/target/classes/com/zy/influxdb/config/InfluxDBProperties.class b/component/component-Influxdb/target/classes/com/zy/influxdb/config/InfluxDBProperties.class
deleted file mode 100644
index b57cddf..0000000
--- a/component/component-Influxdb/target/classes/com/zy/influxdb/config/InfluxDBProperties.class
+++ /dev/null
Binary files differ
diff --git a/component/component-Influxdb/target/classes/com/zy/influxdb/service/InfluxDBService.class b/component/component-Influxdb/target/classes/com/zy/influxdb/service/InfluxDBService.class
deleted file mode 100644
index c535a91..0000000
--- a/component/component-Influxdb/target/classes/com/zy/influxdb/service/InfluxDBService.class
+++ /dev/null
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
new file mode 100644
index 0000000..7490632
--- /dev/null
+++ b/component/component-Influxdb/target/component-Influxdb-1.0.0.jar
Binary files differ
diff --git a/component/component-Influxdb/target/maven-archiver/pom.properties b/component/component-Influxdb/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..d5a3eea
--- /dev/null
+++ b/component/component-Influxdb/target/maven-archiver/pom.properties
@@ -0,0 +1,3 @@
+artifactId=component-Influxdb
+groupId=com.zy
+version=1.0.0
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
new file mode 100644
index 0000000..3f0a789
--- /dev/null
+++ b/component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,3 @@
+com\zy\component\influxdb\service\InfluxDBService.class
+com\zy\component\influxdb\properties\InfluxDBProperties.class
+com\zy\component\influxdb\config\InfluxDBAutoConfiguration.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
new file mode 100644
index 0000000..548806c
--- /dev/null
+++ b/component/component-Influxdb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +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
diff --git a/component/component-Influxdb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/component/component-Influxdb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/component/component-Influxdb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
diff --git a/component/component-Influxdb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/component/component-Influxdb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/component/component-Influxdb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
diff --git a/zy-acs-cv/src/main/java/com/zy/core/operation/handler/InOperationHandler.java b/zy-acs-cv/src/main/java/com/zy/core/operation/handler/InOperationHandler.java
index 1512cee..08ccfd6 100644
--- a/zy-acs-cv/src/main/java/com/zy/core/operation/handler/InOperationHandler.java
+++ b/zy-acs-cv/src/main/java/com/zy/core/operation/handler/InOperationHandler.java
@@ -75,10 +75,10 @@
if (job != null) {
Integer workNo = staProtocol.getWorkNo();
Integer targetSta = inSta.getTargetSta();
-// staProtocol.setWorkNo(0);
-// staProtocol.setStaNo(0);
-// MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
-// Thread.sleep(1500L);
+ staProtocol.setWorkNo(0);
+ staProtocol.setStaNo(0);
+ MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
+ Thread.sleep(1500L);
staProtocol.setWorkNo(workNo);
staProtocol.setStaNo(targetSta);
boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
diff --git a/zy-acs-hex/pom.xml b/zy-acs-hex/pom.xml
index e35f5e7..95deb61 100644
--- a/zy-acs-hex/pom.xml
+++ b/zy-acs-hex/pom.xml
@@ -16,6 +16,8 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>2.5.3</spring-boot.version>
<fastjson.version>1.2.58</fastjson.version>
+ <!-- Dependency Versions -->
+ <influxdb-java.version>1.7.0</influxdb-java.version>
</properties>
@@ -25,6 +27,11 @@
<artifactId>acs-common</artifactId>
<version>1.0.0</version>
</dependency>
+ <dependency>
+ <groupId>com.zy</groupId>
+ <artifactId>component-Influxdb</artifactId>
+ <version>1.0.0</version>
+ </dependency>
<!-- SpringBoot Web -->
<dependency>
diff --git a/zy-acs-hex/src/main/java/com/zy/acs/hex/HexApplication.java b/zy-acs-hex/src/main/java/com/zy/acs/hex/HexApplication.java
index b69817d..483bede 100644
--- a/zy-acs-hex/src/main/java/com/zy/acs/hex/HexApplication.java
+++ b/zy-acs-hex/src/main/java/com/zy/acs/hex/HexApplication.java
@@ -3,7 +3,9 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+@ComponentScan(basePackages = {"com.zy.component","com.zy.acs"})
@SpringBootApplication
public class HexApplication {
diff --git a/zy-acs-hex/src/main/java/com/zy/acs/hex/config/MessageConverterConfig.java b/zy-acs-hex/src/main/java/com/zy/acs/hex/config/MessageConverterConfig.java
deleted file mode 100644
index 8830925..0000000
--- a/zy-acs-hex/src/main/java/com/zy/acs/hex/config/MessageConverterConfig.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.zy.acs.hex.config;
-
-
-import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
-import org.springframework.amqp.support.converter.MessageConverter;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * 娑堟伅杞崲鍣ㄩ厤缃紝鐢ㄤ簬娑堟伅鐨勫簭鍒楀寲鍜屽弽搴忓垪鍖�
- *
- * @author ken
- */
-@Configuration
-public class MessageConverterConfig {
-
- /**
- * 閰嶇疆Fastjson2娑堟伅杞崲鍣�
- *
- * @return 娑堟伅杞崲鍣�
- */
- @Bean
- public MessageConverter fastJsonMessageConverter() {
- return new Jackson2JsonMessageConverter();
- }
-}
diff --git a/zy-acs-hex/src/main/java/com/zy/acs/hex/config/RabbitConfig.java b/zy-acs-hex/src/main/java/com/zy/acs/hex/config/RabbitConfig.java
new file mode 100644
index 0000000..486003d
--- /dev/null
+++ b/zy-acs-hex/src/main/java/com/zy/acs/hex/config/RabbitConfig.java
@@ -0,0 +1,31 @@
+package com.zy.acs.hex.config;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Slf4j
+@Configuration
+public class RabbitConfig {
+
+ @Bean
+ public RabbitTemplate rabbitTemplate(CachingConnectionFactory connectionFactory) {
+ RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
+ rabbitTemplate.setConfirmCallback((correlationData, ack, cause) -> {
+ if (ack) {
+ log.info("娑堟伅鎴愬姛鍙戦�佸埌Exchange");
+ } else {
+ log.info("娑堟伅鍙戦�佸け璐ワ細" + cause);
+ }
+ });
+ // 涔熷彲浠ヨ缃繑鍥炵被鍨嬩负mandatory锛岃繖鏍峰綋娑堟伅鏃犳硶璺敱鍒颁换浣曢槦鍒楁椂锛屼細杩斿洖缁欑敓浜ц�呬竴涓狟asic.Return銆�
+ rabbitTemplate.setMandatory(true);
+ rabbitTemplate.setReturnCallback((message, replyCode, replyText, exchange, routingKey) -> {
+ log.info("娑堟伅鏃犳硶璺敱鍒伴槦鍒�: " + replyText);
+ });
+ return rabbitTemplate;
+ }
+
+}
diff --git a/zy-acs-hex/src/main/java/com/zy/acs/hex/config/RabbitMQConfig.java b/zy-acs-hex/src/main/java/com/zy/acs/hex/constant/RabbitConstant.java
similarity index 90%
rename from zy-acs-hex/src/main/java/com/zy/acs/hex/config/RabbitMQConfig.java
rename to zy-acs-hex/src/main/java/com/zy/acs/hex/constant/RabbitConstant.java
index 9431ade..ae2d002 100644
--- a/zy-acs-hex/src/main/java/com/zy/acs/hex/config/RabbitMQConfig.java
+++ b/zy-acs-hex/src/main/java/com/zy/acs/hex/constant/RabbitConstant.java
@@ -1,9 +1,4 @@
-package com.zy.acs.hex.config;
-
-
-import org.springframework.amqp.core.*;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
+package com.zy.acs.hex.constant;
/**
@@ -11,9 +6,12 @@
*
* @author ken
*/
-@Configuration
-public class RabbitMQConfig {
+public class RabbitConstant {
+
+ public static final String DURABLE = "true";
+
+ public static final String TOPIC_EXCHANGE_TYPE = "topic";
// ========================== 涓婚妯″紡 ==========================
/**
diff --git a/zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/DownMessageListener.java b/zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/DownMessageListener.java
new file mode 100644
index 0000000..d03084d
--- /dev/null
+++ b/zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/DownMessageListener.java
@@ -0,0 +1,44 @@
+package com.zy.acs.hex.consumer;
+
+import com.rabbitmq.client.Channel;
+import com.zy.acs.hex.constant.RabbitConstant;
+import com.zy.acs.hex.consumer.listener.AbstractListener;
+import com.zy.component.influxdb.service.InfluxDBService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.rabbit.annotation.*;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.amqp.support.AmqpHeaders;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.messaging.handler.annotation.Header;
+import org.springframework.stereotype.Component;
+
+/**
+ * 娑堣垂鑰�
+ */
+@Slf4j
+@Component
+@RabbitListener(bindings = @QueueBinding(
+ value = @Queue(name = RabbitConstant.TOPIC_QUEUE_DOWN, durable = RabbitConstant.DURABLE),
+ exchange = @Exchange(name = RabbitConstant.TOPIC_EXCHANGE,type = RabbitConstant.TOPIC_EXCHANGE_TYPE),
+ key = RabbitConstant.ROUTING_KEY_DOWN
+))
+public class DownMessageListener implements AbstractListener {
+
+
+
+ @Autowired
+ private RabbitTemplate rabbitTemplate;
+
+
+ @Autowired
+ private InfluxDBService influxDBService;
+
+
+ @RabbitHandler
+ public void handle(String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) {
+ log.info("receive down message: {}" , msg);
+
+ }
+
+
+}
diff --git a/zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/MessageListener.java b/zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/MessageListener.java
deleted file mode 100644
index 2068ce9..0000000
--- a/zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/MessageListener.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.zy.acs.hex.consumer;
-
-import com.zy.acs.hex.config.RabbitMQConfig;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.amqp.core.Message;
-import org.springframework.amqp.rabbit.annotation.Exchange;
-import org.springframework.amqp.rabbit.annotation.Queue;
-import org.springframework.amqp.rabbit.annotation.QueueBinding;
-import org.springframework.amqp.rabbit.annotation.RabbitListener;
-import org.springframework.amqp.support.AmqpHeaders;
-import org.springframework.boot.autoconfigure.amqp.RabbitProperties;
-import org.springframework.messaging.handler.annotation.Header;
-import org.springframework.stereotype.Component;
-
-import java.io.IOException;
-
-/**
- * 娑堣垂鑰�
- */
-@Slf4j
-@Component
-public class MessageListener {
-
- public static final String durable = "true";
-
- @RabbitListener(bindings = @QueueBinding(
- value = @Queue(name = RabbitMQConfig.TOPIC_QUEUE_UP, durable = durable),
- exchange = @Exchange(name = RabbitMQConfig.TOPIC_EXCHANGE),
- key = RabbitMQConfig.ROUTING_KEY_UP
- ))
- public void receiveFromUpData(Message message, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag, RabbitProperties.Cache.Channel channel) throws IOException {
- log.info("receive message: {}" + "msgId:" + message.getMessageProperties().getMessageId());
- // 杩涘叆娑堟伅娑堣垂涓氬姟閫昏緫銆�
- System.out.println("鏀跺埌娑堟伅锛�" + new String(message.getBody()));
-
- }
-
- @RabbitListener(bindings = @QueueBinding(
- value = @Queue(name = RabbitMQConfig.TOPIC_QUEUE_DOWN, durable = durable),
- exchange = @Exchange(name = RabbitMQConfig.TOPIC_EXCHANGE),
- key = RabbitMQConfig.ROUTING_KEY_DOWN
- ))
- public void receiveFromDownData(Message message, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag, RabbitProperties.Cache.Channel channel) throws IOException {
- log.info("receive message: {}" + "msgId:" + message.getMessageProperties().getMessageId());
- // 杩涘叆娑堟伅娑堣垂涓氬姟閫昏緫銆�
- System.out.println("鏀跺埌娑堟伅锛�" + new String(message.getBody()));
-
- }
-}
diff --git a/zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/UpMessageListener.java b/zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/UpMessageListener.java
new file mode 100644
index 0000000..5dc351c
--- /dev/null
+++ b/zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/UpMessageListener.java
@@ -0,0 +1,56 @@
+package com.zy.acs.hex.consumer;
+
+import com.rabbitmq.client.Channel;
+import com.zy.acs.hex.constant.RabbitConstant;
+import com.zy.acs.hex.consumer.listener.AbstractListener;
+import com.zy.component.influxdb.service.InfluxDBService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.rabbit.annotation.*;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.amqp.support.AmqpHeaders;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.messaging.handler.annotation.Header;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+
+/**
+ * 娑堣垂鑰�
+ */
+@Slf4j
+@Component
+@RabbitListener(bindings = @QueueBinding(
+ value = @Queue(name = RabbitConstant.TOPIC_QUEUE_UP, durable = RabbitConstant.DURABLE),
+ exchange = @Exchange(name = RabbitConstant.TOPIC_EXCHANGE, type = RabbitConstant.TOPIC_EXCHANGE_TYPE),
+ key = RabbitConstant.ROUTING_KEY_UP
+))
+public class UpMessageListener implements AbstractListener {
+
+
+
+ @Autowired
+ private RabbitTemplate rabbitTemplate;
+
+
+ @Autowired
+ private InfluxDBService influxDBService;
+
+
+ @RabbitHandler
+ public void handle(String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) {
+ log.info("receive up message: {}" , msg);
+ try {
+ channel.basicAck(tag,true);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ // 杩涘叆娑堟伅娑堣垂涓氬姟閫昏緫銆�
+ //String data = new String(message.getBody());
+ //log.info("鏀跺埌娑堟伅锛歿}" ,data );
+ //influxDBService.writeData();
+ }
+
+
+
+
+}
diff --git a/zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/listener/AbstractListener.java b/zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/listener/AbstractListener.java
new file mode 100644
index 0000000..2e1c4c4
--- /dev/null
+++ b/zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/listener/AbstractListener.java
@@ -0,0 +1,9 @@
+package com.zy.acs.hex.consumer.listener;
+
+import com.rabbitmq.client.Channel;
+import org.springframework.amqp.support.AmqpHeaders;
+import org.springframework.messaging.handler.annotation.Header;
+
+public interface AbstractListener {
+ void handle(String event, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag);
+}
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
new file mode 100644
index 0000000..d69d370
--- /dev/null
+++ b/zy-acs-hex/src/main/java/com/zy/acs/hex/controller/TestController.java
@@ -0,0 +1,36 @@
+package com.zy.acs.hex.controller;
+
+import com.zy.acs.hex.constant.RabbitConstant;
+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.*;
+
+@RestController
+@Slf4j
+@RequestMapping(value = "/message")
+public class TestController {
+
+ @Autowired
+ private RabbitTemplate rabbitTemplate;
+
+ /**
+ * 鍙戦�佹秷鎭痶est1
+ * @return
+ */
+ @GetMapping(value = "/test1")
+ public void sendTest1() {
+ String router = RabbitConstant.ROUTING_KEY_UP.replaceFirst("\\*", "1").replaceFirst("\\*", "2");
+ rabbitTemplate.convertAndSend(RabbitConstant.TOPIC_EXCHANGE,router,"1212321323");
+ }
+
+ /**
+ * 鍙戦�佹秷鎭痶est2
+ * @return
+ */
+ @GetMapping(value = "/test2")
+ public void sendTest2() {
+ rabbitTemplate.convertAndSend(RabbitConstant.TOPIC_EXCHANGE, RabbitConstant.ROUTING_KEY_DOWN, "qswaqsaasas");
+ }
+
+}
diff --git a/zy-acs-hex/src/main/resources/application.yml b/zy-acs-hex/src/main/resources/application.yml
index 4f44d2f..ec78f6f 100644
--- a/zy-acs-hex/src/main/resources/application.yml
+++ b/zy-acs-hex/src/main/resources/application.yml
@@ -6,22 +6,20 @@
rabbitmq:
host: localhost
port: 5672
- username: admin
- password: 123456
+ username: root
+ password: xltys1995
+ # 铏氭嫙host鍙互涓嶈缃紝榛樿/
virtual-host: /
# 鐢熶骇鑰呯‘璁ら厤缃�
publisher-confirm-type: correlated
publisher-returns: true
# 娑堣垂鑰呴厤缃�
listener:
- simple:
- # 鎵嬪姩纭妯″紡
- acknowledge-mode: manual
- # 娑堣垂鑰呯嚎绋嬫暟
- concurrency: 1
- # 鏈�澶ф秷璐硅�呯嚎绋嬫暟
- max-concurrency: 5
- # 姣忔浠庨槦鍒椾腑鑾峰彇鐨勬秷鎭暟閲�
- prefetch: 1
direct:
acknowledge-mode: manual
+
+influxdb3:
+ enabled: true
+ url: http://127.0.0.1:8181
+ token: apiv3_Jx1SvmBMV_kikGhc4eZJQbeGmNYN7KX1GdpoR9MClkKzMxSJ0MPKM_O2Xt3o1hVyRikMmlxZ_h9zfy6ybC5Idg
+ database: rcs
\ No newline at end of file
--
Gitblit v1.9.1