Browse Source

Merge branch 'develop' of http://39.106.8.246:3003/BDTP/adm-middleware into develop

lijie 3 years ago
parent
commit
454d3d0ef5

+ 47 - 6
src/main/java/com/persagy/proxy/object/controller/AdmComponentController.java

@@ -1,14 +1,21 @@
 package com.persagy.proxy.object.controller;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
-import com.persagy.proxy.object.model.AdmComponent;
+import com.persagy.dmp.common.exception.BusinessException;
+import com.persagy.proxy.adm.constant.AdmDictCategoryEnum;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.object.service.IAdmComponentService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
+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.AdmComponent;
+import com.persagy.proxy.object.service.IAdmComponentService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -16,7 +23,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.ws.rs.QueryParam;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Adm 部件 API
@@ -29,10 +38,11 @@ import java.util.List;
 public class AdmComponentController {
     @Autowired
     private IAdmComponentService service;
+    @Autowired
+    private IAdmDictService dictService;
 
     /**
      * 统计
-     * 
      * @param request
      * @return
      * @throws Exception
@@ -55,13 +65,44 @@ public class AdmComponentController {
         if(CollUtil.isEmpty(vos)){
             return AdmResponse.success();
         }
-        //创建部件
+        // 查询所有设备类型
+        AdmDict dictCond = AdmDict.builder().type(AdmDictCategoryEnum.COMPONENT.getValue()).build();
+        AdmResponse dictResponse = dictService.queryCategory(AdmContextUtil.toDmpContext(), dictCond, AdmObjectType.class);
+        List<AdmObjectType> dicts = (List<AdmObjectType>) dictResponse.getContent();
+        // 转换为Map,key为编码后4位。用于适配旧类型编码
+        Map<String, AdmObjectType> shortDictMap = new HashMap<>();
+        Map<String, AdmObjectType> fullDictMap = new HashMap<>();
+        for(int i = 0,j = CollUtil.size(dicts);i < j;i++) {
+            AdmObjectType dict = dicts.get(i);
+            shortDictMap.put(StrUtil.subSufByLength(dict.getCode(), 6), dict);
+            fullDictMap.put(dict.getCode(), dict);
+        }
+        // 设备属性调整
         vos.stream().forEach(component -> {
+            // 如果不是Eq开头,则重新生成ID
+            if(StrUtil.startWith(component.getId(), "Ec")) {
+                component.setId("Ec"+ IdUtil.simpleUUID());
+            }
+            // 类型编码适配
+            String classCode = component.getClassCode();
+            // 如果编码为空,或在4位、6位里都不存在,则报错
+            if(StrUtil.isBlank(classCode) ||
+                    (shortDictMap.get(classCode) == null && fullDictMap.get(classCode) == null)) {
+                throw new BusinessException(StrUtil.format("没有找到对象类型【{}】!", component.getClassCode()));
+            }
+            // 如果少于6位,则需要适配新编码
+            if(classCode.length() < 8) {
+                AdmObjectType dict = MapUtil.get(shortDictMap, classCode, AdmObjectType.class);
+                component.setClassCode(dict.getCode());
+            }
+            // 如果名称为空,则提供默认名称
             if (StrUtil.isEmpty(component.getName())){
-                component.setName(ObjectNameUtil.objectName("部件-"));
+                AdmObjectType dict = MapUtil.get(fullDictMap, component.getClassCode(), AdmObjectType.class);
+                String preName = dict == null ? "部件" : dict.getName();
+                component.setName(ObjectNameUtil.objectName(preName + "-"));
             }
         });
-        vos = service.doInsertExt(AdmContextUtil.toDmpContext(), AdmComponent.class, vos);
+        vos = service.doInsert(AdmContextUtil.toDmpContext(), AdmComponent.class, vos);
         return AdmResponse.success(vos);
     }
 

+ 3 - 2
src/main/java/com/persagy/proxy/object/controller/AdmEquipmentController.java

@@ -132,10 +132,11 @@ public class AdmEquipmentController {
 			// 如果名称为空,则提供默认名称
 			if (StrUtil.isEmpty(equipment.getName())){
 				AdmObjectType dict = MapUtil.get(fullDictMap, equipment.getClassCode(), AdmObjectType.class);
-				equipment.setName(ObjectNameUtil.objectName(dict.getName() + "-"));
+				String preName = dict == null ? "设备" : dict.getName();
+				equipment.setName(ObjectNameUtil.objectName(preName + "-"));
 			}
 		});
-		vos = service.doInsertEuip(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
+		vos = service.doInsert(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
 		return AdmResponse.success(vos);
 	}
 

+ 26 - 9
src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java

@@ -2,8 +2,8 @@ package com.persagy.proxy.object.controller;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
@@ -71,7 +71,7 @@ public class AdmSpaceController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmResponse create(@RequestBody AdmCreateRequest<AdmSpace> createRequest) throws Exception {
+    public ObjectNode create(@RequestBody AdmCreateRequest<AdmSpace> createRequest) throws Exception {
         List<AdmSpace> vos = CollUtil.newArrayList(createRequest.getContent());
         String msg = null;
         for (AdmSpace admSpace : vos) {
@@ -85,9 +85,13 @@ public class AdmSpaceController {
         }
         if(StrUtil.isEmpty(msg)){
             vos = service.doInsertExt(AdmContextUtil.toDmpContext(), AdmSpace.class, vos);
-            return AdmResponse.success(vos);
+            AdmResponse admResponse = AdmResponse.success(vos);
+            ObjectNode admResponseObj = JsonNodeUtils.toObjectNode(admResponse, null,null);
+            ArrayNode arrayNode = JsonNodeUtils.toArrayNode(vos,null,null);
+            admResponseObj.putArray("entityList").add(arrayNode);
+            return admResponseObj;
         }else{
-            return AdmResponse.failure(msg);
+            return JsonNodeUtils.toObjectNode(AdmResponse.failure(msg), null,null);
         }
 
     }
@@ -275,20 +279,23 @@ public class AdmSpaceController {
                 if(id.startsWith("Fl") && StrUtil.isNotEmpty(spaceId)){
                     AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
                     admQueryCriteria.setName(AdmFloor.OBJ_TYPE);
+                    admQueryCriteria.setFilters("id = '"+id+"'");
                     AdmResponse admResponseFl = floorService.doQuery( AdmContextUtil.toDmpContext(), admQueryCriteria, AdmFloor.class);
                     if(CollUtil.isNotEmpty(admResponseFl.getContent())){
-                        AdmFloor floor = JSONUtil.toBean(admResponseFl.getContent().get(0).toString(), AdmFloor.class);
+                        AdmFloor floor = (AdmFloor) admResponseFl.getContent().get(0);
                         if (floor!=null){
                             //更新关系
                             RelationDTO rBd_up = new RelationDTO();
                             rBd_up.setObjTo(spaceId);
                             rBd_up.setRelCode("Bd2Sp");
+                            rBd_up.setGraphCode("ArchSubset");
                             rBd_up.setObjFrom(floor.getBuildingId());
                             RSpInBd_up.add(rBd_up);
 
                             RelationDTO rFl_up = new RelationDTO();
                             rFl_up.setObjTo(spaceId);
                             rFl_up.setRelCode("Fl2Sp");
+                            rFl_up.setGraphCode("ArchSubset");
                             rFl_up.setObjFrom(floor.getId());
                             RSpInFl_up.add(rFl_up);
 
@@ -296,7 +303,6 @@ public class AdmSpaceController {
                             AdmSpace space = new AdmSpace();
                             space.setId(spaceId);
                             space.setObjectType(AdmSpace.OBJ_TYPE);
-                            space.setZoneType(type);
                             space.setClassCode(type);
                             space.setBuildingId(floor.getBuildingId());
                             space.setFloorId(floor.getId());
@@ -305,9 +311,19 @@ public class AdmSpaceController {
                     }
                 }else if(id.startsWith("Bd")){
                     //更新关系
+                    QueryCriteria criteria = new QueryCriteria();
+                    ObjectNode node = JsonNodeFactory.instance.objectNode();
+                    //删除关系 然后重建
+                    node.put("relCode", "Bd2Sp");
+                    node.put("objTo", "spaceId");
+                    node.put("graphCode", "ArchSubset");
+                    criteria.setCriteria(node);
+                    relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+
                     RelationDTO rBd_up = new RelationDTO();
                     rBd_up.setObjTo(spaceId);
                     rBd_up.setRelCode("Bd2Sp");
+                    rBd_up.setGraphCode("ArchSubset");
                     rBd_up.setObjFrom(id);
                     RSpInBd_up.add(rBd_up);
 
@@ -315,10 +331,11 @@ public class AdmSpaceController {
                     AdmSpace space = new AdmSpace();
                     space.setId(spaceId);
                     space.setObjectType(AdmSpace.OBJ_TYPE);
-                    space.setZoneType(type);
                     space.setClassCode(type);
                     space.setBuildingId(id);
-                    space.setFloorId(null);
+                    Map<String, Object> info = new HashMap<>(1);
+                    info.put("$remove",Arrays.asList("floorId"));
+                    space.setInfos(info);
                     space_up.add(space);
                 }
             }
@@ -326,7 +343,7 @@ public class AdmSpaceController {
         service.doUpdate( AdmContextUtil.toDmpContext(), AdmSpace.class, space_up);
         relationService.doSave( AdmContextUtil.toDmpContext(), RSpInBd_up);
         relationService.doSave( AdmContextUtil.toDmpContext(), RSpInFl_up);
-         return AdmResponse.success(space_up);
+        return AdmResponse.success(space_up);
     }
 
     /**

+ 1 - 41
src/main/java/com/persagy/proxy/object/service/impl/AdmComponentServiceImpl.java

@@ -1,28 +1,14 @@
 package com.persagy.proxy.object.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.persagy.dmp.basic.model.QueryCriteria;
-import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.object.model.AdmComponent;
 import com.persagy.proxy.object.service.IAdmComAndEquipService;
 import com.persagy.proxy.object.service.IAdmComponentService;
-import com.persagy.proxy.adm.utils.ObjectNameUtil;
-import com.persagy.proxy.common.client.DmpRwdClient;
-import com.persagy.proxy.common.entity.DmpResult;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
 
 /**
  * ADM 组件 服务
@@ -32,37 +18,11 @@ import java.util.stream.Collectors;
 @Service
 public class AdmComponentServiceImpl extends AbstractAdmBaseServiceImpl<AdmComponent> implements IAdmComponentService, IAdmComAndEquipService {
 
-    @Autowired
-    private DmpRwdClient rwdClient;
-    @Autowired
-    private ObjectMapper objectMapper;
-
     @Override
     public List<AdmComponent> doInsertExt(InstanceUrlParam context, Class<AdmComponent> clazz, List<AdmComponent> voList) {
         if(CollUtil.isEmpty(voList)) {
             return null;
         }
-        Set<String> classCodes = voList.stream().map(AdmComponent::getClassCode).collect(Collectors.toSet());
-        //查询定义类型
-        QueryCriteria criteriaObject = getDmpCriteria(context, classCodes, AdmComponent.OBJ_TYPE);
-        JSONObject paraPe = null;
-        try {
-            String paraStr = objectMapper.writeValueAsString(criteriaObject);
-            paraPe = JSONObject.parseObject(paraStr);
-        } catch (JsonProcessingException e) {
-            throw new RuntimeException("转换查询条件出错:" + e.getMessage());
-        }
-        DmpResult<JSONArray> resultDef = rwdClient.queryDefClass(context, paraPe);
-        Map<String, ObjectTypeDefine> finalDefClassMap = getDefineMap(resultDef);
-        // 设备名字处理
-        voList.forEach(component -> {
-            if (StrUtil.isNotEmpty(component.getName()) && CollUtil.isNotEmpty(finalDefClassMap) && finalDefClassMap.containsKey(component.getClassCode())) {
-                ObjectTypeDefine defclass = finalDefClassMap.get(component.getClassCode());
-                component.setName(ObjectNameUtil.objectName(defclass.getName()+"-"));
-            }else{
-                component.setName(ObjectNameUtil.objectName("部件-"));
-            }
-        });
         return doInsert(context, clazz, voList);
     }
 

+ 8 - 17
src/main/java/com/persagy/proxy/object/service/impl/AdmSpaceServiceImpl.java

@@ -1,17 +1,8 @@
 package com.persagy.proxy.object.service.impl;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -31,7 +22,6 @@ import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmRelationService;
 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.common.client.DmpRwdClient;
 import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
@@ -42,11 +32,12 @@ import com.persagy.proxy.object.model.AdmSystem;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
 import com.persagy.proxy.object.service.IAdmSpaceService;
 import com.persagy.proxy.object.service.IAdmSystemService;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONUtil;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * ADM 空间 实现类

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

@@ -36,6 +36,7 @@ import com.persagy.proxy.object.model.*;
 import com.persagy.proxy.object.service.IAdmComponentService;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
 import com.persagy.proxy.object.service.IAdmSystemService;
+import com.persagy.proxy.report.model.AdmGatherInfoPoint;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -744,12 +745,54 @@ public class AdmReportEquipController {
      */
     @PostMapping("/info-point")
     public AdmResponse infoPoint() {
-        //return customSqlService.infoPoints()
-        JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, false, false);
-        JSONObject infoPoint = new JSONObject();
-        infoPoint.put("dynamicInfoPoint",gatherInfoPoint.getString("gatherDynamicInfoPointCounts"));
-        infoPoint.put("staticInfoPoint",gatherInfoPoint.getString("gatherStaticInfoPointCounts"));
-        return AdmResponse.success(CollUtil.newArrayList(infoPoint));
+        if(StrUtil.isEmpty(AdmContextUtil.toDmpContext().getProjectId())){
+            return AdmResponse.failure(ResponseCode.A0400.getCode());
+        }
+        Integer controlInfoCounts = controlInfoCounts(AdmEquipment.OBJ_TYPE);
+        // 根据objType获取定义 获取采集的设备的classcode
+        Set<String> objTypes = new HashSet<>(1);
+        objTypes.add(AdmEquipment.OBJ_TYPE);
+        List<Map<String, Object>> codes = DigitalObjectSimpleFacade.queryDefineInfoByObjType(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null, RequestData.builder().objTypes(objTypes).build());
+        Set<String> classCodeSet = new HashSet<String>(codes.size());
+        codes.stream().forEach(stringObjectMap -> classCodeSet.add(stringObjectMap.get("code").toString()));
+
+        //项目下所有已采集的动态信息点编码
+        List<ObjectInfoDefine> dynamicInfoPointCodes = gatherDynamicInfoCode(false, classCodeSet);
+        //项目下所有已采集静态信息点编码
+        List<ObjectInfoDefine> staticInfoPointCodes =  gatherStaticInfoCode(false, classCodeSet);
+        //项目下所有的设备  分页查询
+        AdmQueryCriteria admQueryCriteriaObj =  new AdmQueryCriteria();
+        admQueryCriteriaObj.setPageNumber(1);
+        admQueryCriteriaObj.setPageSize(500);
+        admQueryCriteriaObj.setName(AdmEquipment.OBJ_TYPE);
+
+        admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","bimLocation","infos","classCode","equipSerial","bimFamilyName","bimFamilySymbol"));
+        AdmResponse admResponse = equipmentService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmEquipment.class);
+
+        Map<String,Integer> hashMap = new HashMap<>();
+        List<AdmEquipment> admEquipmentList = (List<AdmEquipment>) admResponse.getContent();
+        List<ObjectNode> projectEquipment = JsonNodeUtils.toListNode(admEquipmentList,null,null);
+        calculate(dynamicInfoPointCodes, staticInfoPointCodes, projectEquipment,0, hashMap);
+
+        long page = admResponse.getTotal() / admResponse.getPageSize() + 1;
+        if(page >= 2){
+            for(long i = 2; i <= page; i++){
+                admQueryCriteriaObj.setPageNumber(Integer.parseInt(String.valueOf(i)));
+                admResponse = equipmentService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmEquipment.class);
+                admEquipmentList = (List<AdmEquipment>) admResponse.getContent();
+                projectEquipment = JsonNodeUtils.toListNode(admEquipmentList,null,null);
+                calculate(dynamicInfoPointCodes, staticInfoPointCodes, projectEquipment,0, hashMap);
+            }
+        }
+        AdmGatherInfoPoint gatherInfoPoint = new AdmGatherInfoPoint();
+        gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
+        gatherInfoPoint.setDynamicInfoPointCounts(dynamicInfoPointCodes.size());
+        gatherInfoPoint.setStaticInfoPointCounts(staticInfoPointCodes.size());
+        gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
+        gatherInfoPoint.setGatherCustomInfoPointCounts(hashMap.get("customInfoPoint"));
+        gatherInfoPoint.setGatherDynamicInfoPointCounts(hashMap.get("dynamicInfoPoint"));
+        gatherInfoPoint.setGatherStaticInfoPointCounts(hashMap.get("staticInfoPoint"));
+        return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
     }
 
     /**
@@ -758,12 +801,51 @@ public class AdmReportEquipController {
      */
     @PostMapping("/gather-info-point")
     public AdmResponse gatherInfoPoint() {
-        //return customSqlService.gatherInfoPoints()
         if(StrUtil.isEmpty(AdmContextUtil.toDmpContext().getProjectId())){
             return AdmResponse.failure(ResponseCode.A0400.getCode());
         }
-        
-        JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, true, true);
+        Integer controlInfoCounts = controlInfoCounts(AdmEquipment.OBJ_TYPE);
+       // 根据objType获取定义 获取采集的设备的classcode
+        Set<String> objTypes = new HashSet<>(1);
+        objTypes.add(AdmEquipment.OBJ_TYPE);
+        List<Map<String, Object>> codes = DigitalObjectSimpleFacade.queryDefineInfoByObjType(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null, RequestData.builder().objTypes(objTypes).build());
+        Set<String> classCodeSet = new HashSet<String>(codes.size());
+        codes.stream().forEach(stringObjectMap -> classCodeSet.add(stringObjectMap.get("code").toString()));
+
+        //项目下所有已采集的动态信息点编码
+        List<ObjectInfoDefine> gatherDynamicInfoCode = gatherDynamicInfoCode(true, classCodeSet);
+        //项目下所有已采集静态信息点编码
+        List<ObjectInfoDefine> gatherStaticInfoCode =  gatherStaticInfoCode(true, classCodeSet);
+
+        //项目下所有的设备  分页查询
+        AdmQueryCriteria admQueryCriteriaObj =  new AdmQueryCriteria();
+        admQueryCriteriaObj.setPageNumber(1);
+        admQueryCriteriaObj.setPageSize(500);
+        admQueryCriteriaObj.setName(AdmEquipment.OBJ_TYPE);
+
+        admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","bimLocation","infos","classCode","equipSerial","bimFamilyName","bimFamilySymbol"));
+        AdmResponse admResponse = equipmentService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmEquipment.class);
+
+        Map<String,Integer> hashMap = new HashMap<>();
+        List<AdmEquipment> admEquipmentList = (List<AdmEquipment>) admResponse.getContent();
+        List<ObjectNode> projectEquipment = JsonNodeUtils.toListNode(admEquipmentList,null,null);
+        calculate(gatherDynamicInfoCode, gatherStaticInfoCode, projectEquipment,0, hashMap);
+
+        long page = admResponse.getTotal() / admResponse.getPageSize() + 1;
+        if(page >= 2){
+            for(long i = 2; i <= page; i++){
+                admQueryCriteriaObj.setPageNumber(Integer.parseInt(String.valueOf(i)));
+                admResponse = equipmentService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmEquipment.class);
+                admEquipmentList = (List<AdmEquipment>) admResponse.getContent();
+                projectEquipment = JsonNodeUtils.toListNode(admEquipmentList,null,null);
+                calculate(gatherDynamicInfoCode, gatherStaticInfoCode, projectEquipment,0, hashMap);
+            }
+        }
+        AdmGatherInfoPoint gatherInfoPoint = new AdmGatherInfoPoint();
+        gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
+        gatherInfoPoint.setGatherCustomInfoPointCounts(hashMap.get("customInfoPoint"));
+        gatherInfoPoint.setGatherDynamicInfoPointCounts(hashMap.get("dynamicInfoPoint"));
+        gatherInfoPoint.setGatherStaticInfoPointCounts(hashMap.get("staticInfoPoint"));
         return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
     }
 
