Browse Source

space/query 获取不到空间

lvxianyun 3 years ago
parent
commit
178f531740

+ 20 - 30
src/main/java/com/persagy/proxy/object/service/impl/AdmSpaceServiceImpl.java

@@ -140,44 +140,41 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
         }else{
             request.setFilters(filters+"; "+classCodeFilter);
         }
+        AdmResponse response = null;
         if(StrUtil.isNotEmpty(request.getBuildingId()) && StrUtil.isNotEmpty(request.getFloorId()) && !request.getFloorId().equals("isnull")){
             //明确建筑,明确楼层
-            /*ObjectNode relationTo = JsonNodeFactory.instance.objectNode();
-            relationTo.put("relCode", "Fl2Sp");
-            relationTo.put("graphCode", "ArchSubset");
-            relationTo.put("objFrom", request.getFloorId());
-            request.setRelationTo(relationTo);*/
             request.setFilters(request.getFilters()+" ; buildingId = '"+request.getBuildingId()+"' ; floorId='"+request.getFloorId()+"' ;");
-            AdmResponse response = super.doQuery(context,request,AdmSpace.class);
-            //空间需要补充分类名称属性
-            ensureSpecialValues(context, (List<AdmSpace>) response.getContent());
-            return response;
+            /*response = doQuery(context,request,AdmSpace.class);
+            return response;*/
         }else if(StrUtil.isNotEmpty(request.getBuildingId()) && StrUtil.isNotEmpty(request.getFloorId()) && request.getFloorId().equals("isnull")){
         	//查询此建筑下未关联楼层的空间
-        	AdmResponse response = this.query(request);
-        	//空间需要补充分类名称属性
-            ensureSpecialValues(context, (List<AdmSpace>) response.getContent());
-            return response;
+            request.setFilters(request.getFilters()+" ; buildingId = '"+request.getBuildingId()+"' ; floorId isnull");
+        	/*response = this.query(request);
+            return response;*/
         }else if(StrUtil.isNotEmpty(request.getBuildingId()) && StrUtil.isEmpty(request.getFloorId()) && !request.getBuildingId().equals("isnull")){
             //查询建筑下的空间
-            ObjectNode relationTo = JsonNodeFactory.instance.objectNode();
+            /*ObjectNode relationTo = JsonNodeFactory.instance.objectNode();
             relationTo.put("relCode", "Bd2Sp");
             relationTo.put("graphCode", "ArchSubset");
             relationTo.put("objFrom", request.getBuildingId());
             request.setRelationTo(relationTo);
+            response = query(request);
+            return response;*/
+            request.setFilters(request.getFilters()+" ; buildingId = '"+request.getBuildingId()+"' ; ");
         }else if(StrUtil.isNotEmpty(request.getBuildingId()) && StrUtil.isEmpty(request.getFloorId()) && request.getBuildingId().equals("isnull")){
             //未明确建筑下的空间
             //查询建筑下的空间
-            ObjectNode relationTo = JsonNodeFactory.instance.objectNode();
+            /*ObjectNode relationTo = JsonNodeFactory.instance.objectNode();
             relationTo.put("relCode", "Bd2Sp");
             relationTo.put("graphCode", "ArchSubset");
             relationTo.put("$bindFlag", false);
             request.setRelationTo(relationTo);
+            response = query(request);
+            return response;*/
+            request.setFilters(request.getFilters()+" ; buildingId isnull");
         }else if(StrUtil.isEmpty(request.getBuildingId()) && StrUtil.isEmpty(request.getFloorId())){
         }
-        AdmResponse response = query(request);
-        //空间需要补充分类名称属性
-        ensureSpecialValues(context, (List<AdmSpace>) response.getContent());
+        response = this.query(request);
         return response;
     }
 
@@ -341,11 +338,13 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
     	String orders = request.getOrders();
     	List<OrderItem> orderItem = AdmQueryCriteriaHelper.toOrderItem(orders);
     	Set<String> classCodes = StrUtil.isBlank(request.getZoneType()) ? request.getZoneTypeList() : Sets.newHashSet(request.getZoneType());
-    	ObjectNode objectNode = objectMapper.createObjectNode();
+    	/*ObjectNode objectNode = objectMapper.createObjectNode();
     	ObjectNode condition = objectMapper.createObjectNode();
     	condition.put("$null", true);
-    	objectNode.putPOJO("floorId", condition);
-    	List<ObjectNode> queryObjects = this.relationReportService.queryObjects(objectNode, AppContext.getContext().getGroupCode(), AppContext.getContext().getProjectId(), 
+    	objectNode.putPOJO("floorId", condition);*/
+    	QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
+    	ObjectNode criteria = queryCriteria.getCriteria();
+    	List<ObjectNode> queryObjects = this.relationReportService.queryObjects(criteria, AppContext.getContext().getGroupCode(), AppContext.getContext().getProjectId(),
     			null, classCodes, Sets.newHashSet("space"), orderItem);
     	
         List<AdmSpace> admVOs = AdmEntityTransferUtil.toAdmMultiEntity(queryObjects, request.getProjection(), AdmSpace.class);
@@ -674,15 +673,6 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
         rwdQueryCriteria.setCriteria(criteria);
     }
 
-    private void addRelationFrom(QueryCriteria rwdQueryCriteria, String objTo, String relCode){
-        ObjectNode relationFrom = JsonNodeFactory.instance.objectNode();
-        if(StrUtil.isNotEmpty(objTo)){
-            relationFrom.put("objTo", objTo);
-        }
-        ObjectNode criteria = rwdQueryCriteria.getCriteria();
-        criteria.putPOJO("relationFrom", relationFrom);
-        rwdQueryCriteria.setCriteria(criteria);
-    }
     /**
      *  查询存在空间的数量
      * @param context