浏览代码

报表下载初构造

zhangqiankun 3 年之前
父节点
当前提交
c6b76763fc
共有 25 个文件被更改,包括 705 次插入172 次删除
  1. 68 0
      src/main/java/com/persagy/proxy/adm/constant/ObjTypeMapping.java
  2. 51 4
      src/main/java/com/persagy/proxy/adm/controller/ReportDownloadController.java
  3. 136 0
      src/main/java/com/persagy/proxy/adm/handler/RelationImportExcelDataHandler.java
  4. 13 1
      src/main/java/com/persagy/proxy/adm/model/AdmRelationObject.java
  5. 14 1
      src/main/java/com/persagy/proxy/adm/service/IReportDownloadService.java
  6. 24 3
      src/main/java/com/persagy/proxy/adm/service/impl/ReportDownloadService.java
  7. 40 1
      src/main/java/com/persagy/proxy/adm/strategy/QueryRelationObjectContext.java
  8. 102 34
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/AbstractQueryRelationObject.java
  9. 14 8
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2BdForRelationObject.java
  10. 14 8
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2BdRelationObject.java
  11. 14 8
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2FlForRelationObject.java
  12. 13 7
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2FlRelationObject.java
  13. 15 9
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2ShForRelationObject.java
  14. 13 7
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2SpRelationObject.java
  15. 37 3
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/QueryRelationObjectStrategy.java
  16. 13 7
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2BdForRelationObject.java
  17. 14 8
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2FlForRelationObject.java
  18. 12 7
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2ShForRelationObject.java
  19. 15 9
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2SpForRelationObject.java
  20. 14 8
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sp2BdForRelationObject.java
  21. 14 8
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sp2FlForRelationObject.java
  22. 13 7
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2BdForRelationObject.java
  23. 14 8
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2FlForRelationObject.java
  24. 13 7
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2ShForRelationObject.java
  25. 15 9
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2SpForRelationObject.java

+ 68 - 0
src/main/java/com/persagy/proxy/adm/constant/ObjTypeMapping.java

@@ -0,0 +1,68 @@
+package com.persagy.proxy.adm.constant;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import cn.hutool.core.util.StrUtil;
+
+/**
+ * 对象类型的前缀与全名的来回映射,以及根据边类型获取对应的对象类型前缀
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年9月3日 下午9:16:10
+ */
+public class ObjTypeMapping {
+
+	/** example: Sp -> space */
+	public static final Map<String, String> PREFIX_FULLNAME = new HashMap<String, String>();
+	
+	/** example: space -> Sp */
+	public static final Map<String, String> FULLNAME_PREFIX = new HashMap<String, String>();
+	
+	static {
+	    
+		PREFIX_FULLNAME.put("Pj", "project");
+		PREFIX_FULLNAME.put("Bd", "building");
+		PREFIX_FULLNAME.put("Fl", "floor");
+		PREFIX_FULLNAME.put("Sp", "space");
+		PREFIX_FULLNAME.put("Sy", "system");
+		PREFIX_FULLNAME.put("Eq", "equipment");
+		PREFIX_FULLNAME.put("Sh", "shaft");
+		PREFIX_FULLNAME.put("Ec", "component");
+		PREFIX_FULLNAME.put("Pe", "property");
+		
+		FULLNAME_PREFIX.put("project", "Pj");
+		FULLNAME_PREFIX.put("building", "Bd");
+		FULLNAME_PREFIX.put("floor", "Fl");
+		FULLNAME_PREFIX.put("space", "Sp");
+		FULLNAME_PREFIX.put("system", "Sy");
+		FULLNAME_PREFIX.put("equipment", "Eq");
+		FULLNAME_PREFIX.put("shaft", "Sh");
+		FULLNAME_PREFIX.put("component", "Ec");
+		FULLNAME_PREFIX.put("property", "Pe");
+		
+	}
+	
+	/**
+	 * 获取中台中,边类型编码的前两位
+	 * 
+	 * @param relCode 最低2位,不然抛异常
+	 * @return 空字符串或者对应前缀
+	 */
+	public static String getRelCodePrefix(String relCode) {
+		return StrUtil.isBlank(relCode) ? AdmCommonConstant.EMPTY : relCode.substring(0, 2);
+	}
+	
+	/**
+	 * 获取中台中对象类型的前两位
+	 * 
+	 * @param objType 最低5位,不然抛异常
+	 * @return 空字符串或者对应后缀
+	 */
+	public static String getRelCodeSuffix(String relCode) {
+		return StrUtil.isBlank(relCode) ? AdmCommonConstant.EMPTY : relCode.substring(3, 5);
+	}
+	
+}

+ 51 - 4
src/main/java/com/persagy/proxy/adm/controller/ReportDownloadController.java

@@ -14,12 +14,16 @@ 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 org.springframework.web.multipart.MultipartFile;
 
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.ExcelWriter;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.handler.RelationImportExcelDataHandler;
 import com.persagy.proxy.adm.model.AdmRelationObject;
-import com.persagy.proxy.adm.service.IReportDownloadService;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IRelationReportService;
+import com.persagy.proxy.adm.strategy.QueryRelationObjectContext;
 
 import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -34,12 +38,15 @@ import lombok.extern.slf4j.Slf4j;
  */
 @Slf4j
 @RestController
