Browse Source

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

zhangqiankun 3 years ago
parent
commit
49e8ec13c5

+ 7 - 7
src/main/java/com/persagy/proxy/adm/model/AdmPoint.java

@@ -1,6 +1,6 @@
 package com.persagy.proxy.adm.model;
 
-import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.persagy.proxy.relation.model.BaseEntity;
 import lombok.Data;
 
@@ -13,14 +13,14 @@ import lombok.Data;
 public class AdmPoint extends BaseEntity {
 
     /** 坐标x */
-    @JSONField(name = "X")
-    private Double X;
+    @JsonProperty("X")
+    private Double x;
 
     /** 坐标y */
-    @JSONField(name = "Y")
-    private Double Y;
+    @JsonProperty("Y")
+    private Double y;
 
     /** 坐标z */
-    @JSONField(name = "Z")
-    private Double Z;
+    @JsonProperty("Z")
+    private Double z;
 }

+ 1 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmBaseServiceImpl.java

@@ -68,6 +68,7 @@ public class AbstractAdmBaseServiceImpl<T> implements IAdmBaseService<T> {
         // 调用中台查询
         DmpResult<JSONArray> dmpResult = rwdClient.queryObject(context, para);
         List<T> admVOs = AdmEntityTransferUtil.toAdmMultiEntity(dmpResult.getData(), request.getProjection(), clazz);
+        //List<T> admVOs = AdmEntityTransferUtil.toAdmMultiEntityExtra(dmpResult.getData(), request.getProjection(), clazz);
         // 级联查询
         processCascade(context, admVOs, request.getName(), request.getCascade());
         // 设置返回值

+ 19 - 2
src/main/java/com/persagy/proxy/adm/utils/AdmEntityTransferUtil.java

@@ -3,10 +3,12 @@ package com.persagy.proxy.adm.utils;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ArrayUtil;
 import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
-import com.persagy.dmp.common.utils.JsonHelper;
+import com.persagy.dmp.common.exception.BusinessException;
+import com.persagy.dmp.common.helper.SpringHelper;
 
 import java.io.IOException;
 import java.util.Iterator;
@@ -139,13 +141,28 @@ public class AdmEntityTransferUtil {
         JsonNode outLine = node.get("outline");
         if(outLine != null && outLine.isTextual()) {
             node.remove("outline");
-            ArrayNode arrayNode = JsonHelper.toSingleEntityQuietly(outLine.textValue(), ArrayNode.class);
+            ArrayNode arrayNode = toSingleEntityQuietly(outLine.textValue(), ArrayNode.class);
             node.set("outline", arrayNode);
         }
         removeProperty(node, projection);
     }
 
     /**
+     * 转换为指定对象
+     * @param jsonStr
+     * @param clazz
+     * @param <T>
+     * @return
+     */
+    public static <T> T toSingleEntityQuietly(String jsonStr, Class<T> clazz) {
+        try {
+            return SpringHelper.getBean(ObjectMapper.class).readValue(jsonStr, clazz);
+        } catch (IOException e) {
+            throw new BusinessException("outline格式解析失败");
+        }
+    }
+
+    /**
      * 拷贝属性
      * @param dmpData 数据中台对象
      * @param srcProp 数据中台属性名

+ 2 - 3
src/main/java/com/persagy/proxy/adm/utils/AdmQueryCriteriaHelper.java

@@ -31,7 +31,7 @@ public class AdmQueryCriteriaHelper {
     /** 条件匹配字符串 */
     public static final String[] COND_STR = {" = "," != "," > "," >= "," < "," <= "," in "," isnull "," contain "," startwith "," endwith "};
     /** 条件匹配字符串 根据ADM实际调用查看,去掉空格*/
-    public static final String[] COND_STR_TRIM = {"=","!=",">",">=","<","<=","contain","in","isnull","startwith","endwith"};
+    public static final String[] COND_STR_TRIM = {"=","!=",">",">=","<","<=","contain","isnull","in","startwith","endwith"};
     /** 需要替换的字段对照 Map<AdmQueryCriteria.name, Map<AdmFieldName, DmpFieldName> */
     public static Map<String, Map<String, String>> RENAME_MAP = new HashMap<>(16);
     /** 与数据中台的操作参数对照 */
@@ -247,11 +247,10 @@ public class AdmQueryCriteriaHelper {
             boolean ifNot = true;
             if(column.indexOf("not") >= 0){
                 ifNot = false;
-                column = column.split(" ")[1];
+                column = column.replace("not","").trim();
             }
             ObjectNode node = criteria.putObject(column);
             node.put("$null", ifNot);
-
         } else {
             ObjectNode node = criteria.putObject(column);
             node.set(OPERATOR_MAP.get(operator), getJsonNode(node, value));

+ 382 - 308
src/main/java/com/persagy/proxy/object/controller/AdmEquipmentController.java

@@ -3,21 +3,28 @@ package com.persagy.proxy.object.controller;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.Sets;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
 import com.persagy.dmp.common.context.AppContext;
+import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.common.model.entity.BaseEntity;
 import com.persagy.dmp.define.client.DigitalDefineFacade;
 import com.persagy.dmp.define.entity.ObjectInfoDefine;
 import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.entity.ObjectDigital;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmDictCategoryEnum;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
@@ -26,6 +33,9 @@ import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmExcelUtil;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
 import com.persagy.proxy.common.entity.RelationDTO;
+import com.persagy.proxy.dictionary.model.AdmDict;
+import com.persagy.proxy.dictionary.model.AdmObjectType;
+import com.persagy.proxy.dictionary.service.IAdmDictService;
 import com.persagy.proxy.object.model.AdmEquipment;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
 import com.persagy.proxy.report.service.IRelationReportService;
@@ -54,61 +64,93 @@ import java.util.*;
 @RestController
 @RequestMapping("/object/equip")
 public class AdmEquipmentController {
-    @Autowired
-    private IAdmEquipmentService service;
-    @Autowired
-    private IAdmRelationService relationService;
-    @Autowired
-    private IRelationReportService relationReportService;
+	@Autowired
+	private IAdmEquipmentService service;
+	@Autowired
+	private IAdmRelationService relationService;
+	@Autowired
+	private IRelationReportService relationReportService;
+	@Autowired
+	private IAdmDictService dictService;
 
-    /**
-     * 统计
-     * 
-     * @param request
-     * @return
-     * @throws Exception
-     */
-    @PostMapping("/count")
-    public AdmResponse count(@RequestBody AdmQueryCriteria request) throws Exception {
-        request.setName(AdmEquipment.OBJ_TYPE);
-        request.setOnlyCount(true);
-        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmEquipment.class);
-    }
+	/**
+	 * 统计
+	 *
+	 * @param request
+	 * @return
+	 * @throws Exception
+	 */
+	@PostMapping("/count")
+	public AdmResponse count(@RequestBody AdmQueryCriteria request) throws Exception {
+		request.setName(AdmEquipment.OBJ_TYPE);
+		request.setOnlyCount(true);
+		return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmEquipment.class);
+	}
 
-    /**
-     * 创建
-     * @param createRequest
-     * @return
-     * @throws Exception
-     */
-    @PostMapping("/create")
-    public AdmResponse create(@RequestBody AdmCreateRequest<AdmEquipment> createRequest) throws Exception {
-        List<AdmEquipment> vos = CollUtil.newArrayList(createRequest.getContent());
-        if(CollUtil.isEmpty(vos)){
-            return AdmResponse.success();
-        }
-        //创建设备
-        vos.stream().forEach(equipment -> {
-            if (StrUtil.isEmpty(equipment.getName())){
-                equipment.setName(ObjectNameUtil.objectName("设备-"));
-            }
-        });
-        vos = service.doInsertEuip(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
-        return AdmResponse.success(vos);
-    }
+	/**
+	 * 创建
+	 * @param createRequest
+	 * @return
+	 * @throws Exception
+	 */
+	@PostMapping("/create")
+	public AdmResponse create(@RequestBody AdmCreateRequest<AdmEquipment> createRequest) throws Exception {
+		List<AdmEquipment> vos = CollUtil.newArrayList(createRequest.getContent());
+		if(CollUtil.isEmpty(vos)){
+			return AdmResponse.success();
+		}
+		// 查询所有设备类型
+		AdmDict dictCond = AdmDict.builder().type(AdmDictCategoryEnum.EQUIPMENT.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(), 4), dict);
+			fullDictMap.put(dict.getCode(), dict);
+		}
+		// 设备属性调整
+		vos.stream().forEach(equipment -> {
+			// 如果不是Eq开头,则重新生成ID
+			if(StrUtil.startWith(equipment.getId(), "Eq")) {
+				equipment.setId("Eq"+ IdUtil.simpleUUID());
+			}
+			// 类型编码适配
+			String classCode = equipment.getClassCode();
+			// 如果编码为空,或在4位、6位里都不存在,则报错
+			if(StrUtil.isBlank(classCode) ||
+					(shortDictMap.get(classCode) == null && fullDictMap.get(classCode) == null)) {
+				throw new BusinessException(StrUtil.format("没有找到对象类型【{}】!", equipment.getClassCode()));
+			}
+			// 如果少于6位,则需要适配新编码
+			if(classCode.length() < 6) {
+				AdmObjectType dict = MapUtil.get(shortDictMap, classCode, AdmObjectType.class);
+				equipment.setClassCode(dict.getCode());
+			}
+			// 如果名称为空,则提供默认名称
+			if (StrUtil.isEmpty(equipment.getName())){
+				AdmObjectType dict = MapUtil.get(fullDictMap, equipment.getClassCode(), AdmObjectType.class);
+				equipment.setName(ObjectNameUtil.objectName(dict.getName() + "-"));
+			}
+		});
+		vos = service.doInsertEuip(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
+		return AdmResponse.success(vos);
+	}
 
-    /**
-     * 根据ID删除
-     * @param vos
-     * @return
-     * @throws Exception
-     */
-    @PostMapping("/delete")
-    public AdmResponse delete( @RequestBody List<AdmEquipment> vos) throws Exception {
-        // 组装上下文条件
-        service.doDelete(AdmContextUtil.toDmpContext(), vos);
-        return AdmResponse.success();
-    }
+	/**
+	 * 根据ID删除
+	 * @param vos
+	 * @return
+	 * @throws Exception
+	 */
+	@PostMapping("/delete")
+	public AdmResponse delete( @RequestBody List<AdmEquipment> vos) throws Exception {
+		// 组装上下文条件
+		service.doDelete(AdmContextUtil.toDmpContext(), vos);
+		return AdmResponse.success();
+	}
 
 
     /**
@@ -123,6 +165,40 @@ public class AdmEquipmentController {
         //vos = service.doUpdateEuip(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
         //针对设备更新时,所有更新的字段都放到信息点中的情况特殊处理
         if(CollUtil.isNotEmpty(vos)){
+			Map<String, AdmEquipment> admEquipmentMap = CollUtil.fieldValueMap(vos, BaseEntity.PROP_ID);
+			AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2BD;
+			String graphCode = typeEnum.getGraphCode();
+			QueryCriteria criteria = new QueryCriteria();
+			ObjectNode node = JsonNodeFactory.instance.objectNode();
+			node.put("graphCode", graphCode);
+			admEquipmentMap.keySet().stream().forEach(equipId -> {
+				node.put("relCode", "Eq2Bd");
+				node.put("objFrom", equipId);
+				criteria.setCriteria(node);
+				relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+
+				node.put("relCode", "Eq2Fl");
+				node.put("objFrom", equipId);
+				criteria.setCriteria(node);
+				relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+			});
+
+			List<RelationDTO> relationDTOList = new ArrayList<>(vos.size());
+			admEquipmentMap.keySet().stream().forEach(equipId -> {
+				if(StrUtil.isNotEmpty(admEquipmentMap.get(equipId).getBuildingId())){
+					RelationDTO relationbd = new RelationDTO(null, graphCode, "Eq2Bd", null, equipId, admEquipmentMap.get(equipId).getBuildingId());
+					relationDTOList.add(relationbd);
+				}
+				if(StrUtil.isNotEmpty(admEquipmentMap.get(equipId).getFloorId())) {
+					RelationDTO relationfl = new RelationDTO(null, graphCode, "Eq2Fl", null, equipId, admEquipmentMap.get(equipId).getFloorId());
+					relationDTOList.add(relationfl);
+				}
+			});
+
+			if(CollUtil.isNotEmpty(relationDTOList)){
+				relationService.doSave(AdmContextUtil.toDmpContext(), relationDTOList);
+			}
+
             List<AdmEquipment> equipmentList = new ArrayList<>(vos.size());
             vos.stream().forEach(equipment -> {
                 if(CollUtil.isNotEmpty(equipment.getInfos())){
@@ -140,105 +216,103 @@ public class AdmEquipmentController {
         return AdmResponse.success(vos);
     }
 
-    /**
-     * 查询
-     * 
-     * @param request
-     * @return
-     * @throws Exception
-     */
-    @PostMapping("/query")
-    public AdmResponse query(@RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        request.setName(AdmEquipment.OBJ_TYPE);
-        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmEquipment.class);
-    }
+	/**
+	 * 查询
+	 *
+	 * @param request
+	 * @return
+	 * @throws Exception
+	 */
+	@PostMapping("/query")
+	public AdmResponse query(@RequestBody AdmQueryCriteria request) throws Exception {
+		// 组装上下文条件
+		request.setName(AdmEquipment.OBJ_TYPE);
+		return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmEquipment.class);
+	}
 
