浏览代码

处理多个关系查询,未明确楼层等情况

lvxianyun 3 年之前
父节点
当前提交
0af8f689c6

+ 13 - 11
src/main/java/com/persagy/proxy/object/service/impl/AdmEquipmentServiceImpl.java

@@ -168,17 +168,19 @@ public class AdmEquipmentServiceImpl extends AbstractAdmBaseServiceImpl<AdmEquip
             return;
         }
         if (criteria.has("floorId")){
-            // 有建筑id过滤
-            ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
-            ObjectNode relationFrom = objectMapper.createObjectNode();
-            relationFrom.put("graphCode", GraphCodeEnum.MechInArch.name());
-            relationFrom.put("relCode", RelCodeEnum.Eq2Fl.name());
-            relationFrom.set("objTo",criteria.get("floorId"));
-            criteria.set("relationFrom",relationFrom);
-            criteria.remove("floorId");
-            if (criteria.has("buildingId"))
-                criteria.remove("buildingId");
-            return;
+            // 有楼层id过滤
+            if(!criteria.get("floorId").toString().contains("$null")){
+                ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+                ObjectNode relationFrom = objectMapper.createObjectNode();
+                relationFrom.put("graphCode", GraphCodeEnum.MechInArch.name());
+                relationFrom.put("relCode", RelCodeEnum.Eq2Fl.name());
+                relationFrom.set("objTo",criteria.get("floorId"));
+                criteria.set("relationFrom",relationFrom);
+                criteria.remove("floorId");
+                if (criteria.has("buildingId"))
+                    criteria.remove("buildingId");
+                return;
+            }
         }
         if (criteria.has("buildingId")){
             // 有建筑id过滤

+ 12 - 10
src/main/java/com/persagy/proxy/object/service/impl/AdmSpaceServiceImpl.java

@@ -382,16 +382,18 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
         
         ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
         if (criteria.has("floorId")){
-            // 有建筑id过滤
-            ObjectNode relationTo = objectMapper.createObjectNode();
-            relationTo.put("graphCode", GraphCodeEnum.ArchSubset.name());
-            relationTo.put("relCode", RelCodeEnum.Fl2Sp.name());
-            relationTo.set("objFrom",criteria.get("floorId"));
-            criteria.set("relationTo",relationTo);
-            criteria.remove("floorId");
-            if (criteria.has("buildingId"))
-                criteria.remove("buildingId");
-            return;
+            // 有楼层id过滤
+            if(!criteria.get("floorId").toString().contains("$null")) {
+                ObjectNode relationTo = objectMapper.createObjectNode();
+                relationTo.put("graphCode", GraphCodeEnum.ArchSubset.name());
+                relationTo.put("relCode", RelCodeEnum.Fl2Sp.name());
+                relationTo.set("objFrom", criteria.get("floorId"));
+                criteria.set("relationTo", relationTo);
+                criteria.remove("floorId");
+                if (criteria.has("buildingId"))
+                    criteria.remove("buildingId");
+                return;
+            }
         }
         if (criteria.has("buildingId")){
             // 有建筑id过滤

+ 13 - 13
src/main/java/com/persagy/proxy/object/service/impl/AdmSystemServiceImpl.java

@@ -3,7 +3,6 @@ package com.persagy.proxy.object.service.impl;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
@@ -32,7 +31,6 @@ import com.persagy.proxy.object.service.IAdmFloorService;
 import com.persagy.proxy.object.service.IAdmSystemService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -113,17 +111,19 @@ public class AdmSystemServiceImpl extends AbstractAdmBaseServiceImpl<AdmSystem>
             return;
         }
         if (criteria.has("floorId")){
-            // 有建筑id过滤
-            ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
-            ObjectNode relationFrom = objectMapper.createObjectNode();
-            relationFrom.put("graphCode", GraphCodeEnum.MechInArch.name());
-            relationFrom.put("relCode", RelCodeEnum.Sy2Fl.name());
-            relationFrom.set("objTo",criteria.get("floorId"));
-            criteria.set("relationFrom",relationFrom);
-            criteria.remove("floorId");
-            if (criteria.has("buildingId"))
-                criteria.remove("buildingId");
-            return;
+            // 有楼层id过滤
+            if(!criteria.get("floorId").toString().contains("$null")){
+                ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+                ObjectNode relationFrom = objectMapper.createObjectNode();
+                relationFrom.put("graphCode", GraphCodeEnum.MechInArch.name());
+                relationFrom.put("relCode", RelCodeEnum.Sy2Fl.name());
+                relationFrom.set("objTo",criteria.get("floorId"));
+                criteria.set("relationFrom",relationFrom);
+                criteria.remove("floorId");
+                if (criteria.has("buildingId"))
+                    criteria.remove("buildingId");
+                return;
+            }
         }
         if (criteria.has("buildingId")){
             // 有建筑id过滤