Browse Source

下载报表

zhangqiankun 3 years ago
parent
commit
a4642cd873

+ 4 - 0
pom.xml

@@ -71,5 +71,9 @@
             <artifactId>easyexcel</artifactId>
             <version>${easyexcel.version}</version>
         </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
     </dependencies>
 </project>

+ 17 - 0
src/main/java/com/persagy/proxy/adm/constant/AdmCommonConstant.java

@@ -10,9 +10,14 @@ public interface AdmCommonConstant {
 	/** 项目根路径*/
 	String SERVER_ROOT_PATH = System.getProperty("user.dir");
 	
+	String EMPTY = "";
+	
     /** appId */
     String APP_ID = "ADM";
     
+    /** 默认的userId */
+    String USER_ID = "systemId";
+    
     /** 集团编码 header key*/
     String GROUP_CODE_HEADER = "groupCode";
 
@@ -28,4 +33,16 @@ public interface AdmCommonConstant {
     /** excel文件后缀*/
     String EXCEL_SUFFIX_XLSX = ".xlsx";
     
+    /** 连接符 ? */
+    String WHERE = "?";
+
+    /** 连接符 & */
+    String AND = "&";
+    
+    /** 连接符 _ */
+    String UNDERLINE = "_";
+    
+    /** 连接符 - */
+    String LINE_THROUGH = "-";
+    
 }

+ 25 - 0
src/main/java/com/persagy/proxy/adm/constant/FuncidCategory.java

@@ -0,0 +1,25 @@
+package com.persagy.proxy.adm.constant;
+
+/**
+ * @author: yaoll
+ * @date: 2020-09-09
+ * @verison: 1.0
+ */
+public enum FuncidCategory {
+	/**
+	 * 静态量
+	 */
+	STATIC,
+	/**
+	 * 脉冲量
+	 */
+	PULSE,
+	/**
+	 * 阶段量
+	 */
+	GRADATION,
+	/**
+	 * 时序量
+	 */
+	SEQUENTIAL
+}

+ 21 - 0
src/main/java/com/persagy/proxy/adm/constant/GraphCodeEnum.java

@@ -0,0 +1,21 @@
+package com.persagy.proxy.adm.constant;
+
+/**
+ * 图类型编码
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月2日 下午4:31:27
+ */
+
+public enum GraphCodeEnum {
+
+	ArchSubset,SpaceNeighborhood,ThroughRelationship,TrafficNetwork,ConvectionNetwork,
+	RadiationNetwork,SpaceCorrespond,ArchForArch,MechInArch,MechForArch,MechSubset,LUDistribution,
+	HUDistribution,ChillWaterLoop,CoolingWaterLoop,HeatWaterLoop,CondWaterNetwork,ACAirNetwork,FreshAirNetwork,
+	VentNetwork,VRFNetwork,DomesticWaterNetwork,DrainingWaterNetwork,RecycleWaterNetwork,DrinkingWaterNetwork,DHWNetwork,
+	GasNetwork,FireWaterNetwork,FireVentNetwork,WENetwork,MechCtrl,MechPower,SensorRelationship,ValveRelationship,
+	EnergySubMeter,ScheduleRelationship,MeteorologyRelationship,TenentInArch,BlocRelationship,Property2Mech,PropertyInArch,
+	
+}

+ 24 - 0
src/main/java/com/persagy/proxy/adm/constant/RelCodeEnum.java

@@ -0,0 +1,24 @@
+package com.persagy.proxy.adm.constant;
+
+/**
+ * 边类型编码
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月2日 下午4:32:28
+ */
+public enum RelCodeEnum {
+	Pj2Bd,Bd2Fl,
+	None,Door,Window,DoorWindow,
+	FFOpen,FFClose,
+	Natural,OnewayMech,MixMech,Connect,Transparent,
+	Fl2Bd,Fl2Fl,Fl2Sh,Fl2Sp,Sh2Bd,Sh2Fl,Sh2Sh,Sh2Sp,Sp2Bd,
+	ExactCorrespond,InexactCorrespond,Bd2Bd,Bd2Sh,Bd2Sp,
+	Sp2Fl,Sp2Sh,Sp2Sp,
+	Sy2Bd,Sy2Fl,Sy2Sh,Sy2Sp,Eq2Bd,Eq2Fl,Eq2Sh,Eq2Sp,Pj2Sy,Pj2Eq,Sy2Eq,Eq2Ec,
+	Backup,Fill,Return,Fresh,
+	Uncertain,SupplyReturn,Supply,Bypass,Discharge,Normal,SyCtrl,EqCtrl,SyNormal,
+	SyBackup,EqNormal,EqBackup,Ss2Eq,Ss2Sy,Ss2Sp,Vv2Eq,Vv2Sy,Vv2Vv,Em2Bd,Sub2Em,SubTree,Br2Sub,
+	Br2Eq,Sch2Pj,Sch2Bd,Sch2Fl,Sch2Sp,Sch2Tn,Ms2Pj,Tn2Sp,Bl2Pj,Pe2Eq,Pe2Ec,Pe2Pj,Pe2Bd,Pe2Fl,Pe2Sh,Pe2Sp;
+}

+ 173 - 14
src/main/java/com/persagy/proxy/adm/controller/ReportDownloadController.java

@@ -8,14 +8,18 @@ import java.nio.charset.StandardCharsets;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import com.alibaba.excel.ExcelWriter;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.ResourceUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 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.service.IReportDownloadService;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -31,6 +35,9 @@ import lombok.extern.slf4j.Slf4j;
 @RestController
 public class ReportDownloadController {
 
+	@Autowired
+	private IReportDownloadService reportDownloadService;
+	
 	/**
 	 * 下载报告-设备静态信息维护模板
 	 * 
@@ -48,16 +55,8 @@ public class ReportDownloadController {
 			String fileName = URLEncoder.encode("台账信息导入模板", encode);
 			response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
 			
-			File file = null;
-			try {
-				file = ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + "template/equip_template.xlsx");
-			} catch (FileNotFoundException e) {
-			}
-			if (file == null || !file.exists()) {
-				file = ResourceUtils.getFile(AdmCommonConstant.SERVER_ROOT_PATH + "/template/equip_template.xlsx");
-			}
-			
-			excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(file).build();
+			File templateFile = this.getTemplateFile("equip_template.xlsx");
+			excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(templateFile).build();
 		} catch (Exception e) {
 			log.error("设备静态信息维护模板下载失败", e);
 		} finally {
@@ -86,20 +85,180 @@ public class ReportDownloadController {
 			try {
 				file = ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + "template/upload/" + key);
 			} catch (FileNotFoundException e) {
-				file = ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + "template/relation-template.xlsx");
+				file = ResourceUtils.getFile(AdmCommonConstant.SERVER_ROOT_PATH + "template/upload/" + key);
 			}
 			if (file == null || !file.exists()) {
-				file = ResourceUtils.getFile(AdmCommonConstant.SERVER_ROOT_PATH + "/template/relation-template.xlsx");
+				try {
+					file = ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + "/template/relation-template.xlsx");
+				} catch (FileNotFoundException e) {
+					file = ResourceUtils.getFile(AdmCommonConstant.SERVER_ROOT_PATH + "/template/relation-template.xlsx");
+				}
 			}
 			
 			excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(file).build();
 		} catch (Exception e) {
-			log.error("设备静态信息维护模板下载失败", e);
+			log.error("下载报告-点表失败", e);
+		} finally {
+			if (excelWriter != null) {
+				excelWriter.finish();
+			}
+		}
+	}
+	
+	/**
+	 * 下载模板
+	 * 
+	 * @param request
+	 * @param response
+	 */
+	@RequestMapping("/graphic/template-downloads")
+	public void templateDownloads(HttpServletRequest request, HttpServletResponse response) {
+		ExcelWriter excelWriter = null;
+		try {
+			response.setContentType("application/vnd.ms-excel");
+			String encode = StandardCharsets.UTF_8.name();
+			response.setCharacterEncoding(encode);
+			response.setHeader("Content-disposition", "attachment;filename=relation-template.xlsx");
+			
+			File templateFile = this.getTemplateFile("relation-template.xlsx");
+			excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(templateFile).build();
+		} catch (Exception e) {
+			log.error("模板下载失败", e);
 		} finally {
 			if (excelWriter != null) {
 				excelWriter.finish();
 			}
 		}
 	}
+	
+	/**
+	 * 下载报告
+	 * 
+	 * @param request
+	 * @param response
+	 */
+	@RequestMapping("/graphic/report-downloads")
+	public void reportDownloads(@RequestParam String projectId, @RequestParam String relType, @RequestParam(required = false) String zoneType, 
+			HttpServletRequest request, HttpServletResponse response) {
+		ExcelWriter excelWriter = null;
+		try {
+			response.setContentType("application/vnd.ms-excel");
+			String encode = StandardCharsets.UTF_8.name();
+			response.setCharacterEncoding(encode);
+			
+			String templateFile = projectId + AdmCommonConstant.LINE_THROUGH + relType + AdmCommonConstant.EXCEL_SUFFIX_XLSX;
+			response.setHeader("Content-disposition", "attachment;filename=" + templateFile);
+			
+			File file = this.getTemplateOrDefaultFile(templateFile);
+			excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(file).build();
+		} catch (Exception e) {
+			log.error("下载报告失败", e);
+		} finally {
+			if (excelWriter != null) {
+				excelWriter.finish();
+			}
+		}
+	}
+	
+	/**
+	 * 导出-点位模板
+	 * 
+	 * @param request
+	 * @param response
+	 */
+	@RequestMapping("/graphic/export/point")
+	public void exportPoint(@RequestParam String buildingId, @RequestParam String floorId, @RequestParam String category, 
+			HttpServletRequest request, HttpServletResponse response) {
+		ExcelWriter excelWriter = null;
+		try {
+			response.setContentType("application/vnd.ms-excel");
+			String encode = StandardCharsets.UTF_8.name();
+			response.setCharacterEncoding(encode);
+			
+			//excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(file).build();
+		} catch (Exception e) {
+			log.error("导出-点位模板失败", e);
+		} finally {
+			if (excelWriter != null) {
+				excelWriter.finish();
+			}
+		}
+	}
+	
+	/**
+	 * 导出关系
+	 * 
+	 * @param request
+	 * @param response
+	 */
+	@RequestMapping("/graphic/export")
+	public void export(@RequestParam String projectId, @RequestParam String relType, @RequestParam(required = false) String code, 
+			@RequestParam(required = false) String zoneType, HttpServletRequest request, HttpServletResponse response) {
+		ExcelWriter excelWriter = null;
+		try {
+			String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
+			
+			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);
+			
+			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);
+		} catch (Exception e) {
+			log.error("导出关系失败", e);
+		} finally {
+			if (excelWriter != null) {
+				excelWriter.finish();
+			}
+		}
+	}
+	
+	/**
+	 * 获取对应的文件,或者默认文件
+	 * 不同路径,防止镜像部署时获取不到
+	 * 
+	 * @param templateName 带后缀的文件名
+	 * @return
+	 * @throws FileNotFoundException 
+	 */
+	private File getTemplateOrDefaultFile(String templateName) throws FileNotFoundException {
+		File file = null;
+		try {
+			file = ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + "template/" + templateName);
+		} catch (FileNotFoundException e) {
+			file = ResourceUtils.getFile(AdmCommonConstant.SERVER_ROOT_PATH + "template/" + templateName);
+		}
+		if (file == null || !file.exists()) {
+			try {
+				file = ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + "template/relation-template.xlsx");
+			} catch (FileNotFoundException e) {
+				file = ResourceUtils.getFile(AdmCommonConstant.SERVER_ROOT_PATH + "/template/relation-template.xlsx");
+			}
+		}
+		return file;
+	}
+	
+	/**
+	 * 获取对应的模板文件,不同路径,防止镜像内获取不到
+	 * 
+	 * @param templateName 带后缀的文件名
+	 * @return
+	 * @throws FileNotFoundException 
+	 */
+	private File getTemplateFile(String templateName) throws FileNotFoundException {
+		File file = null;
+		try {
+			file = ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + "template/" + templateName);
+		} catch (FileNotFoundException e) {}
+		if (file == null || !file.exists()) {
+			file = ResourceUtils.getFile(AdmCommonConstant.SERVER_ROOT_PATH + "/template/" + templateName);
+		}
+		return file;
+	}
 
 }

