Browse Source

优化报表下载功能逻辑

zhangqiankun 3 years ago
parent
commit
da32f8dadb
26 changed files with 1813 additions and 597 deletions
  1. 46 0
      src/main/java/com/persagy/proxy/adm/constant/AdmRelationType.java
  2. 2 0
      src/main/java/com/persagy/proxy/adm/constant/AdmRelationTypeEnum.java
  3. 8 6
      src/main/java/com/persagy/proxy/adm/controller/ReportDownloadController.java
  4. 84 0
      src/main/java/com/persagy/proxy/adm/model/AdmRelationObject.java
  5. 4 3
      src/main/java/com/persagy/proxy/adm/service/IReportDownloadService.java
  6. 15 588
      src/main/java/com/persagy/proxy/adm/service/impl/ReportDownloadService.java
  7. 53 0
      src/main/java/com/persagy/proxy/adm/strategy/QueryRelationObjectContext.java
  8. 165 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/AbstractQueryRelationObject.java
  9. 97 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2BdForRelationObject.java
  10. 88 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2BdRelationObject.java
  11. 98 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2FlForRelationObject.java
  12. 82 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2FlRelationObject.java
  13. 97 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2ShForRelationObject.java
  14. 77 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2SpRelationObject.java
  15. 31 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/QueryRelationObjectStrategy.java
  16. 77 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2BdForRelationObject.java
  17. 85 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2FlForRelationObject.java
  18. 77 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2ShForRelationObject.java
  19. 97 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2SpForRelationObject.java
  20. 95 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sp2BdForRelationObject.java
  21. 97 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sp2FlForRelationObject.java
  22. 77 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2BdForRelationObject.java
  23. 86 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2FlForRelationObject.java
  24. 77 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2ShForRelationObject.java
  25. 98 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2SpForRelationObject.java
  26. BIN
      src/main/resources/template/relation-template.xlsx

+ 46 - 0
src/main/java/com/persagy/proxy/adm/constant/AdmRelationType.java

@@ -0,0 +1,46 @@
+package com.persagy.proxy.adm.constant;
+
+/**
+ * 所有数据的来源为
+ * {@link com.persagy.proxy.adm.constant.AdmRelationTypeEnum}
+ * 的relationType字段
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:55:09
+ */
+public interface AdmRelationType {
+
+	String EQ2BD = "eq2bd";
+	
+	String EQ2FL = "eq2fl";
+
+	String EQ2BD_FOR = "eq2bd_for";
+	
+	String EQ2FL_FOR = "eq2fl_for";
+	
+	String EQ2SH_FOR = "eq2sh_for";
+	
+	String SY2BD_FOR = "sy2bd_for";
+	
+	String SY2FL_FOR = "sy2fl_for";
+	
+	String SY2SH_FOR = "sy2sh_for";
+	
+	String SY2SP_FOR = "sy2sp_for";
+	
+	String EQ2SP_SENSORRELATIONSHIP_SS2SP = "eq2sp_SensorRelationship_ss2sp";
+	
+	String SH2BD_ARCHFORARCH = "sh2bd_ArchForArch";
+	
+	String SH2FL_ARCHFORARCH = "sh2fl_ArchForArch";
+	
+	String SH2SH_ARCHFORARCH = "sh2sh_ArchForArch";
+	
+	String SH2SP_ARCHFORARCH = "sh2sp_ArchForArch";
+	
+	String SP2BD_ARCHFORARCH = "sp2bd_ArchForArch";
+	
+	String SP2FL_ARCHFORARCH ="sp2fl_ArchForArch";
+	
+}

+ 2 - 0
src/main/java/com/persagy/proxy/adm/constant/AdmRelationTypeEnum.java

@@ -229,6 +229,8 @@ public enum AdmRelationTypeEnum {
     SH2BD_ARCHFORARCH("sh2bd_ArchForArch","ArchForArch","Sh2Bd",AdmObjectType.SHAFT.getIndex(),AdmObjectType.BUILDING.getIndex(),false,false,false,false,true,false),
     /**系统所在空间-系统→业务空间-【系统台账】,【业务空间台账】*/
     SY2SP("sy2sp","MechInArch","Sy2Sp",AdmObjectType.SYSTEM.getIndex(),AdmObjectType.SPACE.getIndex(),false,false,false,false,false,false),
+    /**设备所在建筑-设备→建筑*/
+    EQ2BD("eq2bd","MechInArch","Eq2Bd",AdmObjectType.EQUIPMENT.getIndex(),AdmObjectType.BUILDING.getIndex(),false,false,false,false,false,false),
     /**设备所在建筑-设备→建筑-【设备台账】*/
     SYEQ2BD("syeq2bd","MechInArch","Eq2Bd",AdmObjectType.EQUIPMENT.getIndex(),AdmObjectType.BUILDING.getIndex(),false,false,false,false,false,false),
     /**系统服务于空间-系统→业务空间-【业务空间台账】*/

+ 8 - 6
src/main/java/com/persagy/proxy/adm/controller/ReportDownloadController.java

@@ -4,6 +4,7 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
+import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -16,11 +17,11 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.ExcelWriter;
-import com.alibaba.excel.write.metadata.WriteSheet;
-import com.google.common.collect.Lists;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.model.AdmRelationObject;
 import com.persagy.proxy.adm.service.IReportDownloadService;
 
+import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 
 /**
@@ -35,6 +36,8 @@ import lombok.extern.slf4j.Slf4j;
 @RestController
 public class ReportDownloadController {
 
+	public static final String EXPORT_SHEET_NAME = "关系维护";
+	
 	@Autowired
 	private IReportDownloadService reportDownloadService;
 	
@@ -197,18 +200,17 @@ public class ReportDownloadController {
 		ExcelWriter excelWriter = null;
 		try {
 			String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
+			code = StrUtil.isBlank(code) ? "对象ID" : code;
 			
 			response.setContentType("application/vnd.ms-excel");
 			String encode = StandardCharsets.UTF_8.name();
 			response.setCharacterEncoding(encode);
 			response.setHeader("Content-disposition", "attachment;filename=relation-template.xlsx");
 			
-			this.reportDownloadService.queryAllEquip(groupCode, projectId, relType, code, zoneType);
+			List<AdmRelationObject> relationObjects = this.reportDownloadService.reportRelationObject(groupCode, projectId, relType, code, zoneType);
 			
 			File templateFile = this.getTemplateFile("relation-template.xlsx");
-			excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(templateFile).build();
-            WriteSheet writeSheet = EasyExcel.writerSheet("关系维护").build();
-            excelWriter.write(Lists.newArrayList(), writeSheet);
+			EasyExcel.write(response.getOutputStream()).withTemplate(templateFile).sheet(EXPORT_SHEET_NAME).needHead(false).doWrite(relationObjects);
 		} catch (Exception e) {
 			log.error("导出关系失败", e);
 		} finally {

+ 84 - 0
src/main/java/com/persagy/proxy/adm/model/AdmRelationObject.java

@@ -0,0 +1,84 @@
+package com.persagy.proxy.adm.model;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * graphic/export 导出所使用的实体类对象
+ * 
+ * @version 1.0.0
+ * @company persagy
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午11:23:39
+ */
+@Getter
+@Setter
+public class AdmRelationObject {
+	// 主对象
+	// *识别编码 -- 对象ID
+	@ExcelProperty(value = "*识别编码", index = 0)
+	private String masterCode;
+	// 设计图纸中编码
+	@ExcelProperty(value = "设计图纸中编码", index = 1)
+	private String masterCadId;
+	// 对象名称
+	@ExcelProperty(value = "对象名称", index = 2)
+	private String masterName;
+	// 对象id
+	@ExcelProperty(value = "对象id", index = 3)
+	private String masterId;
+	// 对象本地编码
+	@ExcelProperty(value = "对象本地编码", index = 4)
+	private String masterLocalId;
+	// 对象本地名称
+	@ExcelProperty(value = "对象本地名称", index = 5)
+	private String masterLocalName;
+	// 对象-类型
+	@ExcelProperty(value = "对象-类型", index = 6)
+	private String masterType;
+	// 所属建筑楼层 中划线隔开
+	@ExcelProperty(value = "所属建筑楼层", index = 7)
+	private String masterBelong;
+
+	// 从对象
+	// *识别编码 -- 对象ID
+	@ExcelProperty(value = "*识别编码", index = 8)
+	private String slaveCode;
+	// 设计图纸中编码
+	@ExcelProperty(value = "设计图纸中编码", index = 9)
+	private String slaveCadId;
+	// 对象名称
+	@ExcelProperty(value = "对象名称", index = 10)
+	private String slaveName;
+	// 对象id
+	@ExcelProperty(value = "对象id", index = 11)
+	private String slaveId;
+	// 对象本地编码
+	@ExcelProperty(value = "对象本地编码", index = 12)
+	private String slaveLocalId;
+	// 对象本地名称
+	@ExcelProperty(value = "对象本地名称", index = 13)
+	private String slaveLocalName;
+	// 对象-类型
+	@ExcelProperty(value = "对象-类型", index = 14)
+	private String slaveType;
+	// 所属建筑楼层 中划线隔开
+	@ExcelProperty(value = "所属建筑楼层", index = 15)
+	private String slaveBelong;
+	
+	@ExcelIgnore
+	private String masterBuildingName;	// 建筑本地名称
+
+	@ExcelIgnore
+	private String masterFloorName;		// 楼层本地名称
+	
+	@ExcelIgnore
+	private String slaveBuildingName;	// 建筑本地名称
+
+	@ExcelIgnore
+	private String slaveFloorName;		// 楼层本地名称
+	
+}

+ 4 - 3
src/main/java/com/persagy/proxy/adm/service/IReportDownloadService.java

@@ -2,9 +2,9 @@ package com.persagy.proxy.adm.service;
 
 import java.util.List;
 
-import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.model.AdmRelationObject;
 
 /**
  * 报表/模板下载
@@ -52,14 +52,15 @@ public interface IReportDownloadService {
 	
 	/**
 	 * 查询出所有的关系信息
+	 * <p>因原代码中,不存在zoneType类型不为空时对应的方法,所以此处不再进行此数据的判断</p>
 	 * 
 	 * @param groupCode
 	 * @param projectId
 	 * @param relType
 	 * @param code
 	 * @param zoneType
-	 * @return
+	 * @return 可以被直接导出的数据集
 	 */
-	List<JSONObject> queryAllEquip(String groupCode, String projectId, String relType, String code, String zoneType);
+	List<AdmRelationObject> reportRelationObject(String groupCode, String projectId, String relType, String code, String zoneType);
 	
 }