-public class ReportDownloadController {
+public class RelationReportController {
 
 	public static final String EXPORT_SHEET_NAME = "关系维护";
 	
 	@Autowired
-	private IReportDownloadService reportDownloadService;
+	private IRelationReportService relationReportService;
+	
+	@Autowired
+	private QueryRelationObjectContext queryRelationObjectContext;
 	
 	/**
 	 * 下载报告-设备静态信息维护模板
@@ -207,7 +214,7 @@ public class ReportDownloadController {
 			response.setCharacterEncoding(encode);
 			response.setHeader("Content-disposition", "attachment;filename=relation-template.xlsx");
 			
-			List<AdmRelationObject> relationObjects = this.reportDownloadService.reportRelationObject(groupCode, projectId, relType, code, zoneType);
+			List<AdmRelationObject> relationObjects = this.relationReportService.reportRelationObject(groupCode, projectId, relType, code, zoneType);
 			
 			File templateFile = this.getTemplateFile("relation-template.xlsx");
 			EasyExcel.write(response.getOutputStream()).withTemplate(templateFile).sheet(EXPORT_SHEET_NAME).needHead(false).doWrite(relationObjects);
@@ -220,6 +227,46 @@ public class ReportDownloadController {
 		}
 	}
 	
+	
+	/************************************************** 文件上传 ***********************************************/
+	
+	/**
+	 * 文件导入
+	 * 
+	 * @param relType
+	 * @param code
+	 * @param zoneType
+	 * @param request
+	 * @param response
+	 */
+	@RequestMapping("/graphic/import")
+	public AdmResponse importFile(@RequestParam("file") MultipartFile file, @RequestParam String relType, @RequestParam(required = false) String zoneType, 
+			HttpServletRequest request, HttpServletResponse response) {
+		String failure = null;
+		try {
+			if (file == null) {
+				return AdmResponse.failure("未选择文件");
+			}
+			String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
+			String projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
+			
+			RelationImportExcelDataHandler excelDataHandler = new RelationImportExcelDataHandler(groupCode, projectId, relType, queryRelationObjectContext);
+			
+        	EasyExcel.read(file.getInputStream(), AdmRelationObject.class, excelDataHandler).sheet(EXPORT_SHEET_NAME).doRead();
+        	return AdmResponse.success();
+		} catch (Exception e) {
+			log.error("文件导入失败", e);
+			failure = e.getMessage();
+		}
+		return AdmResponse.failure(failure);
+	}
+	
+	
+	
+	
+	/************************************************** 本地文件获取 ***********************************************/
+	
+	
 	/**
 	 * 获取对应的文件,或者默认文件
 	 * 不同路径,防止镜像部署时获取不到

+ 136 - 0
src/main/java/com/persagy/proxy/adm/handler/RelationImportExcelDataHandler.java

@@ -0,0 +1,136 @@
+package com.persagy.proxy.adm.handler;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.alibaba.excel.metadata.CellData;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.proxy.adm.model.AdmRelationObject;
+import com.persagy.proxy.adm.strategy.QueryRelationObjectContext;
+
+import cn.hutool.core.collection.CollectionUtil;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 传感器数据导入, 此类不能被spring管理,要每次读取excel都要new
+ * 
+ * @version v1.0.0
+ * @company persagy
+ * @author zhangqiankun
+ * @date 2020-11-25 19:52:37
+ */
+@Slf4j
+@SuppressWarnings("unchecked")
+public class RelationImportExcelDataHandler extends AnalysisEventListener<AdmRelationObject> {
+	
+	private final String groupCode;
+	
+	private final String projectId;
+	
+	private final String relType;
+	
+	private String code;
+	
+	private final ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+	
+	private final QueryRelationObjectContext queryRelationObjectContext;
+	
+	/** 失败信息描述*/
+	private Map<Integer, String> failureMap = new HashMap<Integer, String>(256);
+	
+	private String graphId;		// 图类型ID
+	
+	private int failureNum = 0;
+	
+	private int successNum = 0;
+	
+
+	/**
+	 * 上传的数据
+	 */
+	private List<ObjectNode> relationObjects = new ArrayList<ObjectNode>();
+	
+	public RelationImportExcelDataHandler(String groupCode, String projectId, String relType, QueryRelationObjectContext queryRelationObjectContext) {
+		this.relType = relType;
+		this.groupCode = groupCode;
+		this.projectId = projectId;
+		this.queryRelationObjectContext = queryRelationObjectContext;
+	}
+	
+	/**
+	 * 每一条数据解析都会来调用
+	 * 
+	 * @param data one row value {@link AnalysisContext#readRowHolder()}
+	 * @param context
+	 */
+	@Override
+	public void invoke(AdmRelationObject data, AnalysisContext context) {
+		// 数据不可为空校验
+		int rowIndex = context.readRowHolder().getRowIndex();
+		if (rowIndex == 2 && code == null) {
+			CellData<String> cell = (CellData<String>)context.readRowHolder().getCellMap().get(1);
+			code = cell.getStringValue();
+		}
+		// 数据校验
+		ObjectNode objectNode = this.objectMapper.createObjectNode();
+		String checkResult = this.queryRelationObjectContext.checkRelationObject(objectNode, data, groupCode, projectId, relType, code);
+		if (checkResult != null) {
+			this.failureMap.put(rowIndex, checkResult);
+			return;
+		}
+		this.graphId = objectNode.get("graphId") == null ? graphId : objectNode.get("graphId").asText();
+		
+		// 批量插入
+		relationObjects.add(objectNode);
+		if (relationObjects.size() >= 1000) {
+			boolean saveRelationObjects = this.queryRelationObjectContext.saveRelationObjects(relationObjects, groupCode, projectId, relType);
+			if (saveRelationObjects) {
+				successNum += relationObjects.size();
+			} else {
+				failureNum += relationObjects.size();
+			}
+			relationObjects.clear();
+		}
+	}
+
+	/**
+	 * 所有数据解析完成了都会来调用,在这里进行数据存储,可确保最后遗留的数据也被存储到数据库
+	 * 
+	 * @param context
+	 */
+	@Override
+	public void doAfterAllAnalysed(AnalysisContext context) {
+		if (CollectionUtil.isNotEmpty(relationObjects)) {
+			boolean saveRelationObjects = this.queryRelationObjectContext.saveRelationObjects(relationObjects, groupCode, projectId, relType);
+			if (saveRelationObjects) {
+				successNum += relationObjects.size();
+			} else {
+				failureNum += relationObjects.size();
+			}
+			relationObjects.clear();
+		}
+		log.info("集团: {},项目: {},类型:{},关系数据导入成功,", groupCode, projectId, relType);
+	}
+
+	/**
+	 * 数据写入完成后,可以通过此方法获取部分信息
+	 * 
+	 * @return
+	 */
+	public JSONObject afterWriteObject() {
+		JSONObject result = new JSONObject();
+		result.put("relationType", graphId);
+		result.put("successCount", successNum);
+		result.put("failCount", failureNum);
+		result.put("state", graphId);
+		return result;
+	}
+	
+}

+ 13 - 1
src/main/java/com/persagy/proxy/adm/model/AdmRelationObject.java

@@ -77,8 +77,20 @@ public class AdmRelationObject {
 	
 	@ExcelIgnore
 	private String slaveBuildingName;	// 建筑本地名称
-
+	
 	@ExcelIgnore
 	private String slaveFloorName;		// 楼层本地名称
 	
+	@ExcelIgnore
+	private String graphId;				// 图类型ID
+	
+	@ExcelIgnore
+	private String graphCode;			// 图类型编码
+	
+	@ExcelIgnore
+	private String relCode;				// 边类型编码
+	
+	@ExcelIgnore
+	private String relVaue;				// 关系值
+
 }

+ 14 - 1
src/main/java/com/persagy/proxy/adm/service/IReportDownloadService.java

@@ -14,7 +14,7 @@ import com.persagy.proxy.adm.model.AdmRelationObject;
  * @author zhangqiankun
  * @date 2021年8月31日 下午4:42:51
  */
-public interface IReportDownloadService {
+public interface IRelationReportService {
 
 	/**
 	 * 获取指定对象信息
@@ -27,6 +27,19 @@ public interface IReportDownloadService {
 	ObjectNode getObjectNode(String groupCode, String projectId, String id);
 	
 	/**
+	 * 获取指定对象信息
+	 * <p>定制接口,不建议兼容额外的处理方案</p>
+	 * 
+	 * @param groupCode
+	 * @param projectId
+	 * @param objType
+	 * @param code	ADM-中的code类型,请参考{@link com.persagy.proxy.adm.strategy.relationdata.QueryRelationObjectStrategy#OBJNAME_2_TYPE}
+	 * @param value 属性值
+	 * @return
+	 */
+	List<ObjectNode> findObjectNodes(String groupCode, String projectId, String objType, String code, String value);
+	
+	/**
 	 * 获取对象,通过关系对象的id和rel_code
 	 * 
 	 * @param groupCode

+ 24 - 3
src/main/java/com/persagy/proxy/adm/service/impl/ReportDownloadService.java

@@ -16,8 +16,9 @@ import com.persagy.dmp.digital.client.DigitalRelationFacade;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.AdmRelationObject;
-import com.persagy.proxy.adm.service.IReportDownloadService;
+import com.persagy.proxy.adm.service.IRelationReportService;
 import com.persagy.proxy.adm.strategy.QueryRelationObjectContext;
+import com.persagy.proxy.adm.strategy.relationdata.QueryRelationObjectStrategy;
 
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
@@ -33,7 +34,7 @@ import lombok.extern.slf4j.Slf4j;
  */
 @Slf4j
 @Service
-public class ReportDownloadService implements IReportDownloadService {
+public class RelationReportService implements IRelationReportService {
 
 	public static final String cADID = "cADID";
 	
@@ -58,6 +59,26 @@ public class ReportDownloadService implements IReportDownloadService {
 	}
 	
 	@Override
+	public List<ObjectNode> findObjectNodes(String groupCode, String projectId, String objType, String code, String value) {
+		if (StrUtil.isBlank(code)) {
+			return null;
+		}
+		String key = QueryRelationObjectStrategy.OBJNAME_2_TYPE.get(code);
+		if (StrUtil.isBlank(key)) {
+			return null;
+		}
+		
+		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode objectNode = objectMapper.createObjectNode();
+		objectNode.put(key, value);
+		objectNode.put("objType", objType);
+		queryCriteria.setCriteria(objectNode);
+		List<ObjectNode> objectNodes = DigitalObjectFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
+		return objectNodes;
+	}
+	
+	@Override
 	public ObjectNode getObjectByCodeAndId(String groupCode, String projectId, String graphCode, String relCode, String objFrom, String objTo) {
 		groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
 		
@@ -105,5 +126,5 @@ public class ReportDownloadService implements IReportDownloadService {
 		log.info("下载报表: groupCode[{}], projectId[{}], relType[{}], code[{}]", groupCode, projectId, relType, code);
 		return this.queryRelationObjectContext.findRelationObject(groupCode, projectId, relType);
 	}
-	
+
 }

+ 40 - 1
src/main/java/com/persagy/proxy/adm/strategy/QueryRelationObjectContext.java

@@ -7,10 +7,13 @@ import javax.annotation.Resource;
 
 import org.springframework.stereotype.Component;
 
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.Lists;
 import com.persagy.proxy.adm.model.AdmRelationObject;
 import com.persagy.proxy.adm.strategy.relationdata.QueryRelationObjectStrategy;
 
+import cn.hutool.core.util.StrUtil;
+
 /**
  * 获取关系对象的上下文类
  * 
@@ -47,7 +50,43 @@ public class QueryRelationObjectContext {
 	 */
 	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);
+		return strategy == null ? Lists.newArrayList() : strategy.findRelationObject(groupCode, projectId);
+	}
+	
+	/**
+	 * 检查关联对象的合法性
+	 * 
+	 * @param relationObject 当前需要校验的对象
+	 * @param relType ADM-类型
+	 * @param code 获取对象的依据
+	 * @return null - 检验通过,not null - 校验不通过,并返回原因
+	 */
+	public String checkRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode, String projectId, String relType, String code) {
+		QueryRelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
+		if (strategy == null) {
+			return "不存在此策略类";
+		}
+		
+		String result = strategy.beforeSaveRelationObject(objectNode, relationObject, groupCode, projectId, code);
+		return StrUtil.isBlank(result) ? null : result;
 	}
 	
+	/**
+	 * 批量保存对象之间的关系
+	 * 
+	 * @param admRelationObject
+	 * @param groupCode
+	 * @param projectId
+	 * @param relType ADM-传过来的边类型
+	 * @return 
+	 */
+	public boolean saveRelationObjects(List<ObjectNode> relationObjects, String groupCode, String projectId, String relType) {
+		QueryRelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
+		if (strategy == null) {
+			return false;
+		}
+		
+		return strategy.saveRelationObjects(relationObjects, groupCode, projectId);
+	}
+
 }

+ 102 - 34
src/main/java/com/persagy/proxy/adm/strategy/relationdata/AbstractQueryRelationObject.java

@@ -8,11 +8,16 @@ 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.dmp.digital.client.DigitalRelationFacade;
+import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.ObjTypeMapping;
 import com.persagy.proxy.adm.model.AdmRelationObject;
-import com.persagy.proxy.adm.service.IReportDownloadService;
+import com.persagy.proxy.adm.service.IRelationReportService;
 
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.StrUtil;
 
 /**
  * 
@@ -23,47 +28,27 @@ import cn.hutool.core.collection.CollectionUtil;
  */
 public abstract class AbstractQueryRelationObject implements QueryRelationObjectStrategy {
 
-	protected String groupCode;
+	protected IRelationReportService relationReportService;
 	
-	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);
+	public AbstractQueryRelationObject(IRelationReportService reportDownloadService) {
+		this.relationReportService = reportDownloadService;
 	}
 	
 	/**
-	 * 查询出指定设备信息
-	 * 
-	 * @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) {
+	protected List<AdmRelationObject> queryAllObjectInfo(QueryCriteria queryCriteria, String groupCode, String projectId) {
 		List<ObjectNode> tempList = new ArrayList<ObjectNode>();
 		
 		// 获取数据
-		this.queryPageObjectInfo(tempList, queryCriteria, queryCriteria.getPage());
+		this.queryPageObjectInfo(tempList, queryCriteria, groupCode, projectId, queryCriteria.getPage());
 		
 		// 转换中台数据
-		return this.handleObjectDigital(tempList, relType);
+		return this.handleObjectDigital(tempList, groupCode, projectId);
 	}
 	
 	/**
@@ -76,14 +61,14 @@ public abstract class AbstractQueryRelationObject implements QueryRelationObject
 	 * @param page
 	 * @param pageSize
 	 */
-	protected void queryPageObjectInfo(List<ObjectNode> tempList, QueryCriteria queryCriteria, Long page) {
+	protected void queryPageObjectInfo(List<ObjectNode> tempList, QueryCriteria queryCriteria, String groupCode, String projectId, 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);
+		this.queryPageObjectInfo(tempList, queryCriteria, groupCode, projectId, ++page);
 	}
 	
 	/**
@@ -92,10 +77,9 @@ public abstract class AbstractQueryRelationObject implements QueryRelationObject
 	 * @param tempList
 	 * @param groupCode
 	 * @param projectId
-	 * @param relType
 	 * @return
 	 */
-	private List<AdmRelationObject> handleObjectDigital(List<ObjectNode> tempList, String relType) {
+	private List<AdmRelationObject> handleObjectDigital(List<ObjectNode> tempList, String groupCode, String projectId) {
 		// 第一次遍历
 		// id -> object
 		Map<String, ObjectNode> tempAllMap = new HashMap<String, ObjectNode>(tempList.size());
@@ -104,18 +88,19 @@ public abstract class AbstractQueryRelationObject implements QueryRelationObject
 			tempAllMap.put(id, objectNode);
 		}
 		
-		return this.handleObjectDigital(tempAllMap, relType);
+		return this.handleObjectDigital(tempAllMap, groupCode, projectId);
 	}
 	
 	
 	/**
 	 * 处理中台响应数据,转换为ADM所需要的数据
 	 * 
+	 * @param groupCode
+	 * @param projectId
 	 * @param tempAllMap 对象ID -> 对象
-	 * @param relType
 	 * @return 不允许返回null
 	 */
-	protected abstract List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType);	
+	protected abstract List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId);	
 	
 	/**
 	 * 封装响应数据,具体的传值,请仔细侦查,这里仅返回共有字段,特殊字段,自行赋值
@@ -162,4 +147,87 @@ public abstract class AbstractQueryRelationObject implements QueryRelationObject
 		return relationObject;
 	}
 	
+	
+	@Override
+	public boolean saveRelationObjects(List<ObjectNode> relationObjects, String groupCode, String projectId) {
+		List<ObjectRelation> create = DigitalRelationFacade.create(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, relationObjects);
+		return 	CollectionUtil.isEmpty(create) ? false : true;
+	}
+	
+	/**
+	 * 检查关系对象数据的正确性,并完成额外字段的赋值功能
+	 * 
+	 * @param relationObject
+	 * @param relationTypeEnum AdmRelationTypeEnum枚举类
+	 * @param code
+	 * @return 当为null时,检查通过,否则失败,返回失败原因
+	 */
+	protected String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, AdmRelationTypeEnum relationTypeEnum,
+			String groupCode, String projectId, String code) {
+		if (!StrUtil.isAllNotBlank(relationObject.getMasterCode(), relationObject.getSlaveCode())) {
+			return "主对象和从对象的识别编码为空";
+		}
+		
+		String relCode = relationTypeEnum.getRelCode();
+		String relCodePrefix = ObjTypeMapping.getRelCodePrefix(relCode);
+		String masterObjType = ObjTypeMapping.PREFIX_FULLNAME.get(relCodePrefix);
+		if (StrUtil.isBlank(masterObjType)) {
+			return "边类型错误";
+		}
+		String slaveObjType = ObjTypeMapping.PREFIX_FULLNAME.get(ObjTypeMapping.getRelCodePrefix(relCode));
+		if (StrUtil.isBlank(slaveObjType)) {
+			return "边类型错误";
+		}
+		// 查询出对象信息
+		List<ObjectNode> masters = this.relationReportService.findObjectNodes(groupCode, projectId, masterObjType, code, relationObject.getMasterCode());
+		if (CollectionUtil.isEmpty(masters)) {
+			return "未找到主对象";
+		}
+		if (masters.size() > 1) {
+			return "匹配到多个主对象";
+		}
+		// 查询出从对象
+		List<ObjectNode> slaves = this.relationReportService.findObjectNodes(groupCode, projectId, slaveObjType, code, relationObject.getSlaveCode());
+		if (CollectionUtil.isEmpty(slaves)) {
+			return "未找到从对象";
+		}
+		if (masters.size() > 1) {
+			return "匹配到多个从对象";
+		}
+		
+		// 添加关系数据
+		ObjectNode master = masters.get(0);
+		ObjectNode slave = slaves.get(0);
+		String masterClassCode = master.get("classCode") == null ? AdmCommonConstant.EMPTY : master.get("classCode").asText();
+		String slaveClassCode = slave.get("classCode") == null ? AdmCommonConstant.EMPTY : slave.get("classCode").asText();
+		
+		if (objectNode != null) {
+			String graphCode = relationTypeEnum.getGraphCode();
+			objectNode.put("graphId", "Gt" + graphCode + "001");
+			objectNode.put("graphCode", graphCode);
+			objectNode.put("relCode", relCode);
+			if ("Sp".equals(relCodePrefix)) {
+				relationObject.setRelVaue(masterClassCode);
+			}
+			objectNode.put("objFrom", master.get("id").asText());
+			objectNode.put("objTo", slave.get("id").asText());
+		}
+		
+		return this.checkRelationObject(master, masterClassCode, slave, slaveClassCode);
+	} 
+	
+	/**
+	 * 检查关系对象数据的正确性,并可完成额外字段的赋值功能
+	 * 默认不实现,由子类实现
+	 * 
+	 * @param master
+	 * @param masterClassCode
+	 * @param slave
+	 * @param slaveClassCode
+	 * @return 当为null时,检查通过,否则失败,返回失败原因
+	 */
+	protected String checkRelationObject(ObjectNode master, String masterClassCode, ObjectNode slave, String slaveClassCode) {
+		return null;
+	}
+
 }

