Kaynağa Gözat

fix:空间查询条件丢失

lvxianyun 3 yıl önce
ebeveyn
işleme
bb985d8ddb

+ 1 - 1
src/main/java/com/persagy/proxy/adm/controller/AdmFloorController.java

@@ -91,7 +91,7 @@ public class AdmFloorController {
         }
         List<AdmFloor> admFloors = service.doInsert(AdmContextUtil.toDmpContext(), AdmFloor.class, createRequest.getContent());
         //更新关系
-        //TODO 楼层:新增楼层,添加floor和building的关系,如果后期关系计算支持,此部分去掉
+        //楼层:新增楼层,添加floor和building的关系,如果后期关系计算支持,此部分去掉
         if(CollUtil.isNotEmpty(admFloors)){
             //建筑id一定存在
             String buildingId = vos.get(0).getBuildingId();

+ 16 - 11
src/main/java/com/persagy/proxy/adm/service/impl/AdmSpaceServiceImpl.java

@@ -96,7 +96,7 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
         QueryCriteria dmpRequest = AdmQueryCriteriaHelper.toDmpCriteria(request);
         //查询的时候,floorId,buildingId 按照空间对象的自定义信息点处理
         //TODO 这个ifelse判断是原来的代码实现,写此方法实现的时候不清楚实际业务,保留原来的判断,之后了解业务再根据业务调整
-        DmpResult<JSONArray> dmpResult = new DmpResult<>();
+        DmpResult<JSONArray> result = new DmpResult<>();
         List spaceArray = new ArrayList();
         List<String> zoneTypeList = StrUtil.isNotEmpty(request.getZoneType()) ? CollUtil.newArrayList(request.getZoneType()) : request.getZoneTypeList();
         if(StrUtil.isNotEmpty(request.getBuildingId()) && StrUtil.isNotEmpty(request.getFloorId()) && !request.getFloorId().equals("isnull")){
@@ -118,9 +118,9 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
                 floorMap.keySet().forEach(floorId -> jsonArray.add(floorId));
                 criteriaPe.putPOJO("floorId", jsonArray);
                 queryCriteria.setCriteria(criteriaPe);
-                dmpResult = queryObj(context, queryCriteria);
-                if(CollUtil.isNotEmpty(dmpResult.getData())){
-                    spaceArray.addAll(dmpResult.getData());
+                result = queryObj(context, queryCriteria);
+                if(CollUtil.isNotEmpty(result.getData())){
+                    spaceArray.addAll(result.getData());
                 }
                 querySpaceByFl(dmpRequest, context, spaceArray, zoneTypeList, request.getBuildingId(), "Bd2Sp");
             }
@@ -134,9 +134,9 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
             isnull.put("$null", true);
             criteriaPe.putPOJO("buildingId", isnull);
             queryCriteria.setCriteria(criteriaPe);
-            dmpResult = queryObj(context, queryCriteria);
-            if(CollUtil.isNotEmpty(dmpResult.getData())){
-                spaceArray.addAll(dmpResult.getData());
+            result = queryObj(context, queryCriteria);
+            if(CollUtil.isNotEmpty(result.getData())){
+                spaceArray.addAll(result.getData());
             }
         }else if(StrUtil.isEmpty(request.getBuildingId()) && StrUtil.isEmpty(request.getFloorId())){
             QueryCriteria queryCriteria = ensureQueryCommParm(dmpRequest, context, zoneTypeList, "space");
@@ -145,9 +145,9 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
             isnull.put("$null", true);
             criteriaPe.putPOJO("floorId", isnull);
             queryCriteria.setCriteria(criteriaPe);*/
-            dmpResult = queryObj(context, queryCriteria);
-            if(CollUtil.isNotEmpty(dmpResult.getData())){
-                spaceArray.addAll(dmpResult.getData());
+            result = queryObj(context, queryCriteria);
+            if(CollUtil.isNotEmpty(result.getData())){
+                spaceArray.addAll(result.getData());
             }
         }
         AdmResponse admResponse = new AdmResponse();
@@ -305,7 +305,12 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
     }
 
     private QueryCriteria ensureQueryCommParm(QueryCriteria dmpRequest, InstanceUrlParam context, Collection<String> classCodes, String objType){
-        ObjectNode criteriaEq = JsonNodeFactory.instance.objectNode();
+        ObjectNode criteriaEq = null;
+        if(JSONUtil.isNull(dmpRequest.getCriteria())){
+            criteriaEq = JsonNodeFactory.instance.objectNode();
+        }else{
+            criteriaEq = dmpRequest.getCriteria();
+        }
         if(CollUtil.isNotEmpty(classCodes)){
             ArrayNode array = criteriaEq.putObject("classCode").putArray("$in");
             classCodes.forEach(code -> array.add(code));