+ 15 - 588
src/main/java/com/persagy/proxy/adm/service/impl/ReportDownloadService.java

@@ -1,34 +1,27 @@
 package com.persagy.proxy.adm.service.impl;
 
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
-import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.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.constant.AdmObjectType;
-import com.persagy.proxy.adm.constant.GraphCodeEnum;
-import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
 import com.persagy.proxy.adm.service.IReportDownloadService;
+import com.persagy.proxy.adm.strategy.QueryRelationObjectContext;
 
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
+import lombok.extern.slf4j.Slf4j;
 
 /**
  * 报表/模板下载
@@ -38,25 +31,20 @@ import cn.hutool.core.util.StrUtil;
  * @author zhangqiankun
  * @date 2021年8月31日 下午4:43:15
  */
+@Slf4j
 @Service
 public class ReportDownloadService implements IReportDownloadService {
 
 	public static final String cADID = "cADID";
 	
-	public static final String eq2bd = "eq2bd";
 	public static final String pe2bd = "pe2bd";
-	public static final String eq2fl = "eq2fl";
 	public static final String pe2fl = "pe2fl";
-	public static final String eq2bd_for = "eq2bd_for";
-	public static final String eq2fl_for = "eq2fl_for";
-	public static final String eq2sh_for = "eq2sh_for";
-	public static final String sy2bd_for = "sy2bd_for";
-	public static final String sy2fl_for = "sy2fl_for";
-	public static final String sy2sh_for = "sy2sh_for";
-	public static final String sy2sp_for = "sy2sp_for";
 
 	@Value("${middleware.group.code}")
 	private String defaultCode;
+
+	@Autowired
+	private QueryRelationObjectContext queryRelationObjectContext;
 	
 	@Override
 	public ObjectNode getObjectNode(String groupCode, String projectId, String id) {
@@ -102,581 +90,20 @@ public class ReportDownloadService implements IReportDownloadService {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		
 		QueryCriteria queryCriteria = new QueryCriteria();
-		ObjectNode objectNode = objectMapper.createObjectNode();
-		objectNode.put("graphCode", graphCode);
-		objectNode.put("relCode", relCode);
-		queryCriteria.setCriteria(objectNode);
+		ObjectNode criteria = objectMapper.createObjectNode();
+		criteria.put("graphCode", graphCode);
+		criteria.put("relCode", relCode);
+		queryCriteria.setCriteria(criteria);
 		List<ObjectRelation> objectRelations = DigitalRelationFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
 		return CollectionUtil.isEmpty(objectRelations) ? Lists.newArrayList() : objectRelations;
 	}
 	
 	
 	@Override
-	public List<JSONObject> queryAllEquip(String groupCode, String projectId, String relType, String code, String zoneType) {
+	public List<AdmRelationObject> reportRelationObject(String groupCode, String projectId, String relType, String code, String zoneType) {
 		groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
-		
-		RequestData requestData = new RequestData();
-		requestData.setGroupCode(groupCode);
-		requestData.setProjectId(projectId);
-		
-		List<JSONObject> resultList = new ArrayList<JSONObject>();
-        if (eq2bd.equals(relType)) {
-        	requestData.setObjTypes(Sets.newHashSet(AdmObjectType.EQUIPMENT.getIndex(), AdmObjectType.BUILDING.getIndex(), AdmObjectType.FLOOR.getIndex()));
-        	this.queryAllEquipInfo(requestData, relType, true);
-        	
-        } else if (pe2bd.equals(relType)) {
-        	// TODO 根据项目ID,查询出所有的建筑、楼层、资产信息,且包含关联关系
-        	
-		} else if (eq2fl.equals(relType)) {
-			requestData.setObjTypes(Sets.newHashSet(AdmObjectType.EQUIPMENT.getIndex(), AdmObjectType.BUILDING.getIndex(), AdmObjectType.FLOOR.getIndex()));
-        	this.queryAllEquipInfo(requestData, relType, true);
-        	
-        } else if (pe2fl.equals(relType)) {
-        	// TODO 根据项目ID,查询出所有的楼层、资产信息,且包含关联关系
-        	
-		} else if (eq2bd_for.equals(relType) || eq2fl_for.equals(relType)) {
-			requestData.setObjTypes(Sets.newHashSet(AdmObjectType.EQUIPMENT.getIndex(), AdmObjectType.BUILDING.getIndex(), AdmObjectType.FLOOR.getIndex()));
-        	this.queryAllEquipInfo(requestData, relType, true);
-        	
-		} else if (eq2sh_for.equals(relType)) {
-			requestData.setObjTypes(Sets.newHashSet(AdmObjectType.EQUIPMENT.getIndex(), AdmObjectType.BUILDING.getIndex(), AdmObjectType.SHAFT.getIndex()));
-        	this.queryAllEquipInfo(requestData, relType, true);
-        	
-		} else if (sy2bd_for.equals(relType)) {
-			requestData.setObjTypes(Sets.newHashSet(AdmObjectType.SYSTEM.getIndex(), AdmObjectType.BUILDING.getIndex()));
-        	this.queryAllEquipInfo(requestData, relType, true);
-        	
-		} else if (sy2fl_for.equals(relType)) {
-			// 这里仅取楼层信息,获得楼层 -> 建筑的映射关系,后续的系统数据,单独获取
-			requestData.setObjTypes(Sets.newHashSet(AdmObjectType.BUILDING.getIndex(), AdmObjectType.FLOOR.getIndex()));
-        	this.queryAllEquipInfo(requestData, relType, true);
-        	
-		} else if (sy2sh_for.equals(relType)) {
-			requestData.setObjTypes(Sets.newHashSet(AdmObjectType.SYSTEM.getIndex(), AdmObjectType.SHAFT.getIndex()));
-        	this.queryAllEquipInfo(requestData, relType, false);
-        	
-		} else if (sy2sp_for.equals(relType)) {
-			requestData.setObjTypes(Sets.newHashSet(AdmObjectType.SYSTEM.getIndex(), AdmObjectType.SPACE.getIndex()));
-        	this.queryAllEquipInfo(requestData, relType, false);
-		}
-        
-        String relation = null;
-        if ("eq2sp_SensorRelationship_ss2sp".equals(relType)){
-        	// 设备所在空间
-        	relation = "eq2spIn";
-        } else if ("sh2bd_ArchForArch".equals(relType)) {
-        	relation = "sh2bdArchForArch";
-        } else if ("sh2fl_ArchForArch".equals(relType)){
-        	relation = "sh2flArchForArch";
-        } else if ("sh2sh_ArchForArch".equals(relType)){
-        	relation = "sh2shArchForArch";
-        } else if ("sh2sp_ArchForArch".equals(relType)){
-        	relation = "sh2spArchForArch";
-        } else if ("sp2bd_ArchForArch".equals(relType)){
-        	relation = "sp2bdArchForArch";
-        } else if ("sp2fl_ArchForArch".equals(relType)){
-        	relation = "sp2flArchForArch";
-        }
-        
-        if (StrUtil.isBlank(zoneType)) {
-			
-		}
-        
-		return resultList;
-	}
-
-	/**
-	 * 根据项目ID,查询出所有的设备、建筑、楼层信息,且包含关联关系
-	 * 
-	 * @param requestData
-	 * @param relType
-	 * @param extraMapping
-	 * @return
-	 */
-	private List<JSONObject> queryAllEquipInfo(RequestData requestData, String relType, boolean extraMapping) {
-		// 获取数据
-		List<ObjectDigital> tempList = new ArrayList<ObjectDigital>();
-		this.queryPageEquipInfo(tempList, requestData, 1L, 1000L);
-		
-		// 转换中台数据
-		return this.handleObjectDigital(tempList, requestData.getGroupCode(), requestData.getProjectId(), relType, extraMapping);
-	}
-	
-	/**
-	 * 分页查询
-	 * 
-	 * @param tempList
-	 * @param requestData
-	 * @param page
-	 * @param pageSize
-	 */
-	private void queryPageEquipInfo(List<ObjectDigital> tempList, RequestData requestData, Long page, Long pageSize) {
-		requestData.setPage(page);
-		requestData.setSize(pageSize);
-		List<ObjectDigital> superiorIds = DigitalObjectFacade.queryObjectListSuperiorId(requestData.getGroupCode(), requestData.getProjectId(), 
-				AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, requestData);
-		if (CollectionUtil.isEmpty(superiorIds)) {
-			return;
-		}
-		tempList.addAll(superiorIds);
-		this.queryPageEquipInfo(tempList, requestData, ++page, pageSize);
-	}
-	
-	/**
-	 * 处理中台的响应数据,封装为ADM需要的数据返回
-	 * 
-	 * @param tempList
-	 * @param groupCode
-	 * @param projectId
-	 * @param relType
-	 * @param extraMapping
-	 * @return
-	 */
-	private List<JSONObject> handleObjectDigital(List<ObjectDigital> tempList, String groupCode, String projectId, String relType, boolean extraMapping) {
-		// 第一次遍历
-		// shaftId -> buildingId
-		Map<String, String> sh2BuildingId = new HashMap<String, String>();
-		// floorId -> buildingId
-		Map<String, String> fl2BuildingId = new HashMap<String, String>();
-		// systemId -> buildingId
-		Map<String, String> sy2BuildingId = new HashMap<String, String>();
-		// spaceId -> buildingId
-		Map<String, String> sp2BuildingId = new HashMap<String, String>();
-		// buildingId -> equipId
-		Map<String, String> bd2EquipId = new HashMap<String, String>();
-		// id -> object
-		Map<String, ObjectDigital> tempAllMap = new HashMap<String, ObjectDigital>(tempList.size());
-		for (ObjectDigital objectDigital : tempList) {
-			String id = objectDigital.getId();
-			tempAllMap.put(id, objectDigital);
-			if (!extraMapping) {
-				continue;
-			}
-			
-			Set<String> objFromIds = objectDigital.getObjFromIds();
-			Set<String> objToIds = objectDigital.getObjToIds();
-			// Bd2Fl
-			if (id.startsWith("Fl")) {
-				// floorId -> buildingId
-				if (!fl2BuildingId.containsKey(id) && CollectionUtil.isNotEmpty(objFromIds)) {
-					fl2BuildingId.put(id, objFromIds.iterator().next());
-				}
-			} else if (id.startsWith("Sy")) {
-				// Sy2Bd
-				// systemId -> buildingId
-				if (!sy2BuildingId.containsKey(id) && CollectionUtil.isNotEmpty(objToIds)) {
-					sy2BuildingId.put(id, objToIds.iterator().next());
-				}
-			} else if (id.startsWith("Sp")) {
-				// Bd2Sp
-				// spaceId -> buildingId
-				if (!sp2BuildingId.containsKey(id) && CollectionUtil.isNotEmpty(objFromIds)) {
-					sp2BuildingId.put(id, objFromIds.iterator().next());
-				}
-			} else if (id.startsWith("Sh")) {
-				// Bb2Sh
-				// shaftId -> buildingId
-				if (!sh2BuildingId.containsKey(id) && CollectionUtil.isNotEmpty(objFromIds)) {
-					sh2BuildingId.put(id, objFromIds.iterator().next());
-				}
-			} else if (id.startsWith("Eq") && CollectionUtil.isNotEmpty(objToIds)) {
-				// buildingId -> equipId
-				for (String buildingId : objToIds) {
-					if (!bd2EquipId.containsKey(buildingId)) {
-						bd2EquipId.put(buildingId, id);
-					}
-				}
-			}
-		}
-		
-		// 第二次遍历,封装响应数据
-		List<JSONObject> resultList = null;
-		if (eq2bd.equals(relType) || eq2bd_for.equals(relType)) {
-			resultList = this.getBuildingEquip(tempAllMap, bd2EquipId, fl2BuildingId, relType);
-			
-		} else if (eq2fl.equals(relType) || eq2fl_for.equals(relType)) {
-			resultList = this.getFloorEquip(tempAllMap, bd2EquipId, fl2BuildingId, relType);
-			
-		} else if (eq2sh_for.equals(relType)) {
-			resultList = this.getShaftEquip(tempAllMap, bd2EquipId, sh2BuildingId, groupCode, projectId, relType);
-			
-		} else if (sy2bd_for.equals(relType)) {
-			resultList = this.getSystemBuilding(tempAllMap, sy2BuildingId, relType);
-			
-		} else if (sy2fl_for.equals(relType)) {
-			resultList = this.getSystemFloor(tempAllMap, fl2BuildingId, groupCode, projectId, relType);
-			
-		} else if (sy2sh_for.equals(relType)) {
-			resultList = this.getSystemShaft(tempAllMap, groupCode, projectId, relType);
-			
-		} else if (sy2sp_for.equals(relType)) {
-			resultList = this.getSystemSpace(tempAllMap, groupCode, projectId, relType);
-		}
-		
-		return resultList;
-	}
-
-	/**
-	 * 获取建筑,设备信息
-	 * 
-	 * @param tempAllMap
-	 * @param bd2EquipId
-	 * @param fl2BuildingId
-	 * @param relType
-	 * @return
-	 */
-	private List<JSONObject> getBuildingEquip(Map<String, ObjectDigital> tempAllMap, Map<String, String> bd2EquipId,
-			Map<String, String> fl2BuildingId, String relType) {
-		List<JSONObject> resultList = new ArrayList<JSONObject>();
-		
-		// 以建筑为维度
-		Set<String> buildingIds = bd2EquipId.keySet();
-		Set<String> floorIds = fl2BuildingId.keySet();
-		for (String buildingId : buildingIds) {
-			for (String floorId : floorIds) {
-				// 获取设备,建筑,楼层信息
-				String equipId = bd2EquipId.get(buildingId);
-				ObjectDigital equipment = tempAllMap.get(equipId);
-				ObjectDigital building = tempAllMap.get(buildingId);
-				ObjectDigital floor = tempAllMap.get(floorId);
-				if (equipment == null || building == null || floor == null) {
-					continue;
-				}
-				// 响应数据转换添加
-				JSONObject convertObject = null;
-				if (eq2bd.equals(relType)) {
-					convertObject = this.convertObject(building, "建筑", equipment, "设备");
-					convertObject.put("building_floor", building.getName());		// 建筑名称
-					convertObject.put("_building_floor", floor.getName());			// 楼层名称
-				} else if (eq2bd_for.equals(relType)) {
-					convertObject = this.convertObject(equipment, "设备", building, "建筑");
-					ObjectNode infos = equipment.getInfos();
-					convertObject.put("cad_id", infos == null ? "" : infos.get(cADID));	// 图纸编码
-					convertObject.put("building_name", building.getLocalName());			// 建筑本地名称
-					convertObject.put("floor_namer", floor.getLocalName());					// 楼层本地名称
-					convertObject.put("floor_name", floor.getLocalName());					// 楼层本地名称
-				}
-				
-				if (convertObject != null) {
-					resultList.add(convertObject);
-				}
-			}
-		}
-		return resultList;
-	}
-	
-	
-	/**
-	 * 获取楼层,设备信息
-	 * 
-	 * @param tempAllMap
-	 * @param bd2EquipId
-	 * @param fl2BuildingId
-	 * @param relType
-	 * @return
-	 */
-	private List<JSONObject> getFloorEquip(Map<String, ObjectDigital> tempAllMap, Map<String, String> bd2EquipId,
-			Map<String, String> fl2BuildingId, String relType) {
-		List<JSONObject> resultList = new ArrayList<JSONObject>();
-		// 以楼层为维度
-		Set<String> floorIds = fl2BuildingId.keySet();
-		for (String floorId : floorIds) {
-			// 获取设备,建筑,楼层信息
-			String buildingId = fl2BuildingId.get(floorId);
-			String equipId = bd2EquipId.get(buildingId);
-			ObjectDigital equipment = tempAllMap.get(equipId);
-			ObjectDigital building = tempAllMap.get(buildingId);
-			ObjectDigital floor = tempAllMap.get(floorId);
-			if (equipment == null || building == null || floor == null) {
-				continue;
-			}
-			// 响应数据转换添加
-			JSONObject convertObject = null;
-			if (eq2fl.equals(relType)) {
-				convertObject = this.convertObject(floor, "楼层", equipment, "设备");
-				convertObject.put("building_floor", floor.getName());			// 楼层名称
-				convertObject.put("_building_floor", floor.getName());			// 楼层名称
-			} else if (eq2fl_for.equals(relType)) {
-				convertObject = this.convertObject(equipment, "设备", floor, "楼层");
-				ObjectNode infos = equipment.getInfos();
-				convertObject.put("cad_id", infos == null ? "" : infos.get(cADID));	// 图纸编码
-				convertObject.put("building_name", building.getLocalName());			// 建筑本地名称
-				convertObject.put("_building_name", building.getLocalName());			// 建筑本地名称
-				convertObject.put("floor_namer", floor.getLocalName());					// 楼层本地名称
-				convertObject.put("floor_name", floor.getLocalName());					// 楼层本地名称
-			}
-			
-			if (convertObject != null) {
-				resultList.add(convertObject);
-			}
-		}
-		return resultList;
-	}
-	
-	/**
-	 * 获取竖井、设备信息
-	 * 
-	 * @param tempAllMap
-	 * @param bd2EquipId
-	 * @param fl2BuildingId
-	 * @param sh2BuildingId
-	 * @param relType
-	 * @return
-	 * @throws Exception 
-	 */
-	private List<JSONObject> getShaftEquip(Map<String, ObjectDigital> tempAllMap, Map<String, String> bd2EquipId, 
-			Map<String, String> sh2BuildingId, String groupCode, String projectId, String relType) {
-		List<JSONObject> resultList = new ArrayList<JSONObject>();
-		// 以竖井为维度
-		Set<String> shaftIds = sh2BuildingId.keySet();
-		// shaftId -> floorName
-		Map<String, String> tempFloor = new HashMap<String, String>();
-		for (String shaftId : shaftIds) {
-			// 获取设备,建筑,竖井信息
-			String buildingId = sh2BuildingId.get(shaftId);
-			String equipId = bd2EquipId.get(buildingId);
-			ObjectDigital equipment = tempAllMap.get(equipId);
-			ObjectDigital building = tempAllMap.get(buildingId);
-			ObjectDigital shaft = tempAllMap.get(shaftId);
-			if (equipment == null || building == null || shaft == null) {
-				continue;
-			}
-			// 获取楼层本地名称
-			String floorName = null;
-			if (tempFloor.containsKey(shaftId)) {
-				floorName = tempFloor.get(shaftId);
-			} else {
-				ObjectNode floor = this.getObjectByCodeAndId(groupCode, projectId, GraphCodeEnum.ArchForArch.name(), RelCodeEnum.Sh2Fl.name(), shaftId, null);
-				floorName = floor == null ? AdmCommonConstant.EMPTY : floor.get("localName").textValue();
-			}
-			JSONObject convertObject = null;
-			if (eq2sh_for.equals(relType)) {
-				convertObject = this.convertObject(equipment, "设备", shaft, "竖井");
-				ObjectNode infos = equipment.getInfos();
-				convertObject.put("cad_id", infos == null ? "" : infos.get(cADID));	// 图纸编码
-				convertObject.put("building_name", building.getLocalName());			// 建筑本地名称
-				convertObject.put("floor_namer", floorName);							// 楼层本地名称
-				convertObject.put("floor_name", floorName);								// 楼层本地名称
-			}
-			
-			if (convertObject != null) {
-				resultList.add(convertObject);
-			}
-		} 
-		
-		tempFloor.clear();
-		return resultList;
-	}
-	
-	/**
-	 * 获取系统、建筑信息
-	 * 
-	 * @param tempAllMap
-	 * @param sy2BuildingId
-	 * @param relType
-	 * @return
-	 */
-	private List<JSONObject> getSystemBuilding(Map<String, ObjectDigital> tempAllMap, Map<String, String> sy2BuildingId, String relType) {
-		List<JSONObject> resultList = new ArrayList<JSONObject>();
-		// 以系统为维度
-		Set<String> systemIds = sy2BuildingId.keySet();
-		for (String systemId : systemIds) {
-			// 获取系统,建筑信息
-			String buildingId = sy2BuildingId.get(systemId);
-			ObjectDigital system = tempAllMap.get(systemId);
-			ObjectDigital building = tempAllMap.get(buildingId);
-			if (system == null || building == null) {
-				continue;
-			}
-			JSONObject convertObject = this.convertObject(system, "系统", building, "建筑");
-			ObjectNode infos = system.getInfos();
-			convertObject.put("cad_id", infos == null ? "" : infos.get(cADID));	// 图纸编码
-		
-			resultList.add(convertObject);
-		} 
-		
-		return resultList;
-	}
-	
-	/**
-	 * 获取系统、楼层信息,以系统为维度
-	 * 
-	 * @param tempAllMap
-	 * @param fl2BuildingId
-	 * @param groupCode
-	 * @param projectId
-	 * @param relType
-	 * @return
-	 */
-	private List<JSONObject> getSystemFloor(Map<String, ObjectDigital> tempAllMap, Map<String, String> fl2BuildingId, 
-			String groupCode, String projectId, String relType) {
-		Set<String> floorIds = fl2BuildingId.keySet();
-		List<JSONObject> resultList = new ArrayList<JSONObject>();
-		// 获取所有的Sy2Fl关系
-		List<ObjectRelation> relationList = this.findObjectRelationList(groupCode, projectId, GraphCodeEnum.MechForArch.name(), RelCodeEnum.Sy2Fl.name());
-		for (ObjectRelation objectRelation : relationList) {
-			String systemId = objectRelation.getObjFrom();
-			String floorId = objectRelation.getObjTo();
-			if (!floorIds.contains(floorId)) {
-				continue;
-			}
-			// 获取此楼层对应的建筑及自身信息
-			String buildingId = fl2BuildingId.get(floorId);
-			ObjectDigital floor = tempAllMap.get(floorId);
-			ObjectDigital building = tempAllMap.get(buildingId);
-			// 获取此系统的信息
-			ObjectNode objectNode = this.getObjectNode(groupCode, projectId, systemId);
-			JSONObject convertObject = this.convertObject(objectNode, "系统", floor, "楼层");
-			convertObject.put("cad_id", objectNode.get(cADID) == null ? "" : objectNode.get(cADID).asText());		// 图纸编码
-			convertObject.put("_building_name", building.getLocalName());			// 建筑本地名称
-			resultList.add(convertObject);
-		}
-		
-		return resultList;
-	}
-
-	/**
-	 * 获取系统、楼层信息,以系统为维度
-	 * 
-	 * @param tempAllMap
-	 * @param fl2BuildingId
-	 * @param groupCode
-	 * @param projectId
-	 * @param relType
-	 * @return
-	 */
-	private List<JSONObject> getSystemShaft(Map<String, ObjectDigital> tempAllMap, String groupCode, String projectId, String relType) {
-		// 所有的系统和竖井ID集合
-		Set<String> allKeys = tempAllMap.keySet();
-		List<JSONObject> resultList = new ArrayList<JSONObject>();
-		
-		// 获取所有的Sy2Sh关系
-		List<ObjectRelation> relationList = this.findObjectRelationList(groupCode, projectId, GraphCodeEnum.MechForArch.name(), RelCodeEnum.Sy2Sh.name());
-		for (ObjectRelation objectRelation : relationList) {
-			String systemId = objectRelation.getObjFrom();
-			String shaftId = objectRelation.getObjTo();
-			if (!allKeys.contains(shaftId) || !allKeys.contains(systemId)) {
-				continue;
-			}
-			ObjectDigital shaft = tempAllMap.get(shaftId);
-			ObjectDigital system = tempAllMap.get(systemId);
-			// 获取此楼层的信息
-			JSONObject convertObject = this.convertObject(system, "系统", shaft, "竖井");
-			ObjectNode infos = system.getInfos();
-			convertObject.put("cad_id", infos == null ? "" : infos.get(cADID));	// 图纸编码
-			resultList.add(convertObject);
-		}
-		
-		return resultList;
-	}
-	
-	/**
-	 * 获取系统、空间信息
-	 * @param tempAllMap
-	 * @param groupCode
-	 * @param projectId
-	 * @param relType
-	 * @return
-	 */
-	private List<JSONObject> getSystemSpace(Map<String, ObjectDigital> tempAllMap, String groupCode, String projectId, String relType) {
-		// 所有的系统和空间ID集合
-		Set<String> allKeys = tempAllMap.keySet();
-		List<JSONObject> resultList = new ArrayList<JSONObject>();
-		
-		// 获取所有的Sy2Sp关系
-		List<ObjectRelation> relationList = this.findObjectRelationList(groupCode, projectId, GraphCodeEnum.MechForArch.name(), RelCodeEnum.Sy2Sp.name());
-		for (ObjectRelation objectRelation : relationList) {
-			String systemId = objectRelation.getObjFrom();
-			String spaceId = objectRelation.getObjTo();
-			if (!allKeys.contains(spaceId) || !allKeys.contains(systemId)) {
-				continue;
-			}
-			ObjectDigital space = tempAllMap.get(spaceId);
-			ObjectDigital system = tempAllMap.get(systemId);
-			// 获取楼层的信息
-			ObjectNode floorInfo = this.getObjectByCodeAndId(groupCode, projectId, GraphCodeEnum.ArchForArch.name(), RelCodeEnum.Sp2Fl.name(), spaceId, null);
-			// 获取建筑的信息
-			ObjectNode buildingInfo = this.getObjectByCodeAndId(groupCode, projectId, GraphCodeEnum.ArchForArch.name(), RelCodeEnum.Sp2Bd.name(), spaceId, null);
-			
-			JSONObject convertObject = this.convertObject(system, "系统", space, "空间");
-			ObjectNode infos = system.getInfos();
-			convertObject.put("cad_id", infos == null ? "" : infos.get(cADID));	// 图纸编码
-			convertObject.put("_building_name", buildingInfo.get("localName"));	// 建筑本地编码
-			convertObject.put("_floor_name", floorInfo.get("localName"));		// 楼层本地编码
-			resultList.add(convertObject);
-		}
-		
-		return resultList;
-	}
-	
-	/**
-	 * 封装响应数据,具体的传值,请仔细侦查,这里仅返回共有字段,特殊字段,自行赋值
-	 * 
-	 * @param prefix
-	 * @param prefixName
-	 * @param suffix
-	 * @param suffixName
-	 * @return
-	 */
-	private JSONObject convertObject(ObjectNode prefix, String prefixName, ObjectDigital suffix, String suffixName) {
-		// 封装响应数据记录
-		JSONObject result = new JSONObject();
-		// ID
-		result.put("id", prefix.get("id") == null ? "" : prefix.get("id").asText());
-		// 名称
-		result.put("name", prefix.get("name") == null ? "" : prefix.get("name").asText());
-		// 本地ID
-		result.put("local_id", prefix.get("localId") == null ? "" : prefix.get("localId").asText());
-		// 本地名称
-		result.put("local_name", prefix.get("localName") == null ? "" : prefix.get("localName").asText());
-		// 类型
-		result.put("object_type", prefixName);
-		// ID
-		result.put("_id", suffix.getId());
-		// 名称
-		result.put("_name", suffix.getName());
-		// 本地ID
-		result.put("_local_id", suffix.getLocalId());
-		// 本地名称
-		result.put("_local_name", suffix.getLocalName());
-		// 类型
-		result.put("_object_type", suffixName);
-		return result;
-	}
-	
-	/**
-	 * 封装响应数据,具体的传值,请仔细侦查,这里仅返回共有字段,特殊字段,自行赋值
-	 * 
-	 * @param prefix
-	 * @param prefixName
-	 * @param suffix
-	 * @param suffixName
-	 * @return
-	 */
-	private JSONObject convertObject(ObjectDigital prefix, String prefixName, ObjectDigital suffix, String suffixName) {
-		// 封装响应数据记录
-		JSONObject result = new JSONObject();
-		// ID
-		result.put("id", prefix.getId());
-		// 名称
-		result.put("name", prefix.getName());
-		// 本地ID
-		result.put("local_id", prefix.getLocalId());
-		// 本地名称
-		result.put("local_name", prefix.getLocalName());
-		// 类型
-		result.put("object_type", prefixName);
-		// ID
-		result.put("_id", suffix.getId());
-		// 名称
-		result.put("_name", suffix.getName());
-		// 本地ID
-		result.put("_local_id", suffix.getLocalId());
-		// 本地名称
-		result.put("_local_name", suffix.getLocalName());
-		// 类型
-		result.put("_object_type", suffixName);
-		return result;
+		log.info("下载报表: groupCode[{}], projectId[{}], relType[{}], code[{}]", groupCode, projectId, relType, code);
+		return this.queryRelationObjectContext.findRelationObject(groupCode, projectId, relType);
 	}
 	
 }

+ 53 - 0
src/main/java/com/persagy/proxy/adm/strategy/QueryRelationObjectContext.java

@@ -0,0 +1,53 @@
+package com.persagy.proxy.adm.strategy;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Component;
+
+import com.google.common.collect.Lists;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.strategy.relationdata.QueryRelationObjectStrategy;
+
+/**
+ * 获取关系对象的上下文类
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月2日 下午10:44:32
+ */
+@Component
+public class QueryRelationObjectContext {
+
+	/**
+	 * 策略执行类
+	 */
+	private Map<String, QueryRelationObjectStrategy> relationObjectStrategyMap;
+	
+	/**
+	 * 自动注入 byName
+	 * 
+	 * @param relationObjectStrategyMap
+	 */
+	@Resource
+	public void relationObjectStrategyMap(Map<String, QueryRelationObjectStrategy> relationObjectStrategyMap) {
+		this.relationObjectStrategyMap = relationObjectStrategyMap;
+	}
+	
+	/**
+	 * 获取关系对象数据
+	 * 
+	 * @param groupCode
+	 * @param projectId
+	 * @param relType
+	 * @return
+	 */
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId, String relType) {
+		QueryRelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
+		return strategy == null ? Lists.newArrayList() : strategy.findRelationObject(groupCode, projectId, relType);
+	}
+	
+}

+ 165 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/AbstractQueryRelationObject.java

@@ -0,0 +1,165 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.digital.client.DigitalObjectFacade;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+import cn.hutool.core.collection.CollectionUtil;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月2日 下午11:00:26
+ */
+public abstract class AbstractQueryRelationObject implements QueryRelationObjectStrategy {
+
+	protected String groupCode;
+	
+	protected String projectId;
+	
+	protected IReportDownloadService reportDownloadService;
+	
+	public AbstractQueryRelationObject(IReportDownloadService reportDownloadService) {
+		this.reportDownloadService = reportDownloadService;
+	}
+	
+	@Override
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId, String relType) {
+		this.groupCode = groupCode;
+		this.projectId = projectId;
+		return this.findRelationObject(relType);
+	}
+	
+	/**
+	 * 查询出指定设备信息
+	 * 
+	 * @param relType
+	 * @return 返回ADM所需要的数据
+	 */
+	protected abstract List<AdmRelationObject> findRelationObject(String relType);
+	
+	/**
+	 * 根据项目ID,查询出所有的对象信息
+	 * 
+	 * @param requestData
+	 * @param relType
+	 * @param extraMapping
+	 * @return
+	 */
+	protected List<AdmRelationObject> queryAllObjectInfo(QueryCriteria queryCriteria, String relType) {
+		List<ObjectNode> tempList = new ArrayList<ObjectNode>();
+		
+		// 获取数据
+		this.queryPageObjectInfo(tempList, queryCriteria, queryCriteria.getPage());
+		
+		// 转换中台数据
+		return this.handleObjectDigital(tempList, relType);
+	}
+	
+	/**
+	 * 分页查询
+	 * 
+	 * @param tempList
+	 * @param queryCriteria
+	 * @param groupCode
+	 * @param projectId
+	 * @param page
+	 * @param pageSize
+	 */
+	protected void queryPageObjectInfo(List<ObjectNode> tempList, QueryCriteria queryCriteria, Long page) {
+		queryCriteria.setPage(page);
+		List<ObjectNode> objectNodes = DigitalObjectFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
+		if (CollectionUtil.isEmpty(objectNodes)) {
+			return;
+		}
+		tempList.addAll(objectNodes);
+		this.queryPageObjectInfo(tempList, queryCriteria, ++page);
+	}
+	
+	/**
+	 * 处理中台响应数据,转换为ADM所需要的数据
+	 * 
+	 * @param tempList
+	 * @param groupCode
+	 * @param projectId
+	 * @param relType
+	 * @return
+	 */
+	private List<AdmRelationObject> handleObjectDigital(List<ObjectNode> tempList, String relType) {
+		// 第一次遍历
+		// id -> object
+		Map<String, ObjectNode> tempAllMap = new HashMap<String, ObjectNode>(tempList.size());
+		for (ObjectNode objectNode : tempList) {
+			String id = objectNode.get("id").asText();
+			tempAllMap.put(id, objectNode);
+		}
+		
+		return this.handleObjectDigital(tempAllMap, relType);
+	}
+	
+	
+	/**
+	 * 处理中台响应数据,转换为ADM所需要的数据
+	 * 
+	 * @param tempAllMap 对象ID -> 对象
+	 * @param relType
+	 * @return 不允许返回null
+	 */
+	protected abstract List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType);	
+	
+	/**
+	 * 封装响应数据,具体的传值,请仔细侦查,这里仅返回共有字段,特殊字段,自行赋值
+	 * 
+	 * @param master
+	 * @param masterType
+	 * @param slave
+	 * @param slaveType
+	 * @return
+	 */
+	protected AdmRelationObject convertObject(ObjectNode master, String masterType, ObjectNode slave, String slaveType) {
+		AdmRelationObject relationObject = new AdmRelationObject();
+		
+		// ID
+		String masterId = master.get("id") == null ? AdmCommonConstant.EMPTY  : master.get("id").asText();
+		relationObject.setMasterCode(masterId);
+		relationObject.setMasterId(masterId);
+		// 图纸编码
+		relationObject.setMasterCadId(master.get("cADID") == null ? AdmCommonConstant.EMPTY  : master.get("cADID").asText());
+		// 名称
+		relationObject.setMasterName(master.get("name") == null ? AdmCommonConstant.EMPTY  : master.get("name").asText());
+		// 本地ID
+		relationObject.setMasterLocalId(master.get("localId") == null ? AdmCommonConstant.EMPTY  : master.get("localId").asText());
+		// 本地名称
+		relationObject.setMasterLocalName(master.get("localName") == null ? AdmCommonConstant.EMPTY  : master.get("localName").asText());
+		// 类型
+		relationObject.setMasterType(masterType);
+		
+		// ID
+		String slaveId = slave.get("id") == null ? AdmCommonConstant.EMPTY  : slave.get("id").asText();
+		relationObject.setSlaveCode(slaveId);
+		relationObject.setSlaveId(slaveId);
+		// 图纸编码
+		relationObject.setSlaveCadId(master.get("cADID") == null ? AdmCommonConstant.EMPTY  : master.get("cADID").asText());
+		// 名称
+		relationObject.setSlaveName(slave.get("name") == null ? AdmCommonConstant.EMPTY  : slave.get("name").asText());
+		// 本地ID
+		relationObject.setSlaveLocalId(slave.get("localId") == null ? AdmCommonConstant.EMPTY  : slave.get("localId").asText());
+		// 本地名称
+		relationObject.setSlaveLocalName(slave.get("localName") == null ? AdmCommonConstant.EMPTY  : slave.get("localName").asText());
+		// 类型
+		relationObject.setSlaveType(slaveType);
+		
+		return relationObject;
+	}
+	
+}

