Parcourir la source

return fee comment

java110 il y a 3 ans
Parent
commit
a4c75ff630

+ 13 - 6
service-job/src/main/java/com/java110/job/adapt/hcIot/machine/AddMachineToIotAdapt.java

@@ -127,12 +127,19 @@ public class AddMachineToIotAdapt extends DatabusAdaptImpl {
 
         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);
+        String locationType = "";
 
-        Assert.listOnlyOne(communityLocationDtos, "设备位置不存在");
+        if(MachineDto.MACHINE_TYPE_ATTENDANCE.equals(machineDtos.get(0).getMachineTypeCd())){
+            locationType = "5000";
+        }else {
+            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, "设备位置不存在");
+
+            locationType = communityLocationDtos.get(0).getLocationType();
+        }
 
         String hmId = getHmId(machineDtos.get(0));
 
@@ -149,7 +156,7 @@ public class AddMachineToIotAdapt extends DatabusAdaptImpl {
         postParameters.put("machineName", machinePo.getMachineName());
         postParameters.put("machineVersion", machinePo.getMachineVersion());
         postParameters.put("machineTypeCd", machinePo.getMachineTypeCd());
-        postParameters.put("locationType", communityLocationDtos.get(0).getLocationType());
+        postParameters.put("locationType", locationType);
         postParameters.put("locationObjId", machineDtos.get(0).getLocationObjId());
         postParameters.put("extMachineId", machineDtos.get(0).getMachineId());
         postParameters.put("extCommunityId", machinePo.getCommunityId());

+ 14 - 6
service-job/src/main/java/com/java110/job/adapt/hcIot/machine/ModifyMachineToIotAdapt.java

@@ -101,13 +101,21 @@ public class ModifyMachineToIotAdapt extends DatabusAdaptImpl {
         List<MachineDto> machineDtos = machineInnerServiceSMOImpl.queryMachines(machineDto);
 
         Assert.listOnlyOne(machineDtos, "未找到设备");
+        String locationType = "";
 
-        CommunityLocationDto communityLocationDto = new CommunityLocationDto();
-        communityLocationDto.setLocationId(machineDtos.get(0).getLocationTypeCd());
-        communityLocationDto.setCommunityId(machineDtos.get(0).getCommunityId());
-        List<CommunityLocationDto> communityLocationDtos = communityLocationInnerServiceSMOImpl.queryCommunityLocations(communityLocationDto);
+        if(MachineDto.MACHINE_TYPE_ATTENDANCE.equals(machineDtos.get(0).getMachineTypeCd())){
+            locationType = "5000";
+        }else {
+            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, "设备位置不存在");
+
+            locationType = communityLocationDtos.get(0).getLocationType();
+        }
 
-        Assert.listOnlyOne(communityLocationDtos, "设备位置不存在");
 
         String hmId = getHmId(machineDtos.get(0));
         JSONObject postParameters = new JSONObject();
@@ -116,7 +124,7 @@ public class ModifyMachineToIotAdapt extends DatabusAdaptImpl {
         postParameters.put("machineName", machinePo.getMachineName());
         postParameters.put("machineVersion", machinePo.getMachineVersion());
         postParameters.put("machineTypeCd", machinePo.getMachineTypeCd());
-        postParameters.put("locationType", communityLocationDtos.get(0).getLocationType());
+        postParameters.put("locationType", locationType);
         postParameters.put("locationObjId", machineDtos.get(0).getLocationObjId());
         postParameters.put("extMachineId", machineDtos.get(0).getMachineId());
         postParameters.put("extCommunityId", machinePo.getCommunityId());