-    /**
-     * 设备绑定的动态信息点或静态信息点
-     * @param admEquipment
-     * @return
-     * @throws Exception
-     */
-    @GetMapping("/export")
-    public AdmResponse exportInfos(@RequestBody AdmCreateRequest<AdmEquipment> admEquipment) throws Exception {
-        List<AdmEquipment> vos = CollUtil.newArrayList(admEquipment.getContent());
-        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
-        return AdmResponse.success(vos);
-    }
+	/**
+	 * 设备绑定的动态信息点或静态信息点
+	 * @param admEquipment
+	 * @return
+	 * @throws Exception
+	 */
+	@GetMapping("/export")
+	public AdmResponse exportInfos(@RequestBody AdmCreateRequest<AdmEquipment> admEquipment) throws Exception {
+		List<AdmEquipment> vos = CollUtil.newArrayList(admEquipment.getContent());
+		vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
+		return AdmResponse.success(vos);
+	}
 
 
-    /**
-     * 根据项目id查询所有的设备和部件
-     * 
-     * @param request
-     * @return
-     * @throws Exception
-     */
-    @GetMapping("/query-equip")
-    public AdmResponse queryEquip(@RequestBody AdmQueryCriteria request) throws Exception {
-        //request.setName("equipment");
-        if(StrUtil.isNotEmpty(request.getFilters())){
-            request.setFilters(String.join(";",request.getFilters(),"objType in ['equipment','component']"));
-        }else{
-            request.setFilters("objType in ['equipment','component']");
-        }
-        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmEquipment.class);
-    }
+	/**
+	 * 根据项目id查询所有的设备和部件
+	 *
+	 * @param request
+	 * @return
+	 * @throws Exception
+	 */
+	@GetMapping("/query-equip")
+	public AdmResponse queryEquip(@RequestBody AdmQueryCriteria request) throws Exception {
+		//request.setName("equipment");
+		if(StrUtil.isNotEmpty(request.getFilters())){
+			request.setFilters(String.join(";",request.getFilters(),"objType in ['equipment','component']"));
+		}else{
+			request.setFilters("objType in ['equipment','component']");
+		}
+		return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmEquipment.class);
+	}
 