+ 97 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2BdForRelationObject.java

@@ -0,0 +1,97 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+import cn.hutool.core.util.StrUtil;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.EQ2BD_FOR)
+public class Eq2BdForRelationObject extends AbstractQueryRelationObject {
+
+	public Eq2BdForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.EQUIPMENT.getIndex()).add(AdmObjectType.BUILDING.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.EQ2BD_FOR.getGraphCode(), AdmRelationTypeEnum.EQ2BD_FOR.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String equipId = objectRelation.getObjFrom();
+			String buildingId = objectRelation.getObjTo();
+			if (!allKeys.contains(equipId) || !allKeys.contains(buildingId)) {
+				continue;
+			}
+			ObjectNode equipment = tempAllMap.get(equipId);
+			ObjectNode building = tempAllMap.get(buildingId);
+			
+			// 获取楼层信息
+			ObjectNode floorInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2BD_FOR.getGraphCode(), 
+					RelCodeEnum.Eq2Fl.name(), equipId, null);
+			
+			AdmRelationObject convertObject = this.convertObject(equipment, "设备", building, "建筑");
+			String buildingName = building.get("localName") == null ? AdmCommonConstant.EMPTY : building.get("localName").asText();
+			String floorName = floorInfo.get("localName") == null ? AdmCommonConstant.EMPTY : floorInfo.get("localName").asText();
+			convertObject.setMasterBuildingName(buildingName);
+			convertObject.setMasterFloorName(floorName);
+			
+			if (StrUtil.isBlank(floorName)) {
+				convertObject.setMasterBelong(buildingName);
+			} else {
+				convertObject.setMasterBelong((StrUtil.isBlank(buildingName) ? AdmCommonConstant.EMPTY 
+						: StrUtil.join(AdmCommonConstant.LINE_THROUGH, buildingName, floorName)));
+			}
+			
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 88 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2BdRelationObject.java

@@ -0,0 +1,88 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.EQ2BD)
+public class Eq2BdRelationObject extends AbstractQueryRelationObject {
+
+	public Eq2BdRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.EQUIPMENT.getIndex()).add(AdmObjectType.BUILDING.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.EQ2BD.getGraphCode(), AdmRelationTypeEnum.EQ2BD.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String equipId = objectRelation.getObjFrom();
+			String buildingId = objectRelation.getObjTo();
+			if (!allKeys.contains(equipId) || !allKeys.contains(buildingId)) {
+				continue;
+			}
+			ObjectNode equipment = tempAllMap.get(equipId);
+			ObjectNode building = tempAllMap.get(buildingId);
+			
+			// 获取楼层信息
+			ObjectNode floorInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2BD.getGraphCode(), 
+					RelCodeEnum.Eq2Fl.name(), equipId, null);
+			
+			AdmRelationObject convertObject = this.convertObject(equipment, "设备", building, "建筑");
+			String buildingName = building.get("localName") == null ? AdmCommonConstant.EMPTY : building.get("localName").asText();
+			String floorName = floorInfo.get("localName") == null ? AdmCommonConstant.EMPTY : floorInfo.get("localName").asText();
+			convertObject.setMasterBuildingName(buildingName);
+			convertObject.setSlaveFloorName(floorName);
+			
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 98 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2FlForRelationObject.java

@@ -0,0 +1,98 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+import cn.hutool.core.util.StrUtil;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.EQ2FL_FOR)
+public class Eq2FlForRelationObject extends AbstractQueryRelationObject {
+
+	public Eq2FlForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.EQUIPMENT.getIndex()).add(AdmObjectType.FLOOR.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.EQ2FL_FOR.getGraphCode(), AdmRelationTypeEnum.EQ2FL_FOR.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String equipId = objectRelation.getObjFrom();
+			String floorId = objectRelation.getObjTo();
+			if (!allKeys.contains(equipId) || !allKeys.contains(floorId)) {
+				continue;
+			}
+			ObjectNode equipment = tempAllMap.get(equipId);
+			ObjectNode floor = tempAllMap.get(floorId);
+			
+			// 获取建筑信息
+			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2FL_FOR.getGraphCode(), 
+					RelCodeEnum.Eq2Bd.name(), equipId, null);
+			
+			AdmRelationObject convertObject = this.convertObject(equipment, "设备", floor, "楼层");
+			String buildingName = buildingInfo.get("localName") == null ? AdmCommonConstant.EMPTY : buildingInfo.get("localName").asText();
+			String floorName = floor.get("localName") == null ? AdmCommonConstant.EMPTY : floor.get("localName").asText();
+			convertObject.setMasterBuildingName(buildingName);
+			convertObject.setMasterFloorName(floorName);
+			convertObject.setSlaveBuildingName(buildingName);
+			convertObject.setSlaveBelong(buildingName);
+			if (StrUtil.isBlank(floorName)) {
+				convertObject.setMasterBelong(buildingName);
+			} else {
+				convertObject.setMasterBelong((StrUtil.isBlank(buildingName) ? AdmCommonConstant.EMPTY 
+						: StrUtil.join(AdmCommonConstant.LINE_THROUGH, buildingName, floorName)));
+			}
+			
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 82 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2FlRelationObject.java

