Parcourir la source

设备报表24接口

lvxianyun il y a 3 ans
Parent
commit
686704a2d4

+ 979 - 0
src/main/java/com/persagy/proxy/adm/controller/AdmReportEquipController.java

@@ -0,0 +1,979 @@
+package com.persagy.proxy.adm.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.JsonNode;
+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.dto.RequestData;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.constant.ResponseCode;
+import com.persagy.dmp.common.model.entity.BaseEntity;
+import com.persagy.dmp.define.client.DigitalObjectInfoFacade;
+import com.persagy.dmp.define.entity.ObjectInfoDefine;
+import com.persagy.dmp.digital.client.DigitalObjectFacade;
+import com.persagy.dmp.digital.client.DigitalObjectSimpleFacade;
+import com.persagy.dmp.digital.client.DigitalRelationFacade;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.model.*;
+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.adm.service.IAdmComponentService;
+import com.persagy.proxy.adm.service.IAdmDictService;
+import com.persagy.proxy.adm.service.IAdmEquipmentService;
+import com.persagy.proxy.adm.service.IAdmSystemService;
+import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
+import com.persagy.proxy.common.entity.DmpResult;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import javax.ws.rs.QueryParam;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+*  设备报表API
+* @author lvxy
+* @date 2021/9/18
+*/
+@RestController
+@RequestMapping("/equip-query")
+public class AdmReportEquipController {
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+    @Autowired
+    private IAdmDictService dictService;
+    @Autowired
+    private IAdmEquipmentService equipmentService;
+    @Autowired
+    private IAdmComponentService componentService;
+    @Autowired
+    private IAdmSystemService systemService;
+
+    /**
+     * 查询设备信息 关联的部件 资产信息
+     * 查询设备关联资产部件数量
+     *
+     * @param projectId
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/equip-components")
+    public AdmResponse getEquipAssetComponents(@QueryParam("projectId") String projectId,
+                             @RequestBody AdmQueryCriteria request) throws Exception {
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        //查询设备
+        request.setName(AdmEquipment.OBJ_TYPE);
+        List<AdmQueryCriteria> cascade = new ArrayList<>();
+        //查询设备关联的部件
+        AdmQueryCriteria cascadeCom = new AdmQueryCriteria();
+        cascadeCom.setName("component");
+        cascade.add(cascadeCom);
+        //查询设备关联的系统
+        AdmQueryCriteria cascadeSys = new AdmQueryCriteria();
+        cascadeSys.setName("linkSystem");
+        cascade.add(cascadeSys);
+        request.setCascade(cascade);
+        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
+        List<ObjectNode> equips = DigitalObjectFacade.query(context.getGroupCode(), context.getProjectId(), context.getAppId(), null, queryCriteria);
+        if (CollUtil.isEmpty(equips)) {
+            return AdmResponse.success();
+        }
+        List<AdmEquipment> equipmentList = JSONUtil.toList(equips.toString(), AdmEquipment.class);
+        equipmentList.stream().forEach(equip -> {
+            if (CollUtil.isNotEmpty(equip.getComponent())) {
+                equip.setCount(equip.getComponent().size());
+                equip.setComponent(null);
+            } else {
+                equip.setCount(0);
+            }
+        });
+        //查询设备的类型信息,取list中的第一个数据
+        AdmEquipment admEquipment = equipmentList.get(0);
+        QueryCriteria defineCriteria = new QueryCriteria();
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        criteria.put("code", admEquipment.getClassCode());
+        defineCriteria.setCriteria(criteria);
+        AdmResponse defRes = dictService.doQueryObjectType(context, queryCriteria, AdmObjectType.class);
+        if (CollUtil.isNotEmpty(defRes.getContent())) {
+            List<AdmObjectType> componentCategory = (List<AdmObjectType>) defRes.getContent();
+            admEquipment.setComponentCategory(componentCategory);
+            equipmentList.set(0, admEquipment);
+        }
+        return AdmResponse.success(equipmentList);
+    }
+
+    /**
+     * 查询当前设备类型下的部件分类以及数量
+     *
+     * @param request 查询信息条件
+     * @return 查询结果
+     */
+    @PostMapping("/components-count")
+    public AdmResponse getEquipComponentsCount(@QueryParam("projectId") String projectId,
+                                               @RequestBody AdmQueryCriteria request){
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
+        ObjectNode criteria = queryCriteria.getCriteria();
+        if(JSONUtil.isNull(criteria)){
+            return AdmResponse.failure("请求参数错误");
+        }
+        JsonNode euipId = criteria.get("id");
+        RequestData requestData = new RequestData();
+        requestData.setEquipmentId(String.valueOf(euipId));
+        List result = DigitalObjectSimpleFacade.queryComponentsCountByEquipId(context.getGroupCode(), context.getProjectId(), context.getAppId(),null,requestData);
+        if(CollUtil.isNotEmpty(result)){
+            return AdmResponse.success(result);
+        }else{
+            return AdmResponse.success();
+        }
+    }
+
+
+    /**
+     * 查詢部件关联的资产
+     *  资产相关暂未支持
+     *
+     * @param   request     查询信息条件
+     * @return              查询结果
+     */
+    @PostMapping("/components-property")
+    public AdmResponse getComponentProperty(@QueryParam("projectId") String projectId,
+                                             @RequestBody AdmQueryCriteria request){
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        request.setName(AdmComponent.OBJ_TYPE);
+        return componentService.doQuery(context, request, AdmComponent.class);
+    }
+
+    /**
+     *查询当前设备类型的允许下所有部件类型,设备下的部件对应数量
+     *
+     * @param   id          设备id
+     * @param   category    分类
+     */
+    @GetMapping("/equip-compon")
+    public AdmResponse getEquipCompon(@QueryParam("projectId") String projectId, @QueryParam("id") String id, @QueryParam("category") String category){
+        //return  rEquipComponService.getEquipCompon(id,category)
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        RequestData requestData = new RequestData();
+        if(StrUtil.isNotEmpty(id)){
+            requestData.setEquipmentId(id);
+        }
+        if(StrUtil.isNotEmpty(category)){
+            requestData.setClassCode(category);
+        }
+        List result = DigitalObjectSimpleFacade.queryEquipComponentsByProjectId(context.getGroupCode(), context.getProjectId(), context.getAppId(),null, requestData);
+        if(CollUtil.isNotEmpty(result)){
+            return AdmResponse.success(result);
+        }else{
+            return AdmResponse.success();
+        }
+    }
+
+    /**
+     * TODO
+     * 根据设备批量创建资产
+     * 资产相关暂未支持
+     */
+    @PostMapping("/creat-propertys")
+    public AdmResponse batchCreation(@RequestBody AdmCreateRequest<AdmEquipment> createRequest, @QueryParam("projectId") String projectId) {
+        //return EquipmentService.batchCreationProperty(request)
+        return null;
+    }
+
+    /**
+     * 根据条件查询统计数量 查询设备或部件
+     * 例子: 根据设备类型或部件类型查询(\"Filters\": \"category ='SISU'\")," +
+     *      "根据设备类型和建筑查询(\"Filters\": \"category ='FASE';buildingId = '建筑id'\")," +
+     *      "根据设备类型和建筑楼层查询(\"Filters\": \"category ='FASE';buildingId = '建筑id';floorId = '楼层id'\")"
+     */
+    @PostMapping("/count")
+    public AdmResponse count(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request) {
+        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        if(StrUtil.isNotEmpty(request.getFilters()) && request.getFilters().contains("category")){
+            criteria.put("classCode", criteria.get("category").textValue());
+            criteria.remove("category");
+        }
+        queryCriteria.setCriteria(criteria);
+        queryCriteria.setOnlyCount(true);
+        List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteria);
+        if(CollUtil.isNotEmpty(euipCom)){
+            return AdmResponse.success(euipCom);
+        }else{
+            return AdmResponse.success();
+        }
+    }
+
+    /**
+     * 查询设备或部件
+     *
+     * 例子: 根据设备类型或部件类型查询(\"Filters\": \"category ='SISU'\")," +
+     *             "根据设备类型和建筑查询(\"Filters\": \"category ='FASE';buildingId = '建筑id'\")," +
+     *             "根据设备类型和建筑楼层查询(\"Filters\": \"category ='FASE';buildingId = '建筑id';floorId = '楼层id'\")"
+     */
+    @PostMapping("/pagequery")
+    public AdmResponse pageQuery(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request) {
+        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        queryCriteria.setCriteria(criteria);
+        if(StrUtil.isNotEmpty(request.getFilters()) && request.getFilters().contains("category")){
+            criteria.put("classCode", criteria.get("category").textValue());
+            criteria.remove("category");
+        }
+        List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteria);
+        if(CollUtil.isNotEmpty(euipCom)){
+            return AdmResponse.success(euipCom);
+        }else{
+            return AdmResponse.success();
+        }
+    }
+
+    /**
+     * 根据建筑, 楼层, 业务空间类型, 业务空间id 查询设备
+     *
+     *  description = "例子: 根据设备类型或部件类型查询(\"Filters\": \"category ='SISU'\")," +
+     *             "根据设备类型和建筑查询(\"Filters\": \"category ='FASE';buildingId = '建筑id'\")," +
+     *             "根据设备类型和建筑楼层查询(\"Filters\": \"category ='FASE';buildingId = '建筑id';floorId = '楼层id'\")" +
+     *             "所属业务空间类型填在ZoneType字段, 所属业务空间id填在ZoneId字段" +
+     *             "如果是查询不属于任何业务空间的对象, 设置notInZone = true"
+     */
+    @PostMapping("/zone-query")
+    public AdmResponse zoneQuery(@QueryParam("projectId") String projectId, @RequestBody AdmZoneEquipQueryRequest request) {
+        request.setName(AdmEquipment.OBJ_TYPE);
+        if(StrUtil.isAllEmpty(request.getZoneType(),request.getZoneId())){
+            return pageQuery(projectId, request);
+        }else{
+
+        }
+        return null;
+    }
+
+    /**
+     * 根据建筑, 楼层, 业务空间类型, 业务空间id  查询部件
+     *
+     * 根据建筑, 楼层, 业务空间类型, 业务空间id查询部件", description = "例子: 根据设备类型或部件类型查询(\"Filters\": \"category ='SISU'\")," +
+     *             "根据设备类型和建筑查询(\"Filters\": \"category ='FASE';buildingId = '建筑id'\")," +
+     *             "根据设备类型和建筑楼层查询(\"Filters\": \"category ='FASE';buildingId = '建筑id';floorId = '楼层id'\")" +
+     *             "所属业务空间类型填在ZoneType字段, 所属业务空间id填在ZoneId字段" +
+     *             "如果是查询不属于任何业务空间的对象, 设置notInZone = true"
+     */
+    @PostMapping("/zone-component-query")
+    public AdmResponse zoneComponentQuery(@QueryParam("projectId") String projectId,@RequestBody AdmZoneEquipQueryRequest request) {
+        if(StrUtil.isAllEmpty(request.getZoneType(),request.getZoneId())){
+            request.setName(AdmComponent.OBJ_TYPE);
+            return pageQuery(projectId, request);
+        }
+       return null;
+    }
+
+    /**
+     * 批量创建设备同时创建资产、创建设备和系统的关系
+     *
+     */
+    @PostMapping("/creat-equip-pro")
+    public AdmResponse create(@QueryParam("projectId") String projectId,@RequestBody AdmCreateRequest<AdmEquipment> createRequest){
+        //return EquipmentProSyService.createList(request)
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        List<AdmEquipment> vos = CollUtil.newArrayList(createRequest.getContent());
+        vos = equipmentService.doInsertEuip(context, AdmEquipment.class, vos);
+        return AdmResponse.success(vos);
+    }
+
+    /**
+     * 查询不在当前系统下的设备
+     */
+    @PostMapping("/equip-sys")
+    public AdmResponse pageQueryEquipSys(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request,@QueryParam("sysId") String sysId){
+        //return EquipmentService.queryBeforeEquipSy(sysId,request)
+        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
+        ObjectNode criteriaEquip = JsonNodeFactory.instance.objectNode();
+        criteriaEquip.put("objType", AdmEquipment.OBJ_TYPE);
+        JSONObject relationTo = new JSONObject();
+        relationTo.put("relCode", "Sy2Eq");
+        relationTo.put("graphCode", "MechSubset");
+        JSONObject objFrom = new JSONObject();
+        objFrom.put("$ne",sysId);
+        relationTo.put("objFrom", objFrom);
+        criteriaEquip.putPOJO("relationTo",relationTo);
+        queryCriteria.setCriteria(criteriaEquip);
+        List<ObjectNode> equips = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteria);
+        if (CollUtil.isEmpty(equips))
+            return AdmResponse.success();
+        else
+            return AdmResponse.success(equips);
+    }
+
+    /**
+     * 查询当前系统下的设备
+     *
+     * datacenter 查询目标是SysEquip 没先查询系统,根据系统id查询系统和设备的关系,根据关系查询设备,拼接数据
+     */
+    @PostMapping("/sys-equip")
+    public AdmResponse pageQuerySysEquip(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request){
+        //return SysEquipService.pageQuery(request, arrayListOf(SFilter.eq("projectId", SPageContext.getHeader("projectId").toString())))
+        request.setName(AdmSystem.OBJ_TYPE);
+        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
+        queryCriteria.setSize(500l);
+        List<ObjectNode> objectNodeList = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteria);
+        if(CollUtil.isEmpty(objectNodeList)){
+            return AdmResponse.success();
+        }
+        List<AdmSystem> admSystemList = JSONUtil.toList(objectNodeList.toString(), AdmSystem.class);
+        Map<String, AdmSystem> admSystemMap = CollUtil.fieldValueMap(admSystemList, BaseEntity.PROP_ID);
+        QueryCriteria queryCriteriaRelation = new QueryCriteria();
+        queryCriteriaRelation.setPage(request.getPageNumber() == null ? 0 : request.getPageNumber()*1l);
+        queryCriteriaRelation.setSize(request.getPageSize() == null ? 0 : request.getPageSize()*1l);
+
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        criteria.put("relCode", "Sy2Eq");
+        criteria.put("graphCode", "MechSubset");
+        ArrayNode arrayNode = criteria.putObject("objTo").putArray("$in");
+        admSystemMap.keySet().stream().forEach(id -> arrayNode.add(id));
+        queryCriteriaRelation.setCriteria(criteria);
+
+        List<ObjectRelation> relations = DigitalRelationFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteriaRelation);
+        if(CollUtil.isEmpty(relations)){
+            AdmResponse.success();
+        }
+        //objfrom = euipId
+        Map<String, ObjectRelation> relationMap = CollUtil.fieldValueMap(relations,"objFrom");
+
+        QueryCriteria queryCriteriaEqu = new QueryCriteria();
+        ObjectNode criteriaEquip = JsonNodeFactory.instance.objectNode();
+        criteriaEquip.put("objType", AdmEquipment.OBJ_TYPE);
+        ArrayNode array = criteriaEquip.putObject("id").putArray("$in");
+        relationMap.keySet().stream().forEach(id -> array.add(id));
+        queryCriteriaEqu.setCriteria(criteriaEquip);
+        List<ObjectNode> equips = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteriaEqu);
+        List<AdmEquipment> equipsList = JSONUtil.toList(equips.toString(), AdmEquipment.class);
+        Map<String, AdmEquipment> admEquipmentMap = CollUtil.fieldValueMap(equipsList, BaseEntity.PROP_ID);
+
+        List<AdmSystem> admSystems = new ArrayList<>(relations.size());
+        relationMap.keySet().stream().forEach(euipId -> {
+            ObjectRelation relation = relationMap.get(euipId);
+            AdmSystem admSystem = admSystemMap.get(relation.getObjTo());
+            admSystem.setEquipId(euipId);
+            admSystem.setEquipLocalName(admEquipmentMap.get(euipId).getLocalName());
+            admSystems.add(admSystem);
+        });
+
+        AdmResponse admResponse = new AdmResponse();
+        admResponse.setPageNumber(request.getPageNumber());
+        admResponse.setPageSize(admSystems.size());
+        admResponse.setContent(admSystems);
+        admResponse.setResult(DmpResult.SUCCESS);
+        return admResponse;
+    }
+
+    /**
+     * 查询项目下的所有设备和部件的类型、以及类型名称
+     */
+    @GetMapping("/equip-compon-category")
+    public AdmResponse equipORComponCategory(@QueryParam("projectId") String projectId){
+        //return EquipORComponCategoryService.getEquipORComponCategory()
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        RequestData requestData = new RequestData();
+        if(StrUtil.isNotEmpty(projectId)){
+            requestData.setProjectId(projectId);
+        }
+        requestData.setObjTypes(CollUtil.newHashSet(AdmEquipment.OBJ_TYPE, AdmComponent.OBJ_TYPE));
+        List<Map<String, Object>> result = DigitalObjectSimpleFacade.queryDefineInfoByObjType(context.getGroupCode(),projectId,context.getAppId(),null,requestData);
+        if(CollUtil.isNotEmpty(result)){
+            return AdmResponse.success(result);
+        }else{
+            return AdmResponse.success();
+        }
+    }
+
+    /**
+     *  批量处理设备关联资产、 查询接口
+     *  查询项目下的设备或部件-根据项目、建筑、楼层、设备或部件分类、业务空间实例筛选设备 然后通过计算匹配资产
+     *  查询条件中建筑id必须书写为buildingId,楼层id必须书写为floorId,spacrType物理世界定义的空间类型,spaceIdList业务空间实例id列表,category设备或部件类型
+     *  TODO 资产相关功能暂时不提供,之后根据业务进行需求处理
+     */
+    @PostMapping("/equip-category-property")
+    public AdmResponse equipProperty(@QueryParam("category") String category, @RequestBody AdmQueryCriteria request, @RequestBody List<String>  spaceIdList, @QueryParam("spacrType") String spacrType){
+        //return EquipmentComService.equipProperty(category, request, spaceIdList, spacrType)
+        return null;
+    }
+
+    /**
+     * 批量添加设备和资产的关系
+     * TODO 资产相关功能暂时不提供,之后根据业务进行需求处理
+     */
+    @PostMapping("/equip-r-property")
+    public AdmResponse equipRelationshipProperty(@RequestBody AdmCreateRequest<AdmProperty> createRequest, @QueryParam("projectId") String projectId) {
+        //return EquipmentComService.equipPro(request)
+        return null;
+    }
+
+    /**
+     * 修改设备的附件功能
+     * {
+     *     "content":"[{....}]"  EquipUpDateEnclosure 实体list
+     * }
+     */
+    @PostMapping("/update")
+    public AdmResponse equipUpDateEnclosure(@QueryParam("projectId") String projectId,@RequestBody ObjectNode equipUpDateEnclosureRequest) {
+        //return EquipmentService.equipUpDateEnclosurs(equipUpDateEnclosureRequest)
+        //TODO
+        return null;
+    }
+
+    /**
+     * 根据模型id查询待删除的设备数量
+     [{
+     *    "modelId":"",
+     *    "count":""
+     * }]
+     */
+    @PostMapping("/equip-del-com")
+    public AdmResponse equipComDel(@QueryParam("projectId") String projectId,@RequestBody List<ObjectNode> equipComDelList){
+        //return EquipmentService.equipComDels(equipComDelList)
+        if(CollUtil.isEmpty(equipComDelList)){
+            return AdmResponse.failure(ResponseCode.A0400.getCode());
+        }
+        QueryCriteria queryCriteriaEuip = new QueryCriteria();
+        ObjectNode criteriaEquip = JsonNodeFactory.instance.objectNode();
+        criteriaEquip.put("objType", AdmEquipment.OBJ_TYPE);
+        criteriaEquip.put("taskState",-1);
+        ArrayNode array = criteriaEquip.putObject("modelId").putArray("$in");
+        equipComDelList.stream().forEach(nodeObj -> {
+            if(StrUtil.isNotEmpty(nodeObj.get("modelId").textValue())) {
+                array.add(nodeObj.get("modelId").textValue());
+            }
+        });
+        queryCriteriaEuip.setCriteria(criteriaEquip);
+        List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteriaEuip);
+        if(CollUtil.isEmpty(equipList)){
+            return AdmResponse.success(equipComDelList);
+        }
+        Map<String, ObjectNode> equipDelMap = new HashMap<>(equipComDelList.size());
+        for (ObjectNode equipComDel : equipComDelList) {
+            String modelIdObj = equipComDel.get("modelId").toString();
+            equipDelMap.put(modelIdObj, equipComDel);
+        }
+        equipList.stream().forEach(euip -> {
+            String modelIdEq = euip.get("modelId").textValue();
+            if(equipDelMap.containsKey(modelIdEq)){
+                Integer count = Integer.parseInt(equipDelMap.get(modelIdEq).get("count").textValue()) + 1;
+                equipDelMap.get(modelIdEq).put("count", count);
+            }
+        });
+        return AdmResponse.success(equipDelMap.values().stream().collect(Collectors.toList()));
+    }
+
+
+    /**
+     * 根据模型id查询待补充的设备数量
+     * [{
+     *    "modelId":"",
+     *    "count":""
+     * }]
+     */
+    @PostMapping("/equip-supply")
+    public AdmResponse equipPropertySupply(@QueryParam("projectId") String projectId,@RequestBody List<ObjectNode> equipComDelList){
+        //return EquipmentService.equipPropertySupplys(equipComDelList)
+        //InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        if(CollUtil.isEmpty(equipComDelList)){
+            return AdmResponse.failure(ResponseCode.A0400.getCode());
+        }
+        //1. 根据modelId查询楼层信息
+        QueryCriteria queryCriteria = new QueryCriteria();
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        criteria.put("objType", AdmFloor.OBJ_TYPE);
+        ArrayNode arrayNode = criteria.putObject("modelId").putArray("$in");
+        equipComDelList.stream().forEach(node -> {
+            arrayNode.add(node.get("modelId").textValue());
+        });
+        queryCriteria.setCriteria(criteria);
+        List<ObjectNode> floorList = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteria);
+        if(CollUtil.isEmpty(floorList)){
+            return AdmResponse.success();
+        }
+        List<AdmFloor> admFloorList = JSONUtil.toList(floorList.toString(), AdmFloor.class);
+        Map<String, AdmFloor> admFloorMap = CollUtil.fieldValueMap(admFloorList, BaseEntity.PROP_ID);
+        //2. 根据楼层信息 查询需要补充设备(bimId isnull,bimLocation not isnull,modelId isnull)数量
+        QueryCriteria queryCriteriaEuip = new QueryCriteria();
+        ObjectNode criteriaEquip = JsonNodeFactory.instance.objectNode();
+        criteriaEquip.put("objType", AdmEquipment.OBJ_TYPE);
+        ArrayNode array = criteriaEquip.putObject("floorId").putArray("$in");
+        admFloorMap.keySet().stream().forEach(id -> array.add(id));
+
+        JSONObject bimId = new JSONObject();
+        bimId.put("$null", true);
+        criteria.putPOJO("bimId", bimId);
+
+        JSONObject bimLocation = new JSONObject();
+        bimId.put("$null", false);
+        criteriaEquip.putPOJO("bimLocation", bimLocation);
+
+        JSONObject modelId = new JSONObject();
+        modelId.put("$null", true);
+        criteriaEquip.putPOJO("modelId", modelId);
+
+        queryCriteriaEuip.setCriteria(criteriaEquip);
+        List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteriaEuip);
+        if(CollUtil.isEmpty(equipList)){
+            return AdmResponse.success(equipComDelList);
+        }
+        equipList.stream().forEach(equip -> {
+            String floolId = equip.get("floorId").textValue();
+            if(admFloorMap.containsKey(floolId)){
+                Integer count = Integer.parseInt(admFloorMap.get(floolId).getCount()) + 1;
+                admFloorMap.get(floolId).setCount(count.toString());
+            }
+        });
+
+        // 3 根据floorId,modelId 汇总
+        Map<String, ObjectNode> equipDelMap = new HashMap<>(equipComDelList.size());
+        for (ObjectNode equipComDel : equipComDelList) {
+           String modelIdObj = equipComDel.get("modelId").toString();
+           equipDelMap.put(modelIdObj, equipComDel);
+        }
+        admFloorMap.values().stream().forEach(floor -> {
+            String modelIdFl = floor.getModelId();
+            if(equipDelMap.containsKey(modelIdFl)){
+                Integer count = Integer.parseInt(equipDelMap.get(modelIdFl).get("count").textValue()) + Integer.parseInt(floor.getCount());
+                equipDelMap.get(modelIdFl).put("count", count);
+            }
+        });
+        return AdmResponse.success(equipDelMap.values().stream().collect(Collectors.toList()));
+    }
+
+    /**
+     * 模型质量报告 待删除的设备
+     * 级联-任务(scanTaskBase)、资产(property)、设备类型(equipCategory),级联任务的时候需要设置条件(TaskState = 0 添加时间降序  取第一个值 )
+     */
+    @PostMapping("/equip-comm-del")
+    public AdmResponse equipCommDel(@QueryParam("projectId") String projectId,@RequestBody AdmQueryCriteria request){
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        //return EquipDelService.pageQuery(sQueryRequest,withFilterList)
+        //e.task_state = '-1'::integer
+        //AND NOT e.model_id IS NULL
+        //TODO 关联 revit.model_floor revit.model_folder 展示模型相关内容
+        request.setName(AdmEquipment.OBJ_TYPE);
+        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
+        ObjectNode criteria = queryCriteria.getCriteria();
+        JSONObject modelId = new JSONObject();
+        modelId.put("$null", false);
+        criteria.putPOJO("modelId", modelId);
+        criteria.put("taskState","-1");
+        queryCriteria.setCriteria(criteria);
+
+        AdmResponse equipRes = equipmentService.doQuery(context, queryCriteria, AdmEquipment.class);
+        return equipRes;
+    }
+
+    /**
+     * 模型质量报告 待补充的设备
+     * 级联-设备类型(equipFamily)
+     */
+    @PostMapping("/property-equip-supp")
+    public AdmResponse propertyEquip(@QueryParam("projectId") String projectId,@RequestBody AdmQueryCriteria request){
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        //return EquipmentService.equipPropertySupp(sQueryRequest)
+        //equipment.bim_id IS NULL
+        //  AND equipment.model_id IS NULL
+        //  AND NOT equipment.bim_location IS NULL;
+
+        AdmQueryCriteria admQueryCriteria = request;
+        StringBuilder filters = new StringBuilder();
+        filters.append("floorId startwith 'Eq'");
+        filters.append(";buildingId startwith 'Bd'");
+        filters.append(";bimId isnull");
+        filters.append(";modelId isnull");
+        admQueryCriteria.setFilters(filters.toString());
+        admQueryCriteria.setName(AdmEquipment.OBJ_TYPE);
+        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(admQueryCriteria);
+        ObjectNode criteria = queryCriteria.getCriteria();
+        JSONObject bimLocation = new JSONObject();
+        bimLocation.put("$null", false);
+        criteria.putPOJO("bimLocation", bimLocation);
+        queryCriteria.setCriteria(criteria);
+
+        AdmResponse equipRes = equipmentService.doQuery(context, queryCriteria, AdmEquipment.class);
+        if(CollUtil.isNotEmpty(equipRes.getContent())){
+            List<AdmEquipment> admEquipments = JSONUtil.toList(equipRes.getContent().toString(), AdmEquipment.class);
+            Map<String, AdmEquipment> admEquipmentMap = CollUtil.fieldValueMap(admEquipments, BaseEntity.PROP_ID);
+            if(CollUtil.isEmpty(request.getCascade())){
+                List<AdmQueryCriteria> cascade = new ArrayList<>();
+                AdmQueryCriteria admQueryCriteriaBd = new AdmQueryCriteria();
+                admQueryCriteriaBd.setName(AdmBuilding.OBJ_TYPE);
+                cascade.add(admQueryCriteriaBd);
+                AdmQueryCriteria admQueryCriteriaFl = new AdmQueryCriteria();
+                admQueryCriteriaFl.setName(AdmFloor.OBJ_TYPE);
+                cascade.add(admQueryCriteriaFl);
+                request.setCascade(cascade);
+                request.setName(AdmEquipment.OBJ_TYPE);
+            }
+            ArrayNode arrayNode = JsonNodeFactory.instance.arrayNode();
+            admEquipmentMap.keySet().stream().forEach(id -> arrayNode.add(id));
+            String filter = "";
+            if(StrUtil.isNotEmpty(request.getFilters())){
+                filter = request.getFilters();
+            }
+            filter =  filter + ";id in "+arrayNode.toString();
+            request.setFilters(filter);
+
+           AdmResponse admResponse = equipmentService.doQuery(context, request, AdmEquipment.class);
+           if(CollUtil.isNotEmpty(admResponse.getContent())){
+               //处理数据
+               List<ObjectNode> objectNodeList = (List<ObjectNode>) admResponse.getContent();
+               objectNodeList.stream().forEach(equip ->{
+                   JsonNode building = equip.get("building");
+                   JsonNode floor = equip.get("floor");
+                   if(!JSONUtil.isNull(building)){
+                       equip.put("buildingName", building.get("localName").textValue());
+                   }
+                   if(!JSONUtil.isNull(floor)){
+                       equip.put("floorName", floor.get("localName").textValue());
+                       equip.put("modelId", floor.get("modelId").textValue());
+                   }
+               });
+           }
+           return admResponse;
+        }else{
+            return AdmResponse.success();
+        }
+
+        /**  sql
+         *  SELECT equipment.id,
+         *        equipment.name,
+         *        equipment.local_id,
+         *        equipment.local_name,
+         *        equipment.bim_id,
+         *        equipment.bim_location,
+         *        equipment.floor_id,
+         *        equipment.building_id,
+         *        equipment.cad_id,
+         *        equipment.project_id,
+         *        equipment.find_people,
+         * 			 equipment.class_code,
+         *        equipment.infos,
+         * 			 JSON_EXTRACT(floor.infos, '$.modeId') as model_id,
+         * 							 floor.local_name as floor_name,
+         *                (SELECT building.local_name
+         *                 FROM dt_object building
+         *                 WHERE building.id = JSON_EXTRACT(equipment.infos, '$.buildingId') and building.obj_type = 'building') AS building_name,
+         *
+         *                (SELECT def_class.name
+         *                 FROM dt_define_type def_class
+         *                 WHERE def_class.code = equipment.class_code
+         *                 LIMIT 1)                                               AS code_name
+         *
+         * from (	SELECT equipment.id,
+         *                equipment.name,
+         *                equipment.local_id,
+         *                equipment.local_name,
+         * 							 equipment.class_code,
+         *                JSON_EXTRACT(equipment.infos, '$.bimId') bim_id,
+         *                JSON_EXTRACT(equipment.infos, '$.bimLocation') bim_location,
+         *                JSON_EXTRACT(equipment.infos, '$.floorId') floor_id,
+         *                JSON_EXTRACT(equipment.infos, '$.buildingId') building_id,
+         *                JSON_EXTRACT(equipment.infos, '$.cadId') cad_id,
+         *                equipment.project_id,
+         *                JSON_EXTRACT(equipment.infos, '$.findPeople') find_people,
+         *                equipment.infos
+         * 				FROM dt_object equipment
+         * 				WHERE equipment.obj_type='equipment'
+         * 					AND JSON_EXTRACT(equipment.infos, '$.bimId') IS NULL
+         *           AND JSON_EXTRACT(equipment.infos, '$.modeId') IS NULL
+         * 					AND JSON_EXTRACT(equipment.infos, '$.buildingId') IS NOT NULL
+         *           AND JSON_EXTRACT(equipment.infos, '$.floorId') IS NOT NULL
+         *           AND JSON_EXTRACT(equipment.infos, '$.bimLocation') IS NOT NULL
+         * ) equipment	left join dt_object floor on fl
+         */
+    }
+
+    /**
+     * 设备信息点
+     * 统计设备信息点与总数据占比
+     */
+    @PostMapping("/info-point")
+    public AdmResponse infoPoint(@QueryParam("projectId") String projectId) {
+        //return customSqlService.infoPoints()
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, context, false, false);
+        JSONObject infoPoint = new JSONObject();
+        infoPoint.put("dynamicInfoPoint",gatherInfoPoint.getString("gatherDynamicInfoPointCounts"));
+        infoPoint.put("staticInfoPoint",gatherInfoPoint.getString("gatherStaticInfoPointCounts"));
+        return AdmResponse.success(CollUtil.newArrayList(infoPoint));
+    }
+
+    /**
+     * 设备已采集信息点
+     * 统计设备信息点与需采集数据占比
+     */
+    @PostMapping("/gather-info-point")
+    public AdmResponse gatherInfoPoint(@QueryParam("projectId") String projectId) {
+        //return customSqlService.gatherInfoPoints()
+        if(StrUtil.isEmpty(projectId)){
+            return AdmResponse.failure(ResponseCode.A0400.getCode());
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, context, true, true);
+        return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
+    }
+
+
+    /**
+     * 统计系统信息点与需采集数据占比
+     */
+    @PostMapping("/system-info-point")
+    public AdmResponse systemInfoPoin(@QueryParam("projectId") String projectId) {
+        if(StrUtil.isEmpty(projectId)){
+            return AdmResponse.failure(ResponseCode.A0400.getCode());
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        JSONObject gatherInfoPoint = calInfoPointByObjType(AdmSystem.OBJ_TYPE, context, true, true);
+        return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
+    }
+
+
+    /**
+     * 台账中待删除的对象 数量统计
+     */
+    @PostMapping("/del-equip-comm-pro")
+    public AdmResponse deleteObj(@QueryParam("projectId") String projectId){
+        QueryCriteria queryCriteria = new QueryCriteria();
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        criteria.put("taskState", -1);
+        criteria.put("objType","['equipment','component']");
+        queryCriteria.setCriteria(criteria);
+        queryCriteria.setOnlyCount(true);
+        List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteria);
+        if(CollUtil.isNotEmpty(euipCom)){
+           return AdmResponse.success(euipCom);
+        }else{
+            return AdmResponse.success();
+        }
+    }
+
+    /**
+     * 项目下的所有设备类型以及名称
+     *
+     * @return 返回对象列表
+     */
+    @PostMapping("/type")
+    public AdmResponse equipType(@QueryParam("projectId") String projectId){
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        RequestData requestData = new RequestData();
+        if(StrUtil.isNotEmpty(projectId)){
+            requestData.setProjectId(projectId);
+        }
+        requestData.setObjType(AdmEquipment.OBJ_TYPE);
+        List<Map<String, Object>> result = DigitalObjectSimpleFacade.queryDefineInfoByObjType(context.getGroupCode(),projectId,context.getAppId(),null,requestData);
+        if(CollUtil.isNotEmpty(result)){
+            return AdmResponse.success(result);
+        }else{
+            return AdmResponse.success();
+        }
+    }
+
+
+    /**
+     * 计算动态、静态信息点
+     */
+    private Map<String, Integer> calculate(List<ObjectInfoDefine> dynamicInfoPointCodes, List<ObjectInfoDefine> staticInfoPointCodes, List<ObjectNode> objectNodeList, Integer num) {
+        Map<String, Integer> hashMap = new HashMap<String, Integer>();
+        int dynamicInfoPoint = 0;
+        int staticInfoPoint = 0;
+        int customInfoPoint=0;
+        Iterator<ObjectInfoDefine> iterator1 = staticInfoPointCodes.iterator();
+        for (ObjectNode objectNode : objectNodeList) {
+            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();
+                }
+
+                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();
+                }
+            }
+        }
+
+        for (ObjectNode objectNode : objectNodeList) {
+            if (objectNode.get("infos") != null) {
+                Map<String,Object> dynamic = calculateInfoPoints(objectNode.get("infos").toString(), objectNode.get("classCode").textValue().toString(), dynamicInfoPointCodes);
+                Map<String,Object> staticMap = calculateInfoPoints(objectNode.get("infos").toString(), objectNode.get("classCode").textValue().toString(), 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;
+    }
+
+
+    /**
+     * 计算信息点
+     *
+     */
+    private Map<String,Object> calculateInfoPoints(String str, String type, List<ObjectInfoDefine> infoPointCodes) {
+        int counts = 0;
+        Map<String,Object> hashMap = new HashMap<String,Object>();
+        Iterator<ObjectInfoDefine> iterator = infoPointCodes.iterator();
+        while (iterator.hasNext()){
+            ObjectInfoDefine nextInfo = iterator.next();
+            if(str.contains(nextInfo.getCode()) && type==nextInfo.getClassCode()){
+                counts ++;
+                hashMap.put("next", nextInfo);
+                iterator.remove();
+            }
+        }
+        hashMap.put("counts", counts);
+        return hashMap;
+    }
+
+    private JSONObject calInfoPointByObjType(String objType, InstanceUrlParam context, Boolean visible, Boolean getInfoCounts){
+        //1 查询项目下所有现有的系统
+        AdmQueryCriteria admQueryCriteriaObj =  new AdmQueryCriteria();
+        if(objType.equals(AdmEquipment.OBJ_TYPE)){
+            admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","bimLocation","infos","classCode","equipSerial","bimFamilyName","bimFamilySymbol"));
+        }else{
+            admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","infos","classCode"));
+        }
+        admQueryCriteriaObj.setName(objType);
+        QueryCriteria queryCriteriaSys = AdmQueryCriteriaHelper.toDmpCriteria(admQueryCriteriaObj);
+        List<ObjectNode> admObjList = DigitalObjectFacade.query(groupCode, context.getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteriaSys);
+
+        //2 获取动态 静态 信息点
+        // 2.1 根据objType获取定义
+        Set<String> classCodeSet = new HashSet<>();
+        if(AdmSystem.OBJ_TYPE.equals(objType)){
+            QueryCriteria queryCriteriaType = new QueryCriteria();
+            ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+            criteria.put("objType", objType);
+            queryCriteriaType.setCriteria(criteria);
+            AdmResponse admResponseType = dictService.doQueryObjectType(context, queryCriteriaType, AdmObjectType.class);
+            if(CollUtil.isEmpty(admResponseType.getContent())){
+                return null;
+            }
+            List<AdmObjectType> admObjectTypes = (List<AdmObjectType>) admResponseType.getContent();
+            Map<String, AdmObjectType> admObjectTypeMap = CollUtil.fieldValueMap(admObjectTypes, "code");
+            classCodeSet = admObjectTypeMap.keySet();
+        }else {
+            List<AdmEquipment> equipmentList = JSONUtil.toList(admObjList.toString(), AdmEquipment.class);
+            Map<String, AdmEquipment> admObjectTypeMap = CollUtil.fieldValueMap(equipmentList, "code");
+            classCodeSet = admObjectTypeMap.keySet();
+        }
+
+        JSONObject gatherInfoPoint = new JSONObject();
+        if(CollUtil.isEmpty(admObjList)){
+            gatherInfoPoint.put("gatherInfoPointCounts", 0);
+            gatherInfoPoint.put("gatherCustomInfoPointCounts",0);
+            gatherInfoPoint.put("gatherDynamicInfoPointCounts",0);
+            gatherInfoPoint.put("gatherStaticInfoPointCounts",0);
+        } else {
+            // 2.2 根据定义获取信息点
+            //查询当前实例所有信息点总数
+            long controlInfoCounts = 0l;
+            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));
+            criteria.put("type", "commo");
+            if(getInfoCounts){
+                criteria.put("valid","['0','1']");
+                queryCriteria.setCriteria(criteria);
+                queryCriteria.setOnlyCount(true);
+                List<ObjectInfoDefine> totalInfo = DigitalObjectInfoFacade.query(groupCode, context.getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
+                controlInfoCounts = totalInfo.size();
+                criteria.remove("valid");
+            }
+            //静态信息点
+            criteria.put("category","STATIC");
+            if(visible){
+                criteria.put("valid", "1");
+            }else{
+                criteria.put("valid","['0','1']");
+            }
+            queryCriteria.setCriteria(criteria);
+            List<ObjectInfoDefine> staticInfoCode = DigitalObjectInfoFacade.query(groupCode, context.getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
+            criteria.remove("category");
+
+            //动态信息点
+            JSONObject category = new JSONObject();
+            category.put("$ne","STATIC");
+            criteria.putPOJO("category", category);
+            queryCriteria.setCriteria(criteria);
+            List<ObjectInfoDefine> dynamicInfoCode = DigitalObjectInfoFacade.query(groupCode, context.getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
+            //4 计算已采集的和需要采集的信息点占比
+            //return customSqlService.systemInfoPoins()
+            Map<String, Integer> hashMap = calculate(dynamicInfoCode, staticInfoCode, admObjList, 1);
+            gatherInfoPoint.put("gatherCustomInfoPointCounts",hashMap.get("customInfoPoint"));
+            gatherInfoPoint.put("gatherDynamicInfoPointCounts",hashMap.get("dynamicInfoPoint"));
+            gatherInfoPoint.put("gatherStaticInfoPointCounts",hashMap.get("staticInfoPoint"));
+            gatherInfoPoint.put("gatherInfoPointCounts", controlInfoCounts);
+        }
+        return gatherInfoPoint;
+    }
+}

+ 56 - 12
src/main/java/com/persagy/proxy/adm/controller/AdmSystemController.java

@@ -2,7 +2,6 @@ package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONUtil;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -12,13 +11,14 @@ import com.persagy.dmp.define.client.DigitalDefineFacade;
 import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
-import com.persagy.dmp.digital.entity.ObjectDigital;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.*;
 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.adm.service.IAdmBuildingService;
+import com.persagy.proxy.adm.service.IAdmFloorService;
 import com.persagy.proxy.adm.service.IAdmSystemService;
 import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
@@ -30,8 +30,9 @@ import org.springframework.web.bind.annotation.*;
 import javax.json.JsonObject;
 import javax.validation.constraints.NotNull;
 import javax.ws.rs.QueryParam;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 /**
  * Adm 系统 API
@@ -44,6 +45,10 @@ import java.util.stream.Collectors;
 public class AdmSystemController {
     @Autowired
     private IAdmSystemService service;
+    @Autowired
+    private IAdmBuildingService buildingService;
+    @Autowired
+    private IAdmFloorService floorService;
     @Value("${middleware.group.code}")
     private String groupCode;
 
@@ -220,6 +225,45 @@ public class AdmSystemController {
         }
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        if(StrUtil.isAllNotEmpty(buildingId, floorId) && !"1".equals(buildingId) && !"1".equals(floorId)){
+            //系统级联建筑 楼层
+            AdmResponse syses = service.doQuery(context, request, AdmSystem.class);
+            if(CollUtil.isEmpty(syses.getContent())){
+                return syses;
+            }
+            AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
+            admQueryCriteria.setName(AdmBuilding.OBJ_TYPE);
+            admQueryCriteria.setFilters("id = "+buildingId);
+            AdmResponse buildings = buildingService.doQuery(context, request, AdmBuilding.class);
+
+            admQueryCriteria = new AdmQueryCriteria();
+            admQueryCriteria.setName(AdmFloor.OBJ_TYPE);
+            admQueryCriteria.setFilters("id = "+floorId);
+            AdmResponse floors = floorService.doQuery(context, request, AdmFloor.class);
+            //处理数据 BuildingFloorInfo
+            AdmBuildingFloorInfo buildingFloorInfo = new AdmBuildingFloorInfo();
+            if(CollUtil.isNotEmpty(floors.getContent())){
+                AdmFloor floor = (AdmFloor) floors.getContent().get(0);
+                buildingFloorInfo.setFloorName(floor.getLocalName());
+                buildingFloorInfo.setFloorID(floorId);
+            }
+            if(CollUtil.isNotEmpty(buildings.getContent())){
+                AdmBuilding building = (AdmBuilding) floors.getContent().get(0);
+                buildingFloorInfo.setBuildName(building.getLocalName());
+                buildingFloorInfo.setBuildID(buildingId);
+            }
+            List<AdmSystem> admSystemList = (List<AdmSystem>) syses.getContent();
+            admSystemList.stream().forEach( admSystem -> {
+                admSystem.setBuildingFloorInfoList(CollUtil.newArrayList(buildingFloorInfo));
+            });
+            syses.setContent(admSystemList);
+            return syses;
+        }
+
+
+
+        return null;
+       /*
         QueryCriteria queryCriteria_sysInFl = new QueryCriteria();
         ObjectNode criteria_sysInFl = JsonNodeFactory.instance.objectNode();
         criteria_sysInFl.put("relCode","Sy2Fl");
@@ -237,7 +281,7 @@ public class AdmSystemController {
         Set<String> sysIds = new HashSet<>();
         List<ObjectRelation> relations_SysInFl = null;
         if(StrUtil.isAllNotEmpty(buildingId,floorId)&&!floorId.equals("1")){
-            /** 楼层id不为空且不为1,建筑id为空 ---> 系统和楼层关系表 取系统id  408 --> 明确建筑明确楼层->空间*/
+            *//** 楼层id不为空且不为1,建筑id为空 ---> 系统和楼层关系表 取系统id  408 --> 明确建筑明确楼层->空间*//*
             criteria_sysInFl.put("objTo", floorId);
             queryCriteria_sysInFl.setCriteria(criteria_sysInFl);
             relations_SysInFl = DigitalRelationFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteria_sysInFl);
@@ -246,7 +290,7 @@ public class AdmSystemController {
             }
             ensureCondion(context, null, sysIds, criteria_obj,true);
         }else if(StrUtil.isAllNotEmpty(buildingId,floorId)&&floorId.equals("1")&&!buildingId.equals("1")){
-            /** 楼层id为空,建筑id不为空且不为1 ---> 系统和建筑关系表 取系统id  421*/
+            *//** 楼层id为空,建筑id不为空且不为1 ---> 系统和建筑关系表 取系统id  421*//*
             // 明确建筑 未明确楼层
             relations_SysInFl = DigitalRelationFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteria_sysInFl);
             if(CollUtil.isNotEmpty(relations_SysInFl)){
@@ -258,16 +302,16 @@ public class AdmSystemController {
                 ensureCondion(context, queryCriteria_sysInBd, sysIds, criteria_obj,true);
             }
         }else if(StrUtil.isEmpty(floorId) && StrUtil.isNotEmpty(buildingId) && buildingId.equals("1")){
-            /** 楼层id为1,建筑id为1 ---> 系统id不在(系统和楼层关系表 取系统id  系统和建筑关系表 取系统id)之内 450*/
+            *//** 楼层id为1,建筑id为1 ---> 系统id不在(系统和楼层关系表 取系统id  系统和建筑关系表 取系统id)之内 450*//*
             //未明确建筑 没有Sy2Bd关系的系统
             ensureCondion(context, queryCriteria_sysInBd, sysIds, criteria_obj,false);
         }else if(StrUtil.isEmpty(floorId) && StrUtil.isNotEmpty(buildingId) && !buildingId.equals("1")){
-            /** 楼层id不为空,建筑id不为空 ---> 系统和楼层关系表 取系统id  将建筑id作为条件 461*/
+            *//** 楼层id不为空,建筑id不为空 ---> 系统和楼层关系表 取系统id  将建筑id作为条件 461*//*
             criteria_sysInBd.put("objTo", buildingId);
             queryCriteria_sysInBd.setCriteria(criteria_sysInBd);
             ensureCondion(context, queryCriteria_sysInBd, sysIds, criteria_obj,true);
         } else if(StrUtil.isAllEmpty(floorId, buildingId)){
-            /** 楼层id为空,建筑id为空 ---> 查询所有 */
+            *//** 楼层id为空,建筑id为空 ---> 查询所有 *//*
         }
         queryCriteriaObj.setCriteria(criteria_obj);
         List<ObjectNode> systems = DigitalObjectFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteriaObj);