-    /**
-     * 批量创建设备同时创建资产、创建设备和系统的关系
-     * @param admEquipment
-     * @return
-     * @throws Exception
-     */
-    @PostMapping("/creat-equip-pro")
-    public AdmResponse createExt(@RequestBody AdmCreateRequest<AdmEquipment> admEquipment) throws Exception {
-        List<AdmEquipment> vos = admEquipment.getContent();
-        if(CollUtil.isEmpty(vos)){
-            return AdmResponse.success();
-        }
-        //创建设备
-        vos.stream().forEach(equipment -> {
-            if (StrUtil.isEmpty(equipment.getName())){
-                equipment.setName(ObjectNameUtil.objectName("设备-"));
-            }
-        });
-        List<AdmEquipment> reVos = new ArrayList<>(vos.size());
-        List<RelationDTO> relationDTOS = new ArrayList<>(16);
-        vos.stream().forEach(admEq -> {
-            //创建设备
-            List<AdmEquipment> vosR = service.doInsert(AdmContextUtil.toDmpContext(), AdmEquipment.class, CollUtil.newArrayList(admEq));
-            //TODO 创建资产
-            //添加设备和系统、建筑、楼层的关系
-            if(CollUtil.isNotEmpty(vosR)){
-                String equipId = vosR.get(0).getId();
-                if(StrUtil.isNotEmpty(equipId)){
-                    if(CollUtil.isNotEmpty(admEq.getLinkSystem())){
-                        admEq.getLinkSystem().stream().forEach(admSystem -> {
-                            relationDTOS.add(new RelationDTO(null, "MechSubset", "Sy2Eq", null , admSystem.getId(), equipId));
-                        });
-                    }
-                    if(StrUtil.isNotEmpty(admEq.getBuildingId())){
-                        relationDTOS.add(new RelationDTO(null, "MechInArch", "Eq2Bd", null , equipId, admEq.getBuildingId()));
-                    }
-                    if(StrUtil.isNotEmpty(admEq.getFloorId())){
-                        relationDTOS.add(new RelationDTO(null, "MechInArch", "Eq2Fl", null , equipId, admEq.getFloorId()));
-                    }
-                }
-            }
-            reVos.addAll(vosR);
-        });
-        relationService.doSave(AdmContextUtil.toDmpContext(),relationDTOS);
-        return AdmResponse.success(reVos);
-    }
+	/**
+	 * 批量创建设备同时创建资产、创建设备和系统的关系
+	 * @param admEquipment
+	 * @return
+	 * @throws Exception
+	 */
+	@PostMapping("/creat-equip-pro")
+	public AdmResponse createExt(@RequestBody AdmCreateRequest<AdmEquipment> admEquipment) throws Exception {
+		List<AdmEquipment> vos = admEquipment.getContent();
+		if(CollUtil.isEmpty(vos)){
+			return AdmResponse.success();
+		}
+		//创建设备
+		vos.stream().forEach(equipment -> {
+			if (StrUtil.isEmpty(equipment.getName())){
+				equipment.setName(ObjectNameUtil.objectName("设备-"));
+			}
+		});
+		List<AdmEquipment> reVos = new ArrayList<>(vos.size());
+		List<RelationDTO> relationDTOS = new ArrayList<>(16);
+		vos.stream().forEach(admEq -> {
+			//创建设备
+			List<AdmEquipment> vosR = service.doInsert(AdmContextUtil.toDmpContext(), AdmEquipment.class, CollUtil.newArrayList(admEq));
+			//TODO 创建资产
+			//添加设备和系统、建筑、楼层的关系
+			if(CollUtil.isNotEmpty(vosR)){
+				String equipId = vosR.get(0).getId();
+				if(StrUtil.isNotEmpty(equipId)){
+					if(CollUtil.isNotEmpty(admEq.getLinkSystem())){
+						admEq.getLinkSystem().stream().forEach(admSystem -> {
+							relationDTOS.add(new RelationDTO(null, "MechSubset", "Sy2Eq", null , admSystem.getId(), equipId));
+						});
+					}
+					if(StrUtil.isNotEmpty(admEq.getBuildingId())){
+						relationDTOS.add(new RelationDTO(null, "MechInArch", "Eq2Bd", null , equipId, admEq.getBuildingId()));
+					}
+					if(StrUtil.isNotEmpty(admEq.getFloorId())){
+						relationDTOS.add(new RelationDTO(null, "MechInArch", "Eq2Fl", null , equipId, admEq.getFloorId()));
+					}
+				}
+			}
+			reVos.addAll(vosR);
+		});
+		relationService.doSave(AdmContextUtil.toDmpContext(),relationDTOS);
+		return AdmResponse.success(reVos);
+	}
 
 	/**
 	 * 设备上传excel识别静态信息点
-	 * 
-	 * @param relType
-	 * @param code
-	 * @param zoneType
+	 *
+	 * @param file
 	 * @param request
 	 * @param response
 	 */
@@ -248,7 +322,7 @@ public class AdmEquipmentController {
 			return AdmResponse.failure("未选择文件");
 		}
 		String path = AdmCommonConstant.SERVER_ROOT_PATH + AdmExcelUtil.TEMP_UPLOAD_PAHT;
-		
+
 		int failurNum = 0;
 		int successCount = 0;
 		String failure = null;
