Преглед на файлове

补充连接信息缓存

liuyaowen преди 1 година
родител
ревизия
07ed9b018b

+ 2 - 0
src/main/java/com/yunfeiyun/agmp/iots/core/manager/ConnectionManager.java

@@ -47,6 +47,7 @@ public class ConnectionManager {
     @Resource
     private DeviceconnCacheService deviceconnCacheService;
 
+
     /**
      * 加载数据库设备配置
      *
@@ -58,6 +59,7 @@ public class ConnectionManager {
         List<IotDeviceconnResVo> iotDeviceConnResVoList = businessCoreService.selectTosDevicetypeResVoList();
         log.info("【初始化】设备型号 构建链接 协议: {}个", iotDeviceConnResVoList.size());
         for (IotDeviceconnResVo iotDeviceconnResVo : iotDeviceConnResVoList) {
+            deviceconnCacheService.setCache(iotDeviceconnResVo);
             log.info("【初始化】【开始】协议加载,连接名称:{},厂家:{},类型:{} ,配置:{}", iotDeviceconnResVo.getDevconnName(),iotDeviceconnResVo.getFirmName(), iotDeviceconnResVo.getDevtypeBid(), iotDeviceconnResVo.getDevconnConfig());
             //将配置信息转换成jsonObject,这是个数组
             JSONArray jsonConfig = parseConfigJson(iotDeviceconnResVo.getDevconnConfig());

+ 8 - 3
src/main/java/com/yunfeiyun/agmp/iots/device/common/DeviceAbstractImpl.java

@@ -3,34 +3,39 @@ package com.yunfeiyun.agmp.iots.device.common;
 import com.alibaba.fastjson2.JSONObject;
 import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
 import com.yunfeiyun.agmp.iot.common.model.cmd.CmdModel;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
 /**
- * @author 123
+ * @author liuyaowen
  */
-@Service
+@Slf4j
 public  abstract class DeviceAbstractImpl implements Device{
     @Override
     public Object sendCmd(CmdModel cmdModel) throws Exception {
+        log.error("此类型设备未实现发送设备指令接口");
         return null;
     }
 
     @Override
     public Object receiveData(String topic, JSONObject cmdJson, String connectionId) throws Exception {
+        log.error("此类型设备未实现接收设备数据接口");
         return null;
     }
 
     @Override
     public boolean isDeviceProps(JSONObject cmdJson) {
+        log.error("此类型设备未实现配置信息判定接口");
         return false;
     }
 
     @Override
     public IotDevice findIotDevice(String topic, JSONObject jobjMsg, String connectionId) {
+        log.error("此类型设备未实现根据topi查询设备接口");
         return null;
     }
     @Override
     public void sysAllDevice(){
-
+        log.error("此类型设备未实现同步所有设备数据接口");
     }
 }

+ 0 - 1
src/main/java/com/yunfeiyun/agmp/iots/device/common/HttpDeviceAbstractImpl.java

@@ -6,5 +6,4 @@ import org.springframework.stereotype.Service;
 @Slf4j
 @Service
 public abstract class HttpDeviceAbstractImpl extends DeviceAbstractImpl implements HttpDevice{
-
 }

+ 3 - 3
src/main/java/com/yunfeiyun/agmp/iots/mq/listener/IotmBaseDataChannelAwareMessageListener.java

@@ -11,6 +11,7 @@ import com.yunfeiyun.agmp.iot.common.domain.IotDeviceconn;
 import com.yunfeiyun.agmp.iot.common.model.cmd.CmdGroupModel;
 import com.yunfeiyun.agmp.iot.common.model.cmd.CmdModel;
 import com.yunfeiyun.agmp.iot.common.model.mq.IotDeviceEditMqModel;
+import com.yunfeiyun.agmp.iot.common.service.DeviceconnCacheService;
 import com.yunfeiyun.agmp.iot.common.service.TypeCacheService;
 import com.yunfeiyun.agmp.iots.core.cmd.core.CmdDispatcherService;
 import com.yunfeiyun.agmp.iots.core.manager.ConnectionManager;
@@ -94,14 +95,13 @@ public class IotmBaseDataChannelAwareMessageListener implements ChannelAwareMess
                         break;
                     //更新所有设备信息
                     case DEVICE_ALL_SYN:
-                        Device device = SpringUtils.getBean(typeCacheService.getServiceNameByDevTypeCode(synGlobalTenantInfoDto.getData().toString()));
+                        Device device = SpringUtils.getBean(typeCacheService.getServiceNameByDevTypeCode(synGlobalTenantInfoDto.getData().getString("devTypeCode")));
+                        device.sysAllDevice();
                         break;
                     //测报灯重新识别
                     case DEVICE_CBD_AGAIN_RECORD:
                         iotCbdImgService.iotmAgainRecog(synGlobalTenantInfoDto.getData().toString());
                         break;
-
-
                     default:
                         break;
                 }