zhangqiankun 3 years ago
parent
commit
a01cb07fa8
23 changed files with 362 additions and 213 deletions
  1. 52 6
      src/main/java/com/persagy/proxy/adm/controller/RelationReportController.java
  2. 180 0
      src/main/java/com/persagy/proxy/adm/handler/RelationReportHandler.java
  3. 5 5
      src/main/java/com/persagy/proxy/adm/model/EquipmentExcel.java
  4. 96 0
      src/main/java/com/persagy/proxy/adm/model/EquipmentExcel2.java
  5. 0 9
      src/main/java/com/persagy/proxy/adm/service/IRelationReportService.java
  6. 1 126
      src/main/java/com/persagy/proxy/adm/service/impl/RelationReportService.java
  7. 12 51
      src/main/java/com/persagy/proxy/adm/strategy/RelationObjectContext.java
  8. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/ArchForArchSh2BdRelationObject.java
  9. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/ArchForArchSh2FlRelationObject.java
  10. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/ArchForArchSh2ShRelationObject.java
  11. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/ArchForArchSh2SpRelationObject.java
  12. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/ArchForArchSp2BdRelationObject.java
  13. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/ArchForArchSp2FlRelationObject.java
  14. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchEq2BdRelationObject.java
  15. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchEq2FlRelationObject.java
  16. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchEq2ShRelationObject.java
  17. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchSy2BdRelationObject.java
  18. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchSy2FlRelationObject.java
  19. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchSy2ShRelationObject.java
  20. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchSy2SpRelationObject.java
  21. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechInArchEq2BdRelationObject.java
  22. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechInArchEq2FlRelationObject.java
  23. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechInArchEq2SpRelationObject.java

+ 52 - 6
src/main/java/com/persagy/proxy/adm/controller/RelationReportController.java

@@ -33,6 +33,8 @@ import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.Lists;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.handler.RelationReportHandler;
 import com.persagy.proxy.adm.model.AdmRelationObject;
 import com.persagy.proxy.adm.model.EquipmentExcel;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
