Browse Source

模型修改设备元空间bug修复

linhuili 3 years ago
parent
commit
c45783a367

+ 37 - 6
src/main/java/com/persagy/proxy/dictionary/service/impl/AdmModelRelServiceImpl.java

@@ -145,8 +145,18 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
 
         //查询模型下的设备信息
         AdmQueryCriteria criteria = new AdmQueryCriteria();
-        criteria.setFilters("bimId = '"+modelRel.getBimId()+"'");
-        criteria.setFilters("floorId = '"+modelRel.getFloorId()+"'");
+        StringBuilder filters = new StringBuilder();
+        if(StringUtils.isNotEmpty(modelRel.getBimId())){
+            filters.append("bimId contain '"+modelRel.getBimId()+"%'");
+        }
+        /*if(StringUtils.isNotEmpty(modelRel.getFloorId())){
+            if(filters != null && filters.length()>0){
+                filters.append(" ; ");
+            }
+            filters.append("floorId = '"+modelRel.getFloorId()+"'");
+        }*/
+        criteria.setFilters(filters.toString());
+        criteria.setName("equipment");
         AdmResponse admResponse = equipmentService.query(criteria);
         List<AdmEquipment> content = (List<AdmEquipment>) admResponse.getContent();
         if(CollUtil.isEmpty(content)){
@@ -169,8 +179,18 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
 
         //查询模型下的元空间信息
         AdmQueryCriteria criteria = new AdmQueryCriteria();
-        criteria.setFilters("bimId = '"+modelRel.getBimId()+"'");
-        criteria.setFilters("floorId = '"+modelRel.getFloorId()+"'");
+        StringBuilder filters = new StringBuilder();
+        if(StringUtils.isNotEmpty(modelRel.getBimId())){
+            filters.append("bimId contain '"+modelRel.getBimId()+"%'");
+        }
+        /*if(StringUtils.isNotEmpty(modelRel.getFloorId())){
+            if(filters != null && filters.length()>0){
+                filters.append(" ; ");
+            }
+            filters.append("floorId = '"+modelRel.getFloorId()+"'");
+        }*/
+        criteria.setName("ispace");
+        criteria.setFilters(filters.toString());
         AdmResponse admResponse = iSpaceService.doQuery(context, criteria, AdmISpace.class);
         List<AdmISpace> content = (List<AdmISpace>) admResponse.getContent();
         if(CollUtil.isEmpty(content)){
@@ -308,6 +328,7 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
     private List<AdmEquipment> queryEquipmentByBimId(InstanceUrlParam context, AdmModelRel vo){
         AdmQueryCriteria criteria = new AdmQueryCriteria();
         criteria.setFilters("bimId = '"+vo.getOldBimId()+"'");
+        criteria.setName("equipment");
         AdmResponse admResponse = equipmentService.query(criteria);
         return (List<AdmEquipment>)admResponse.getContent();
     }
@@ -319,6 +340,7 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
     private List<AdmISpace> queryIspaceByBimId(InstanceUrlParam context, AdmModelRel vo){
         AdmQueryCriteria criteria = new AdmQueryCriteria();
         criteria.setFilters("bimId = '"+vo.getOldBimId()+"'");
+        criteria.setName("ispace");
         AdmResponse admResponse = iSpaceService.doQuery(context, criteria, AdmISpace.class);
         return (List<AdmISpace>)admResponse.getContent();
     }
@@ -328,13 +350,22 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
      * 查询模型文件是否有楼层在使用
      */
     private List<AdmFloor> queryFloorEntity(InstanceUrlParam context, AdmModelRel vo){
+        if(StringUtils.isEmpty(vo.getModelId()) && StringUtils.isEmpty(vo.getFloorId())){
+            return new ArrayList<>();
+        }
         AdmQueryCriteria criteria = new AdmQueryCriteria();
+
+        StringBuilder filters = new StringBuilder();
         if(StringUtils.isNotEmpty(vo.getModelId())){
-            criteria.setFilters("modelId = '"+vo.getModelId()+"'");
+            filters.append("modelId = '"+vo.getModelId()+"'");
         }
         if(StringUtils.isNotEmpty(vo.getFloorId())){
-            criteria.setFilters("id = '"+vo.getFloorId()+"'");
+            if(filters != null && filters.length()>0){
+                filters.append(" ; ");
+            }
+            filters.append("id = '"+vo.getFloorId()+"'");
         }
+        criteria.setFilters(filters.toString());
         criteria.setName("floor");
         AdmResponse admResponse = floorService.doQuery(context, criteria, AdmFloor.class);
         return (List<AdmFloor>)admResponse.getContent();