@@ -0,0 +1,82 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.EQ2FL)
+public class Eq2FlRelationObject extends AbstractQueryRelationObject {
+
+	public Eq2FlRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.EQUIPMENT.getIndex()).add(AdmObjectType.FLOOR.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.EQ2FL.getGraphCode(), AdmRelationTypeEnum.EQ2FL.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String equipId = objectRelation.getObjFrom();
+			String floorId = objectRelation.getObjTo();
+			if (!allKeys.contains(equipId) || !allKeys.contains(floorId)) {
+				continue;
+			}
+			ObjectNode equipment = tempAllMap.get(equipId);
+			ObjectNode floor = tempAllMap.get(floorId);
+			
+			AdmRelationObject convertObject = this.convertObject(floor, "楼层", equipment, "设备");
+			String floorName = floor.get("localName") == null ? AdmCommonConstant.EMPTY : floor.get("localName").asText();
+			convertObject.setMasterFloorName(floorName);
+			convertObject.setSlaveFloorName(floorName);
+			
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 97 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2ShForRelationObject.java

@@ -0,0 +1,97 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+import cn.hutool.core.util.StrUtil;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.EQ2SH_FOR)
+public class Eq2ShForRelationObject extends AbstractQueryRelationObject {
+
+	public Eq2ShForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.EQUIPMENT.getIndex()).add(AdmObjectType.SHAFT.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.EQ2SH_FOR.getGraphCode(), AdmRelationTypeEnum.EQ2SH_FOR.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String equipId = objectRelation.getObjFrom();
+			String shaftId = objectRelation.getObjTo();
+			if (!allKeys.contains(equipId) || !allKeys.contains(shaftId)) {
+				continue;
+			}
+			ObjectNode equipment = tempAllMap.get(equipId);
+			ObjectNode shaft = tempAllMap.get(shaftId);
+			
+			// 获取楼层信息
+			ObjectNode floorInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2SH_FOR.getGraphCode(), 
+					RelCodeEnum.Eq2Fl.name(), equipId, null);
+			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2SH_FOR.getGraphCode(), 
+					RelCodeEnum.Eq2Bd.name(), equipId, null);
+			
+			AdmRelationObject convertObject = this.convertObject(equipment, "设备", shaft, "竖井");
+			String buildingName = buildingInfo.get("localName") == null ? AdmCommonConstant.EMPTY : buildingInfo.get("localName").asText();
+			String floorName = floorInfo.get("localName") == null ? AdmCommonConstant.EMPTY : floorInfo.get("localName").asText();
+			convertObject.setMasterBuildingName(buildingName);
+			convertObject.setMasterFloorName(floorName);
+			if (StrUtil.isBlank(floorName)) {
+				convertObject.setMasterBelong(buildingName);
+			} else {
+				convertObject.setMasterBelong((StrUtil.isBlank(buildingName) ? AdmCommonConstant.EMPTY 
+						: StrUtil.join(AdmCommonConstant.LINE_THROUGH, buildingName, floorName)));
+			}
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 77 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2SpRelationObject.java

@@ -0,0 +1,77 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+/**
+ * 此类型需转为 AdmRelationTypeEnum.EQ2SP_IN 进行数据查询
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.EQ2SP_SENSORRELATIONSHIP_SS2SP)
+public class Eq2SpRelationObject extends AbstractQueryRelationObject {
+
+	public Eq2SpRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.EQUIPMENT.getIndex()).add(AdmObjectType.SPACE.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, AdmRelationTypeEnum.EQ2SP_IN.getGraphCode(), AdmRelationTypeEnum.EQ2SP_IN.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String equipId = objectRelation.getObjFrom();
+			String spaceId = objectRelation.getObjTo();
+			if (!allKeys.contains(equipId) || !allKeys.contains(spaceId)) {
+				continue;
+			}
+			ObjectNode space = tempAllMap.get(spaceId);
+			ObjectNode equipment = tempAllMap.get(equipId);
+			
+			AdmRelationObject convertObject = this.convertObject(equipment, "设备", space, "空间");
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 31 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/QueryRelationObjectStrategy.java

@@ -0,0 +1,31 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.List;
+
+import com.persagy.proxy.adm.model.AdmRelationObject;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月2日 下午10:46:03
+ */
+public interface QueryRelationObjectStrategy {
+
+	String WHERE_IN = "$in";
+	
+	String OBJ_TYPE = "objType";
+	
+	/**
+	 * 查询出所有的关系信息
+	 * <p>因原代码中,不存在zoneType类型不为空时对应的方法,所以此处不再进行此数据的判断</p>
+	 * 
+	 * @param groupCode 集团编码
+	 * @param projectId 项目ID
+	 * @param relType   边类型--ADM的
+	 * @return 不会返回null
+	 */
+	List<AdmRelationObject> findRelationObject(String groupCode, String projectId, String relType);
+	
+}

+ 77 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2BdForRelationObject.java

@@ -0,0 +1,77 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.SH2BD_ARCHFORARCH)
+public class Sh2BdForRelationObject extends AbstractQueryRelationObject {
+
+	public Sh2BdForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.SHAFT.getIndex()).add(AdmObjectType.BUILDING.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.SH2BD_ARCHFORARCH.getGraphCode(), AdmRelationTypeEnum.SH2BD_ARCHFORARCH.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String equipId = objectRelation.getObjFrom();
+			String spaceId = objectRelation.getObjTo();
+			if (!allKeys.contains(equipId) || !allKeys.contains(spaceId)) {
+				continue;
+			}
+			ObjectNode space = tempAllMap.get(spaceId);
+			ObjectNode equipment = tempAllMap.get(equipId);
+			
+			AdmRelationObject convertObject = this.convertObject(equipment, "设备", space, "空间");
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 85 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2FlForRelationObject.java

@@ -0,0 +1,85 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.SH2FL_ARCHFORARCH)
+public class Sh2FlForRelationObject extends AbstractQueryRelationObject {
+
+	public Sh2FlForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.SHAFT.getIndex()).add(AdmObjectType.FLOOR.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.SH2FL_ARCHFORARCH.getGraphCode(), AdmRelationTypeEnum.SH2FL_ARCHFORARCH.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String shaftId = objectRelation.getObjFrom();
+			String floorId = objectRelation.getObjTo();
+			if (!allKeys.contains(shaftId) || !allKeys.contains(floorId)) {
+				continue;
+			}
+			ObjectNode shaft = tempAllMap.get(shaftId);
+			ObjectNode floor = tempAllMap.get(floorId);
+			// 获取建筑的信息
+			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SH2FL_ARCHFORARCH.getGraphCode(), 
+					RelCodeEnum.Sh2Bd.name(), shaftId, null);
+
+			AdmRelationObject convertObject = this.convertObject(shaft, "竖井", floor, "楼层");
+			String buildingName = buildingInfo.get("localName") == null ? AdmCommonConstant.EMPTY : buildingInfo.get("localName").asText();
+			convertObject.setSlaveBuildingName(buildingName);
+			convertObject.setSlaveBelong(buildingName);
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 77 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2ShForRelationObject.java

@@ -0,0 +1,77 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.SH2SH_ARCHFORARCH)
+public class Sh2ShForRelationObject extends AbstractQueryRelationObject {
+
+	public Sh2ShForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.SHAFT.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.SH2SH_ARCHFORARCH.getGraphCode(), AdmRelationTypeEnum.SH2SH_ARCHFORARCH.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String shaftIdF = objectRelation.getObjFrom();
+			String shaftIdT = objectRelation.getObjTo();
+			if (!allKeys.contains(shaftIdF) || !allKeys.contains(shaftIdT)) {
+				continue;
+			}
+			ObjectNode shaftF = tempAllMap.get(shaftIdF);
+			ObjectNode shaftT = tempAllMap.get(shaftIdT);
+			
+			AdmRelationObject convertObject = this.convertObject(shaftF, "竖井", shaftT, "竖井");
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 97 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2SpForRelationObject.java

@@ -0,0 +1,97 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+import cn.hutool.core.util.StrUtil;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.SH2SP_ARCHFORARCH)
+public class Sh2SpForRelationObject extends AbstractQueryRelationObject {
+
+	public Sh2SpForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.SHAFT.getIndex()).add(AdmObjectType.SPACE.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.SH2SP_ARCHFORARCH.getGraphCode(), AdmRelationTypeEnum.SH2SP_ARCHFORARCH.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String shaftId = objectRelation.getObjFrom();
+			String spaceId = objectRelation.getObjTo();
+			if (!allKeys.contains(shaftId) || !allKeys.contains(spaceId)) {
+				continue;
+			}
+			ObjectNode shaft = tempAllMap.get(shaftId);
+			ObjectNode space = tempAllMap.get(spaceId);
+			// 获取建筑的信息
+			ObjectNode floorInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SH2SP_ARCHFORARCH.getGraphCode(), 
+					RelCodeEnum.Sh2Fl.name(), shaftId, null);
+			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SH2SP_ARCHFORARCH.getGraphCode(), 
+					RelCodeEnum.Sh2Bd.name(), shaftId, null);
+			
+			AdmRelationObject convertObject = this.convertObject(shaft, "竖井", space, "空间");
+			String buildingName = buildingInfo.get("localName") == null ? AdmCommonConstant.EMPTY : buildingInfo.get("localName").asText();
+			String floorName = floorInfo.get("localName") == null ? AdmCommonConstant.EMPTY : floorInfo.get("localName").asText();
+			convertObject.setSlaveBuildingName(buildingName);
+			convertObject.setSlaveFloorName(floorName);
+			if (StrUtil.isBlank(floorName)) {
+				convertObject.setSlaveBelong(buildingName);
+			} else {
+				convertObject.setSlaveBelong((StrUtil.isBlank(buildingName) ? AdmCommonConstant.EMPTY 
+						: StrUtil.join(AdmCommonConstant.LINE_THROUGH, buildingName, floorName)));
+			}
+
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 95 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sp2BdForRelationObject.java