@@ -314,10 +358,10 @@ public class AdmSystemController {
             return AdmResponse.success(systems);
         }else{
             return AdmResponse.success();
-        }
+        }*/
     }
 
-    private void ensureCondion(InstanceUrlParam context, QueryCriteria queryCriteria_sysInBd, Set<String>sysIds, ObjectNode criteria_obj, boolean ifInCondition){
+    /*private void ensureCondion(InstanceUrlParam context, QueryCriteria queryCriteria_sysInBd, Set<String>sysIds, ObjectNode criteria_obj, boolean ifInCondition){
         if(queryCriteria_sysInBd != null){
             List<ObjectRelation> relations_SysInBd = DigitalRelationFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteria_sysInBd);
             if(CollUtil.isNotEmpty(relations_SysInBd)){
@@ -332,7 +376,7 @@ public class AdmSystemController {
                 sysIds.stream().forEach(id -> arrayNode.add(id));
             }
         }
-    }
+    }*/
 
     /**
      * 查询系统信息-试图级联建筑楼层 暂未使用

+ 5 - 0
src/main/java/com/persagy/proxy/adm/model/AdmBuildingFloorInfo.java

@@ -1,5 +1,6 @@
 package com.persagy.proxy.adm.model;
 
+import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Data;
 
 /**
@@ -10,14 +11,18 @@ import lombok.Data;
 @Data
 public class AdmBuildingFloorInfo {
     /** 建筑体ID */
+    @JSONField(name = "BuildID")
     private String buildID;
 
     /** 建筑体名称 */
+    @JSONField(name = "BuildName")
     private String buildName;
 
     /** 楼层ID */
+    @JSONField(name = "FloorID")
     private String floorID;
 
     /** 楼层名称 */
+    @JSONField(name = "FloorName")
     private String floorName;
 }

+ 22 - 0
src/main/java/com/persagy/proxy/adm/model/AdmZoneEquipQueryRequest.java

@@ -0,0 +1,22 @@
+package com.persagy.proxy.adm.model;
+
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author lvxy
+ * @date 2021/9/24
+ */
+@Data
+@EqualsAndHashCode(callSuper=true)
+public class AdmZoneEquipQueryRequest extends AdmQueryCriteria {
+    /**所属业务空间类型", example = "TenantZone" */
+    private String zoneType;
+
+    /** "所属业务空间Id", example = "Sp*****" */
+    private String zoneId;
+
+    /**"不在任何业务空间内的设备或部件(true)", example = "true" */
+    private Boolean notInZone = false;
+}

+ 80 - 0
src/main/java/com/persagy/proxy/adm/model/equip/EquipUpDateEnclosure.java

@@ -0,0 +1,80 @@
+package com.persagy.proxy.adm.model.equip;
+
+import com.persagy.proxy.adm.model.AdmTaskPic;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author lvxy
+ * @date 2021/9/27
+ * 增量附件
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class EquipUpDateEnclosure implements Serializable {
+
+    /** 设备id */
+    private String  equipId;
+
+    /** 保险文件 */
+    private List<AdmTaskPic> insuranceFile;
+
+    /** 设备铭牌照片 */
+    private List<AdmTaskPic> nameplate;
+
+    /** 设备照片 */
+    private List<AdmTaskPic> pic;
+
+    /** 设备图纸 */
+    private List<AdmTaskPic> drawing;
+
+    /** 设备文档 */
+    private List<AdmTaskPic> archive;
+
+    /** 安装照片 */
+    private List<AdmTaskPic> installPic;
+
+    /** 安装图纸 */
+    private List<AdmTaskPic> installDrawing;
+
+    /** 安装质检报告 */
+    private List<AdmTaskPic> checkReport;
+
+    /** 操作说明书 */
+    private List<AdmTaskPic> operationManual;
+
+    /** 产品合格证 */
+    private List<AdmTaskPic> productCertification;
+
+    /** 维修保养手册 */
+    private List<AdmTaskPic> maintainManual;
+
+    /** 安装说明书 */
+    private List<AdmTaskPic> installInstruction;
+
+    /** 验收报告 */
+    private List<AdmTaskPic> acceptanceReport;
+
+    /** 进场验收单 */
+    private List<AdmTaskPic> approachingAcceptance;
+
+    /** 供应合同 */
+    private List<AdmTaskPic> supplierContract;
+
+    /** 检测报告 */
+    private List<AdmTaskPic> testReport;
+
+    /** 原厂证明 */
+    private List<AdmTaskPic> originalCertificate;
+
+    /** 原厂证明 */
+    private List<AdmTaskPic> fanCharacterCurve;
+
+    /** 原厂证明 */
+    private List<AdmTaskPic> designIDGraph;
+}

+ 2 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AdmSpaceServiceImpl.java

@@ -337,6 +337,7 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
 
     private JSONObject addXParam(String relCode, String masterObjType, String slaveObjType, JSONObject requestData){
         requestData.put("relCode", "Bd2Sp");
+        requestData.put("graphCode", "ArchSubset");
         requestData.put("masterObjType", masterObjType);
         requestData.put("slaveObjType", slaveObjType);
         return requestData;
@@ -410,6 +411,7 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
     private void addRelationTo(QueryCriteria rwdQueryCriteria, String objFrom, String relCode){
         ObjectNode relationTO = JsonNodeFactory.instance.objectNode();
         relationTO.put("relCode", relCode);
+        relationTO.put("graphCode", "ArchSubset");
         relationTO.put("objFrom", objFrom);
         ObjectNode criteria = rwdQueryCriteria.getCriteria();
         criteria.putPOJO("relationTo", relationTO);