Pārlūkot izejas kodu

feat:
传输设备信息

18339543638 2 gadi atpakaļ
vecāks
revīzija
bd79005146

+ 6 - 11
nb-admin/src/main/resources/application-dev.yml

@@ -30,7 +30,7 @@ spring:
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
     driverClassName: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://192.168.100.32:3307/nbnetpump?useUnicode=true&createDatabaseIfNotExist=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true
+    url: jdbc:mysql://192.168.100.32:3307/nbnetpump?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true
     username: root
     password: 123456
     druid:
@@ -56,7 +56,7 @@ spring:
         # 通过别名的方式配置扩展插件,多个英文逗号分隔,常用的插件有:
         # 监控统计用的filter:stat
         # 日志用的filter:log4j2
-        # 防御sql注入的filter:wall
+      # 防御sql注入的filter:wall
       filters: stat,wall,lo4j2 #log4j
       webStatFilter:
         enabled: true
@@ -82,9 +82,9 @@ spring:
   redis:
     # 地址
     host: 192.168.100.32
-      # 端口,默认为6379
+    # 端口,默认为6379
     port: 9736
-      # 数据库索引
+    # 数据库索引
     database: 6
     # 密码
     password: 6E6985E1F7CB40F24A\.
@@ -100,11 +100,6 @@ spring:
         max-active: 16
         # #连接池最大阻塞等待时间(使用负值表示没有限制)
         max-wait: -1ms
-  rabbitmq:
-    username: guest
-    host: 192.168.100.32
-    port: 5672
-    password: guest
 request:
   check:
     enable: false
@@ -132,7 +127,7 @@ request:
 aliyun:
   accessKey: "LTAI4G7FA9ytMc76oNkJ45YJ"
   accessSecret: "R7hOvMfiHb0PYroDqUDXAYgB9htQss"
-  consumerGroupId: "NZKDBbvhxUqtcF5VqDb2000100"
+  consumerGroupId: "Un44crQ5EQB121syWzFz000100"
   aliyunUid: "1238892013759131"
   regionId: "cn-shanghai"
   # iotInstanceId:企业版实例请填写实例ID,公共实例请填空字符串""。
@@ -140,7 +135,7 @@ aliyun:
   server-subscription:
     enable: true  # 是否开启阿里云物联网服务端订阅
   product:
-    productKey: he1fACg7ySx
+    productKey: he1fy3RqSr0
 
 oss:
   aliyun:

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 433 - 433
nb-admin/src/main/resources/db/migration/V1_init_20230802.sql


+ 5 - 2
nb-service/iot-service/src/main/java/com/nb/aliyun/service/process/DeviceMsgHandler.java

@@ -2,6 +2,7 @@ package com.nb.aliyun.service.process;
 
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.spring.SpringUtil;
 import cn.hutool.json.JSONUtil;
 import com.nb.aliyun.service.AliIotConstant;
 import com.nb.aliyun.service.bean.AliIotMessagePojo;
@@ -13,6 +14,7 @@ import com.nb.web.api.feign.result.HospitalResult;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 import java.util.List;
 
@@ -45,7 +47,7 @@ public class DeviceMsgHandler {
             BusDeviceEntity device = message.getDevice();
             //分发数据
             if(aliIot){
-                distributeIotMsg(message, ObjectUtil.isNull(device)?null:device.getTenantId());
+                SpringUtil.getBean(DeviceMsgHandler.class).distributeIotMsg(message, ObjectUtil.isNull(device)?null:device.getTenantId());
             }else {
                 deviceService.saveDevice(device);
             }
@@ -63,7 +65,8 @@ public class DeviceMsgHandler {
      * 向本地服务器分发数据
      * @param msg
      */
-    private void distributeIotMsg(AliIotMessagePojo msg,String tenantId){
+    @Async
+    public void distributeIotMsg(AliIotMessagePojo msg,String tenantId){
         if(StrUtil.isNullOrUndefined(tenantId)){
             return;
         }

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels