瀏覽代碼

fix bug:/object/general-system/query-new接口根据楼层id或建筑id查询系统列表时返回的所属建筑楼层数据不正确的问题

lijie 3 年之前
父節點
當前提交
41dd613a78

+ 8 - 224
src/main/java/com/persagy/proxy/object/controller/AdmSystemController.java

@@ -38,10 +38,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.json.JsonObject;
 import javax.validation.constraints.NotNull;
 import javax.ws.rs.QueryParam;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * Adm 系统 API
@@ -55,10 +52,6 @@ public class AdmSystemController {
     @Autowired
     private IAdmSystemService service;
     @Autowired
-    private IAdmBuildingService buildingService;
-    @Autowired
-    private IAdmFloorService floorService;
-    @Autowired
     private IAdmRelationService relationService;
 
     /**
@@ -72,7 +65,7 @@ public class AdmSystemController {
     public AdmResponse count(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmSystem.OBJ_TYPE);
         request.setOnlyCount(true);
-        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
+        return service.query(request);
     }
 
     /**
@@ -184,7 +177,7 @@ public class AdmSystemController {
     @GetMapping("/export")
     public AdmResponse exportInfos(@RequestBody AdmQueryCriteria request) {
         request.setName(AdmSystem.OBJ_TYPE);
-        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
+        return service.query(request);
     }
 
     /**
@@ -242,7 +235,7 @@ public class AdmSystemController {
             response.setPageSize(request.getPageSize());
             return response;
         }else {
-            return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
+            return service.query(request);
         }
     }
 
@@ -263,218 +256,9 @@ public class AdmSystemController {
      */
     @PostMapping("/query-new")
     public AdmResponse queryNew(@QueryParam("buildingId") String buildingId,
-                                @QueryParam("floorId") String floorId, @RequestBody AdmQueryCriteria request) throws Exception {
-        request.setName(AdmSystem.OBJ_TYPE);
-        AdmResponse syses = new AdmResponse();
-        List<AdmSystem> admSystemList = new ArrayList<>();
-        if(StrUtil.isAllEmpty(buildingId,floorId)){
-            //case one 查询全部系统,级联建筑,建筑级联楼层
-
-            AdmQueryCriteria admQueryCriteriaFl = new AdmQueryCriteria();
-            admQueryCriteriaFl.setName("floorList");
-            List<AdmQueryCriteria> cascadeFlBd = new ArrayList<>(1);
-            AdmQueryCriteria admQueryCriteriaBdFl = new AdmQueryCriteria();
-            admQueryCriteriaBdFl.setName("building");
-            cascadeFlBd.add(admQueryCriteriaBdFl);
-            admQueryCriteriaFl.setCascade(cascadeFlBd);
-
-            List<AdmQueryCriteria> cascade = new ArrayList<>(1);
-            cascade.add(admQueryCriteriaFl);
-            request.setCascade(cascade);
-            syses = service.doQuery(AdmContextUtil.toDmpContext(),request,AdmSystem.class);
-            //处理数据 BuildingFloorInfo
-            if(CollUtil.isNotEmpty(syses.getContent())){
-                admSystemList = (List<AdmSystem>) syses.getContent();
-                admSystemList.stream().forEach(admSystem -> {
-                    List<ObjectNode> buildingFloorInfoList = new ArrayList<>();
-                    List<AdmFloor> admFloorList = admSystem.getFloorList();
-                    if(CollUtil.isNotEmpty(admFloorList)){
-                        admFloorList.stream().forEach(admFloor -> {
-                            ObjectNode infobd = JsonNodeFactory.instance.objectNode();
-                            infobd.put("BuildID",admFloor.getBuildingId());
-                            infobd.put("BuildName",admFloor.getBuilding() != null ? admFloor.getBuilding().getLocalName() : "");
-                            if(!buildingFloorInfoList.contains(infobd)){
-                                buildingFloorInfoList.add(infobd);
-                            }
-                            ObjectNode infobd1 = infobd.deepCopy();
-                            infobd1.put("FloorID",admFloor.getId());
-                            infobd1.put("FloorName",admFloor.getLocalName());
-                            buildingFloorInfoList.add(infobd1);
-                        });
-                    }
-                    admSystem.setFloorList(null);
-                    admSystem.setBuildingFloorInfoList(buildingFloorInfoList);
-                });
-                syses.setContent(CollUtil.isEmpty(admSystemList) ? new ArrayList<>(1) : admSystemList);
-            }
-        }else{
-            QueryCriteria rwdQueryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
-            ObjectNode criteria = rwdQueryCriteria.getCriteria();
-            if(JSONUtil.isNull(criteria)){
-                return AdmResponse.failure("请求参数错误");
-            }
-            if (StrUtil.isNotEmpty(floorId)) {
-                if(!"1".equals(floorId)){
-                    //case two 明确建筑、明确楼层的 系统
-                    JSONObject relationFrom = new JSONObject();
-                    relationFrom.put("relCode", "Sy2Fl");
-                    relationFrom.put("graphCode", "MechInArch");
-                    relationFrom.put("objTo", floorId);
-                    criteria.putPOJO("relationFrom",relationFrom);
-                    rwdQueryCriteria.setCriteria(criteria);
-                    syses = service.doQuery(AdmContextUtil.toDmpContext(), rwdQueryCriteria, AdmSystem.class);
-                    if (CollUtil.isNotEmpty(syses.getContent())) {
-                        admSystemList = (List<AdmSystem>) syses.getContent();
-                    }
-
-                }else if("1".equals(floorId)){
-                    //case three 明确建筑 不明确楼层
-                    syses = queryNotSureObj(buildingId, rwdQueryCriteria);
-                    if(null != syses && CollUtil.isNotEmpty(syses.getContent())){
-                        admSystemList = (List<AdmSystem>) syses.getContent();
-                    }
-                }
-                if(CollUtil.isNotEmpty(admSystemList)){
-                    //处理数据 BuildingFloorInfo
-                    admSystemList = dealBdFlInfo(floorId,buildingId,admSystemList);
-                    syses.setContent(admSystemList);
-                }
-            }else if(StrUtil.isEmpty(floorId) && StrUtil.isNotEmpty(buildingId)){
-                if(!"1".equals(buildingId)){
-                    //case two 明确建筑、明确楼层的 系统
-                    JSONObject relationFrom = new JSONObject();
-                    relationFrom.put("relCode", "Sy2Bd");
-                    relationFrom.put("graphCode", "MechInArch");
-                    relationFrom.put("objTo", buildingId);
-                    criteria.putPOJO("relationFrom",relationFrom);
-                    rwdQueryCriteria.setCriteria(criteria);
-                    syses = service.doQuery(AdmContextUtil.toDmpContext(), rwdQueryCriteria, AdmSystem.class);
-                }else if("1".equals(buildingId)){
-                    syses = queryNotSureObj(null, rwdQueryCriteria);
-                }
-                admSystemList = (List<AdmSystem>) syses.getContent();
-                if(CollUtil.isNotEmpty(admSystemList)){
-                    //处理数据 BuildingFloorInfo
-                    admSystemList = dealBdFlInfo(floorId,buildingId,admSystemList);
-                    syses.setContent(admSystemList);
-                }
-            }else{
-                //处理通用返回结果
-                if(StrUtil.isNotEmpty(buildingId) && buildingId.equals("1")){
-                    //case four 未明确建筑
-                    syses = queryNotSureObj(null, rwdQueryCriteria);
-                    admSystemList = (List<AdmSystem>) syses.getContent();
-                    if(CollUtil.isNotEmpty(admSystemList)){
-                        //处理数据 BuildingFloorInfo
-                        admSystemList = dealBdFlInfo(null,null, admSystemList);
-                    }
-                }
-            }
-            if(CollUtil.isNotEmpty(admSystemList))
-                syses.setTotal(admSystemList.size()*1l);
-
-        }
-        if(CollUtil.isNotEmpty(admSystemList)){
-            syses.setContent(admSystemList);
-        }else{
-            syses.setContent(new ArrayList<>(1));
-        }
-        return syses;
-    }
-
-    /**
-     * 查询不确定建筑/楼层的系统
-     * @param buildingId
-     * @param rwdQueryCriteria
-     * @return
-     */
-    private AdmResponse queryNotSureObj(String buildingId, QueryCriteria rwdQueryCriteria){
-        RequestData requestData = new RequestData();
-        String classCode = rwdQueryCriteria.getCriteria().get("classCode").textValue();
-        if(StrUtil.isNotEmpty(classCode)){
-            requestData.setClassCode(classCode);
-        }
-        if(StrUtil.isNotEmpty(buildingId)){
-            requestData.setBuildingId(buildingId);
-        }
-        requestData.setProjectId(AdmContextUtil.toDmpContext().getProjectId());
-        requestData.setGraphCode(AdmContextUtil.toDmpContext().getGroupCode());
-        requestData.setObjType(AdmSystem.OBJ_TYPE);
-        requestData.setPage(rwdQueryCriteria.getPage());
-        requestData.setSize(rwdQueryCriteria.getSize());
-        Page<Map<String,Object>> result = DigitalObjectSimpleFacade.queryNotSureSystem(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(),null, requestData);
-        if(CollUtil.isNotEmpty(result.getRecords())){
-            AdmResponse response = new AdmResponse();
-            response.setPageSize(Integer.parseInt(String.valueOf(result.getSize())));
-            response.setPageNumber(Integer.parseInt(String.valueOf(result.getCurrent())));
-            response.setResult(DmpResult.SUCCESS);
-            response.setContent(AdmEntityTransferUtil.toAdmMultiEntity(result.getRecords(),null,AdmSystem.class));
-            response.setTotal(result.getTotal());
-            return response;
-        }else{
-            return AdmResponse.success();
-        }
-    }
-
-    /**
-     * 处理建筑楼层信息 建筑确定,楼层可为空
-     * @param floorId
-     * @param buildingId
-     * @param admSystemList
-     * @return
-     */
-    private List<AdmSystem> dealBdFlInfo(String floorId, String buildingId, List<AdmSystem> admSystemList){
-        if(CollUtil.isEmpty(admSystemList)){
-            return null;
-        }
-        if(StrUtil.isEmpty(buildingId)){//处理成adm目标格式
-            List<ObjectNode> nullList = new ArrayList<>(0);
-            admSystemList.stream().forEach(admSystem -> {
-                admSystem.setBuildingFloorInfoList(nullList);
-            });
-            return admSystemList;
-        }
-        AdmResponse buildings = null;
-        if(StrUtil.isNotEmpty(buildingId)){
-            AdmQueryCriteria admQueryCriteria = getAdmQueryCriteria(AdmBuilding.OBJ_TYPE, buildingId);
-            buildings = buildingService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmBuilding.class);
-        }
-        AdmResponse floors = null;
-        if(StrUtil.isNotEmpty(floorId)){
-            AdmQueryCriteria admQueryCriteria = getAdmQueryCriteria(AdmFloor.OBJ_TYPE, floorId);
-            floors = floorService.query(admQueryCriteria);
-        }
-
-        ObjectNode buildingFloorInfo = JsonNodeFactory.instance.objectNode();
-        if (CollUtil.isNotEmpty(buildings.getContent())) {
-            AdmBuilding admBuilding = (AdmBuilding) buildings.getContent().get(0);
-            buildingFloorInfo.put("BuildID",admBuilding.getId());
-            buildingFloorInfo.put("BuildName",admBuilding.getLocalName());
-        }
-        if (null!=floors && CollUtil.isNotEmpty(floors.getContent())) {
-            ObjectNode buildingFloorInfoFl = JsonNodeFactory.instance.objectNode();
-            buildingFloorInfoFl = buildingFloorInfo.deepCopy();
-            AdmFloor floor = (AdmFloor) floors.getContent().get(0);
-            buildingFloorInfoFl.put("FloorID",floor.getId());
-            buildingFloorInfoFl.put("FloorName",floor.getLocalName());
-        }
-        if(JSONUtil.isNull(buildingFloorInfo) || buildingFloorInfo.isNull() || !buildingFloorInfo.fieldNames().hasNext()){
-            admSystemList.stream().forEach(admSystem -> {
-                admSystem.setBuildingFloorInfoList(new ArrayList<>(1));
-            });
-            return admSystemList;
-        }
-        admSystemList.stream().forEach(admSystem -> {
-            admSystem.setBuildingFloorInfoList(Arrays.asList(buildingFloorInfo));
-        });
-        return admSystemList;
-    }
-
-    private AdmQueryCriteria getAdmQueryCriteria(String objType, String Id){
-        AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
-        admQueryCriteria.setName(objType);
-        admQueryCriteria.setFilters("id = " + Id);
-        return  admQueryCriteria;
+                                @QueryParam("floorId") String floorId,
+                                @RequestBody AdmQueryCriteria request) throws Exception {
+        return service.queryNewInternal(buildingId,floorId,request);
     }
 
     /**
@@ -487,7 +271,7 @@ public class AdmSystemController {
     @PostMapping("/query-bdfl")
     public AdmResponse queryUnBdFl(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmSystem.OBJ_TYPE);
-        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
+        return service.query(request);
     }
 
     /**

+ 22 - 0
src/main/java/com/persagy/proxy/object/service/IAdmSystemService.java

@@ -1,6 +1,8 @@
 package com.persagy.proxy.object.service;
 
 import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmBaseService;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.object.model.AdmSystem;
@@ -13,6 +15,15 @@ import java.util.List;
  * @date 2021/8/18
  */
 public interface IAdmSystemService extends IAdmBaseService<AdmSystem> {
+    /***
+     * Description: 查询系统数据
+     * @param request : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmResponse
+     * @author : lijie
+     * @date :2021/11/2 14:04
+     * Update By lijie 2021/11/2 14:04
+     */
+    AdmResponse query(AdmQueryCriteria request);
 
     /**
      * 补充系统分类名称属性
@@ -26,4 +37,15 @@ public interface IAdmSystemService extends IAdmBaseService<AdmSystem> {
      * @return : void
      */
     void processDmpCriteria(QueryCriteria dmpRequest);
+    /***
+     * Description: 查询系统信息-系统建筑楼层一对多
+     * @param buildingId : 建筑id
+     * @param floorId : 楼层id
+     * @param request : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmResponse  
+     * @author : lijie
+     * @date :2021/11/2 13:51
+     * Update By lijie 2021/11/2 13:51
+     */
+    AdmResponse queryNewInternal(String buildingId, String floorId, AdmQueryCriteria request);
 }

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

@@ -1,28 +1,42 @@
 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;
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
 import com.persagy.proxy.adm.constant.GraphCodeEnum;
 import com.persagy.proxy.adm.constant.RelCodeEnum;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
+import com.persagy.proxy.adm.utils.AdmEntityTransferUtil;
+import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
+import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.dictionary.model.AdmDict;
 import com.persagy.proxy.dictionary.model.AdmObjectType;
 import com.persagy.proxy.dictionary.service.IAdmDictService;
-import com.persagy.proxy.object.model.AdmEquipment;
-import com.persagy.proxy.object.model.AdmSystem;
-import com.persagy.proxy.object.model.AdmSystemCategory;
+import com.persagy.proxy.object.model.*;
+import com.persagy.proxy.object.service.IAdmBuildingService;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
+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;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -32,18 +46,27 @@ import java.util.Map;
  * @date 2021/8/18
  */
 @Service
+@RequiredArgsConstructor
+@Slf4j
 public class AdmSystemServiceImpl extends AbstractAdmBaseServiceImpl<AdmSystem> implements IAdmSystemService {
 
-    @Autowired
-    private IAdmDictService dictService;
-    @Autowired
-    private IAdmEquipmentService equipmentService;
-
+    private final IAdmDictService dictService;
+    private final IAdmEquipmentService equipmentService;
+    private final IAdmBuildingService buildingService;
+    private final IAdmFloorService floorService;
+    /***
+     * Description: 查询系统数据
+     * @param request : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmResponse
+     * @author : lijie
+     * @date :2021/11/2 14:04
+     * Update By lijie 2021/11/2 14:04
+     */
     @Override
-    public AdmResponse doQuery(InstanceUrlParam context, AdmQueryCriteria request, Class<AdmSystem> clazz) {
-        AdmResponse response = super.doQuery(context, request, clazz);
+    public AdmResponse query(AdmQueryCriteria request) {
+        AdmResponse response = this.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
         // 系统需要补充分类名称属性
-        ensureSpecialValues(context, (List<AdmSystem>) response.getContent());
+        ensureSpecialValues(AdmContextUtil.toDmpContext(), (List<AdmSystem>) response.getContent());
         return response;
     }
 
@@ -113,4 +136,221 @@ public class AdmSystemServiceImpl extends AbstractAdmBaseServiceImpl<AdmSystem>
             criteria.remove("buildingId");
         }
     }
+
+    @Override
+    public AdmResponse queryNewInternal(String buildingId, String floorId, AdmQueryCriteria request) {
+        constructQueryNewParam(buildingId,floorId,request);
+        QueryCriteria rwdQueryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
+        if(JSONUtil.isNull(rwdQueryCriteria.getCriteria())){
+            return AdmResponse.failure("请求参数错误");
+        }
+        if (StrUtil.isNotBlank(floorId) && "1".equals(floorId)){
+            // 楼层id不为空且为1
+            AdmResponse admResponse = queryNotSureObj(buildingId, rwdQueryCriteria);
+            dealBdFlInfo(floorId,buildingId, (List<AdmSystem>) admResponse.getContent());
+            return admResponse;
+        }
+        if(StrUtil.isEmpty(floorId) && StrUtil.isNotEmpty(buildingId) && "1".equals(buildingId)){
+            // 楼层id为空且建筑id不为空且建筑id为1
+            AdmResponse admResponse = queryNotSureObj(null, rwdQueryCriteria);
+            dealBdFlInfo(floorId,buildingId, (List<AdmSystem>) admResponse.getContent());
+            return admResponse;
+        }
+        return queryNewInternal(request);
+    }
+
+    /***
+     * Description: 构建query-new接口的请求参数
+     * @param buildingId : 建筑id
+     * @param floorId : 楼层id
+     * @param request : 请求参数
+     * @return : void
+     * @author : lijie
+     * @date :2021/11/2 11:57
+     * Update By lijie 2021/11/2 11:57
+     */
+    private void constructQueryNewParam(String buildingId, String floorId, AdmQueryCriteria request) {
+        request.setName(AdmSystem.OBJ_TYPE);
+        AdmQueryCriteria admQueryCriteriaFl = new AdmQueryCriteria();
+        admQueryCriteriaFl.setName("floorList");
+        List<AdmQueryCriteria> cascadeFlBd = new ArrayList<>(1);
+        AdmQueryCriteria admQueryCriteriaBdFl = new AdmQueryCriteria();
+        admQueryCriteriaBdFl.setName("building");
+        cascadeFlBd.add(admQueryCriteriaBdFl);
+        admQueryCriteriaFl.setCascade(cascadeFlBd);
+        List<AdmQueryCriteria> cascade = new ArrayList<>(1);
+        cascade.add(admQueryCriteriaFl);
+        request.setCascade(cascade);
+        // 楼层id不为空且楼层id不为1,加上关系筛选
+        if (StrUtil.isNotEmpty(floorId) && !"1".equals(floorId)) {
+            String filters = request.getFilters();
+            if (StrUtil.isNotBlank(filters)){
+                request.setFilters(filters+"; floorId='"+floorId+"'");
+            }else {
+                request.setFilters("floorId='"+floorId+"'");
+            }
+            return;
+//
+//            JSONObject relationFrom = new JSONObject();
+//            relationFrom.put("relCode", "Sy2Fl");
+//            relationFrom.put("graphCode", "MechInArch");
+//            relationFrom.put("objTo", floorId);
+//            criteria.putPOJO("relationFrom",relationFrom);
+//            rwdQueryCriteria.setCriteria(criteria);
+//            return rwdQueryCriteria;
+        }
+        // 楼层id为空且建筑id不为空且建筑id不为1,加上关系筛选
+        if(StrUtil.isEmpty(floorId) && StrUtil.isNotEmpty(buildingId) && !"1".equals(buildingId)){
+            String filters = request.getFilters();
+            if (StrUtil.isNotBlank(filters)){
+                request.setFilters(filters+";buildingId='"+buildingId+"'");
+            }else {
+                request.setFilters("buildingId='"+buildingId+"'");
+            }
+//            JSONObject relationFrom = new JSONObject();
+//            relationFrom.put("relCode", "Sy2Bd");
+//            relationFrom.put("graphCode", "MechInArch");
+//            relationFrom.put("objTo", buildingId);
+//            criteria.putPOJO("relationFrom",relationFrom);
+//            rwdQueryCriteria.setCriteria(criteria);
+//            return rwdQueryCriteria;
+        }
+    }
+
+    /***
+     * Description: 当楼层id和建筑id都为空时query-new接口的处理逻辑
+     * @param rwdQueryCriteria : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmResponse
+     * @author : lijie
+     * @date :2021/11/2 11:40
+     * Update By lijie 2021/11/2 11:40
+     */
+    private AdmResponse queryNewInternal(AdmQueryCriteria rwdQueryCriteria) {
+        AdmResponse syses = this.query(rwdQueryCriteria);
+        if (CollUtil.isEmpty(syses.getContent())){
+            syses.setContent(new ArrayList<>());
+            return syses;
+        }
+        //处理数据 BuildingFloorInfo
+        List<AdmSystem> admSystemList = (List<AdmSystem>) syses.getContent();
+        admSystemList.forEach(admSystem -> {
+            List<ObjectNode> buildingFloorInfoList = new ArrayList<>();
+            List<AdmFloor> admFloorList = admSystem.getFloorList();
+            if (CollUtil.isEmpty(admFloorList)){
+                admSystem.setFloorList(null);
+                admSystem.setBuildingFloorInfoList(buildingFloorInfoList);
+                return;
+            }
+            admFloorList.forEach(admFloor -> {
+                ObjectNode infobd = JsonNodeFactory.instance.objectNode();
+                infobd.put("BuildID",admFloor.getBuildingId());
+                infobd.put("BuildName",admFloor.getBuilding() != null ? admFloor.getBuilding().getLocalName() : "");
+                if(!buildingFloorInfoList.contains(infobd)){
+                    buildingFloorInfoList.add(infobd);
+                }
+                ObjectNode infobd1 = infobd.deepCopy();
+                infobd1.put("FloorID",admFloor.getId());
+                infobd1.put("FloorName",admFloor.getLocalName());
+                buildingFloorInfoList.add(infobd1);
+            });
+            admSystem.setFloorList(null);
+            admSystem.setBuildingFloorInfoList(buildingFloorInfoList);
+        });
+        syses.setContent(CollUtil.isEmpty(admSystemList) ? new ArrayList<>() : admSystemList);
+        return syses;
+    }
+
+    /**
+     * 查询不确定建筑/楼层的系统
+     * @param buildingId
+     * @param rwdQueryCriteria
+     * @return
+     */
+    private AdmResponse queryNotSureObj(String buildingId, QueryCriteria rwdQueryCriteria){
+        RequestData requestData = new RequestData();
+        String classCode = rwdQueryCriteria.getCriteria().get("classCode").textValue();
+        if(StrUtil.isNotEmpty(classCode)){
+            requestData.setClassCode(classCode);
+        }
+        if(StrUtil.isNotEmpty(buildingId)){
+            requestData.setBuildingId(buildingId);
+        }
+        requestData.setProjectId(AdmContextUtil.toDmpContext().getProjectId());
+        requestData.setGraphCode(AdmContextUtil.toDmpContext().getGroupCode());
+        requestData.setObjType(AdmSystem.OBJ_TYPE);
+        requestData.setPage(rwdQueryCriteria.getPage());
+        requestData.setSize(rwdQueryCriteria.getSize());
+        Page<Map<String,Object>> result = DigitalObjectSimpleFacade.queryNotSureSystem(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(),null, requestData);
+        if(CollUtil.isNotEmpty(result.getRecords())){
+            AdmResponse response = new AdmResponse();
+            response.setPageSize(Integer.parseInt(String.valueOf(result.getSize())));
+            response.setPageNumber(Integer.parseInt(String.valueOf(result.getCurrent())));
+            response.setResult(DmpResult.SUCCESS);
+            response.setContent(AdmEntityTransferUtil.toAdmMultiEntity(result.getRecords(),null,AdmSystem.class));
+            response.setTotal(result.getTotal());
+            return response;
+        }else{
+            return AdmResponse.success();
+        }
+    }
+
+    /**
+     * 处理建筑楼层信息 建筑确定,楼层可为空
+     * @param floorId
+     * @param buildingId
+     * @param admSystemList
+     * @return
+     */
+    private void dealBdFlInfo(String floorId, String buildingId, List<AdmSystem> admSystemList){
+        if(CollUtil.isEmpty(admSystemList)){
+            return;
+        }
+        if(StrUtil.isEmpty(buildingId)){//处理成adm目标格式
+            List<ObjectNode> nullList = new ArrayList<>(0);
+            admSystemList.forEach(admSystem -> {
+                admSystem.setBuildingFloorInfoList(nullList);
+            });
+            return;
+        }
+        AdmResponse buildings = null;
+        if(StrUtil.isNotEmpty(buildingId)){
+            AdmQueryCriteria admQueryCriteria = getAdmQueryCriteria(AdmBuilding.OBJ_TYPE, buildingId);
+            buildings = buildingService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmBuilding.class);
+        }
+        AdmResponse floors = null;
+        if(StrUtil.isNotEmpty(floorId)){
+            AdmQueryCriteria admQueryCriteria = getAdmQueryCriteria(AdmFloor.OBJ_TYPE, floorId);
+            floors = floorService.query(admQueryCriteria);
+        }
+
+        ObjectNode buildingFloorInfo = JsonNodeFactory.instance.objectNode();
+        if (CollUtil.isNotEmpty(buildings.getContent())) {
+            AdmBuilding admBuilding = (AdmBuilding) buildings.getContent().get(0);
+            buildingFloorInfo.put("BuildID",admBuilding.getId());
+            buildingFloorInfo.put("BuildName",admBuilding.getLocalName());
+        }
+        if (null!=floors && CollUtil.isNotEmpty(floors.getContent())) {
+            ObjectNode buildingFloorInfoFl = JsonNodeFactory.instance.objectNode();
+            buildingFloorInfoFl = buildingFloorInfo.deepCopy();
+            AdmFloor floor = (AdmFloor) floors.getContent().get(0);
+            buildingFloorInfoFl.put("FloorID",floor.getId());
+            buildingFloorInfoFl.put("FloorName",floor.getLocalName());
+        }
+        if(JSONUtil.isNull(buildingFloorInfo) || buildingFloorInfo.isNull() || !buildingFloorInfo.fieldNames().hasNext()){
+            admSystemList.forEach(admSystem -> {
+                admSystem.setBuildingFloorInfoList(new ArrayList<>(1));
+            });
+            return;
+        }
+        admSystemList.forEach(admSystem -> {
+            admSystem.setBuildingFloorInfoList(Collections.singletonList(buildingFloorInfo));
+        });
+    }
+
+    private AdmQueryCriteria getAdmQueryCriteria(String objType, String Id){
+        AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
+        admQueryCriteria.setName(objType);
+        admQueryCriteria.setFilters("id = " + Id);
+        return  admQueryCriteria;
+    }
 }

+ 1 - 1
src/main/java/com/persagy/proxy/report/controller/AdmEquipShaftController.java

@@ -57,7 +57,7 @@ public class AdmEquipShaftController {
         request.setName(AdmSystem.OBJ_TYPE);
         // 设置关系条件
         request.resetRelationCond(true, "MechInArch", "Sy2Sh", shaftId, false);
-        return systemService.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
+        return systemService.query(request);
     }
 
     /**

+ 2 - 2
src/main/java/com/persagy/proxy/report/controller/AdmReportEquipController.java

@@ -891,7 +891,7 @@ public class AdmReportEquipController {
             admQueryCriteriaObj.setName(AdmSystem.OBJ_TYPE);
 
             //admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","infos","classCode"));
-            AdmResponse admResponse = systemService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmSystem.class);
+            AdmResponse admResponse = systemService.query(admQueryCriteriaObj);
 
             Map<String,Integer> hashMap = new HashMap<>();
             List<AdmSystem> admSystemList = (List<AdmSystem>) admResponse.getContent();
@@ -902,7 +902,7 @@ public class AdmReportEquipController {
             if(page >= 2){
                 for(long i = 2; i <= page; i++){
                     admQueryCriteriaObj.setPageNumber(Integer.parseInt(String.valueOf(i)));
-                    admResponse = systemService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmSystem.class);
+                    admResponse = systemService.query(admQueryCriteriaObj);
                     admSystemList = (List<AdmSystem>) admResponse.getContent();
                     projectEquipment = JsonNodeUtils.toListNode(admSystemList,null,null);
                     calculate(gatherDynamicInfoCode, gatherStaticInfoCode, projectEquipment,1, hashMap);

+ 1 - 1
src/main/java/com/persagy/proxy/report/controller/AdmSpaceInfoController.java

@@ -86,7 +86,7 @@ public class AdmSpaceInfoController {
 		request.setName(AdmSystem.OBJ_TYPE);
 		// 设置关系条件
 		request.resetRelationCond(true, "MechInArch", "Sy2Sp", spaceId, false);
-		return systemService.doQuery(AdmContextUtil.toDmpContext(),request, AdmSystem.class);
+		return systemService.query(request);
 	}
 
 	/**