From 597cae7743fde0ca86efb4659a2ded937fc308ae Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 19 一月 2021 00:32:28 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity

---
 service-job/src/main/java/com/java110/job/adapt/hcIot/machine/AddMachineToIotAdapt.java |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/service-job/src/main/java/com/java110/job/adapt/hcIot/machine/AddMachineToIotAdapt.java b/service-job/src/main/java/com/java110/job/adapt/hcIot/machine/AddMachineToIotAdapt.java
index e9c6628..d703781 100644
--- a/service-job/src/main/java/com/java110/job/adapt/hcIot/machine/AddMachineToIotAdapt.java
+++ b/service-job/src/main/java/com/java110/job/adapt/hcIot/machine/AddMachineToIotAdapt.java
@@ -77,6 +77,7 @@
     @Autowired
     private IFileInnerServiceSMO fileInnerServiceSMOImpl;
 
+
     /**
      * accessToken={access_token}
      * &extCommunityUuid=01000
@@ -122,19 +123,35 @@
 
         Assert.listOnlyOne(machineDtos, "鏈壘鍒拌澶�");
 
+        CommunityLocationDto communityLocationDto = new CommunityLocationDto();
+        communityLocationDto.setLocationId(machineDtos.get(0).getLocationTypeCd());
+        communityLocationDto.setCommunityId(machineDtos.get(0).getCommunityId());
+        List<CommunityLocationDto> communityLocationDtos = communityLocationInnerServiceSMOImpl.queryCommunityLocations(communityLocationDto);
+
+        Assert.listOnlyOne(communityLocationDtos, "璁惧浣嶇疆涓嶅瓨鍦�");
+
         String hmId = getHmId(machineDtos.get(0));
 
-        List<JSONObject> ownerDtos = getOwners(machinePo);
+        List<JSONObject> ownerDtos = null;
+        if (MachineDto.MACHINE_TYPE_ACCESS_CONTROL.equals(machineDtos.get(0).getMachineTypeCd())) {
+            ownerDtos = getOwners(machinePo);
+        } else {
+            ownerDtos = new ArrayList<>();
+        }
 
         JSONObject postParameters = new JSONObject();
 
         postParameters.put("machineCode", machinePo.getMachineCode());
         postParameters.put("machineName", machinePo.getMachineName());
+        postParameters.put("machineVersion", machinePo.getMachineVersion());
         postParameters.put("machineTypeCd", machinePo.getMachineTypeCd());
+        postParameters.put("locationType", communityLocationDtos.get(0).getLocationType());
+        postParameters.put("locationObjId", machineDtos.get(0).getLocationObjId());
         postParameters.put("extMachineId", machineDtos.get(0).getMachineId());
         postParameters.put("extCommunityId", machinePo.getCommunityId());
         postParameters.put("machineIp", machinePo.getMachineIp());
         postParameters.put("machineMac", machinePo.getMachineMac());
+        postParameters.put("direction", machinePo.getDirection());
         postParameters.put("hmId", hmId);
         hcMachineAsynImpl.addMachine(postParameters, ownerDtos);
     }
@@ -191,6 +208,9 @@
             ownerDto.setRoomId(machinePo.getLocationObjId());
             owners = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto);
         }
+        if (owners == null) {
+            return ownerDtos;
+        }
 
         for (OwnerDto tOwnerDto : owners) {
             FileRelDto fileRelDto = new FileRelDto();

--
Gitblit v1.8.0