@@ -0,0 +1,95 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+import cn.hutool.core.util.StrUtil;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.SP2BD_ARCHFORARCH)
+public class Sp2BdForRelationObject extends AbstractQueryRelationObject {
+
+	public Sp2BdForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.SPACE.getIndex()).add(AdmObjectType.BUILDING.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.SP2BD_ARCHFORARCH.getGraphCode(), AdmRelationTypeEnum.SP2BD_ARCHFORARCH.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String spaceId = objectRelation.getObjFrom();
+			String buildingId = objectRelation.getObjTo();
+			if (!allKeys.contains(spaceId) || !allKeys.contains(buildingId)) {
+				continue;
+			}
+			ObjectNode space = tempAllMap.get(spaceId);
+			ObjectNode building = tempAllMap.get(buildingId);
+			// 获取楼层的信息
+			ObjectNode floorInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SP2BD_ARCHFORARCH.getGraphCode(), 
+					RelCodeEnum.Sp2Fl.name(), spaceId, null);
+			
+			// 这里最后一个参数,写为空间,和ADM保持一致
+			AdmRelationObject convertObject = this.convertObject(space, "空间", building, "空间");
+			String buildingName = building.get("localName") == null ? AdmCommonConstant.EMPTY : building.get("localName").asText();
+			String floorName = floorInfo.get("localName") == null ? AdmCommonConstant.EMPTY : floorInfo.get("localName").asText();
+			convertObject.setMasterBuildingName(buildingName);
+			convertObject.setMasterFloorName(floorName);
+			if (StrUtil.isBlank(floorName)) {
+				convertObject.setMasterBelong(buildingName);
+			} else {
+				convertObject.setMasterBelong((StrUtil.isBlank(buildingName) ? AdmCommonConstant.EMPTY 
+						: StrUtil.join(AdmCommonConstant.LINE_THROUGH, buildingName, floorName)));
+			}
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 97 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sp2FlForRelationObject.java

@@ -0,0 +1,97 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+import cn.hutool.core.util.StrUtil;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.SP2FL_ARCHFORARCH)
+public class Sp2FlForRelationObject extends AbstractQueryRelationObject {
+
+	public Sp2FlForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.SPACE.getIndex()).add(AdmObjectType.FLOOR.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.SP2FL_ARCHFORARCH.getGraphCode(), AdmRelationTypeEnum.SP2FL_ARCHFORARCH.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String spaceId = objectRelation.getObjFrom();
+			String floorId = objectRelation.getObjTo();
+			if (!allKeys.contains(spaceId) || !allKeys.contains(floorId)) {
+				continue;
+			}
+			ObjectNode space = tempAllMap.get(spaceId);
+			ObjectNode floor = tempAllMap.get(floorId);
+			// 获取建筑的信息
+			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SP2FL_ARCHFORARCH.getGraphCode(), 
+					RelCodeEnum.Sp2Bd.name(), spaceId, null);
+			
+			AdmRelationObject convertObject = this.convertObject(space, "空间", floor, "楼层");
+			String buildingName = buildingInfo.get("localName") == null ? AdmCommonConstant.EMPTY : buildingInfo.get("localName").asText();
+			String floorName = floor.get("localName") == null ? AdmCommonConstant.EMPTY : floor.get("localName").asText();
+			convertObject.setMasterBuildingName(buildingName);
+			convertObject.setMasterFloorName(floorName);
+			convertObject.setSlaveBuildingName(buildingName);
+			convertObject.setSlaveBelong(buildingName);
+			
+			if (StrUtil.isBlank(floorName)) {
+				convertObject.setMasterBelong(buildingName);
+			} else {
+				convertObject.setMasterBelong((StrUtil.isBlank(buildingName) ? AdmCommonConstant.EMPTY 
+						: StrUtil.join(AdmCommonConstant.LINE_THROUGH, buildingName, floorName)));
+			}
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 77 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2BdForRelationObject.java

@@ -0,0 +1,77 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.SY2BD_FOR)
+public class Sy2BdForRelationObject extends AbstractQueryRelationObject {
+
+	public Sy2BdForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.SYSTEM.getIndex()).add(AdmObjectType.BUILDING.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.SY2BD_FOR.getGraphCode(), AdmRelationTypeEnum.SY2BD_FOR.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String systemId = objectRelation.getObjFrom();
+			String buildingId = objectRelation.getObjTo();
+			if (!allKeys.contains(systemId) || !allKeys.contains(buildingId)) {
+				continue;
+			}
+			ObjectNode system = tempAllMap.get(systemId);
+			ObjectNode building = tempAllMap.get(buildingId);
+			
+			AdmRelationObject convertObject = this.convertObject(system, "系统", building, "建筑");
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 86 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2FlForRelationObject.java

@@ -0,0 +1,86 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.SY2FL_FOR)
+public class Sy2FlForRelationObject extends AbstractQueryRelationObject {
+
+	public Sy2FlForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.SYSTEM.getIndex()).add(AdmObjectType.FLOOR.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.SY2FL_FOR.getGraphCode(), AdmRelationTypeEnum.SY2FL_FOR.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String systemId = objectRelation.getObjFrom();
+			String floorId = objectRelation.getObjTo();
+			if (!allKeys.contains(systemId) || !allKeys.contains(floorId)) {
+				continue;
+			}
+			ObjectNode system = tempAllMap.get(systemId);
+			ObjectNode floor = tempAllMap.get(floorId);
+			
+			// 获取楼层信息
+			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SY2FL_FOR.getGraphCode(), 
+					RelCodeEnum.Sy2Bd.name(), systemId, null);
+			
+			AdmRelationObject convertObject = this.convertObject(system, "系统", floor, "楼层");
+			String buildingName = buildingInfo.get("localName") == null ? AdmCommonConstant.EMPTY : buildingInfo.get("localName").asText();
+			convertObject.setSlaveBuildingName(buildingName);
+			convertObject.setSlaveBelong(buildingName);
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 77 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2ShForRelationObject.java

@@ -0,0 +1,77 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.SY2SH_FOR)
+public class Sy2ShForRelationObject extends AbstractQueryRelationObject {
+
+	public Sy2ShForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.SYSTEM.getIndex()).add(AdmObjectType.SHAFT.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.SY2SH_FOR.getGraphCode(), AdmRelationTypeEnum.SY2SH_FOR.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String systemId = objectRelation.getObjFrom();
+			String shaftId = objectRelation.getObjTo();
+			if (!allKeys.contains(systemId) || !allKeys.contains(shaftId)) {
+				continue;
+			}
+			ObjectNode system = tempAllMap.get(systemId);
+			ObjectNode shaft = tempAllMap.get(shaftId);
+			
+			AdmRelationObject convertObject = this.convertObject(system, "系统", shaft, "竖井");
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

+ 98 - 0
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2SpForRelationObject.java

@@ -0,0 +1,98 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+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.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.service.IReportDownloadService;
+
+import cn.hutool.core.util.StrUtil;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 上午9:42:46
+ */
+@Component(value = AdmRelationType.SY2SP_FOR)
+public class Sy2SpForRelationObject extends AbstractQueryRelationObject {
+
+	public Sy2SpForRelationObject(IReportDownloadService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	protected List<AdmRelationObject> findRelationObject(String relType) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode criteria = objectMapper.createObjectNode();
+		// 参数条件
+		ObjectNode objType = objectMapper.createObjectNode();
+		ArrayNode objTypes = objType.putArray(WHERE_IN);
+		objTypes.add(AdmObjectType.SYSTEM.getIndex()).add(AdmObjectType.SPACE.getIndex());
+		
+		criteria.set(OBJ_TYPE, objType);
+		queryCriteria.setCriteria(criteria);
+		queryCriteria.setPage(1L);
+		queryCriteria.setSize(1000L);
+		
+		return this.queryAllObjectInfo(queryCriteria, relType);
+	}
+
+	@Override
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+		Set<String> allKeys = tempAllMap.keySet();
+		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
+		
+		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+				AdmRelationTypeEnum.SY2SP_FOR.getGraphCode(), AdmRelationTypeEnum.SY2SP_FOR.getRelCode());
+		for (ObjectRelation objectRelation : relationList) {
+			String systemId = objectRelation.getObjFrom();
+			String spaceId = objectRelation.getObjTo();
+			if (!allKeys.contains(systemId) || !allKeys.contains(spaceId)) {
+				continue;
+			}
+			ObjectNode system = tempAllMap.get(systemId);
+			ObjectNode space = tempAllMap.get(spaceId);
+			
+			// 获取楼层信息
+			ObjectNode floorInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SY2SP_FOR.getGraphCode(), 
+					RelCodeEnum.Sy2Bd.name(), systemId, null);
+			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SY2SP_FOR.getGraphCode(), 
+					RelCodeEnum.Sy2Fl.name(), systemId, null);
+			
+			AdmRelationObject convertObject = this.convertObject(system, "系统", space, "空间");
+			String buildingName = buildingInfo.get("localName") == null ? AdmCommonConstant.EMPTY : buildingInfo.get("localName").asText();
+			String floorName = floorInfo.get("localName") == null ? AdmCommonConstant.EMPTY : floorInfo.get("localName").asText();
+			convertObject.setSlaveBuildingName(buildingName);
+			convertObject.setSlaveFloorName(floorName);
+			if (StrUtil.isBlank(floorName)) {
+				convertObject.setSlaveBelong(buildingName);
+			} else {
+				convertObject.setSlaveBelong((StrUtil.isBlank(buildingName) ? AdmCommonConstant.EMPTY 
+						: StrUtil.join(AdmCommonConstant.LINE_THROUGH, buildingName, floorName)));
+			}
+			
+			resultList.add(convertObject);
+		}
+		
+		return resultList;
+	}
+
+}

BIN
src/main/resources/template/relation-template.xlsx