java110
2021-10-19 3c821b3c5469ac5fc4660d33c3b998fb9005e889
service-job/src/main/java/com/java110/job/adapt/hcIot/machine/AddMachineToIotAdapt.java
old mode 100644 new mode 100755
@@ -18,7 +18,7 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.dto.RoomDto;
import com.java110.dto.communityLocation.CommunityLocationDto;
import com.java110.dto.community.CommunityLocationDto;
import com.java110.dto.file.FileDto;
import com.java110.dto.file.FileRelDto;
import com.java110.dto.machine.MachineAttrDto;
@@ -132,7 +132,12 @@
        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();
@@ -146,6 +151,7 @@
        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);
    }
@@ -201,6 +207,20 @@
        } else if ("3000".equals(communityLocationDto.getLocationType())) {// 3000 房屋门
            ownerDto.setRoomId(machinePo.getLocationObjId());
            owners = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto);
        }else if ("6000".equals(communityLocationDto.getLocationType())) {// 3000 房屋门
            //先根据单元门ID 查询 房屋
            RoomDto roomDto = new RoomDto();
            roomDto.setFloorId(machinePo.getLocationObjId());
            roomDto.setCommunityId(machinePo.getCommunityId());
            List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
            if (roomDtos == null || roomDtos.size() == 0) { // 楼栋下没有房屋
                return ownerDtos;
            }
            ownerDto.setRoomIds(getRoomIds(roomDtos));
            owners = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto);
        }
        if (owners == null) {
            return ownerDtos;
        }
        for (OwnerDto tOwnerDto : owners) {
@@ -229,6 +249,7 @@
            postParameters.put("machineCode", machinePo.getMachineCode());
            postParameters.put("extMachineId", machinePo.getMachineId());
            postParameters.put("extCommunityId", machinePo.getCommunityId());
            postParameters.put("attrs",tOwnerDto.getOwnerAttrDtos());
            ownerDtos.add(postParameters);
        }