Commit 5620cc23 authored by 高建强's avatar 高建强

item:【装备】修改iot指标解析,traceId赋值

parent a0260da6
...@@ -228,18 +228,34 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -228,18 +228,34 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
JSONObject json = JSONObject.parseObject(message); JSONObject json = JSONObject.parseObject(message);
Iterator it = json.entrySet().iterator(); Iterator it = json.entrySet().iterator();
List<IotDataVO> iotDatalist = new ArrayList<IotDataVO>(); List<IotDataVO> iotDatalist = new ArrayList<IotDataVO>();
String traceId = "";
while (it.hasNext()) { while (it.hasNext()) {
IotDataVO iotDataVO = new IotDataVO(); IotDataVO iotDataVO = new IotDataVO();
Map.Entry<String, Object> entry = (Map.Entry<String, Object>) it.next(); Map.Entry<String, Object> entry = (Map.Entry<String, Object>) it.next();
iotDataVO.setKey(entry.getKey()); String key = entry.getKey();
iotDataVO.setValue(entry.getValue()); Object value = entry.getValue();
iotDataVO.setKey(key);
iotDataVO.setValue(value);
if ("traceId".equalsIgnoreCase(key)) {
traceId = value.toString();
continue;
}
iotDatalist.add(iotDataVO); iotDatalist.add(iotDataVO);
} }
if (ObjectUtils.isEmpty(iotDatalist)) { if (ObjectUtils.isEmpty(iotDatalist)) {
return; return;
} }
log.info(String.format("收到mqtt消息:%s", message)); log.info(String.format("收到mqtt消息:%s", message));
realTimeDateProcessing(topicEntity, iotDatalist); if (!StringUtils.isEmpty(traceId)) {
String finalTraceId = traceId;
List<IotDataVO> collect = iotDatalist.stream().map(x -> {
x.setTraceId(finalTraceId);
return x;
}).collect(Collectors.toList());
realTimeDateProcessing(topicEntity, collect);
} else {
realTimeDateProcessing(topicEntity, iotDatalist);
}
} }
/** /**
......
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://39.98.246.31/dl_business_v3.0.1.3?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai spring.datasource.url = jdbc:mysql://172.16.11.201/dl_business_v3.0.1.3?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=Yeejoin@2020 spring.datasource.password=Yeejoin@2020
spring.datasource.type=com.zaxxer.hikari.HikariDataSource spring.datasource.type=com.zaxxer.hikari.HikariDataSource
...@@ -14,10 +14,10 @@ spring.datasource.hikari.connection-test-query= SELECT 1 ...@@ -14,10 +14,10 @@ spring.datasource.hikari.connection-test-query= SELECT 1
# \u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740 # \u6587\u4EF6\u670D\u52A1\u5668\u5730\u5740
fileserver_domain=http://39.98.45.134:9000/ fileserver_domain=http://172.16.11.201:9000/
#eureka.instance.ip-address= 172.16.3.135 #eureka.instance.ip-address= 172.16.3.135
eureka.instance.hostname= 39.98.246.31 eureka.instance.hostname= 172.16.11.201
eureka.instance.prefer-ip-address = true eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/ eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
...@@ -33,9 +33,9 @@ security.appKeyApp=studio_normalapp_3056965 ...@@ -33,9 +33,9 @@ security.appKeyApp=studio_normalapp_3056965
spring.redis.database=1 spring.redis.database=1
spring.redis.host=39.98.246.31 spring.redis.host=172.16.11.201
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=yeejoin@2020 spring.redis.password=1234560
spring.redis.lettuce.pool.max-active=200 spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1 spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10 spring.redis.lettuce.pool.max-idle=10
...@@ -45,10 +45,10 @@ spring.redis.expire.time=30000 ...@@ -45,10 +45,10 @@ spring.redis.expire.time=30000
## emqx ## emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://39.98.246.31:1883 emqx.broker=tcp://172.16.11.201:1883
emqx.user-name=admin emqx.user-name=admin
emqx.password=public emqx.password=public
mqtt.scene.host=mqtt://39.98.246.31:8083/mqtt mqtt.scene.host=mqtt://172.16.11.201:8083/mqtt
mqtt.client.product.id=mqtt mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000 spring.mqtt.completionTimeout=3000
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment