From 675c3b5d83b928c2bfbb84cd99a7d3f222d4432c Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期四, 05 三月 2026 10:18:16 +0800
Subject: [PATCH] 1
---
zy-acs-hex/src/main/java/com/zy/acs/hex/consumer/UpMessageListener.java | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
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
index 1c894d8..377f6c7 100644
--- 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
@@ -1,11 +1,11 @@
package com.zy.acs.hex.consumer;
import com.rabbitmq.client.Channel;
+import com.zy.acs.common.domain.mq.DeviceMessage;
import com.zy.acs.hex.constant.InfluxDBConstant;
import com.zy.acs.hex.constant.RabbitConstant;
import com.zy.acs.hex.consumer.listener.AbstractListener;
-import com.zy.acs.hex.domain.Device;
-import com.zy.acs.hex.utils.ReflectionUtils;
+import com.zy.acs.hex.utils.ObjectToMapUtils;
import com.zy.acs.hex.utils.StrUtils;
import com.zy.component.influxdb.service.InfluxDBService;
import lombok.extern.slf4j.Slf4j;
@@ -31,11 +31,10 @@
@Autowired
private InfluxDBService influxDBService;
-
@RabbitHandler
- public void handle(Device msg, @Header(AmqpHeaders.RECEIVED_ROUTING_KEY) String routingKey, Channel channel) {
+ public void handle(DeviceMessage msg, @Header(AmqpHeaders.RECEIVED_ROUTING_KEY) String routingKey, Channel channel) {
log.info("routingKey:{},receive up message:{}", routingKey, msg);
- influxDBService.writeData(InfluxDBConstant.DEVICE_MEASUREMENT, StrUtils.getTagsByRoutingKey(routingKey), ReflectionUtils.convertBean2Map(msg));
+ influxDBService.writeData(InfluxDBConstant.DEVICE_MEASUREMENT, StrUtils.getTagsByRoutingKey(routingKey), ObjectToMapUtils.objectToMap(msg, false), msg.getTimestamp());
}
--
Gitblit v1.9.1