@@ -63,6 +65,8 @@ public class RelationReportController {
 	@Value("${middleware.group.code}")
 	private String defaultCode;
 	
+	private final RelationReportHandler relationReportHandler;
+	
 	private final RelationObjectContext relationObjectContext;
 	
 	private final IRelationReportService relationReportService;
@@ -143,8 +147,9 @@ public class RelationReportController {
 	 * 下载报告-设备-未关联空间的设备
 	 * 设备.xlsx 是个空模板,所以这里未使用 
 	 * 
-	 * @param queryCriteria
+	 * @param projectId
 	 * @param request
+	 * @param response
 	 * @return
 	 */
 	@RequestMapping("/graphic/downloads/eq/not/sp")
@@ -161,7 +166,37 @@ public class RelationReportController {
             String fileName = URLEncoder.encode("equipment", encode);
             response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
             
-            List<EquipmentExcel> equipByNotSpace = this.relationReportService.findEquipByNotSpace(groupCode, projectId);
+            List<EquipmentExcel> equipByNotSpace = this.relationReportHandler.findEquipByNotSpace(groupCode, projectId);
+            EasyExcel.write(response.getOutputStream(), EquipmentExcel.class).sheet("设备").doWrite(equipByNotSpace);
+		} catch(Exception e) {
+			log.error("设备数据导出异常", e);
+		}
+	}
+	
+	/**
+	 * 下载报告-统计项目下已有的设备,信息点,每个设备
+	 * 设备.xlsx 是个空模板,所以这里未使用 
+	 * 
+	 * @param projectId
+	 * @param request
+	 * @param response
+	 * @return
+	 */
+	@RequestMapping("/graphic/downloads/project/binding/point")
+	public void downloadsProjectBindingPoint(@RequestParam(required = false) String projectId, HttpServletRequest request, HttpServletResponse response) {
+		String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
+		if (StrUtil.isBlank(projectId)) {
+			projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
+		}
+		try {
+            response.setContentType("application/vnd.ms-excel");
+            String encode = StandardCharsets.UTF_8.name();
+            response.setCharacterEncoding(encode);
+            // 防止中文乱码
+            String fileName = URLEncoder.encode("设备实例交付", encode);
+            response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+            
+            List<EquipmentExcel> equipByNotSpace = this.relationReportHandler.findEquipByNotSpace(groupCode, projectId);
             EasyExcel.write(response.getOutputStream(), EquipmentExcel.class).sheet(0).doWrite(equipByNotSpace);
 		} catch(Exception e) {
 			log.error("设备数据导出异常", e);
@@ -336,7 +371,13 @@ public class RelationReportController {
 			response.setHeader("Content-disposition", "attachment;filename=relation-template.xlsx");
 			
 			log.info("下载报表: groupCode[{}], projectId[{}], relType[{}], code[{}]", groupCode, projectId, relType, code);
-			List<AdmRelationObject> relationObjects = this.relationObjectContext.findRelationObject(groupCode, projectId, relType);
+			AdmRelationTypeEnum typeEnum = AdmCommonConstant.RELATION_TYPE_MAP.get(relType);
+			
+			List<AdmRelationObject> relationObjects = null;
+			if (typeEnum != null) {
+				String graphAndRelKey = typeEnum.getGraphCode() + AdmCommonConstant.UNDERLINE + typeEnum.getRelCode();
+				relationObjects = this.relationObjectContext.findRelationObject(groupCode, projectId, graphAndRelKey);
+			}
 			
 			File templateFile = this.getTemplateFile("relation-template.xlsx");
 			EasyExcel.write(response.getOutputStream()).withTemplate(templateFile).sheet(EXPORT_SHEET_NAME).needHead(false).doWrite(relationObjects);
@@ -371,6 +412,11 @@ public class RelationReportController {
 			if (file == null) {
 				return AdmResponse.failure("未选择文件");
 			}
+			AdmRelationTypeEnum typeEnum = AdmCommonConstant.RELATION_TYPE_MAP.get(relType);
+			if (typeEnum == null) {
+				return AdmResponse.failure("不支持的关系类型");
+			}
+			String graphAndRelKey = typeEnum.getGraphCode() + AdmCommonConstant.UNDERLINE + typeEnum.getRelCode();
 			
 			int failurNum = 0;
 			int successNum = 0;
@@ -406,7 +452,7 @@ public class RelationReportController {
 		    	relationObject.setSlaveId(slaveIdCell == null ? null : slaveIdCell.getStringCellValue());
 		    	
 		    	// 校验数据
-				Object result = this.relationObjectContext.checkRelationObject(relationObject, groupCode, projectId, relType, code);
+				Object result = this.relationObjectContext.checkRelationObject(relationObject, groupCode, projectId, graphAndRelKey, code);
 				if (result instanceof String) {
 					failurNum++;
 					xssfRow.createCell(16).setCellValue((String)result);
@@ -419,7 +465,7 @@ public class RelationReportController {
 				rowNums.add(i);
 				relationObjects.add(relation);
 				if (relationObjects.size() >= 1000) {
-					boolean objects = this.relationObjectContext.saveRelationObjects(relationObjects, groupCode, projectId, relType);
+					boolean objects = this.relationObjectContext.saveRelationObjects(relationObjects, groupCode, projectId, graphAndRelKey);
 					if (objects) {
 						successNum += relationObjects.size();
 					} else {
@@ -434,7 +480,7 @@ public class RelationReportController {
 			}
 		    // 最后一次遗留数据录入
 		    if (CollectionUtil.isNotEmpty(relationObjects)) {
-		    	boolean objects = this.relationObjectContext.saveRelationObjects(relationObjects, groupCode, projectId, relType);
+		    	boolean objects = this.relationObjectContext.saveRelationObjects(relationObjects, groupCode, projectId, graphAndRelKey);
 				if (objects) {
 					successNum += relationObjects.size();
 				} else {

+ 180 - 0
src/main/java/com/persagy/proxy/adm/handler/RelationReportHandler.java

@@ -0,0 +1,180 @@
+package com.persagy.proxy.adm.handler;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Lists;
+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.define.client.DigitalDefineFacade;
+import com.persagy.dmp.define.entity.ObjectTypeDefine;
+import com.persagy.dmp.digital.client.DigitalObjectFacade;
+import com.persagy.dmp.digital.client.DigitalRelationFacade;
+import com.persagy.dmp.digital.entity.ObjectDigital;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
+import com.persagy.proxy.adm.constant.GraphCodeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.model.EquipmentExcel;
+import com.persagy.proxy.adm.service.IRelationReportService;
+import com.persagy.proxy.adm.strategy.RelationObjectContext;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.StrUtil;
+import lombok.RequiredArgsConstructor;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年10月15日 下午3:09:10
+ */
+@Component
+@RequiredArgsConstructor
+public class RelationReportHandler {
+	
+	@Value("${middleware.group.code}")
+	private String defaultCode;
+
+	private final RelationObjectContext relationObjectContext;
+	
+	private final IRelationReportService relationReportService;
+
+	/**
+	 * 查询出不在空间内的设备数据
+	 * 
+	 * @param groupCode
+	 * @param projectId
+	 */
+	public List<EquipmentExcel> findEquipByNotSpace(String groupCode, String projectId) {
+		groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
+		
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria objectCriteria = new QueryCriteria();
+		ObjectNode object = objectMapper.createObjectNode();
+		object.put("objType", AdmObjectType.EQUIPMENT.getIndex());
+		objectCriteria.setCriteria(object);
+		
+		// 1.获取所有的设备类定义的className
+		List<ObjectTypeDefine> classList = DigitalDefineFacade.queryObjectType(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, objectCriteria);
+		// key-classCode, value-className
+		Map<String, String> classDefine = new HashMap<String, String>();
+		if (CollectionUtil.isNotEmpty(classList)) {
+			for (ObjectTypeDefine objectTypeDefine : classList) {
+				classDefine.put(objectTypeDefine.getCode(), objectTypeDefine.getName());
+			}
+		}
+		// 2.获取所有的设备对象数据
+		objectCriteria.setOrders(Collections.singletonList(OrderItem.asc("classCode")));
+		List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, objectCriteria);
+		if (CollectionUtil.isEmpty(equipList)) {
+			return Lists.newArrayList();
+		}
+		
+		// 3.查询出所有的边类型为 Eq2Sp 的关系数据
+		QueryCriteria relationCriteria = new QueryCriteria();
+		ObjectNode relation = objectMapper.createObjectNode();
+		relation.put("relCode", RelCodeEnum.Eq2Sp.name());
+		relationCriteria.setCriteria(relation);
+		List<ObjectRelation> relationList = DigitalRelationFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, relationCriteria);
+		Set<String> equipIds = new HashSet<String>();
+		if (CollectionUtil.isNotEmpty(relationList)) {
+			for (ObjectRelation relationInfo : relationList) {
+				equipIds.add(relationInfo.getObjFrom());
+			}
+		}
+		
+		return this.exportEquipmentExcel(equipList, classDefine, equipIds, groupCode, projectId);
+	}
+	
+	/**
+	 * 构造 excel 设备数据
+	 * 
+	 * @param equipList 设备数据集合
+	 * @param classDefine 类定义信息
+	 * @param equipIds 需要剔除的设备ID集合
+	 * @param groupCode 
+	 * @param projectId 
+	 * @return
+	 */
+	private List<EquipmentExcel> exportEquipmentExcel(List<ObjectNode> equipList, Map<String, String> classDefine, Set<String> equipIds, String groupCode, String projectId) {
+		// key: 设备ID,value: 建筑名称
+		Map<String, String> buildTemp = new HashMap<String, String>();
+		// key: 设备ID,value: 楼层名称
+		Map<String, String> floorTemp = new HashMap<String, String>();
+		
+		// 获取建筑名称
+		//this.relationObjectContext.findRelationObject(groupCode, projectId, projectId);
+		RequestData requestData = new RequestData();
+		requestData.setGraphCode(GraphCodeEnum.MechInArch.name());
+		requestData.setRelCode(RelCodeEnum.Eq2Bd.name());
+		requestData.setPage(1L);
+		requestData.setSize(500L);
+		List<ObjectDigital> buildDigitals = DigitalObjectFacade.queryObjectListByGraphCodeAndRelCode(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, requestData);
+		if (CollectionUtil.isNotEmpty(buildDigitals)) {
+			for (ObjectDigital master : buildDigitals) {
+				List<ObjectDigital> slaveDigitals = master.getRelObjs();
+				ObjectDigital slave = CollectionUtil.isEmpty(slaveDigitals) ? null : slaveDigitals.get(0);
+				if (slave != null) {
+					buildTemp.put(master.getId(), slave.getLocalName());
+				}
+			}
+		}
+		// 楼层名称
+		requestData.setRelCode(RelCodeEnum.Eq2Fl.name());
+		List<ObjectDigital> floorDigitals = DigitalObjectFacade.queryObjectListByGraphCodeAndRelCode(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, requestData);
+		if (CollectionUtil.isNotEmpty(floorDigitals)) {
+			for (ObjectDigital master : floorDigitals) {
+				List<ObjectDigital> slaveDigitals = master.getRelObjs();
+				ObjectDigital slave = CollectionUtil.isEmpty(slaveDigitals) ? null : slaveDigitals.get(0);
+				if (slave != null) {
+					floorTemp.put(master.getId(), slave.getLocalName());
+				}
+			}
+		}
+		
+		// 结果封装
+		List<EquipmentExcel> excelList = new ArrayList<EquipmentExcel>();
+		for (ObjectNode equip : equipList) {
+			String id = equip.get("id") == null ? null : equip.get("id").asText();
+			if (id != null && !equipIds.contains(id)) {
+				EquipmentExcel excel = new EquipmentExcel();
+				excel.setId(id);
+				excel.setName(equip.get("name") == null ? null : equip.get("name").asText());
+				excel.setLocalId(equip.get("localId") == null ? null : equip.get("localId").asText());
+				excel.setLocalName(equip.get("localName") == null ? null : equip.get("localName").asText());
+				
+				String infos = equip.get("infos") == null ? null : equip.get("infos").asText();
+				if (StrUtil.isNotBlank(infos)) {
+					JSONObject parseObject = JSONObject.parseObject(infos);
+					excel.setBimId(parseObject.getString("bimId"));
+				}
+				
+				String classCode = equip.get("classCode") == null ? null : equip.get("classCode").asText();
+				excel.setClassCodeName(classCode == null ? null : classDefine.get(classCode));
+				
+				excel.setBuildName(buildTemp.get(id));
+				excel.setFloorName(floorTemp.get(id));
+				excel.setModelFileName("T1F10模型文件v18.rvt");	// 这里写死是不对的,需要后续再补充改变
+				excelList.add(excel);
+			}
+		}
+		return excelList;
+	}
+	
+}

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

@@ -25,15 +25,15 @@ public class EquipmentExcel {
 	@ExcelProperty(value = "设备id", index=0)
 	private String id;
 	
-	@ColumnWidth(25)
+	@ColumnWidth(20)
 	@ExcelProperty(value = "设备名称", index=1)
 	private String name;
 
-	@ColumnWidth(25)
+	@ColumnWidth(20)
 	@ExcelProperty(value = "设备本地名称", index=2)
 	private String localId;
 
-	@ColumnWidth(25)
+	@ColumnWidth(20)
 	@ExcelProperty(value = "设备本地编码", index=3)
 	private String localName;
 	
@@ -41,7 +41,7 @@ public class EquipmentExcel {
 	@ExcelProperty(value = "BIMID", index=4)
 	private String bimId;
 
-	@ColumnWidth(25)
+	@ColumnWidth(20)
 	@ExcelProperty(value = "设备类", index=5)
 	private String classCodeName;
 	
@@ -53,7 +53,7 @@ public class EquipmentExcel {
 	@ExcelProperty(value = "楼层", index=7)
 	private String floorName; 
 	
-	@ColumnWidth(30)
+	@ColumnWidth(20)
 	@ExcelProperty(value = "模型文件名", index=8)
 	private String modelFileName;
 	

+ 96 - 0
src/main/java/com/persagy/proxy/adm/model/EquipmentExcel2.java

@@ -0,0 +1,96 @@
+package com.persagy.proxy.adm.model;
+
+import org.apache.poi.ss.usermodel.Font;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.HeadFontStyle;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @version 
+ * @description 不在空间内的设备数据导出实体类
+ * @company persagy
+ * @author zhangqiankun
+ * @since 2020年11月26日:	下午12:30:39
+ */
+@Getter
+@Setter
+@HeadFontStyle(color = Font.COLOR_NORMAL)
+public class EquipmentExcel2 {
+	
+	@ColumnWidth(10)
+	@ExcelProperty(value = "序号", index=0)
+	private String index;
+	
+	@ColumnWidth(25)
+	@ExcelProperty(value = "项目名称", index=1)
+	private String projectName;
+
+	@ColumnWidth(20)
+	@ExcelProperty(value = "建筑", index=2)
+	private String buildName;
+
+	@ColumnWidth(20)
+	@ExcelProperty(value = "楼层", index=3)
+	private String floorName;
+	
+	@ColumnWidth(10)
+	@ExcelProperty(value = "系统编码", index=4)
+	private String systemCode;
+
+	@ColumnWidth(20)
+	@ExcelProperty(value = "系统名称", index=5)
+	private String systemName;
+	
+	@ColumnWidth(10)
+	@ExcelProperty(value = "设备类型编码", index=6)
+	private String equipCode;
+	
+	@ColumnWidth(20)
+	@ExcelProperty(value = "设备类型名称", index=7)
+	private String equipName; 
+	
+	@ColumnWidth(50)
+	@ExcelProperty(value = "设备ID", index=8)
+	private String equipId;
+	
+	@ColumnWidth(50)
+	@ExcelProperty(value = "BIMID", index=9)
+	private String bimId;
+	
+	@ColumnWidth(20)
+	@ExcelProperty(value = "本地编码", index=10)
+	private String localId;
+	
+	@ColumnWidth(20)
+	@ExcelProperty(value = "本地名称", index=11)
+	private String localName;
+	
+	@ColumnWidth(10)
+	@ExcelProperty(value = "【信息点】应绑点位总数", index=12)
+	private String needPointCount;
+	
+	@ColumnWidth(10)
+	@ExcelProperty(value = "【信息点】已绑点位总数", index=13)
+	private String nowPointCount;
+	
+	@ColumnWidth(10)
+	@ExcelProperty(value = "【信息点】静态应绑点", index=14)
+	private String needStaticPointCount;
+	
+	@ColumnWidth(10)
+	@ExcelProperty(value = "【信息点】静态已绑点", index=15)
+	private String nowStaticPointCount;
+	
+	@ColumnWidth(10)
+	@ExcelProperty(value = "【信息点】动态应绑点", index=16)
+	private String needDynamicPointCount;
+	
+	@ColumnWidth(10)
+	@ExcelProperty(value = "【信息点】动态已绑点", index=17)
+	private String nowDynamicPointCount;
+	
+}

+ 0 - 9
src/main/java/com/persagy/proxy/adm/service/IRelationReportService.java

@@ -10,7 +10,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.define.entity.GraphDefine;
 import com.persagy.dmp.define.entity.RelationDefine;
 import com.persagy.dmp.digital.entity.ObjectRelation;
-import com.persagy.proxy.adm.model.EquipmentExcel;
 
 /**
  * 报表/模板下载
@@ -162,14 +161,6 @@ public interface IRelationReportService {
 	List<ObjectRelation> findObjectRelationList(String groupCode, String projectId, String graphCode, String relCode);
 
 	/**
-	 * 找到不在空间内的设备数据
-	 * 
-	 * @param groupCode
-	 * @param projectId
-	 */
-	List<EquipmentExcel> findEquipByNotSpace(String groupCode, String projectId);
-	
-	/**
 	 * 查询关系总览(空表,先插入)
 	 * @param content: 模糊查询卡片名称关键字
 	 */

+ 1 - 126
src/main/java/com/persagy/proxy/adm/service/impl/RelationReportService.java

@@ -6,7 +6,6 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -28,25 +27,18 @@ import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.common.model.response.CommonResult;
-import com.persagy.dmp.define.client.DigitalDefineFacade;
 import com.persagy.dmp.define.client.DigitalGraphDefineFacade;
 import com.persagy.dmp.define.client.DigitalRelationDefineFacade;
 import com.persagy.dmp.define.entity.GraphDefine;
-import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.define.entity.RelationDefine;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
 import com.persagy.dmp.digital.client.DigitalRelationProjectCalFacade;
-import com.persagy.dmp.digital.entity.ObjectDigital;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.dmp.digital.entity.ObjectRelationProjectCal;
 import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
-import com.persagy.proxy.adm.constant.AdmObjectType;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
-import com.persagy.proxy.adm.constant.GraphCodeEnum;
-import com.persagy.proxy.adm.constant.RelCodeEnum;
-import com.persagy.proxy.adm.model.EquipmentExcel;
 import com.persagy.proxy.adm.service.IRelationReportService;
 import com.persagy.proxy.adm.strategy.relationdata.RelationObjectStrategy;
 
@@ -336,46 +328,6 @@ public class RelationReportService implements IRelationReportService {
 	}
 	
 	@Override
-	public List<EquipmentExcel> findEquipByNotSpace(String groupCode, String projectId) {
-		groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
-		// 1.获取所有的设备对象数据
-		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
-		QueryCriteria objectCriteria = new QueryCriteria();
-		ObjectNode object = objectMapper.createObjectNode();
-		object.put("objType", AdmObjectType.EQUIPMENT.getIndex());
-		objectCriteria.setCriteria(object);
-		List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, objectCriteria);
-		if (CollectionUtil.isEmpty(equipList)) {
-			return Lists.newArrayList();
-		}
-		
-		// 2.获取所有的设备类定义的className
-		List<ObjectTypeDefine> classList = DigitalDefineFacade.queryObjectType(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, objectCriteria);
-		// key-classCode, value-className
-		Map<String, String> classDefine = new HashMap<String, String>();
-		if (CollectionUtil.isNotEmpty(classList)) {
-			for (ObjectTypeDefine objectTypeDefine : classList) {
-				classDefine.put(objectTypeDefine.getCode(), objectTypeDefine.getName());
-			}
-		}
-		
-		// 3.查询出所有的边类型为 Eq2Sp 的关系数据
-		QueryCriteria relationCriteria = new QueryCriteria();
-		ObjectNode relation = objectMapper.createObjectNode();
-		relation.put("relCode", RelCodeEnum.Eq2Sp.name());
-		relationCriteria.setCriteria(relation);
-		List<ObjectRelation> relationList = DigitalRelationFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, relationCriteria);
-		Set<String> equipIds = new HashSet<String>();
-		if (CollectionUtil.isNotEmpty(relationList)) {
-			for (ObjectRelation relationInfo : relationList) {
-				equipIds.add(relationInfo.getObjFrom());
-			}
-		}
-		
-		return this.exportEquipmentExcel(equipList, classDefine, equipIds, groupCode, projectId);
-	}
-	
-	@Override
 	public boolean createRelationProjectCal(String groupCode, String projectId) throws JsonProcessingException {
 		groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
 		// 1.验证是否已经添加过
@@ -418,6 +370,7 @@ public class RelationReportService implements IRelationReportService {
 				AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, nodes);
 		return CollectionUtil.isNotEmpty(result);
 	}
+	
 	/***
 	 * Description: 创建存储的对象
 	 * @param groupCode : 集团编码
@@ -453,10 +406,6 @@ public class RelationReportService implements IRelationReportService {
 		return objectNode;
 	}
 
-	/**
-	 * 查询关系总览(空表,先插入)
-	 * @param content: 模糊查询卡片名称关键字
-	 */
 	@Override
 	public JSONObject overview(String content) throws JsonProcessingException {
 		JSONObject result = new JSONObject();
@@ -679,78 +628,4 @@ public class RelationReportService implements IRelationReportService {
 		return result;
 	}
 
-	/**
-	 * 构造 excel 设备数据
-	 * 
-	 * @param equipList 设备数据集合
-	 * @param classDefine 类定义信息
-	 * @param equipIds 需要剔除的设备ID集合
-	 * @param groupCode 
-	 * @param projectId 
-	 * @return
-	 */
-	private List<EquipmentExcel> exportEquipmentExcel(List<ObjectNode> equipList, Map<String, String> classDefine, Set<String> equipIds, String groupCode, String projectId) {
-		// key: 设备ID,value: 建筑名称
-		Map<String, String> buildTemp = new HashMap<String, String>();
-		// key: 设备ID,value: 楼层名称
-		Map<String, String> floorTemp = new HashMap<String, String>();
-		
-		// 建筑名称		
-		RequestData requestData = new RequestData();
-		requestData.setGraphCode(GraphCodeEnum.MechInArch.name());
-		requestData.setRelCode(RelCodeEnum.Eq2Bd.name());
-		requestData.setPage(1L);
-		requestData.setSize(10000000L);
-		List<ObjectDigital> buildDigitals = DigitalObjectFacade.queryObjectListByGraphCodeAndRelCode(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, requestData);
-		if (CollectionUtil.isNotEmpty(buildDigitals)) {
-			for (ObjectDigital master : buildDigitals) {
-				List<ObjectDigital> slaveDigitals = master.getRelObjs();
-				ObjectDigital slave = CollectionUtil.isEmpty(slaveDigitals) ? null : slaveDigitals.get(0);
-				if (slave != null) {
-					buildTemp.put(master.getId(), slave.getLocalName());
-				}
-			}
-		}
-		// 楼层名称
-		requestData.setRelCode(RelCodeEnum.Eq2Fl.name());
-		List<ObjectDigital> floorDigitals = DigitalObjectFacade.queryObjectListByGraphCodeAndRelCode(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, requestData);
-		if (CollectionUtil.isNotEmpty(floorDigitals)) {
-			for (ObjectDigital master : floorDigitals) {
-				List<ObjectDigital> slaveDigitals = master.getRelObjs();
-				ObjectDigital slave = CollectionUtil.isEmpty(slaveDigitals) ? null : slaveDigitals.get(0);
-				if (slave != null) {
-					floorTemp.put(master.getId(), slave.getLocalName());
-				}
-			}
-		}
-		
-		// 结果封装
-		List<EquipmentExcel> excelList = new ArrayList<EquipmentExcel>();
-		for (ObjectNode equip : equipList) {
-			String id = equip.get("id") == null ? null : equip.get("id").asText();
-			if (id != null && !equipIds.contains(id)) {
-				EquipmentExcel excel = new EquipmentExcel();
-				excel.setId(id);
-				excel.setName(equip.get("name") == null ? null : equip.get("name").asText());
-				excel.setLocalId(equip.get("localId") == null ? null : equip.get("localId").asText());
-				excel.setLocalName(equip.get("localName") == null ? null : equip.get("localName").asText());
-				
-				String infos = equip.get("infos") == null ? null : equip.get("infos").asText();
-				if (StrUtil.isNotBlank(infos)) {
-					JSONObject parseObject = JSONObject.parseObject(infos);
-					excel.setBimId(parseObject.getString("bimId"));
-				}
-				
-				String classCode = equip.get("classCode") == null ? null : equip.get("classCode").asText();
-				excel.setClassCodeName(classCode == null ? null : classDefine.get(classCode));
-				
-				excel.setBuildName(buildTemp.get(id));
-				excel.setFloorName(floorTemp.get(id));
-				excel.setModelFileName("T1F10模型文件v18.rvt");	// 这里写死是不对的,需要后续再补充改变
-				excelList.add(excel);
-			}
-		}
-		return excelList;
-	}
-	
 }

+ 12 - 51
src/main/java/com/persagy/proxy/adm/strategy/RelationObjectContext.java

@@ -12,8 +12,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.Lists;
 import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.digital.entity.ObjectDigital;
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
-import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.model.AdmRelationObject;
 import com.persagy.proxy.adm.strategy.relationdata.RelationObjectStrategy;
 
@@ -46,16 +44,11 @@ public class RelationObjectContext {
 	 * 
 	 * @param groupCode
 	 * @param projectId
-	 * @param relType
+	 * @param relType graphCode_relCode
 	 * @return
 	 */
 	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId, String relType) {
-		AdmRelationTypeEnum relationTypeEnum = AdmCommonConstant.RELATION_TYPE_MAP.get(relType);
-		if (relationTypeEnum == null) {
-			return Lists.newArrayList();
-		}
-		String className = relationTypeEnum.getGraphCode() + AdmCommonConstant.UNDERLINE + relationTypeEnum.getRelCode();
-		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(className);
+		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
 		return strategy == null ? Lists.newArrayList() : strategy.findRelationObject(groupCode, projectId);
 	}
 	
@@ -63,22 +56,13 @@ public class RelationObjectContext {
 	 * 检查关联对象的合法性
 	 * 
 	 * @param relationObject 当前需要校验的对象
-	 * @param relType ADM-类型
+	 * @param relType graphCode_relCode
 	 * @param code 获取对象的依据
 	 * @return String - 校验失败的原因, ObjectNode -- BDTP接口的参数,不会返回null,请用instanceOf 判断返回值
 	 */
 	public Object checkRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String relType, String code) {
-		AdmRelationTypeEnum relationTypeEnum = AdmCommonConstant.RELATION_TYPE_MAP.get(relType);
-		if (relationTypeEnum == null) {
-			return "未知类型";
-		}
-		String className = relationTypeEnum.getGraphCode() + AdmCommonConstant.UNDERLINE + relationTypeEnum.getRelCode();
-		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(className);
-		if (strategy == null) {
-			return "不存在此策略类";
-		}
-		
-		return strategy.beforeSaveRelationObject(relationObject, groupCode, projectId, code);
+		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
+		return strategy == null ? "不存在此策略类" : strategy.beforeSaveRelationObject(relationObject, groupCode, projectId, code);
 	}
 	
 	/**
@@ -87,21 +71,12 @@ public class RelationObjectContext {
 	 * @param admRelationObject
 	 * @param groupCode
 	 * @param projectId
-	 * @param relType ADM-传过来的边类型
+	 * @param relType graphCode_relCode
 	 * @return 
 	 */
 	public boolean saveRelationObjects(List<ObjectNode> relationObjects, String groupCode, String projectId, String relType) {
-		AdmRelationTypeEnum relationTypeEnum = AdmCommonConstant.RELATION_TYPE_MAP.get(relType);
-		if (relationTypeEnum == null) {
-			return false;
-		}
-		String className = relationTypeEnum.getGraphCode() + AdmCommonConstant.UNDERLINE + relationTypeEnum.getRelCode();
-		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(className);
-		if (strategy == null) {
-			return false;
-		}
-		
-		return strategy.saveRelationObjects(relationObjects, groupCode, projectId);
+		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
+		return strategy == null ? false : strategy.saveRelationObjects(relationObjects, groupCode, projectId);
 	}
 
 	/**
@@ -109,21 +84,12 @@ public class RelationObjectContext {
 	 * 
 	 * @param groupCode
 	 * @param projectId
-	 * @param relType ADM-传过来的边类型
+	 * @param relType graphCode_relCode
 	 * @return 
 	 */
 	public long countRelationObjects(String groupCode, String projectId, String relType) {
-		AdmRelationTypeEnum relationTypeEnum = AdmCommonConstant.RELATION_TYPE_MAP.get(relType);
-		if (relationTypeEnum == null) {
-			return 0;
-		}
-		String className = relationTypeEnum.getGraphCode() + AdmCommonConstant.UNDERLINE + relationTypeEnum.getRelCode();
-		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(className);
-		if (strategy == null) {
-			return 0;
-		}
-		
-		return strategy.countRelationObjects(groupCode, projectId);
+		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
+		return strategy == null ? 0 : strategy.countRelationObjects(groupCode, projectId);
 	}
 	
 	/**
@@ -133,15 +99,10 @@ public class RelationObjectContext {
 	 * @param requestData 请求参数
 	 * @param groupCode 集团编码
 	 * @param projectId 项目ID
-	 * @param relType  graphCode_relCode;
+	 * @param relType  graphCode_relCode
 	 */
 	public List<ObjectDigital> queryPageObjectInfo(RequestData requestData, String groupCode, String projectId, String relType) {
 		List<ObjectDigital> masterObjs = new ArrayList<ObjectDigital>();
-		/*AdmRelationTypeEnum relationTypeEnum = AdmCommonConstant.RELATION_TYPE_MAP.get(relType);
-		if (relationTypeEnum == null) {
-			return masterObjs;
-		}
-		String className = relationTypeEnum.getGraphCode() + AdmCommonConstant.UNDERLINE + relationTypeEnum.getRelCode();*/
 		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
 		if (strategy == null) {
 			return masterObjs;

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/ArchForArchSh2BdRelationObject.java

@@ -52,7 +52,7 @@ public class ArchForArchSh2BdRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.ArchForArch.name());
 		requestData.setRelCode(RelCodeEnum.Sh2Bd.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/ArchForArchSh2FlRelationObject.java

@@ -52,7 +52,7 @@ public class ArchForArchSh2FlRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.ArchForArch.name());
 		requestData.setRelCode(RelCodeEnum.Sh2Fl.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/ArchForArchSh2ShRelationObject.java

@@ -52,7 +52,7 @@ public class ArchForArchSh2ShRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.ArchForArch.name());
 		requestData.setRelCode(RelCodeEnum.Sh2Sh.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/ArchForArchSh2SpRelationObject.java

@@ -54,7 +54,7 @@ public class ArchForArchSh2SpRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.ArchForArch.name());
 		requestData.setRelCode(RelCodeEnum.Sh2Sp.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/ArchForArchSp2BdRelationObject.java

@@ -54,7 +54,7 @@ public class ArchForArchSp2BdRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.ArchForArch.name());
 		requestData.setRelCode(RelCodeEnum.Sp2Bd.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/ArchForArchSp2FlRelationObject.java

@@ -54,7 +54,7 @@ public class ArchForArchSp2FlRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.ArchForArch.name());
 		requestData.setRelCode(RelCodeEnum.Sp2Fl.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchEq2BdRelationObject.java

@@ -54,7 +54,7 @@ public class MechForArchEq2BdRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(AdmRelationTypeEnum.EQ2BD_FOR.getGraphCode());
 		requestData.setRelCode(AdmRelationTypeEnum.EQ2BD_FOR.getRelCode());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchEq2FlRelationObject.java

@@ -54,7 +54,7 @@ public class MechForArchEq2FlRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.MechForArch.name());
 		requestData.setRelCode(RelCodeEnum.Eq2Fl.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchEq2ShRelationObject.java

@@ -54,7 +54,7 @@ public class MechForArchEq2ShRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.MechForArch.name());
 		requestData.setRelCode(RelCodeEnum.Eq2Sh.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchSy2BdRelationObject.java

@@ -52,7 +52,7 @@ public class MechForArchSy2BdRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.MechForArch.name());
 		requestData.setRelCode(RelCodeEnum.Sy2Bd.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchSy2FlRelationObject.java

@@ -52,7 +52,7 @@ public class MechForArchSy2FlRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.MechForArch.name());
 		requestData.setRelCode(RelCodeEnum.Sy2Fl.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchSy2ShRelationObject.java

@@ -52,7 +52,7 @@ public class MechForArchSy2ShRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.MechForArch.name());
 		requestData.setRelCode(RelCodeEnum.Sy2Sh.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechForArchSy2SpRelationObject.java

@@ -54,7 +54,7 @@ public class MechForArchSy2SpRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.MechForArch.name());
 		requestData.setRelCode(RelCodeEnum.Sy2Sp.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechInArchEq2BdRelationObject.java

@@ -52,7 +52,7 @@ public class MechInArchEq2BdRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.MechInArch.name());
 		requestData.setRelCode(RelCodeEnum.Eq2Bd.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechInArchEq2FlRelationObject.java

@@ -52,7 +52,7 @@ public class MechInArchEq2FlRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.MechInArch.name());
 		requestData.setRelCode(RelCodeEnum.Eq2Fl.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}

+ 1 - 1
src/main/java/com/persagy/proxy/adm/strategy/relationdata/MechInArchEq2SpRelationObject.java

@@ -52,7 +52,7 @@ public class MechInArchEq2SpRelationObject extends AbstractReportRelationObject
 		requestData.setGraphCode(GraphCodeEnum.MechInArch.name());
 		requestData.setRelCode(RelCodeEnum.Eq2Sp.name());
 		requestData.setPage(1L);
-		requestData.setSize(1000L);
+		requestData.setSize(500L);
 		
 		return this.queryAllObjectInfo(requestData, groupCode, projectId);
 	}