@@ -773,11 +855,48 @@ public class AdmReportEquipController {
      */
     @PostMapping("/system-info-point")
     public AdmResponse systemInfoPoin() {
-        if(StrUtil.isEmpty(AdmContextUtil.toDmpContext().getProjectId())){
-            return AdmResponse.failure(ResponseCode.A0400.getCode());
+        Integer controlInfoCounts = controlInfoCounts(AdmEquipment.OBJ_TYPE);
+        // 根据objType获取定义 获取采集的设备的classcode
+        Set<String> objTypes = new HashSet<>(1);
+        objTypes.add(AdmSystem.OBJ_TYPE);
+        List<Map<String, Object>> codes = DigitalObjectSimpleFacade.queryDefineInfoByObjType(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null, RequestData.builder().objTypes(objTypes).build());
+        Set<String> classCodeSet = new HashSet<String>(codes.size());
+        codes.stream().forEach(stringObjectMap -> classCodeSet.add(stringObjectMap.get("code").toString()));
+
+        //项目下所有已采集的动态信息点编码
+        List<ObjectInfoDefine> gatherDynamicInfoCode = gatherDynamicInfoCode(true, classCodeSet);
+        //项目下所有已采集静态信息点编码
+        List<ObjectInfoDefine> gatherStaticInfoCode =  gatherStaticInfoCode(true, classCodeSet);
+
+        //项目下所有的设备  分页查询
+        AdmQueryCriteria admQueryCriteriaObj =  new AdmQueryCriteria();
+        admQueryCriteriaObj.setPageNumber(1);
+        admQueryCriteriaObj.setPageSize(500);
+        admQueryCriteriaObj.setName(AdmEquipment.OBJ_TYPE);
+
+        admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","infos","classCode"));
+        AdmResponse admResponse = systemService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmSystem.class);
+
+        Map<String,Integer> hashMap = new HashMap<>();
+        List<AdmSystem> admSystemList = (List<AdmSystem>) admResponse.getContent();
+        List<ObjectNode> projectEquipment = JsonNodeUtils.toListNode(admSystemList,null,null);
+        calculate(gatherDynamicInfoCode, gatherStaticInfoCode, projectEquipment,1, hashMap);
+
+        long page = admResponse.getTotal() / admResponse.getPageSize() + 1;
+        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);
+                admSystemList = (List<AdmSystem>) admResponse.getContent();
+                projectEquipment = JsonNodeUtils.toListNode(admSystemList,null,null);
+                calculate(gatherDynamicInfoCode, gatherStaticInfoCode, projectEquipment,1, hashMap);
+            }
         }
