Browse Source

fix:空间查询优化

lvxianyun 3 years ago
parent
commit
b678754c9d

+ 1 - 0
src/main/java/com/persagy/proxy/adm/service/IAdmSpaceService.java

@@ -70,4 +70,5 @@ public interface IAdmSpaceService extends IAdmBaseService<AdmSpace>{
      * @return
      */
     Map<String, Set<String>> queryTrafficSpaceMap(InstanceUrlParam context, Iterable<String> spaceIds, String spaceType);
+    void ensureSpecialValues(InstanceUrlParam context, List<AdmSpace> vos);
 }

+ 20 - 6
src/main/java/com/persagy/proxy/adm/service/impl/AdmSpaceServiceImpl.java

@@ -13,10 +13,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.digital.entity.ObjectRelation;
-import com.persagy.proxy.adm.model.AdmDCSQueryRequest;
-import com.persagy.proxy.adm.model.AdmEquipment;
-import com.persagy.proxy.adm.model.AdmFloor;
-import com.persagy.proxy.adm.model.AdmSpace;
+import com.persagy.proxy.adm.model.*;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmEquipmentService;
@@ -172,11 +169,28 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
         }
 
         AdmResponse response = doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmSpace.class);
-        // 空间需要补充分类名称属性
-        equipmentService.ensureSpecialValues(context, (List<AdmEquipment>) response.getContent());
+        //空间需要补充分类名称属性
+        ensureSpecialValues(context, (List<AdmSpace>) response.getContent());
         return response;
     }
 
+    @Override
+    public void ensureSpecialValues(InstanceUrlParam context, List<AdmSpace> vos) {
+        if(CollUtil.isEmpty(vos)) {
+            return;
+        }
+        // 给系统赋值 - 同时收集设备对象,扩展设备对象赋值
+        List<AdmEquipment> equipmentList = new ArrayList<>();
+        for(AdmSpace vo:vos) {
+            // 收集设备对象
+            if(CollUtil.isEmpty(vo.getEquipment())) {
+                continue;
+            }
+            equipmentList.addAll(vo.getEquipment());
+        }
+        // 对象扩展属性赋值
+        equipmentService.ensureSpecialValues(context, equipmentList);
+    }
 
     @Override
     public List<AdmSpace> querySpaceInShaft(InstanceUrlParam context, String shaftId, String spaceType) {