+ 65 - 0
src/main/java/com/persagy/proxy/adm/service/IReportDownloadService.java

@@ -0,0 +1,65 @@
+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;
+
+/**
+ * 报表/模板下载
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年8月31日 下午4:42:51
+ */
+public interface IReportDownloadService {
+
+	/**
+	 * 获取指定对象信息
+	 * 
+	 * @param groupCode
+	 * @param projectId
+	 * @param id
+	 * @return 不会返回null
+	 */
+	ObjectNode getObjectNode(String groupCode, String projectId, String id);
+	
+	/**
+	 * 获取对象,通过关系对象的id和rel_code
+	 * 
+	 * @param groupCode
+	 * @param projectId
+	 * @param graphCode
+	 * @param relCode
+	 * @param objFrom 与objTo不可同时存在
+	 * @param objTo	  与objFrom不可同时存在
+	 * @return 不会返回null
+	 */
+	ObjectNode getObjectByCodeAndId(String groupCode, String projectId, String graphCode, String relCode, String objFrom, String objTo);
+	
+	/**
+	 * 获取对象关系数据
+	 * 
+	 * @param groupCode
+	 * @param projectId
+	 * @param graphCode
+	 * @param relCode
+	 * @return
+	 */
+	List<ObjectRelation> findObjectRelationList(String groupCode, String projectId, String graphCode, String relCode);
+	
+	/**
+	 * 查询出所有的关系信息
+	 * 
+	 * @param groupCode
+	 * @param projectId
+	 * @param relType
+	 * @param code
+	 * @param zoneType
+	 * @return
+	 */
+	List<JSONObject> queryAllEquip(String groupCode, String projectId, String relType, String code, String zoneType);
+	
+}

