|
|
@@ -2,7 +2,7 @@ package com.nb.aliyun.service.process;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
-import cn.hutool.json.JSONObject;
|
|
|
+import cn.hutool.extra.spring.SpringUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.nb.aliyun.service.AliIotConstant;
|
|
|
import com.nb.aliyun.service.bean.AliIotMessagePojo;
|
|
|
@@ -14,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;
|
|
|
|
|
|
@@ -46,7 +47,9 @@ 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);
|
|
|
}
|
|
|
doProcessMessage(message,ObjectUtil.isNull(device)?null:device.getTenantId());
|
|
|
} catch (Exception e) {
|
|
|
@@ -62,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;
|
|
|
}
|