+ 14 - 8
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2BdForRelationObject.java

@@ -19,7 +19,7 @@ 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 com.persagy.proxy.adm.service.IRelationReportService;
 
 import cn.hutool.core.util.StrUtil;
 
@@ -33,12 +33,12 @@ import cn.hutool.core.util.StrUtil;
 @Component(value = AdmRelationType.EQ2BD_FOR)
 public class Eq2BdForRelationObject extends AbstractQueryRelationObject {
 
-	public Eq2BdForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Eq2BdForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -52,15 +52,15 @@ public class Eq2BdForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.EQ2BD_FOR.getGraphCode(), AdmRelationTypeEnum.EQ2BD_FOR.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String equipId = objectRelation.getObjFrom();
@@ -72,7 +72,7 @@ public class Eq2BdForRelationObject extends AbstractQueryRelationObject {
 			ObjectNode building = tempAllMap.get(buildingId);
 			
 			// 获取楼层信息
-			ObjectNode floorInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2BD_FOR.getGraphCode(), 
+			ObjectNode floorInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2BD_FOR.getGraphCode(), 
 					RelCodeEnum.Eq2Fl.name(), equipId, null);
 			
 			AdmRelationObject convertObject = this.convertObject(equipment, "设备", building, "建筑");
@@ -94,4 +94,10 @@ public class Eq2BdForRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.EQ2BD_FOR, groupCode, projectId, code);
+	}
+
 }

+ 14 - 8
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2BdRelationObject.java

@@ -19,7 +19,7 @@ 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 com.persagy.proxy.adm.service.IRelationReportService;
 
 /**
  * 
@@ -31,12 +31,12 @@ import com.persagy.proxy.adm.service.IReportDownloadService;
 @Component(value = AdmRelationType.EQ2BD)
 public class Eq2BdRelationObject extends AbstractQueryRelationObject {
 
-	public Eq2BdRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Eq2BdRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -50,15 +50,15 @@ public class Eq2BdRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.EQ2BD.getGraphCode(), AdmRelationTypeEnum.EQ2BD.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String equipId = objectRelation.getObjFrom();
@@ -70,7 +70,7 @@ public class Eq2BdRelationObject extends AbstractQueryRelationObject {
 			ObjectNode building = tempAllMap.get(buildingId);
 			
 			// 获取楼层信息
-			ObjectNode floorInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2BD.getGraphCode(), 
+			ObjectNode floorInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2BD.getGraphCode(), 
 					RelCodeEnum.Eq2Fl.name(), equipId, null);
 			
 			AdmRelationObject convertObject = this.convertObject(equipment, "设备", building, "建筑");
@@ -85,4 +85,10 @@ public class Eq2BdRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.EQ2BD, groupCode, projectId, code);
+	}
+
 }

+ 14 - 8
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2FlForRelationObject.java

@@ -19,7 +19,7 @@ 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 com.persagy.proxy.adm.service.IRelationReportService;
 
 import cn.hutool.core.util.StrUtil;
 
@@ -33,12 +33,12 @@ import cn.hutool.core.util.StrUtil;
 @Component(value = AdmRelationType.EQ2FL_FOR)
 public class Eq2FlForRelationObject extends AbstractQueryRelationObject {
 
-	public Eq2FlForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Eq2FlForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -52,15 +52,15 @@ public class Eq2FlForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.EQ2FL_FOR.getGraphCode(), AdmRelationTypeEnum.EQ2FL_FOR.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String equipId = objectRelation.getObjFrom();
@@ -72,7 +72,7 @@ public class Eq2FlForRelationObject extends AbstractQueryRelationObject {
 			ObjectNode floor = tempAllMap.get(floorId);
 			
 			// 获取建筑信息
-			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2FL_FOR.getGraphCode(), 
+			ObjectNode buildingInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2FL_FOR.getGraphCode(), 
 					RelCodeEnum.Eq2Bd.name(), equipId, null);
 			
 			AdmRelationObject convertObject = this.convertObject(equipment, "设备", floor, "楼层");
@@ -94,5 +94,11 @@ public class Eq2FlForRelationObject extends AbstractQueryRelationObject {
 		
 		return resultList;
 	}
+	
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.EQ2FL_FOR, groupCode, projectId, code);
+	}
 
 }

+ 13 - 7
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2FlRelationObject.java

@@ -18,7 +18,7 @@ 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;
+import com.persagy.proxy.adm.service.IRelationReportService;
 
 /**
  * 
@@ -30,12 +30,12 @@ import com.persagy.proxy.adm.service.IReportDownloadService;
 @Component(value = AdmRelationType.EQ2FL)
 public class Eq2FlRelationObject extends AbstractQueryRelationObject {
 
-	public Eq2FlRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Eq2FlRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -49,15 +49,15 @@ public class Eq2FlRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.EQ2FL.getGraphCode(), AdmRelationTypeEnum.EQ2FL.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String equipId = objectRelation.getObjFrom();
@@ -79,4 +79,10 @@ public class Eq2FlRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.EQ2FL, groupCode, projectId, code);
+	}
+	
 }

+ 15 - 9
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2ShForRelationObject.java

@@ -19,7 +19,7 @@ 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 com.persagy.proxy.adm.service.IRelationReportService;
 
 import cn.hutool.core.util.StrUtil;
 
@@ -33,12 +33,12 @@ import cn.hutool.core.util.StrUtil;
 @Component(value = AdmRelationType.EQ2SH_FOR)
 public class Eq2ShForRelationObject extends AbstractQueryRelationObject {
 
-	public Eq2ShForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Eq2ShForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -52,15 +52,15 @@ public class Eq2ShForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.EQ2SH_FOR.getGraphCode(), AdmRelationTypeEnum.EQ2SH_FOR.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String equipId = objectRelation.getObjFrom();
@@ -72,9 +72,9 @@ public class Eq2ShForRelationObject extends AbstractQueryRelationObject {
 			ObjectNode shaft = tempAllMap.get(shaftId);
 			
 			// 获取楼层信息
-			ObjectNode floorInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2SH_FOR.getGraphCode(), 
+			ObjectNode floorInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2SH_FOR.getGraphCode(), 
 					RelCodeEnum.Eq2Fl.name(), equipId, null);
-			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2SH_FOR.getGraphCode(), 
+			ObjectNode buildingInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.EQ2SH_FOR.getGraphCode(), 
 					RelCodeEnum.Eq2Bd.name(), equipId, null);
 			
 			AdmRelationObject convertObject = this.convertObject(equipment, "设备", shaft, "竖井");
@@ -94,4 +94,10 @@ public class Eq2ShForRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.EQ2SH_FOR, groupCode, projectId, code);
+	}
+	
 }

+ 13 - 7
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Eq2SpRelationObject.java

@@ -17,7 +17,7 @@ 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;
+import com.persagy.proxy.adm.service.IRelationReportService;
 
 /**
  * 此类型需转为 AdmRelationTypeEnum.EQ2SP_IN 进行数据查询
@@ -30,12 +30,12 @@ import com.persagy.proxy.adm.service.IReportDownloadService;
 @Component(value = AdmRelationType.EQ2SP_SENSORRELATIONSHIP_SS2SP)
 public class Eq2SpRelationObject extends AbstractQueryRelationObject {
 
-	public Eq2SpRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Eq2SpRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -49,15 +49,15 @@ public class Eq2SpRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		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());
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, AdmRelationTypeEnum.EQ2SP_IN.getGraphCode(), AdmRelationTypeEnum.EQ2SP_IN.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String equipId = objectRelation.getObjFrom();
 			String spaceId = objectRelation.getObjTo();
@@ -74,4 +74,10 @@ public class Eq2SpRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.EQ2SP_IN, groupCode, projectId, code);
+	}
+	
 }

+ 37 - 3
src/main/java/com/persagy/proxy/adm/strategy/relationdata/QueryRelationObjectStrategy.java

@@ -1,7 +1,10 @@
 package com.persagy.proxy.adm.strategy.relationdata;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.proxy.adm.model.AdmRelationObject;
 
 /**
@@ -17,15 +20,46 @@ public interface QueryRelationObjectStrategy {
 	
 	String OBJ_TYPE = "objType";
 	
+	Map<String, String> OBJNAME_2_TYPE = new HashMap<String,String>(){
+		private static final long serialVersionUID = 1L;
+		{
+            put("对象ID", "id");
+            put("对象名称", "name");
+            put("对象本地编码", "local_id");
+            put("对象本地名称", "local_name");
+            put("设计图纸中编码", "cad_id");
+        }
+    };
+    
 	/**
 	 * 查询出所有的关系信息
-	 * <p>因原代码中,不存在zoneType类型不为空时对应的方法,所以此处不再进行此数据的判断</p>
 	 * 
 	 * @param groupCode 集团编码
 	 * @param projectId 项目ID
-	 * @param relType   边类型--ADM的
 	 * @return 不会返回null
 	 */