+ 682 - 0
src/main/java/com/persagy/proxy/adm/service/impl/ReportDownloadService.java

@@ -0,0 +1,682 @@
+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.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.service.IReportDownloadService;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.StrUtil;
+
+/**
+ * 报表/模板下载
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年8月31日 下午4:43:15
+ */
+@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;
+	
+	@Override
+	public ObjectNode getObjectNode(String groupCode, String projectId, String id) {
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode objectNode = objectMapper.createObjectNode();
+		objectNode.put("id", id);
+		queryCriteria.setCriteria(objectNode);
+		List<ObjectNode> objectNodes = DigitalObjectFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
+		return CollectionUtil.isEmpty(objectNodes) ? objectMapper.createObjectNode() : objectNodes.get(0); 
+	}
+	
+	@Override
+	public ObjectNode getObjectByCodeAndId(String groupCode, String projectId, String graphCode, String relCode, String objFrom, String objTo) {
+		groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
+		
+		// 获取出关联对象
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode objectNode = objectMapper.createObjectNode();
+		objectNode.put("graphCode", graphCode);
+		objectNode.put("relCode", relCode);
+		objectNode.put("objFrom", objFrom);
+		objectNode.put("objTo", objTo);
+		queryCriteria.setCriteria(objectNode);
+		List<ObjectRelation> objectRelations = DigitalRelationFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
+		if (CollectionUtil.isEmpty(objectRelations)) {
+			return objectMapper.createObjectNode();
+		}
+		
+		// 获取关联对象的本地名称
+		ObjectRelation objectRelation = objectRelations.get(0);
+		String relationId = StrUtil.isBlank(objFrom) ? objectRelation.getObjFrom() : objectRelation.getObjTo();
+		return this.getObjectNode(groupCode, projectId, relationId); 
+	}
+	
+	@Override
+	public List<ObjectRelation> findObjectRelationList(String groupCode, String projectId, String graphCode, String relCode) {
+		groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
+		
+		// 获取出关联对象
+		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);
+		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) {
+		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;
+	}
+	
+}