@@ -259,187 +333,187 @@ public class AdmEquipmentController {
 		String groupCode = AppContext.getContext().getGroupCode();
 		String projectId = AppContext.getContext().getProjectId();
 		try {
-			
+
 			workbook = new XSSFWorkbook(file.getInputStream());
-		    XSSFSheet sheet = workbook.getSheetAt(0);	// 第一个sheet
-		    XSSFRow row1 = sheet.getRow(1);
-		    if (row1 == null) {
-		    	AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
-                return AdmExcelUtil.getImportFailResult("数据不存在", "2", 0, ++failurNum);
+			XSSFSheet sheet = workbook.getSheetAt(0);	// 第一个sheet
+			XSSFRow row1 = sheet.getRow(1);
+			if (row1 == null) {
+				AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
+				return AdmExcelUtil.getImportFailResult("数据不存在", "2", 0, ++failurNum);
 			}
-		    
-	    	/** 获取识别码 */
-            XSSFCell markCell = row1.getCell(0);
-            if (markCell == null) {
-            	AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
-                return AdmExcelUtil.getImportFailResult("未填写识别码", "2", 0, ++failurNum);
+
+			/** 获取识别码 */
+			XSSFCell markCell = row1.getCell(0);
+			if (markCell == null) {
+				AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
+				return AdmExcelUtil.getImportFailResult("未填写识别码", "2", 0, ++failurNum);
 			}
-        	primaryKey = markCell.getStringCellValue().trim(); 	// 识别码
+			primaryKey = markCell.getStringCellValue().trim(); 	// 识别码
 			boolean containsKey = AdmCommonConstant.codeColMap.containsKey(primaryKey);
 			if (!containsKey) {
 				AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
-                return AdmExcelUtil.getImportFailResult("未找到识别码", "2", 0, ++failurNum);
+				return AdmExcelUtil.getImportFailResult("未找到识别码", "2", 0, ++failurNum);
 			}
 			primaryKey = AdmCommonConstant.codeColMap.get(primaryKey);
-			
-            /** 获取类型 */
-            XSSFCell cell = row1.getCell(1);
-            if (cell == null) {
-            	AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
-                return AdmExcelUtil.getImportFailResult("未填写设备类型", "2", 0, ++failurNum);
+
+			/** 获取类型 */
+			XSSFCell cell = row1.getCell(1);
+			if (cell == null) {
+				AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
+				return AdmExcelUtil.getImportFailResult("未填写设备类型", "2", 0, ++failurNum);
 			}
-            classCodeCloumn = cell.getStringCellValue().trim();
-        	if (!"ClassCode".equals(classCodeCloumn)) {
-        		AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
-                return AdmExcelUtil.getImportFailResult("缺少设备类型(ClassCode)", "2", 0, ++failurNum);
+			classCodeCloumn = cell.getStringCellValue().trim();
+			if (!"ClassCode".equals(classCodeCloumn)) {
+				AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
+				return AdmExcelUtil.getImportFailResult("缺少设备类型(ClassCode)", "2", 0, ++failurNum);
 			}
-		    
-        	// 存取所有的信息点
-        	Map<Integer, String> infoMap = new HashMap<Integer, String>();
-        	short lastCellNum = row1.getLastCellNum();
-        	for (int i = 1; i <= lastCellNum; i++) {
-        		XSSFCell xssfCell = row1.getCell(i);
-        		if (xssfCell != null && xssfCell.getStringCellValue() != null) {
-        			infoMap.put(i, xssfCell.getStringCellValue().trim());
+
+			// 存取所有的信息点
+			Map<Integer, String> infoMap = new HashMap<Integer, String>();
+			short lastCellNum = row1.getLastCellNum();
+			for (int i = 1; i <= lastCellNum; i++) {
+				XSSFCell xssfCell = row1.getCell(i);
+				if (xssfCell != null && xssfCell.getStringCellValue() != null) {
+					infoMap.put(i, xssfCell.getStringCellValue().trim());
 				}
 			}
-        	
-		    // 录入数据获取
-		    int lastRowNum = sheet.getLastRowNum();
-		    boolean isClassCode = "classCode".equals(primaryKey);
-		    for (int i = 2; i <= lastRowNum; i++) {
-		    	XSSFRow xssfRow = sheet.getRow(i);
-		    	if (xssfRow == null) {
+
+			// 录入数据获取
+			int lastRowNum = sheet.getLastRowNum();
+			boolean isClassCode = "classCode".equals(primaryKey);
+			for (int i = 2; i <= lastRowNum; i++) {
+				XSSFRow xssfRow = sheet.getRow(i);
+				if (xssfRow == null) {
 					continue;
 				}
-		    	
-		    	String value = null;
-		    	String classCode = null;
-		    	ObjectNode equipment = null;
-		    	List<ObjectNode> equipmentList = null;
-		    	Map<String, Object> tempMap = new HashMap<String, Object>();
-		    	
-		    	lastCellNum = xssfRow.getLastCellNum();
-	        	for (int j = 0; j <= lastCellNum; j++) {
-	        		cell = xssfRow.getCell(j);
-	        		if (cell == null || StrUtil.isBlank(cell.getRawValue())) {
-	        			xssfRow.createCell(j);
-	        			if (j == 0) {
-	        				this.setColor(workbook, 252, 255, 77, xssfRow.getCell(j));
+
+				String value = null;
+				String classCode = null;
+				ObjectNode equipment = null;
+				List<ObjectNode> equipmentList = null;
+				Map<String, Object> tempMap = new HashMap<String, Object>();
+
+				lastCellNum = xssfRow.getLastCellNum();
+				for (int j = 0; j <= lastCellNum; j++) {
+					cell = xssfRow.getCell(j);
+					if (cell == null || StrUtil.isBlank(cell.getRawValue())) {
+						xssfRow.createCell(j);
+						if (j == 0) {
+							this.setColor(workbook, 252, 255, 77, xssfRow.getCell(j));
 						} else {
 							this.setColor(workbook, 77, 178, 255, xssfRow.getCell(j));
 						}
-	        			continue;
+						continue;
 					}
-	        		if (j == 0) {
-	        			cell.setCellType(CellType.STRING);
-	        			value = cell.getStringCellValue().trim();
-	        			String codeType = isClassCode ? xssfRow.getCell(0).toString().trim() : xssfRow.getCell(1).toString().trim();
-	        			// 获取类型定义
-	        			ObjectTypeDefine define = this.getObjectTypeDefine(groupCode, projectId, codeType);
-	        			if (define == null) {
+					if (j == 0) {
+						cell.setCellType(CellType.STRING);
+						value = cell.getStringCellValue().trim();
+						String codeType = isClassCode ? xssfRow.getCell(0).toString().trim() : xssfRow.getCell(1).toString().trim();
+						// 获取类型定义
+						ObjectTypeDefine define = this.getObjectTypeDefine(groupCode, projectId, codeType);
+						if (define == null) {
 							this.setColor(workbook, 56, 94, 15, cell);
 							continue;
 						}
-	        			classCode = define.getCode();
-	        			equipmentList = isClassCode ? this.getEquipmentList(groupCode, projectId, null, null, classCode)
-	        					: this.getEquipmentList(groupCode, projectId, primaryKey, value, classCode);
-	        			
-	        			if (CollectionUtil.isEmpty(equipmentList)) {
-	        				failurNum++;
-                            this.setColor(workbook, 153, 225, 77, cell);
-                            continue;
+						classCode = define.getCode();
+						equipmentList = isClassCode ? this.getEquipmentList(groupCode, projectId, null, null, classCode)
+								: this.getEquipmentList(groupCode, projectId, primaryKey, value, classCode);
+
+						if (CollectionUtil.isEmpty(equipmentList)) {
+							failurNum++;
+							this.setColor(workbook, 153, 225, 77, cell);
+							continue;
 						}
-	        			
-	        			if (isClassCode) {
-                            equipment = equipmentList.get(0);
+
+						if (isClassCode) {
+							equipment = equipmentList.get(0);
 						} else {
 							if (equipmentList.size() > 1) {
 								failurNum++;
-	                            this.setColor(workbook, 249, 203, 77, cell);
-                            } else {
-                            	equipment = equipmentList.get(0);
+								this.setColor(workbook, 249, 203, 77, cell);
+							} else {
+								equipment = equipmentList.get(0);
 							}
 						}
-	        			
-	        			continue;
-	        		}
-	        		// 剩余列数据处理
-	        		if (j != 1 && equipment != null && infoMap.containsKey(j)) {
-	        			// 获取设备类的信息点
-	        			List<ObjectInfoDefine> funidList = this.relationReportService.queryFunidList(groupCode, projectId, Sets.newHashSet(classCode), infoMap.get(j), "STATIC");
-	        			if (CollectionUtil.isEmpty(funidList)) {
-	        				failurNum++;
-                            this.setColor(workbook, 77, 178, 255, cell);
-                            continue;
+
+						continue;
+					}
+					// 剩余列数据处理
+					if (j != 1 && equipment != null && infoMap.containsKey(j)) {
+						// 获取设备类的信息点
+						List<ObjectInfoDefine> funidList = this.relationReportService.queryFunidList(groupCode, projectId, Sets.newHashSet(classCode), infoMap.get(j), "STATIC");
+						if (CollectionUtil.isEmpty(funidList)) {
+							failurNum++;
+							this.setColor(workbook, 77, 178, 255, cell);
+							continue;
 						}
-	        			ObjectInfoDefine define = funidList.get(0);
-	        			if ("STRING".equalsIgnoreCase(define.getDataType())) {
-	        				tempMap.put(define.getCode(), cell.getStringCellValue().trim());
+						ObjectInfoDefine define = funidList.get(0);
+						if ("STRING".equalsIgnoreCase(define.getDataType())) {
+							tempMap.put(define.getCode(), cell.getStringCellValue().trim());
 						} else if ("INTEGER".equalsIgnoreCase(define.getDataType())) {
 							try {
 								if (!CellType.NUMERIC.equals(cell.getCellTypeEnum()) || StrUtil.isBlank(cell.getRawValue())) {
 									failurNum++;
 									this.setColor(workbook, 155, 227, 255, cell);
-                                    continue;
+									continue;
 								}
 								cell.setCellType(CellType.STRING);
 								tempMap.put(define.getCode(), cell.getStringCellValue().trim());
 							} catch (Exception e) {
 								failurNum++;
 								this.setColor(workbook, 155, 227, 255, cell);
-                                continue;
+								continue;
 							}
 						} else if ("ENUM".equalsIgnoreCase(define.getDataType())) {
 							if (CellType.NUMERIC.equals(cell.getCellTypeEnum()) && StrUtil.isNotBlank(cell.getRawValue())) {
 								cell.setCellType(CellType.STRING);
 								tempMap.put(define.getCode(), cell.getStringCellValue().trim());
-                            } else if (CellType.STRING.equals(cell.getCellTypeEnum()) && StrUtil.isNotBlank(cell.getRawValue())) {
-                            	tempMap.put(define.getCode(), cell.getStringCellValue().trim());
-                            } else {
-                            	failurNum++;
-                            	this.setColor(workbook, 155, 227, 255, cell);
-                                continue;
-                            }
+							} else if (CellType.STRING.equals(cell.getCellTypeEnum()) && StrUtil.isNotBlank(cell.getRawValue())) {
+								tempMap.put(define.getCode(), cell.getStringCellValue().trim());
+							} else {
+								failurNum++;
+								this.setColor(workbook, 155, 227, 255, cell);
+								continue;
+							}
 						} else if ("DATETIME".equalsIgnoreCase(define.getDataType())) {
-                            try {
-                            	cell.setCellType(CellType.STRING);
-                            	String trim = cell.getStringCellValue().trim();
-                            	tempMap.put(define.getCode(), DateUtil.parseByPatterns(trim, "yyyyMMdd"));
-                            } catch (Exception e) {
-                            	failurNum++;
-                            	this.setColor(workbook, 155, 227, 255, cell);
-                                continue;
-                            }
+							try {
+								cell.setCellType(CellType.STRING);
+								String trim = cell.getStringCellValue().trim();
+								tempMap.put(define.getCode(), DateUtil.parseByPatterns(trim, "yyyyMMdd"));
+							} catch (Exception e) {
+								failurNum++;
+								this.setColor(workbook, 155, 227, 255, cell);
+								continue;
+							}
 						} else if ("DOUBLE".equalsIgnoreCase(define.getDataType())) {
 							try {
 								cell.setCellType(CellType.STRING);
-                            	String trim = cell.getStringCellValue().trim();
+								String trim = cell.getStringCellValue().trim();
 								tempMap.put(define.getCode(), Double.parseDouble(trim));
 							} catch (Exception e) {
-                            	failurNum++;
-                            	this.setColor(workbook, 155, 227, 255, cell);
-                                continue;
-                            }
+								failurNum++;
+								this.setColor(workbook, 155, 227, 255, cell);
+								continue;
+							}
 						} else if ("BOOLEAN".equalsIgnoreCase(define.getDataType())) {
 							cell.setCellType(CellType.STRING);
-                        	String trim = cell.getStringCellValue() == null ? null : cell.getStringCellValue().trim();
+							String trim = cell.getStringCellValue() == null ? null : cell.getStringCellValue().trim();
 							if ("1".equals(trim) || "0".equals(trim)) {
 								tempMap.put(define.getCode(), Double.parseDouble(trim));
 							} else {
 								failurNum++;
-                                this.setColor(workbook, 155, 227, 255, cell);
-                                continue;
+								this.setColor(workbook, 155, 227, 255, cell);
+								continue;
 							}
 						} else {
 							failurNum++;
 							this.setColor(workbook, 204, 99, 233, cell);
-                            continue;
+							continue;
 						}
 					}
 				}
-	        	
-	        	if (isClassCode) {
+
+				if (isClassCode) {
 					if (CollectionUtil.isNotEmpty(equipmentList) && tempMap.size() > 0) {
 						for (ObjectNode equipNode : equipmentList) {
 							int success = this.updateEquipInfo(tempMap, groupCode, projectId, equipNode.get("id").asText());
@@ -460,14 +534,14 @@ public class AdmEquipmentController {
 						}
 					}
 				}
-		    }
-        	
-		    // 写入错误报告对比值颜色
-		    this.wirteReport(workbook, sheet);
-		    
-		    // 返回正确结果
-		    String fileName = AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
-		    return AdmExcelUtil.getImportSuccessResult(fileName, successCount, failurNum);
+			}
+
+			// 写入错误报告对比值颜色
+			this.wirteReport(workbook, sheet);
+
+			// 返回正确结果
+			String fileName = AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
+			return AdmExcelUtil.getImportSuccessResult(fileName, successCount, failurNum);
 		} catch (Exception e) {
 			log.error("台账信息导入失败", e);
 			failure = e.getMessage();
@@ -486,10 +560,10 @@ public class AdmEquipmentController {
 		}
 		return AdmResponse.failure(failure);
 	}
-	
+
 	/**
 	 * 更新设备信息
-	 * 
+	 *
 	 * @param tempMap
 	 * @param groupCode
 	 * @param projectId
@@ -498,28 +572,28 @@ public class AdmEquipmentController {
 	 */
 	private int updateEquipInfo(Map<String, Object> tempMap, String groupCode, String projectId, String equipId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
-		
+
 		Set<String> keySet = tempMap.keySet();
 		ObjectNode updateEquip = objectMapper.createObjectNode();
 		for (String key : keySet) {
 			Object obj = tempMap.get(key);
-			
+
 			updateEquip.put("id", equipId);
 			if (obj instanceof Date) {
 				updateEquip.putPOJO(key, obj);
 			} else {
 				updateEquip.put(key, obj.toString());
 			}
-			
+
 		}
-		
+
 		ObjectDigital updateOne = DigitalObjectFacade.updateOne(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, updateEquip);
 		return updateOne == null ? 0 : 1;
 	}
-	
+
 	/**
 	 * 获取类型定义
-	 * 
+	 *
 	 * @param code
 	 * @return
 	 */
@@ -532,14 +606,14 @@ public class AdmEquipmentController {
 		condition.putPOJO("parentCode", arrays);
 		condition.put("code", code);
 		queryCriteria.setCriteria(condition);
-		
+
 		List<ObjectTypeDefine> objectType = DigitalDefineFacade.queryObjectType(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
 		return CollectionUtil.isEmpty(objectType) ? null : objectType.get(0);
 	}
-	
+
 	/**
 	 * 获取设备
-	 * 
+	 *
 	 * @param groupCode
 	 * @param projectId
 	 * @param primaryKey
@@ -556,30 +630,30 @@ public class AdmEquipmentController {
 		}
 		condition.put("classCode", classCode);
 		queryCriteria.setCriteria(condition);
-		
+
 		List<ObjectNode> objectNodes = DigitalObjectFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
 		return objectNodes;
 	}
-	
-    /**
-     * 设置填充色
-     *
-     * @param workbook
-     * @param r
-     * @param g
-     * @param b
-     * @param cell
-     */
+
+	/**
+	 * 设置填充色
+	 *
+	 * @param workbook
+	 * @param r
+	 * @param g
+	 * @param b
+	 * @param cell
+	 */
 	private void setColor(XSSFWorkbook workbook, int r, int g, int b, XSSFCell cell) {
-        XSSFCellStyle createCellStyle = workbook.createCellStyle();
-        createCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
-        createCellStyle.setFillForegroundColor(new XSSFColor(new Color(r, g, b)));
-        cell.setCellStyle(createCellStyle);
-    }
-    
+		XSSFCellStyle createCellStyle = workbook.createCellStyle();
+		createCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+		createCellStyle.setFillForegroundColor(new XSSFColor(new Color(r, g, b)));
+		cell.setCellStyle(createCellStyle);
+	}
+
 	/**
 	 * 写入错误报告对比值颜色
-	 * 
+	 *
 	 * @param workbook
 	 * @param sheet
 	 */
@@ -594,7 +668,7 @@ public class AdmEquipmentController {
 		createCell.setCellValue("导入失败,识别码超出范围( 本地编码,本地名称,数字化交付码 )");
 		createCell = row4.createCell(column + 1);
 		this.setColor(workbook,233,99,99,createCell);
-		
+
 		XSSFRow row5 = sheet.getRow(5);
 		if (row5 == null) {
 			row5 = sheet.createRow(5);
@@ -603,7 +677,7 @@ public class AdmEquipmentController {
 		createCell.setCellValue("导入失败,识别码为空");
 		createCell = row5.createCell(column + 1);
 		this.setColor(workbook,252,147,77,createCell);
-		
+
 		XSSFRow row6 = sheet.getRow(6);
 		if (row6 == null) {
 			row6 = sheet.createRow(6);
@@ -612,7 +686,7 @@ public class AdmEquipmentController {
 		createCell.setCellValue("导入失败,多个实例");
 		createCell = row6.createCell(column + 1);
 		this.setColor(workbook,249,203,77,createCell);
-		
+
 		XSSFRow row7 = sheet.getRow(7);
 		if (row7 == null) {
 			row7 = sheet.createRow(7);
@@ -621,7 +695,7 @@ public class AdmEquipmentController {
 		createCell.setCellValue("导入失败,设备不存在");
 		createCell = row7.createCell(column + 1);
 		this.setColor(workbook,153,225,77,createCell);
-		
+
 		XSSFRow row8 = sheet.getRow(8);
 		if (row8 == null) {
 			row8 = sheet.createRow(8);
@@ -630,7 +704,7 @@ public class AdmEquipmentController {
 		createCell.setCellValue("导入失败,识别码值为空");
 		createCell = row8.createCell(column + 1);
 		this.setColor(workbook,252,255,77,createCell);
-		
+
 		XSSFRow row9 = sheet.getRow(9);
 		if (row9 == null) {
 			row9 = sheet.createRow(9);
@@ -639,7 +713,7 @@ public class AdmEquipmentController {
 		createCell.setCellValue("导入失败,输入类型与字典定义不一致");
 		createCell = row9.createCell(column + 1);
 		this.setColor(workbook,155,227,255,createCell);
-		
+
 		XSSFRow row10 = sheet.getRow(10);
 		if (row10 == null) {
 			row10 = sheet.createRow(10);
@@ -648,7 +722,7 @@ public class AdmEquipmentController {
 		createCell.setCellValue("导入失败,未支持的输入类型");
 		createCell = row10.createCell(column + 1);
 		this.setColor(workbook,204,99,233,createCell);
-		
+
 		XSSFRow row11 = sheet.getRow(11);
 		if (row11 == null) {
 			row11 = sheet.createRow(11);
@@ -667,5 +741,5 @@ public class AdmEquipmentController {
 		createCell = row12.createCell(column + 1);
 		this.setColor(workbook,56,94,15,createCell);
 	}
-	
+
 }

+ 68 - 1
src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java

@@ -8,6 +8,8 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
+import com.persagy.dmp.common.model.entity.BaseEntity;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.handler.SpaceRelationInfoHandler;
 import com.persagy.proxy.adm.request.*;
 import com.persagy.proxy.adm.service.IAdmRelationService;
@@ -28,7 +30,9 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.ws.rs.QueryParam;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Adm 空间 API
@@ -118,7 +122,70 @@ public class AdmSpaceController {
     @PostMapping("/update")
     public AdmResponse update(@RequestBody AdmCreateRequest<AdmSpace> createRequest, @QueryParam("projectId") String projectId) throws Exception {
         List<AdmSpace> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doUpdate( AdmContextUtil.toDmpContext(), AdmSpace.class, vos);
+        if(CollUtil.isNotEmpty(vos)) {
+            Map<String, AdmSpace> admSpaceMap = CollUtil.fieldValueMap(vos, BaseEntity.PROP_ID);
+            AdmRelationTypeEnum typeEnumBd = AdmRelationTypeEnum.BD2SP;
+
+            AdmRelationTypeEnum typeEnumFl = AdmRelationTypeEnum.FL2SP;
+            QueryCriteria criteria = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+
+            List<RelationDTO> relationDTOList = new ArrayList<>(vos.size());
+            vos.stream().forEach(admSpace -> {
+                //删除关系 然后重建
+                node.put("relCode", typeEnumBd.getRelCode());
+                node.put("objTo", admSpace.getId());
+                node.put("graphCode", typeEnumBd.getGraphCode());
+                criteria.setCriteria(node);
+                relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+
+                node.put("relCode", typeEnumFl.getRelCode());
+                node.put("objTo",  admSpace.getId());
+                node.put("graphCode", typeEnumFl.getGraphCode());
+                criteria.setCriteria(node);
+                relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+                //处理建筑 楼层信息点
+                if(StrUtil.isNotEmpty(admSpace.getFlowBuild())){
+                    String flowBuild = admSpace.getFlowBuild();
+                    if(!flowBuild.contains("-")){
+                        if(flowBuild.startsWith("Bd")){
+                            admSpace.setBuildingId(flowBuild);
+                            Map<String, Object> infos = new HashMap<String,Object>(16);
+                            infos.put("$remove","['floorId']");
+                            admSpace.setInfos(infos);
+                        }
+                    }else {
+                        String[] str = flowBuild.split("-");
+                        if(str[0].startsWith("Bd")){
+                            admSpace.setBuildingId(str[0]);
+                            admSpace.setFloorId(str[1]);
+                        }else{
+                            admSpace.setBuildingId(str[1]);
+                            admSpace.setFloorId(str[0]);
+                        }
+                    }
+                }else{
+                    Map<String, Object> infos = new HashMap<String,Object>(16);
+                    infos.put("$remove","['floorId','buildingId']");
+                    admSpace.setInfos(infos);
+                }
+            });
+            vos.stream().forEach(space -> {
+                if (StrUtil.isNotEmpty(space.getBuildingId())) {
+                    RelationDTO relationBd = new RelationDTO(null, typeEnumBd.getGraphCode(), typeEnumBd.getRelCode(), null, space.getBuildingId(), space.getId());
+                    relationDTOList.add(relationBd);
+                }
+                if (StrUtil.isNotEmpty(space.getFloorId())) {
+                    RelationDTO relationFl = new RelationDTO(null, typeEnumFl.getGraphCode(), typeEnumFl.getRelCode(), null, space.getFloorId(), space.getId());
+                    relationDTOList.add(relationFl);
+                }
+            });
+
+            if (CollUtil.isNotEmpty(relationDTOList)) {
+                relationService.doSave(AdmContextUtil.toDmpContext(), relationDTOList);
+            }
+            vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmSpace.class, vos);
+        }
         return AdmResponse.success(vos);
     }
 

+ 4 - 0
src/main/java/com/persagy/proxy/object/model/AdmFloor.java

@@ -7,6 +7,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * ADM 楼层 实体
@@ -85,4 +86,7 @@ public class AdmFloor extends AdmBaseEntity<AdmFloor> {
     /** 楼层平面图地址 */
     //private String floorMap;
 
+    /** 信息点 */
+    //private Map<String, Object> infos;
+
 }

+ 3 - 5
src/main/java/com/persagy/proxy/object/model/AdmISpace.java

@@ -1,11 +1,9 @@
 package com.persagy.proxy.object.model;
 
-import com.persagy.proxy.adm.model.AdmPoint;
+import com.fasterxml.jackson.databind.node.ArrayNode;
 import lombok.Data;
 
-import java.util.ArrayList;
 import java.util.Date;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -55,7 +53,7 @@ public class AdmISpace {
     private Float height;
 
     /** 图片 */
-    private ArrayList<AdmTaskPic> pic;
+    private ArrayNode pic;
     /** 空间是否受影响 */
     private String state;
     /** 空间常驻人数 */
@@ -74,7 +72,7 @@ public class AdmISpace {
     private String objectType = OBJ_TYPE;
 
     /** 轮廓线 */
-    private List<List<AdmPoint>> outline;
+    private ArrayNode outline;
 
     /** 对象类型code */
     private String classCode;

+ 2 - 2
src/main/java/com/persagy/proxy/object/model/AdmShaft.java

@@ -1,8 +1,8 @@
 package com.persagy.proxy.object.model;
 
 import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.persagy.proxy.adm.annotations.CascadeColumn;
-import com.persagy.proxy.adm.model.AdmPoint;
 import com.persagy.proxy.adm.model.AdmBaseEntity;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -44,7 +44,7 @@ public class AdmShaft extends AdmBaseEntity<AdmShaft> {
 
 
     /** BIM模型中轮廓坐标 */
-    private List<AdmPoint> outline;
+    private ArrayNode outline;
     /** 对象类型 */
     private String objectType = OBJ_TYPE;
     /** 级联-竖井内的设备 */

+ 6 - 23
src/main/java/com/persagy/proxy/object/model/AdmSpace.java

@@ -1,12 +1,11 @@
 package com.persagy.proxy.object.model;
 
+import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.persagy.proxy.adm.annotations.CascadeColumn;
-import com.persagy.proxy.adm.model.AdmPoint;
 import com.persagy.proxy.adm.model.AdmBaseEntity;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 
@@ -39,11 +38,11 @@ public class AdmSpace extends AdmBaseEntity<AdmSpace> {
     private String bimId;
 
     /** 楼层选定区域轮廓线 */
-    private ArrayList<ArrayList<ArrayList<AdmPoint>>> outline;
+    private ArrayNode outline;
     /** 轮廓线2 未使用*/
-    private ArrayList<ArrayList<ArrayList<AdmPoint>>> outline2;
+    private ArrayNode outline2;
     /** 图片 - 信息点里已存在的信息点不应在实体中重复定义为其他格式 */
-//    private ArrayList<AdmTaskPic> pic;
+    private ArrayNode pic;
     /** 空间是否受影响 */
     private String state;
     /** 空间常驻人数 */
@@ -100,6 +99,8 @@ public class AdmSpace extends AdmBaseEntity<AdmSpace> {
     private Boolean isAi = false;
     /** 垂直交通关系空间id */
     private Set<String> spaceIdList;
+    /** 更新的时候使用此字段保存楼层和建筑id */
+    private String flowBuild;
 
     /** 信息点 */
     //private Map<String, Object> infos;
@@ -137,22 +138,4 @@ public class AdmSpace extends AdmBaseEntity<AdmSpace> {
     /** 对象类型 */
     private String objectType = OBJ_TYPE;
 
-    public String getZoneType(){
-        return zoneType;
-
-    }
-    public void setZoneType(String zoneType){
-        this.zoneType = zoneType;
-        this.classCode = zoneType;
-    }
-
-    public String getClassCode(){
-        return classCode;
-    }
-    public void setClassCode(String classCode){
-        this.zoneType = classCode;
-        this.classCode = classCode;
-    }
-
-
 }

+ 12 - 35
src/main/java/com/persagy/proxy/object/service/impl/AdmEquipmentServiceImpl.java

@@ -11,33 +11,33 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.common.model.entity.BaseEntity;
-import com.persagy.dmp.define.entity.ObjectTypeDefine;
 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.service.impl.AbstractAdmBaseServiceImpl;
-import com.persagy.proxy.dictionary.model.AdmDict;
-import com.persagy.proxy.object.model.AdmEquipment;
-import com.persagy.proxy.dictionary.model.AdmObjectType;
-import com.persagy.proxy.object.model.AdmProperty;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.object.service.IAdmComAndEquipService;
-import com.persagy.proxy.dictionary.service.IAdmDictService;
-import com.persagy.proxy.object.service.IAdmEquipmentService;
+import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmEntityTransferUtil;
-import com.persagy.proxy.adm.utils.ObjectNameUtil;
 import com.persagy.proxy.common.client.DmpRwdClient;
 import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.common.entity.ObjRelationDTO;
+import com.persagy.proxy.dictionary.model.AdmDict;
+import com.persagy.proxy.dictionary.model.AdmObjectType;
+import com.persagy.proxy.dictionary.service.IAdmDictService;
+import com.persagy.proxy.object.model.AdmEquipment;
+import com.persagy.proxy.object.model.AdmProperty;
+import com.persagy.proxy.object.service.IAdmComAndEquipService;
+import com.persagy.proxy.object.service.IAdmEquipmentService;
 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;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * ADM 设备 实现
@@ -60,29 +60,6 @@ public class AdmEquipmentServiceImpl extends AbstractAdmBaseServiceImpl<AdmEquip
         if(CollUtil.isEmpty(voList)) {
             return null;
         }
-        Set<String> classCodes = voList.stream().map(AdmEquipment::getClassCode).collect(Collectors.toSet());
-        //查询定义类型
-        QueryCriteria criteriaObject = getDmpCriteria(context, classCodes, AdmEquipment.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(equip -> {
-            if (StrUtil.isNotEmpty(equip.getName())) {
-                if(CollUtil.isNotEmpty(finalDefClassMap) && finalDefClassMap.containsKey(equip.getClassCode())){
-                    ObjectTypeDefine defclass = finalDefClassMap.get(equip.getClassCode());
-                    equip.setName(ObjectNameUtil.objectName(defclass.getName()+"-"));
-                }else{
-                    equip.setName(ObjectNameUtil.objectName("设备-"));
-                }
-            }
-        });
         return doInsert(context, clazz, voList);
     }
 

+ 14 - 0
src/main/java/com/persagy/proxy/object/service/impl/AdmFloorServiceImpl.java

@@ -1,6 +1,7 @@
 package com.persagy.proxy.object.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -16,7 +17,9 @@ import org.springframework.stereotype.Service;
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * ADM 楼层 实现类
@@ -46,15 +49,26 @@ public class AdmFloorServiceImpl extends AbstractAdmBaseServiceImpl<AdmFloor> im
         list.add("name");
         list.add("localId");
         list.add("localName");
+        list.add("classCode");
         list.add("outline");
         list.add("floorSequenceId");
         list.add("modelId");
+        list.add("floorElevation");
+        list.add("floorMap");
+        list.add("floorSequenceID");
+        list.add("height");
         list.add("infos");
         list.add("properties");
         request.setProjection(list);
         AdmResponse rs = doQuery(context, request, clazz);
         List<AdmFloor> vos = (List<AdmFloor>) rs.getContent();
         ensureSpecialValues(context, vos, QUERY);
+        vos.forEach(vo->{
+            Map<String, Object> objectMap = MapUtil.defaultIfEmpty(vo.getInfos(), new HashMap<>());
+            objectMap.put("floorSequenceID",vo.getFloorSequenceID());
+            vo.setFloorSequenceID(null);
+            vo.setInfos(objectMap);
+        });
         rs.setContent(vos);
         return rs;
     }

+ 28 - 2
src/main/java/com/persagy/proxy/relation/controller/RelationShInBdController.java

@@ -1,5 +1,12 @@
 package com.persagy.proxy.relation.controller;
 
+import cn.hutool.core.collection.CollUtil;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.basic.utils.QueryCriteriaHelper;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.relation.model.ShInBdList;
 import com.persagy.proxy.adm.request.AdmResponse;
@@ -15,8 +22,11 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * 关系-竖井所在建筑
@@ -36,19 +46,35 @@ public class RelationShInBdController {
      * @return
      */
     @PostMapping("link-bd")
-    public AdmResponse createBd(@RequestBody ShInBdList shInBdList){
+    public AdmResponse createBd(@RequestBody ShInBdList shInBdList) throws IOException {
         log.info("创建系统所在建筑关系link-bd");
         List<String> buildingIdList = shInBdList.getBuildingIdList();
         String shaftId = shInBdList.getShaftId();
-        //检验输入参数
+        // 1.检验输入参数
         if(CollectionUtils.isEmpty(buildingIdList)|| StringUtils.isEmpty(shaftId)){
             return AdmResponse.failure("必填项:shaftId(竖井id)、BuildingIdList(建筑id列表)");
         }
         List<RelationDTO> voList = new ArrayList<>();
         String graphCode = AdmRelationTypeEnum.BD2SH_ARCHSUBSET.getGraphCode();
         String relCode = AdmRelationTypeEnum.BD2SH_ARCHSUBSET.getRelCode();
+        // 2.根据图类型,边类型,建筑id数组,竖井id数组查询关系
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+        ObjectNode queryObj = objectMapper.createObjectNode();
+        queryObj.set("objFrom",objectMapper.readTree(objectMapper.writeValueAsString(buildingIdList)));
+        queryObj.put("objTo",shaftId);
+        queryObj.put("graphCode",graphCode);
+        queryObj.put("relCode",relCode);
+        queryObj.put("valid",Boolean.TRUE);
+        criteria.setCriteria(queryObj);
+        List<ObjectRelation> relations = service.queryByCondition(AdmContextUtil.toDmpContext(), criteria);
+        Set<String> havedBuildIds = CollUtil.newHashSet(CollUtil.isNotEmpty(relations),
+                relations.stream().map(ObjectRelation::getObjFrom).collect(Collectors.toSet()));
         // 组装关系
         for (String buildingId : buildingIdList) {
+            if (havedBuildIds.contains(buildingId)){
+                continue;
+            }
             RelationDTO relation = RelationDTO.builder().graphCode(graphCode).relCode(relCode)
                     .objFrom(buildingId).objTo(shaftId).build();
             voList.add(relation);

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

@@ -11,6 +11,7 @@ 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.basic.utils.JsonNodeUtils;
 import com.persagy.dmp.common.constant.ResponseCode;
 import com.persagy.dmp.common.model.entity.BaseEntity;
 import com.persagy.dmp.define.client.DigitalObjectInfoFacade;
@@ -21,21 +22,20 @@ 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.AdmDictCategoryEnum;
-import com.persagy.proxy.object.model.EquipUpDateEnclosure;
 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.request.AdmZoneEquipQueryRequest;
-import com.persagy.proxy.object.service.IAdmComponentService;
-import com.persagy.proxy.dictionary.service.IAdmDictService;
-import com.persagy.proxy.object.service.IAdmEquipmentService;
-import com.persagy.proxy.object.service.IAdmSystemService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
 import com.persagy.proxy.common.entity.DmpResult;
 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.*;
+import com.persagy.proxy.object.service.IAdmComponentService;
+import com.persagy.proxy.object.service.IAdmEquipmentService;
+import com.persagy.proxy.object.service.IAdmSystemService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -95,6 +95,16 @@ public class AdmReportEquipController {
                 } else {
                     equip.setCount(0);
                 }
+                //特殊处理前端需要展示的字段
+                if(StrUtil.isNotEmpty(equip.getLocalId())){
+                    equip.getInfos().put("localId",equip.getLocalId());
+                }
+                if(StrUtil.isNotEmpty(equip.getBimId())){
+                    equip.getInfos().put("bimId",equip.getBimId());
+                }
+                if(StrUtil.isNotEmpty(equip.getBimLocation())){
+                    equip.getInfos().put("bimLocation",equip.getBimLocation());
+                }
             });
             //查询设备的类型信息,取list中的第一个数据
             AdmEquipment admEquipment = equipmentList.get(0);
@@ -735,7 +745,6 @@ 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"));
@@ -827,13 +836,14 @@ public class AdmReportEquipController {
     /**
      * 计算动态、静态信息点
      */
-    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;
+    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 (ObjectNode objectNode : objectNodeList) {
+        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()) {
@@ -888,17 +898,17 @@ public class AdmReportEquipController {
             }
         }
 
-        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);
+        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);
@@ -909,7 +919,10 @@ public class AdmReportEquipController {
 
     /**
      * 计算信息点
-     *
+     * @param str infos
+     * @param type classCode
+     * @param infoPointCodes
+     * @return
      */
     private Map<String,Object> calculateInfoPoints(String str, String type, List<ObjectInfoDefine> infoPointCodes) {
         int counts = 0;
@@ -928,91 +941,103 @@ public class AdmReportEquipController {
     }
 
     private JSONObject calInfoPointByObjType(String objType, 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(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteriaSys);
-
-        //2 获取动态 静态 信息点
-        // 2.1 根据objType获取定义
+        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<>();
-        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(AdmContextUtil.toDmpContext(), queryCriteriaType, AdmObjectType.class);
-            if(CollUtil.isEmpty(admResponseType.getContent())){
-                return null;
+        //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);
             }
-            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(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
                 controlInfoCounts = totalInfo.size();
-                criteria.remove("valid");
             }
+
             //静态信息点
+            criteria.put("groupCode","0");
+            criteria.put("projectId","0");
             criteria.put("category","STATIC");
             if(visible){
                 criteria.put("valid", "1");
             }else{
-                criteria.put("valid","['0','1']");
+                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);
+
             criteria.remove("category");
 
-            //动态信息点
+            //动态信息点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()
-            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);
+            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"));
+            }
         }
+        gatherInfoPoint.put("gatherInfoPointCounts", controlInfoCounts);
         return gatherInfoPoint;
     }
 
 
+
     /**
      * 处理设备属性文件 -> 设备的信息点
      * @param equip