-        
-        JSONObject gatherInfoPoint = calInfoPointByObjType(AdmSystem.OBJ_TYPE,true, true);
+        AdmGatherInfoPoint gatherInfoPoint = new AdmGatherInfoPoint();
+        gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
+        gatherInfoPoint.setGatherCustomInfoPointCounts(hashMap.get("customInfoPoint"));
+        gatherInfoPoint.setGatherDynamicInfoPointCounts(hashMap.get("dynamicInfoPoint"));
+        gatherInfoPoint.setGatherStaticInfoPointCounts(hashMap.get("staticInfoPoint"));
         return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
     }
 
@@ -836,84 +955,90 @@ public class AdmReportEquipController {
     /**
      * 计算动态、静态信息点
      */
-    private Map<String, Integer> calculate(List<ObjectInfoDefine> dynamicInfoPointCodes, List<ObjectInfoDefine> staticInfoPointCodes, List objList, Integer num,Map<String, Integer> hashMap) {
-        int dynamicInfoPoint = hashMap.get("dynamicInfoPoint");
-        int staticInfoPoint = hashMap.get("staticInfoPoint");
-        int customInfoPoint = hashMap.get("customInfoPoint");
-
-        Iterator<ObjectInfoDefine> iterator1 = staticInfoPointCodes.iterator();
-        for (int i=0;i<objList.size();i++) {
-            JsonNode objectNode = JsonNodeUtils.toObjectNode(objList.get(i),null,null);
-            while (iterator1.hasNext()) {
-                ObjectInfoDefine infoDefine = iterator1.next();
-                if (objectNode.get("id") != null && "id" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
-                    staticInfoPoint++;
-                    iterator1.remove();
-                }
-                if (objectNode.get("name") != null && "name" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
-                    staticInfoPoint++;
-                    iterator1.remove();
-                }
-
-                if (objectNode.get("localId") != null && "localId" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
-                    staticInfoPoint++;
-                    iterator1.remove();
-                }
-
-                if (objectNode.get("localName") != null && "localName" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
-                    staticInfoPoint++;
-                    iterator1.remove();
-                }
-
-                if (objectNode.get("qrCode") != null && "qRCode" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
-                    staticInfoPoint++;
-                    iterator1.remove();
-                }
-                if (objectNode.get("cADID") != null && "cADID" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode() && num==0) {
-                    staticInfoPoint++;
-                    iterator1.remove();
-                }
-
-                if (objectNode.get("bimId") != null && "bimId" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode() && num==0) {
-                    staticInfoPoint++;
-                    iterator1.remove();
+    private void calculate(List<ObjectInfoDefine> dynamicInfoPointCodes, List<ObjectInfoDefine> staticInfoPointCodes, List<ObjectNode> objList, Integer num, Map<String, Integer> hashMap) {
+        int dynamicInfoPoint = hashMap.get("dynamicInfoPoint") == null ? 0 : hashMap.get("dynamicInfoPoint");
+        int staticInfoPoint = hashMap.get("staticInfoPoint") == null ? 0 : hashMap.get("staticInfoPoint");
+        int customInfoPoint = hashMap.get("customInfoPoint") == null ? 0 : hashMap.get("customInfoPoint");
+
+        if(CollUtil.isNotEmpty(objList)) {
+            for (int i = 0; i < objList.size(); i++) {
+                JsonNode objectNode = JsonNodeUtils.toObjectNode(objList.get(i), "infos", null);
+                Iterator<ObjectInfoDefine> iterator1 = staticInfoPointCodes.iterator();
+                while (iterator1.hasNext()) {
+                    ObjectInfoDefine infoDefine = iterator1.next();
+                    if(!objectNode.get("classCode").textValue().equals(infoDefine.getClassCode())){
+                        continue;
+                    }
+                    if (objectNode.get("id") != null && "id".equals(infoDefine.getCode())) {
+                        staticInfoPoint++;
+                        iterator1.remove();
+                        continue;
+                    }
+                    if (objectNode.get("name") != null && "name".equals(infoDefine.getCode())) {
+                        staticInfoPoint++;
+                        iterator1.remove();
+                        continue;
+                    }
+                    if (objectNode.get("localId") != null && "localId".equals(infoDefine.getCode())) {
+                        staticInfoPoint++;
+                        iterator1.remove();
+                        continue;
+                    }
+                    if (objectNode.get("localName") != null && "localName".equals(infoDefine.getCode())) {
+                        staticInfoPoint++;
+                        iterator1.remove();
+                        continue;
+                    }
+                    if (objectNode.get("qrCode") != null && "qRCode".equals(infoDefine.getCode())) {
+                        staticInfoPoint++;
+                        iterator1.remove();
+                        continue;
+                    }
+                    if (objectNode.get("cADID") != null && "cADID".equals(infoDefine.getCode()) && num == 0) {
+                        staticInfoPoint++;
+                        iterator1.remove();
+                    }
+                    if (objectNode.get("bimId") != null && "bimId".equals(infoDefine.getCode()) && num == 0) {
+                        staticInfoPoint++;
+                        iterator1.remove();
+                        continue;
+                    }
+                    if (objectNode.get("bimLocation") != null && "bimLocation".equals(infoDefine.getCode())) {
+                        staticInfoPoint++;
+                        iterator1.remove();
+                        continue;
+                    }
+                    if (objectNode.get("equipSerial") != null && "equipSerial".equals(infoDefine.getCode())) {
+                        staticInfoPoint++;
+                        iterator1.remove();
+                        continue;
+                    }
+                    if (objectNode.get("bimFamilyName") != null && "bimFamilyName".equals(infoDefine.getCode())) {
+                        staticInfoPoint++;
+                        iterator1.remove();
+                        continue;
+                    }
+                    if (objectNode.get("bimFamilySymbol") != null && "bimFamilySymbol".equals(infoDefine.getCode())) {
+                        staticInfoPoint++;
+                        iterator1.remove();
+                        continue;
+                    }
                 }
 
-                if (objectNode.get("bimLocation") != null && "bimLocation" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
-                    staticInfoPoint++;
-                    iterator1.remove();
-                }
-                if (objectNode.get("equipSerial") != null && "equipSerial" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
-                    staticInfoPoint++;
-                    iterator1.remove();
-                }
-                if (objectNode.get("bimFamilyName") != null && "bimFamilyName" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
-                    staticInfoPoint++;
-                    iterator1.remove();
-                }
-                if (objectNode.get("bimFamilySymbol") != null && "bimFamilySymbol" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
-                    staticInfoPoint++;
-                    iterator1.remove();
+                JsonNode objectNode1 = JsonNodeUtils.toObjectNode(objList.get(i), null, null);
+                if (!JSONUtil.isNull(objectNode1.get("infos")) && StrUtil.isNotEmpty(objectNode1.get("infos").textValue())) {
+                    Map<String, Object> dynamic = calculateInfoPoints(objectNode1.get("infos").toString(), objectNode1.get("classCode").textValue(), dynamicInfoPointCodes);
+                    Map<String, Object> staticMap = calculateInfoPoints(objectNode1.get("infos").toString(), objectNode1.get("classCode").textValue(), staticInfoPointCodes);
+                    dynamicInfoPoint += Integer.parseInt(dynamic.get("counts").toString());
+                    staticInfoPoint += Integer.parseInt(staticMap.get("counts").toString());
+                    dynamicInfoPointCodes.remove(dynamic.get("next"));
+                    staticInfoPointCodes.remove(staticMap.get("next"));
                 }
             }
         }
-
-        for (int i=0;i<objList.size();i++) {
-            JsonNode objectNode = JsonNodeUtils.toObjectNode(objList.get(i),null,null);
-            if (StrUtil.isNotEmpty(objectNode.get("infos").textValue())) {
-                Map<String,Object> dynamic = calculateInfoPoints(objectNode.get("infos").toString(), objectNode.get("classCode").textValue(), dynamicInfoPointCodes);
-                Map<String,Object> staticMap = calculateInfoPoints(objectNode.get("infos").toString(), objectNode.get("classCode").textValue(), staticInfoPointCodes);
-                dynamicInfoPoint += Integer.parseInt(dynamic.get("counts").toString());
-                staticInfoPoint += Integer.parseInt(staticMap.get("counts").toString());
-                dynamicInfoPointCodes.remove(dynamic.get("next"));
-                staticInfoPointCodes.remove(staticMap.get("next"));
-            }
-        }
         hashMap.put("dynamicInfoPoint", dynamicInfoPoint);
         hashMap.put("staticInfoPoint", staticInfoPoint);
         hashMap.put("customInfoPoint", customInfoPoint);
-
-        return hashMap;
     }
 
 
@@ -930,7 +1055,7 @@ public class AdmReportEquipController {
         Iterator<ObjectInfoDefine> iterator = infoPointCodes.iterator();
         while (iterator.hasNext()){
             ObjectInfoDefine nextInfo = iterator.next();
-            if(str.contains(nextInfo.getCode()) && type==nextInfo.getClassCode()){
+            if(str.contains(nextInfo.getCode()) && type.equals(nextInfo.getClassCode())){
                 counts ++;
                 hashMap.put("next", nextInfo);
                 iterator.remove();
@@ -940,102 +1065,63 @@ public class AdmReportEquipController {
         return hashMap;
     }
 
-    private JSONObject calInfoPointByObjType(String objType, Boolean visible, Boolean getInfoCounts){
-        JSONObject gatherInfoPoint = new JSONObject();
-        gatherInfoPoint.put("gatherInfoPointCounts", 0);
-        gatherInfoPoint.put("gatherCustomInfoPointCounts",0);
-        gatherInfoPoint.put("gatherDynamicInfoPointCounts",0);
-        gatherInfoPoint.put("gatherStaticInfoPointCounts",0);
-
-        Map<String, Integer> hashMap = new HashMap<>(16);
-        hashMap.put("dynamicInfoPoint", 0);
-        hashMap.put("staticInfoPoint", 0);
-        hashMap.put("customInfoPoint", 0);
-        //查询当前实例所有信息点总数
-        long controlInfoCounts = 0L;
-        Set<String> classCodeSet = new HashSet<>();
-        //2 获取动态 静态 信息点
-        // 2.1 根据objType获取定义 获取采集的设备的classcode
-        Set<String> objTypes = new HashSet<>(1);
-        objTypes.add(objType);
-        List<Map<String, Object>> codes = DigitalObjectSimpleFacade.queryDefineInfoByObjType(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null, RequestData.builder().objTypes(objTypes).build());
-        if(CollUtil.isEmpty(codes)){
-            return gatherInfoPoint;
-        }else{
-            codes.stream().forEach(stringObjectMap -> classCodeSet.add(stringObjectMap.get("code").toString()));
-            //1 查询项目下所有现有的系统
-            AdmQueryCriteria admQueryCriteriaObj =  new AdmQueryCriteria();
-            admQueryCriteriaObj.setPageNumber(1);
-            admQueryCriteriaObj.setPageSize(500);
-            admQueryCriteriaObj.setName(objType);
-            AdmResponse admResponse = new AdmResponse();
-            if(objType.equals(AdmEquipment.OBJ_TYPE)){
-                admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","bimLocation","infos","classCode","equipSerial","bimFamilyName","bimFamilySymbol"));
-                admResponse = equipmentService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmEquipment.class);
-            }else{
-                admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","infos","classCode"));
-                admResponse = systemService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmSystem.class);
-            }
-
-            //获取信息点
-            QueryCriteria queryCriteria = new QueryCriteria();
-            ObjectNode criteria = JsonNodeFactory.instance.objectNode();
-            criteria = JsonNodeFactory.instance.objectNode();
-            ArrayNode arrayNode = criteria.putObject("classCode").putArray("$in");
-            classCodeSet.stream().forEach(classCode -> arrayNode.add(classCode));
-
-            //查询当前实例所有信息点总数
-            if(getInfoCounts){
-                queryCriteria.setCriteria(criteria);
-                queryCriteria.setOnlyCount(true);
-                List<ObjectInfoDefine> totalInfo = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
-                controlInfoCounts = totalInfo.size();
-            }
-
-            //静态信息点
-            criteria.put("groupCode","0");
-            criteria.put("projectId","0");
-            criteria.put("category","STATIC");
-            if(visible){
-                criteria.put("valid", "1");
-            }else{
-                criteria.remove("valid");
-            }
-
-            queryCriteria.setOnlyCount(false);
-            queryCriteria.setCriteria(criteria);
-            List<ObjectInfoDefine> staticInfoCode = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
+    /**
+     * 根据对象分类查询信息的总数
+     * @param objtype
+     * @return
+     */
+    private Integer controlInfoCounts(String objtype){
+        AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
+        admQueryCriteria.setOnlyCount(true);
+        AdmResponse response = dictService.doQueryObjectInfo(AdmContextUtil.toDmpContext(), admQueryCriteria, objtype, AdmObjectInfo.class);
+        return response.getTotal().intValue();
+    }
 
-            criteria.remove("category");
+    /** 项目下所有已采集的动态信息点编码
+     *
+     */
+    private List<ObjectInfoDefine> gatherDynamicInfoCode(Boolean visible, Set<String> classCodeSet){
+        //获取信息点
+        AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
 
-            //动态信息点9
-            JSONObject category = new JSONObject();
-            category.put("$ne","STATIC");
-            criteria.putPOJO("category", category);
-            queryCriteria.setCriteria(criteria);
-            List<ObjectInfoDefine> dynamicInfoCode = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
-
-            // 2.2 根据定义获取信息点
-            //4 计算已采集的和需要采集的信息点占比
-            //return customSqlService.systemInfoPoins()
-            List admObjList = admResponse.getContent();
-            hashMap = calculate(dynamicInfoCode, staticInfoCode, admObjList, 1, hashMap);
-            long totalPage = admResponse.getTotal() / admResponse.getPageSize();
-            if(totalPage > 0l){
-                for (long page = admResponse.getPageSize() +1; page <= totalPage; page++){
-                    hashMap = calculate(dynamicInfoCode, staticInfoCode, admObjList, 1, hashMap);
-                }
-            }
-            if(CollUtil.isNotEmpty(hashMap)){
-                gatherInfoPoint.put("gatherCustomInfoPointCounts",hashMap.get("customInfoPoint"));
-                gatherInfoPoint.put("gatherDynamicInfoPointCounts",hashMap.get("dynamicInfoPoint"));
-                gatherInfoPoint.put("gatherStaticInfoPointCounts",hashMap.get("staticInfoPoint"));
-            }
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        ArrayNode arrayNode = criteria.putObject("classCode").putArray("$in");
+        classCodeSet.stream().forEach(classCode -> arrayNode.add(classCode));
+        //静态信息点
+        String filters = "groupCode='0' and projectId='0' and category != 'STATIC'";
+        if(visible){
+            filters = filters + " and valid = '1' ";
         }
-        gatherInfoPoint.put("gatherInfoPointCounts", controlInfoCounts);
-        return gatherInfoPoint;
+        filters = filters +" and classCode in ['"+StrUtil.join("','",classCodeSet)+"']";
+        admQueryCriteria.setFilters(filters);
+        System.out.println(filters);
+        AdmResponse dynamicInfoCode = dictService.doQueryObjectInfo(AdmContextUtil.toDmpContext(), admQueryCriteria,null, AdmObjectInfo.class);
+        return (List<ObjectInfoDefine>) dynamicInfoCode.getContent();
     }
 
+    /** 项目下所有已采集静态信息点编码
+     *
+     */
+    private List<ObjectInfoDefine> gatherStaticInfoCode(Boolean visible, Set<String> classCodeSet){
+        //获取信息点
+        QueryCriteria queryCriteria = new QueryCriteria();
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        ArrayNode arrayNode = criteria.putObject("classCode").putArray("$in");
+        classCodeSet.stream().forEach(classCode -> arrayNode.add(classCode));
+        //静态信息点
+        criteria.put("groupCode","0");
+        criteria.put("projectId","0");
+        criteria.put("category","STATIC");
+        if(visible){
+            criteria.put("valid", "1");
+        }else{
+            criteria.remove("valid");
+        }
+        queryCriteria.setOnlyCount(false);
+        queryCriteria.setCriteria(criteria);
+        List<ObjectInfoDefine> staticInfoCode = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
+        return staticInfoCode;
+    }
 
 
     /**

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

@@ -1,7 +1,29 @@
 package com.persagy.proxy.report.controller;
 
-import cn.hutool.core.util.StrUtil;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.QueryParam;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Sets;
 import com.persagy.dmp.common.constant.ResponseCode;
+import com.persagy.dmp.common.context.AppContext;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.GraphCodeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
 import com.persagy.proxy.adm.request.AdmDCSQueryRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
@@ -12,15 +34,10 @@ import com.persagy.proxy.object.model.AdmSystem;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
 import com.persagy.proxy.object.service.IAdmISpaceService;
 import com.persagy.proxy.object.service.IAdmSystemService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.QueryParam;
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.StrUtil;
+import lombok.RequiredArgsConstructor;
 
 /**
  *
@@ -47,10 +64,34 @@ public class AdmSpaceInfoController {
 	 * @return
 	 */
 	@RequestMapping("/space-bd-fl")
-	public AdmResponse queryCount(HttpServletRequest request) {
-		AdmResponse response = AdmResponse.success();
-		response.setCount(0L);
-		return response;
+	public JSONObject queryCount(HttpServletRequest request) {
+		String groupCode = AppContext.getContext().getGroupCode();
+		String projectId = AppContext.getContext().getProjectId();
+		
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		ObjectNode objectNode = objectMapper.createObjectNode();
+		objectNode.putPOJO("projectIds", Sets.newHashSet(projectId));
+		objectNode.putPOJO("graphCodes", Sets.newHashSet(GraphCodeEnum.ArchSubset.name()));
+		objectNode.putPOJO("relCodes", Sets.newHashSet(RelCodeEnum.Fl2Sp.name(), RelCodeEnum.Bd2Sp.name()));
+		objectNode.putPOJO("groups", Sets.newHashSet("objTo"));
+		CommonResult<List<ObjectRelation>> countByObjIds = DigitalObjectSimpleFacade.queryRelationCountByObjIds(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, objectNode);
+		List<ObjectRelation> data = countByObjIds.getData();
+		
+		int count = 0;
+		JSONObject result = new JSONObject();
+		result.put("count", count);
+		result.put("message", "");
+		result.put("result", "success");
+		if (CollectionUtil.isEmpty(data)) {
+			return result;
+		}
+		for (ObjectRelation objectRelation : data) {
+			if (objectRelation.getCount() != null && objectRelation.getCount() > 1) {
+				count++;
+			}
+		}
+		result.put("count", count);
+		return result;
 	}
 	/**
 	 * 统计 属于多建筑楼层的空间数据

+ 26 - 0
src/main/java/com/persagy/proxy/report/model/AdmGatherInfoPoint.java

@@ -0,0 +1,26 @@
+package com.persagy.proxy.report.model;
+
+import lombok.Data;
+
+/**
+ * 已采集信息点统计实体类
+ *
+ * @author lvxy
+ * @date 2021/10/28
+ */
+@Data
+public class AdmGatherInfoPoint {
+    /** 信息点总数(数字字典+自定义信息点) */
+    private Integer gatherInfoPointCounts;
+    private Integer dynamicInfoPointCounts;
+    private Integer staticInfoPointCounts;
+
+    /** 已采集的动态信息点总数 */
+    private Integer gatherDynamicInfoPointCounts;
+
+    /** 已采集的静态信息点总数 */
+    private Integer gatherStaticInfoPointCounts;
+
+    /** 已采集的自定义信息点总数 */
+    private Integer gatherCustomInfoPointCounts;
+}