Browse Source

调整http设备创建初始化

liuyaowen 1 năm trước cách đây
mục cha
commit
249a99aed2

+ 4 - 5
src/main/java/com/yunfeiyun/agmp/iots/core/manager/HttpManager.java

@@ -15,7 +15,6 @@ import org.springframework.stereotype.Component;
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Set;
 
 /**
@@ -28,7 +27,7 @@ public class HttpManager {
     private TypeCacheService typeCacheService;
 
     private HashMap<String, HttpClient> privateHttpClientByConnBid = new HashMap<>();
-    private HashMap<String, HttpClient> commonHttpClientByTypeCode = new HashMap<>();
+    private HashMap<String, HttpClient> commonHttpClientByTypeBid = new HashMap<>();
     private HashMap<String,IotDeviceconnResVo> iotDeviceconnResVoHashMap = new HashMap<>();
     private HashMap<String,Class<? extends HttpClient>> httpClinetClassMap = new HashMap<>();
 
@@ -60,14 +59,14 @@ public class HttpManager {
 
     }
     private void initCommonClient(IotDeviceconnResVo iotDeviceconnResVo ,JSONObject configJson){
-        if(null != commonHttpClientByTypeCode.get(iotDeviceconnResVo.getDevtypeCode())){
+        if(null != commonHttpClientByTypeBid.get(iotDeviceconnResVo.getDevtypeBid())){
             return;
         }
         HttpClient httpClient = initHttpClient(iotDeviceconnResVo,configJson);
         if(null == httpClient){
             return;
         }
-        commonHttpClientByTypeCode.put(iotDeviceconnResVo.getDevtypeCode(),httpClient);
+        commonHttpClientByTypeBid.put(iotDeviceconnResVo.getDevtypeBid(),httpClient);
         iotDeviceconnResVoHashMap.put(iotDeviceconnResVo.getDevconnBid(),iotDeviceconnResVo);
     }
     private void initPrivateClient(IotDeviceconnResVo iotDeviceconnResVo ,JSONObject configJson){
@@ -98,7 +97,7 @@ public class HttpManager {
     public HttpClient getHttpClientByDevice(IotDevice iotDevice){
         IotDeviceconnResVo iotDeviceconnResVo = iotDeviceconnResVoHashMap.get(iotDevice.getDevconnBid());
         if(IotDeviceconnTypeEnum.COMMON.getCode().equals(iotDeviceconnResVo.getDevconnType())){
-            return commonHttpClientByTypeCode.get(iotDevice.getDevtypeBid());
+            return commonHttpClientByTypeBid.get(iotDevice.getDevtypeBid());
         }else {
             return privateHttpClientByConnBid.get(iotDevice.getDevconnBid());
         }