-	List<AdmRelationObject> findRelationObject(String groupCode, String projectId, String relType);
+	List<AdmRelationObject> findRelationObject(String groupCode, String projectId);
 	
+	/**
+	 * 保存之前校验数据的合法性
+	 * 
+	 * @param objectNode 校验通过后为其赋予必要的值
+	 * @param relationObject 需要校验的对象
+	 * @param groupCode
+	 * @param projectId
+	 * @param code 参考 OBJNAME_2_TYPE
+	 * @return null - 校验通过,否则-失败原因
+	 */
+	String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode, String projectId, String code);
+
+	/**
+	 * 批量保存对象之间的关系
+	 * 
+	 * @param admRelationObject
+	 * @param groupCode
+	 * @param projectId
+	 * @return 
+	 */
+	boolean saveRelationObjects(List<ObjectNode> relationObjects, String groupCode, String projectId);
+
 }

+ 13 - 7
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2BdForRelationObject.java

@@ -17,7 +17,7 @@ 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;
+import com.persagy.proxy.adm.service.IRelationReportService;
 
 /**
  * 
@@ -29,12 +29,12 @@ import com.persagy.proxy.adm.service.IReportDownloadService;
 @Component(value = AdmRelationType.SH2BD_ARCHFORARCH)
 public class Sh2BdForRelationObject extends AbstractQueryRelationObject {
 
-	public Sh2BdForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Sh2BdForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -48,15 +48,15 @@ public class Sh2BdForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.SH2BD_ARCHFORARCH.getGraphCode(), AdmRelationTypeEnum.SH2BD_ARCHFORARCH.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String equipId = objectRelation.getObjFrom();
@@ -74,4 +74,10 @@ public class Sh2BdForRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.SH2BD_ARCHFORARCH, groupCode, projectId, code);
+	}
+	
 }

+ 14 - 8
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2FlForRelationObject.java

@@ -19,7 +19,7 @@ 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 com.persagy.proxy.adm.service.IRelationReportService;
 
 /**
  * 
@@ -31,12 +31,12 @@ import com.persagy.proxy.adm.service.IReportDownloadService;
 @Component(value = AdmRelationType.SH2FL_ARCHFORARCH)
 public class Sh2FlForRelationObject extends AbstractQueryRelationObject {
 
-	public Sh2FlForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Sh2FlForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -50,15 +50,15 @@ public class Sh2FlForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.SH2FL_ARCHFORARCH.getGraphCode(), AdmRelationTypeEnum.SH2FL_ARCHFORARCH.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String shaftId = objectRelation.getObjFrom();
@@ -69,7 +69,7 @@ public class Sh2FlForRelationObject extends AbstractQueryRelationObject {
 			ObjectNode shaft = tempAllMap.get(shaftId);
 			ObjectNode floor = tempAllMap.get(floorId);
 			// 获取建筑的信息
-			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SH2FL_ARCHFORARCH.getGraphCode(), 
+			ObjectNode buildingInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SH2FL_ARCHFORARCH.getGraphCode(), 
 					RelCodeEnum.Sh2Bd.name(), shaftId, null);
 
 			AdmRelationObject convertObject = this.convertObject(shaft, "竖井", floor, "楼层");
@@ -82,4 +82,10 @@ public class Sh2FlForRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.SH2FL_ARCHFORARCH, groupCode, projectId, code);
+	}
+	
 }

+ 12 - 7
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2ShForRelationObject.java

@@ -17,7 +17,7 @@ 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;
+import com.persagy.proxy.adm.service.IRelationReportService;
 
 /**
  * 
@@ -29,12 +29,12 @@ import com.persagy.proxy.adm.service.IReportDownloadService;
 @Component(value = AdmRelationType.SH2SH_ARCHFORARCH)
 public class Sh2ShForRelationObject extends AbstractQueryRelationObject {
 
-	public Sh2ShForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Sh2ShForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -48,15 +48,15 @@ public class Sh2ShForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.SH2SH_ARCHFORARCH.getGraphCode(), AdmRelationTypeEnum.SH2SH_ARCHFORARCH.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String shaftIdF = objectRelation.getObjFrom();
@@ -74,4 +74,9 @@ public class Sh2ShForRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.SH2SH_ARCHFORARCH, groupCode, projectId, code);
+	}
 }

+ 15 - 9
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sh2SpForRelationObject.java

@@ -19,7 +19,7 @@ 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 com.persagy.proxy.adm.service.IRelationReportService;
 
 import cn.hutool.core.util.StrUtil;
 
@@ -33,12 +33,12 @@ import cn.hutool.core.util.StrUtil;
 @Component(value = AdmRelationType.SH2SP_ARCHFORARCH)
 public class Sh2SpForRelationObject extends AbstractQueryRelationObject {
 
-	public Sh2SpForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Sh2SpForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -52,15 +52,15 @@ public class Sh2SpForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.SH2SP_ARCHFORARCH.getGraphCode(), AdmRelationTypeEnum.SH2SP_ARCHFORARCH.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String shaftId = objectRelation.getObjFrom();
@@ -71,9 +71,9 @@ public class Sh2SpForRelationObject extends AbstractQueryRelationObject {
 			ObjectNode shaft = tempAllMap.get(shaftId);
 			ObjectNode space = tempAllMap.get(spaceId);
 			// 获取建筑的信息
-			ObjectNode floorInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SH2SP_ARCHFORARCH.getGraphCode(), 
+			ObjectNode floorInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SH2SP_ARCHFORARCH.getGraphCode(), 
 					RelCodeEnum.Sh2Fl.name(), shaftId, null);
-			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SH2SP_ARCHFORARCH.getGraphCode(), 
+			ObjectNode buildingInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SH2SP_ARCHFORARCH.getGraphCode(), 
 					RelCodeEnum.Sh2Bd.name(), shaftId, null);
 			
 			AdmRelationObject convertObject = this.convertObject(shaft, "竖井", space, "空间");
@@ -93,5 +93,11 @@ public class Sh2SpForRelationObject extends AbstractQueryRelationObject {
 		
 		return resultList;
 	}
+	
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.SH2SP_ARCHFORARCH, groupCode, projectId, code);
+	}
 
 }

+ 14 - 8
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sp2BdForRelationObject.java

@@ -19,7 +19,7 @@ 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 com.persagy.proxy.adm.service.IRelationReportService;
 
 import cn.hutool.core.util.StrUtil;
 
@@ -33,12 +33,12 @@ import cn.hutool.core.util.StrUtil;
 @Component(value = AdmRelationType.SP2BD_ARCHFORARCH)
 public class Sp2BdForRelationObject extends AbstractQueryRelationObject {
 
-	public Sp2BdForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Sp2BdForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -52,15 +52,15 @@ public class Sp2BdForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.SP2BD_ARCHFORARCH.getGraphCode(), AdmRelationTypeEnum.SP2BD_ARCHFORARCH.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String spaceId = objectRelation.getObjFrom();
@@ -71,7 +71,7 @@ public class Sp2BdForRelationObject extends AbstractQueryRelationObject {
 			ObjectNode space = tempAllMap.get(spaceId);
 			ObjectNode building = tempAllMap.get(buildingId);
 			// 获取楼层的信息
-			ObjectNode floorInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SP2BD_ARCHFORARCH.getGraphCode(), 
+			ObjectNode floorInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SP2BD_ARCHFORARCH.getGraphCode(), 
 					RelCodeEnum.Sp2Fl.name(), spaceId, null);
 			
 			// 这里最后一个参数,写为空间,和ADM保持一致
@@ -92,4 +92,10 @@ public class Sp2BdForRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.SP2BD_ARCHFORARCH, groupCode, projectId, code);
+	}
+	
 }

+ 14 - 8
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sp2FlForRelationObject.java

@@ -19,7 +19,7 @@ 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 com.persagy.proxy.adm.service.IRelationReportService;
 
 import cn.hutool.core.util.StrUtil;
 
@@ -33,12 +33,12 @@ import cn.hutool.core.util.StrUtil;
 @Component(value = AdmRelationType.SP2FL_ARCHFORARCH)
 public class Sp2FlForRelationObject extends AbstractQueryRelationObject {
 
-	public Sp2FlForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Sp2FlForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -52,15 +52,15 @@ public class Sp2FlForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.SP2FL_ARCHFORARCH.getGraphCode(), AdmRelationTypeEnum.SP2FL_ARCHFORARCH.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String spaceId = objectRelation.getObjFrom();
@@ -71,7 +71,7 @@ public class Sp2FlForRelationObject extends AbstractQueryRelationObject {
 			ObjectNode space = tempAllMap.get(spaceId);
 			ObjectNode floor = tempAllMap.get(floorId);
 			// 获取建筑的信息
-			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SP2FL_ARCHFORARCH.getGraphCode(), 
+			ObjectNode buildingInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SP2FL_ARCHFORARCH.getGraphCode(), 
 					RelCodeEnum.Sp2Bd.name(), spaceId, null);
 			
 			AdmRelationObject convertObject = this.convertObject(space, "空间", floor, "楼层");
@@ -94,4 +94,10 @@ public class Sp2FlForRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.SP2FL_ARCHFORARCH, groupCode, projectId, code);
+	}
+	
 }

+ 13 - 7
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2BdForRelationObject.java

@@ -17,7 +17,7 @@ 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;
+import com.persagy.proxy.adm.service.IRelationReportService;
 
 /**
  * 
@@ -29,12 +29,12 @@ import com.persagy.proxy.adm.service.IReportDownloadService;
 @Component(value = AdmRelationType.SY2BD_FOR)
 public class Sy2BdForRelationObject extends AbstractQueryRelationObject {
 
-	public Sy2BdForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Sy2BdForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -48,15 +48,15 @@ public class Sy2BdForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.SY2BD_FOR.getGraphCode(), AdmRelationTypeEnum.SY2BD_FOR.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String systemId = objectRelation.getObjFrom();
@@ -73,5 +73,11 @@ public class Sy2BdForRelationObject extends AbstractQueryRelationObject {
 		
 		return resultList;
 	}
+	
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.SY2BD_FOR, groupCode, projectId, code);
+	}
 
 }

+ 14 - 8
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2FlForRelationObject.java

@@ -19,7 +19,7 @@ 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 com.persagy.proxy.adm.service.IRelationReportService;
 
 /**
  * 
@@ -31,12 +31,12 @@ import com.persagy.proxy.adm.service.IReportDownloadService;
 @Component(value = AdmRelationType.SY2FL_FOR)
 public class Sy2FlForRelationObject extends AbstractQueryRelationObject {
 
-	public Sy2FlForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Sy2FlForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -50,15 +50,15 @@ public class Sy2FlForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.SY2FL_FOR.getGraphCode(), AdmRelationTypeEnum.SY2FL_FOR.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String systemId = objectRelation.getObjFrom();
@@ -70,7 +70,7 @@ public class Sy2FlForRelationObject extends AbstractQueryRelationObject {
 			ObjectNode floor = tempAllMap.get(floorId);
 			
 			// 获取楼层信息
-			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SY2FL_FOR.getGraphCode(), 
+			ObjectNode buildingInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SY2FL_FOR.getGraphCode(), 
 					RelCodeEnum.Sy2Bd.name(), systemId, null);
 			
 			AdmRelationObject convertObject = this.convertObject(system, "系统", floor, "楼层");
@@ -83,4 +83,10 @@ public class Sy2FlForRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.SY2FL_FOR, groupCode, projectId, code);
+	}
+	
 }

+ 13 - 7
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2ShForRelationObject.java

@@ -17,7 +17,7 @@ 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;
+import com.persagy.proxy.adm.service.IRelationReportService;
 
 /**
  * 
@@ -29,12 +29,12 @@ import com.persagy.proxy.adm.service.IReportDownloadService;
 @Component(value = AdmRelationType.SY2SH_FOR)
 public class Sy2ShForRelationObject extends AbstractQueryRelationObject {
 
-	public Sy2ShForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Sy2ShForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -48,15 +48,15 @@ public class Sy2ShForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.SY2SH_FOR.getGraphCode(), AdmRelationTypeEnum.SY2SH_FOR.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String systemId = objectRelation.getObjFrom();
@@ -74,4 +74,10 @@ public class Sy2ShForRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.SY2SH_FOR, groupCode, projectId, code);
+	}
+	
 }

+ 15 - 9
src/main/java/com/persagy/proxy/adm/strategy/relationdata/Sy2SpForRelationObject.java

@@ -19,7 +19,7 @@ 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 com.persagy.proxy.adm.service.IRelationReportService;
 
 import cn.hutool.core.util.StrUtil;
 
@@ -33,12 +33,12 @@ import cn.hutool.core.util.StrUtil;
 @Component(value = AdmRelationType.SY2SP_FOR)
 public class Sy2SpForRelationObject extends AbstractQueryRelationObject {
 
-	public Sy2SpForRelationObject(IReportDownloadService reportDownloadService) {
-		super(reportDownloadService);
+	public Sy2SpForRelationObject(IRelationReportService relationReportService) {
+		super(relationReportService);
 	}
 
 	@Override
-	protected List<AdmRelationObject> findRelationObject(String relType) {
+	public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
 		QueryCriteria queryCriteria = new QueryCriteria();
 		ObjectNode criteria = objectMapper.createObjectNode();
@@ -52,15 +52,15 @@ public class Sy2SpForRelationObject extends AbstractQueryRelationObject {
 		queryCriteria.setPage(1L);
 		queryCriteria.setSize(1000L);
 		
-		return this.queryAllObjectInfo(queryCriteria, relType);
+		return this.queryAllObjectInfo(queryCriteria, groupCode, projectId);
 	}
 
 	@Override
-	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String relType) {
+	protected List<AdmRelationObject> handleObjectDigital(Map<String, ObjectNode> tempAllMap, String groupCode, String projectId) {
 		Set<String> allKeys = tempAllMap.keySet();
 		List<AdmRelationObject> resultList = new ArrayList<AdmRelationObject>();
 		
-		List<ObjectRelation> relationList = this.reportDownloadService.findObjectRelationList(groupCode, projectId, 
+		List<ObjectRelation> relationList = this.relationReportService.findObjectRelationList(groupCode, projectId, 
 				AdmRelationTypeEnum.SY2SP_FOR.getGraphCode(), AdmRelationTypeEnum.SY2SP_FOR.getRelCode());
 		for (ObjectRelation objectRelation : relationList) {
 			String systemId = objectRelation.getObjFrom();
@@ -72,9 +72,9 @@ public class Sy2SpForRelationObject extends AbstractQueryRelationObject {
 			ObjectNode space = tempAllMap.get(spaceId);
 			
 			// 获取楼层信息
-			ObjectNode floorInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SY2SP_FOR.getGraphCode(), 
+			ObjectNode floorInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SY2SP_FOR.getGraphCode(), 
 					RelCodeEnum.Sy2Bd.name(), systemId, null);
-			ObjectNode buildingInfo = this.reportDownloadService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SY2SP_FOR.getGraphCode(), 
+			ObjectNode buildingInfo = this.relationReportService.getObjectByCodeAndId(groupCode, projectId, AdmRelationTypeEnum.SY2SP_FOR.getGraphCode(), 
 					RelCodeEnum.Sy2Fl.name(), systemId, null);
 			
 			AdmRelationObject convertObject = this.convertObject(system, "系统", space, "空间");
@@ -95,4 +95,10 @@ public class Sy2SpForRelationObject extends AbstractQueryRelationObject {
 		return resultList;
 	}
 
+	@Override
+	public String beforeSaveRelationObject(ObjectNode objectNode, AdmRelationObject relationObject, String groupCode,
+			String projectId, String code) {
+		return this.beforeSaveRelationObject(objectNode, relationObject, AdmRelationTypeEnum.SY2SP_FOR, groupCode, projectId, code);
+	}
+	
 }