浏览代码

Merge remote-tracking branch 'origin/develop' into develop

linhuili 3 年之前
父节点
当前提交
56759eba9b
共有 58 个文件被更改,包括 1107 次插入622 次删除
  1. 4 2
      src/main/java/com/persagy/proxy/adm/constant/AdmDictConstant.java
  2. 3 0
      src/main/java/com/persagy/proxy/adm/constant/AdmRelationType.java
  3. 1 1
      src/main/java/com/persagy/proxy/adm/constant/AdmRelationTypeEnum.java
  4. 3 3
      src/main/java/com/persagy/proxy/adm/handler/RelationReportHandler.java
  5. 4 4
      src/main/java/com/persagy/proxy/adm/handler/SpaceRelationInfoHandler.java
  6. 2 0
      src/main/java/com/persagy/proxy/adm/request/AdmDCSQueryRequest.java
  7. 19 3
      src/main/java/com/persagy/proxy/adm/request/AdmQueryCriteria.java
  8. 12 5
      src/main/java/com/persagy/proxy/adm/request/AdmResponse.java
  9. 17 10
      src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmBaseServiceImpl.java
  10. 32 13
      src/main/java/com/persagy/proxy/adm/strategy/RelationObjectContext.java
  11. 40 3
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/AbstractRelationObject.java
  12. 29 4
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/AbstractReportRelationObject.java
  13. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/ConvectionNetworkMixMechRelationObject.java
  14. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/ConvectionNetworkNaturalRelationObject.java
  15. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/ConvectionNetworkOnewayMechRelationObject.java
  16. 82 0
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/DeafultRelationObject.java
  17. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/EquipPowerEqBackupRelationObject.java
  18. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/EquipPowerEqNormalRelationObject.java
  19. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/EquipPowerSyBackupRelationObject.java
  20. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/EquipPowerSyNormalRelationObject.java
  21. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/RadiationNetworkConnectRelationObject.java
  22. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/RadiationNetworkTransparentRelationObject.java
  23. 6 4
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/RelationObjectStrategy.java
  24. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/SensorRelationshipSs2EqRelationObject.java
  25. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/SensorRelationshipSs2SpRelationObject.java
  26. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/SensorRelationshipSs2SyRelationObject.java
  27. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/TrafficNetworkFFCloseRelationObject.java
  28. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/TrafficNetworkFFOpenRelationObject.java
  29. 1 1
      src/main/java/com/persagy/proxy/adm/strategy/relationdata/TrafficNetworkNormalRelationObject.java
  30. 25 0
      src/main/java/com/persagy/proxy/adm/utils/GeoToolsUtil.java
  31. 1 1
      src/main/java/com/persagy/proxy/calculation/model/AdmManualRelationCalcDel.java
  32. 18 19
      src/main/java/com/persagy/proxy/calculation/service/impl/AdmManualRelCalServiceImpl.java
  33. 15 3
      src/main/java/com/persagy/proxy/dictionary/service/impl/AbstractAdmDictBaseServiceImpl.java
  34. 61 27
      src/main/java/com/persagy/proxy/object/controller/AdmEquipmentController.java
  35. 8 8
      src/main/java/com/persagy/proxy/object/controller/AdmISpaceController.java
  36. 3 11
      src/main/java/com/persagy/proxy/object/controller/AdmShaftController.java
  37. 30 20
      src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java
  38. 8 224
      src/main/java/com/persagy/proxy/object/controller/AdmSystemController.java
  39. 2 0
      src/main/java/com/persagy/proxy/object/model/AdmEquipment.java
  40. 2 0
      src/main/java/com/persagy/proxy/object/model/AdmFloor.java
  41. 2 0
      src/main/java/com/persagy/proxy/object/model/AdmSpace.java
  42. 22 0
      src/main/java/com/persagy/proxy/object/service/IAdmSystemService.java
  43. 17 7
      src/main/java/com/persagy/proxy/object/service/impl/AdmSpaceServiceImpl.java
  44. 251 11
      src/main/java/com/persagy/proxy/object/service/impl/AdmSystemServiceImpl.java
  45. 36 9
      src/main/java/com/persagy/proxy/relation/controller/RelationShContainSpBaseController.java
  46. 8 3
      src/main/java/com/persagy/proxy/relation/controller/RelationSpInSiController.java
  47. 13 9
      src/main/java/com/persagy/proxy/relation/controller/RelationSyEqController.java
  48. 64 19
      src/main/java/com/persagy/proxy/relation/controller/RelationSyInBdController.java
  49. 45 34
      src/main/java/com/persagy/proxy/relation/controller/RelationSyInFlController.java
  50. 3 0
      src/main/java/com/persagy/proxy/relation/model/SiInSpBase.java
  51. 13 5
      src/main/java/com/persagy/proxy/report/controller/AdmEquipShaftController.java
  52. 74 84
      src/main/java/com/persagy/proxy/report/controller/AdmReportEquipController.java
  53. 57 39
      src/main/java/com/persagy/proxy/report/controller/AdmSpaceInfoController.java
  54. 13 10
      src/main/java/com/persagy/proxy/report/controller/ComponentStatisticsController.java
  55. 13 6
      src/main/java/com/persagy/proxy/report/controller/RelationReportController.java
  56. 4 6
      src/main/java/com/persagy/proxy/report/model/AdmGatherInfoPoint.java
  57. 28 0
      src/main/java/com/persagy/proxy/report/model/AdmInfoPoint.java
  58. 2 0
      src/main/java/com/persagy/proxy/report/service/impl/RelationReportService.java

+ 4 - 2
src/main/java/com/persagy/proxy/adm/constant/AdmDictConstant.java

@@ -15,9 +15,11 @@ public interface AdmDictConstant {
     /** 信息点infos前缀 */
     String INFOS_EX ="infos.";
 
-    /** 一级标签名称 */
+    /** 一级标签名称-基本信息 */
     String FIRST_BASE_TAG ="基本信息";
 
-    /** 一级标签历史名称 */
+    /** 一级标签历史名称-基础参数 */
     String HIS_FIRST_BASE_TAG="基础参数";
+    /** 一级标签历史名称-基本参数 */
+    String HIS_FIRST_BASE_TAG_TWO="基本参数";
 }

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

@@ -10,6 +10,9 @@ package com.persagy.proxy.adm.constant;
  */
 public interface AdmRelationType {
 
+	/** 默认的处理类 */
+	String DEFAULT_RELATION_OBJECT = "deafultRelationObject";
+	
 	/** MECHINARCH_EQ2BD  设备所在建筑*/
 	String MECHINARCH_EQ2BD = "MechInArch_Eq2Bd";
 	

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

@@ -188,7 +188,7 @@ public enum AdmRelationTypeEnum {
     /**光照连通-空间-空间-【全部关系总览】*/
     SP2SP_RADIATIONNETWORK_1("sp2sp_RadiationNetwork_1","RadiationNetwork","Connect",AdmObjectType.SPACE.getIndex(),AdmObjectType.SPACE.getIndex(),true,true,true,false,true,true,CollUtil.newHashSet("LightingZone")),
     /**竖井下的业务空间-竖井→空间-【竖井台账】*/
-    SH2SP("sh2sp","ShaftandSpace","Sh2Sp",AdmObjectType.SHAFT.getIndex(),AdmObjectType.SPACE.getIndex(),false,false,false,false,false,false),
+    SH2SP("sh2sp","ArchSubset","Sh2Sp",AdmObjectType.SHAFT.getIndex(),AdmObjectType.SPACE.getIndex(),false,false,false,false,false,false),
     /**采暖水旁通-供暖集水器-供暖分水器,液体管道-*/
     EQ2EQ_HEATWATERLOOP_3("eq2eq_HeatWaterLoop_3","HeatWaterLoop","Bypass",AdmObjectType.EQUIPMENT.getIndex(),AdmObjectType.EQUIPMENT.getIndex(),false,true,false,false,false,false),
     /**空调冷却水供水-空调冷却水供水相关设备,沿水流方向-*/

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

@@ -388,7 +388,7 @@ public class RelationReportHandler {
 		/** key: 建筑ID,value: 建筑名称 */
 		Map<String, String> buildNameTemp = new HashMap<String, String>();
 		String graphAndRelKey = GraphCodeEnum.MechInArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Eq2Bd.name();
-		List<ObjectDigital> buildDigitals = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, null);
+		List<ObjectDigital> buildDigitals = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, null, null);
 		if (CollectionUtil.isNotEmpty(buildDigitals)) {
 			for (ObjectDigital master : buildDigitals) {
 				List<ObjectDigital> slaveDigitals = master.getRelObjs();
@@ -547,7 +547,7 @@ public class RelationReportHandler {
 	private void findBuildingName(Map<String, String> buildNameTemp, String groupCode, String projectId) {
 		// 获取建筑名称
 		String graphAndRelKey = GraphCodeEnum.MechInArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Eq2Bd.name();
-		List<ObjectDigital> buildDigitals = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, null);
+		List<ObjectDigital> buildDigitals = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, null, null);
 		if (CollectionUtil.isNotEmpty(buildDigitals)) {
 			for (ObjectDigital master : buildDigitals) {
 				List<ObjectDigital> slaveDigitals = master.getRelObjs();
@@ -569,7 +569,7 @@ public class RelationReportHandler {
 	private void findFloorName(Map<String, String> floorNameTemp, String groupCode, String projectId) {
 		// 获取楼层名称
 		String graphAndRelKey = GraphCodeEnum.MechInArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Eq2Fl.name();
-		List<ObjectDigital> floorDigitals = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, null);
+		List<ObjectDigital> floorDigitals = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, null, null);
 		if (CollectionUtil.isNotEmpty(floorDigitals)) {
 			for (ObjectDigital master : floorDigitals) {
 				List<ObjectDigital> slaveDigitals = master.getRelObjs();

+ 4 - 4
src/main/java/com/persagy/proxy/adm/handler/SpaceRelationInfoHandler.java

@@ -72,7 +72,7 @@ public class SpaceRelationInfoHandler {
 		if (StrUtil.isNotBlank(buildingId) && StrUtil.isNotBlank(floorId) && !"isnull".equals(floorId)) {
 			// 当建筑ID不为空、楼层ID不为空时
 			String graphAndRelKey = GraphCodeEnum.ArchForArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Sp2Fl.name();
-			List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, Sets.newHashSet(buildingId));
+			List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, Sets.newHashSet(buildingId), null);
 			if (CollectionUtil.isNotEmpty(allRelations)) {
 				resultList = this.transferSpaceInfo(allRelations, buildingId, floorId);
 			}
@@ -84,7 +84,7 @@ public class SpaceRelationInfoHandler {
 		} else if (StrUtil.isNotBlank(buildingId) && StrUtil.isBlank(floorId) && !"isnull".equals(buildingId)) {
 			// 当建筑ID不为空、楼层ID为空时
 			String graphAndRelKey = GraphCodeEnum.ArchForArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Sp2Bd.name();
-			List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, Sets.newHashSet(buildingId));
+			List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, Sets.newHashSet(buildingId), null);
 			if (CollectionUtil.isNotEmpty(allRelations)) {
 				resultList = this.transferSpaceInfo(allRelations, buildingId, null);
 			}
@@ -156,7 +156,7 @@ public class SpaceRelationInfoHandler {
 		} else {
 			// 获取所有的空间数据
 			String graphAndRelKey = GraphCodeEnum.MechInArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Eq2Fl.name();
-			List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, Sets.newHashSet(buildingId));
+			List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, Sets.newHashSet(buildingId), null);
 			if (CollectionUtil.isNotEmpty(allRelations)) {
 				resultList = this.transferSpaceInfo(allRelations, buildingId, null);
 			}
@@ -187,7 +187,7 @@ public class SpaceRelationInfoHandler {
 				String buildingId = objectNode.get("id").asText();
 				// 获取所有的空间数据
 				String graphAndRelKey = GraphCodeEnum.MechInArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Eq2Fl.name();
-				List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, Sets.newHashSet(buildingId));
+				List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, Sets.newHashSet(buildingId), null);
 				if (CollectionUtil.isNotEmpty(allRelations)) {
 					// 获取所有的对象数据
 					resultList = this.transferSpaceInfo(allRelations, buildingId, null);

+ 2 - 0
src/main/java/com/persagy/proxy/adm/request/AdmDCSQueryRequest.java

@@ -3,6 +3,7 @@ package com.persagy.proxy.adm.request;
 import com.fasterxml.jackson.annotation.JsonAlias;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
+import lombok.ToString;
 
 import java.util.Set;
 
@@ -12,6 +13,7 @@ import java.util.Set;
  * @date 2021/9/8
  */
 @Data
+@ToString(callSuper = true)
 @EqualsAndHashCode(callSuper=true)
 public class AdmDCSQueryRequest extends AdmQueryCriteria {
     /** 楼层id */

+ 19 - 3
src/main/java/com/persagy/proxy/adm/request/AdmQueryCriteria.java

@@ -1,5 +1,6 @@
 package com.persagy.proxy.adm.request;
 
+import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.annotation.JsonAlias;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -46,8 +47,23 @@ public class AdmQueryCriteria {
     private ObjectNode relationTo;
 
     /**
+     * 拼接条件
+     * @param addFilter
+     */
+    public void addFilters(String addFilter) {
+        if(StrUtil.isBlank(addFilter)) {
+            return;
+        }
+        if(StrUtil.isBlank(filters)) {
+            filters = addFilter;
+            return;
+        }
+        filters = filters + " and " + addFilter;
+    }
+
+    /**
      * 设置关系条件
-     * @param isFrom
+     * @param isFrom 是否查询from结果
      * @param graphCode
      * @param relCode
      * @param objId
@@ -58,7 +74,7 @@ public class AdmQueryCriteria {
 
     /**
      * 设置关系条件
-     * @param isFrom
+     * @param isFrom 是否查询from结果
      * @param graphCode
      * @param relCode
      * @param objId
@@ -70,7 +86,7 @@ public class AdmQueryCriteria {
 
     /**
      * 设置关系条件
-     * @param isFrom
+     * @param isFrom 是否查询from结果
      * @param graphCode
      * @param relCode
      * @param relValue

+ 12 - 5
src/main/java/com/persagy/proxy/adm/request/AdmResponse.java

@@ -35,17 +35,24 @@ public class AdmResponse {
     private Integer pageSize;
     /** 查询到的数据列表 */
     private List<?> content;
+    /**楼层id*/
+    private String floorId;
+    /**空间功能类型*/
+    private String zoneType;
 
     public static AdmResponse success() {
-        return new AdmResponse(SUCCESS, "", 0L,null, 1, 500, new ArrayList<>(1));
+        return new AdmResponse(SUCCESS, "", 0L,null, 1, 500, new ArrayList<>(1),null,null);
     }
 
     public static AdmResponse failure(String message) {
-        return new AdmResponse(FAILURE, message, null, null, null, null, new ArrayList<>(1));
+        return new AdmResponse(FAILURE, message, null, null, null, null, new ArrayList<>(1),null,null);
     }
 
     public static AdmResponse success(List<?> content) {
-        return new AdmResponse(SUCCESS, "", CollUtil.isEmpty(content) ? 0L :content.size()*1L,null, 1, 500, CollUtil.isEmpty(content) ? new ArrayList<>(1): content);
+        return new AdmResponse(SUCCESS, "", CollUtil.isEmpty(content) ? 0L :content.size()*1L,null, 1, 500, CollUtil.isEmpty(content) ? new ArrayList<>(1): content,null,null);
+    }
+    public static AdmResponse success(String message) {
+        return new AdmResponse(SUCCESS, message, null,null, null,null,null,null,null);
     }
 
     /**
@@ -66,9 +73,9 @@ public class AdmResponse {
         Integer pageNo = admRequest == null ? null : admRequest.getPageNumber();
         Integer pageSize = admRequest == null ? null : admRequest.getPageSize();
         if(admRequest.isOnlyCount()){
-            return new AdmResponse(SUCCESS, null, null,total, pageNo, pageSize, CollUtil.isEmpty(admVOs) ? new ArrayList<>(1) : admVOs);
+            return new AdmResponse(SUCCESS, null, null,total, pageNo, pageSize, CollUtil.isEmpty(admVOs) ? new ArrayList<>(1) : admVOs,null,null);
         }else {
-            return new AdmResponse(SUCCESS, null, total,null, pageNo, pageSize, CollUtil.isEmpty(admVOs) ? new ArrayList<>(1) : admVOs);
+            return new AdmResponse(SUCCESS, null, total,null, pageNo, pageSize, CollUtil.isEmpty(admVOs) ? new ArrayList<>(1) : admVOs,null,null);
         }
     }
 }

+ 17 - 10
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmBaseServiceImpl.java

@@ -1,9 +1,16 @@
 package com.persagy.proxy.adm.service.impl;
 
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.map.MapUtil;
-import cn.hutool.core.util.ReflectUtil;
-import cn.hutool.core.util.StrUtil;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -27,13 +34,12 @@ import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
 import com.persagy.proxy.common.client.DmpRwdClient;
 import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.ParameterizedType;
-import java.util.*;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.ReflectUtil;
+import cn.hutool.core.util.StrUtil;
+import lombok.extern.slf4j.Slf4j;
 
 /**
  * ADM 抽象实现类
@@ -67,6 +73,7 @@ public class AbstractAdmBaseServiceImpl<T> implements IAdmBaseService<T> {
             log.error(e.getMessage(), e);
             return AdmResponse.failure("参数格式有误");
         }
+        log.info("request:{},dmpRequest:{}, dmp-param: {}", request.toString(), dmpRequest.toString(), para.toString());
         // 调用中台查询
         DmpResult<JSONArray> dmpResult = rwdClient.queryObject(context, para);
         List<T> admVOs = AdmEntityTransferUtil.toAdmMultiEntity(dmpResult.getData(), request.getProjection(), clazz);

+ 32 - 13
src/main/java/com/persagy/proxy/adm/strategy/RelationObjectContext.java

@@ -1,18 +1,22 @@
 package com.persagy.proxy.adm.strategy;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+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.dmp.basic.dto.RequestData;
 import com.persagy.dmp.digital.entity.ObjectDigital;
+import com.persagy.proxy.adm.constant.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.strategy.relationdata.RelationObjectStrategy;
 import com.persagy.proxy.report.model.AdmRelationObject;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
 /**
  * 获取关系对象的上下文类
@@ -55,13 +59,19 @@ public class RelationObjectContext {
 	 * 检查关联对象的合法性
 	 * 
 	 * @param relationObject 当前需要校验的对象
+	 * @param groupCode
+	 * @param projectId
 	 * @param relType graphCode_relCode
 	 * @param code 获取对象的依据
+	 * @param admRelType ADM定义的类型
 	 * @return String - 校验失败的原因, ObjectNode -- BDTP接口的参数,不会返回null,请用instanceOf 判断返回值
 	 */
-	public Object checkRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String relType, String code) {
+	public Object checkRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String relType, String code, AdmRelationTypeEnum typeEnum) {
 		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
-		return strategy == null ? "不存在此策略类" : strategy.beforeSaveRelationObject(relationObject, groupCode, projectId, code);
+		if (strategy == null && typeEnum != null) {
+			strategy = this.relationObjectStrategyMap.get(AdmRelationType.DEFAULT_RELATION_OBJECT);
+		}
+		return strategy == null ? "不存在此类型" : strategy.beforeSaveRelationObject(relationObject, groupCode, projectId, code, typeEnum);
 	}
 	
 	/**
@@ -75,6 +85,9 @@ public class RelationObjectContext {
 	 */
 	public boolean saveRelationObjects(List<ObjectNode> relationObjects, String groupCode, String projectId, String relType) {
 		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
+		if (strategy == null) {
+			strategy = this.relationObjectStrategyMap.get(AdmRelationType.DEFAULT_RELATION_OBJECT);
+		}
 		return strategy == null ? false : strategy.saveRelationObjects(relationObjects, groupCode, projectId);
 	}
 
@@ -86,9 +99,12 @@ public class RelationObjectContext {
 	 * @param relType graphCode_relCode
 	 * @return 
 	 */
-	public long countRelationObjects(String groupCode, String projectId, String relType) {
+	public long countRelationObjects(String groupCode, String projectId, String relType, AdmRelationTypeEnum typeEnum) {
 		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
-		return strategy == null ? 0 : strategy.countRelationObjects(groupCode, projectId);
+		if (strategy == null && typeEnum != null) {
+			strategy = this.relationObjectStrategyMap.get(AdmRelationType.DEFAULT_RELATION_OBJECT);
+		}
+		return strategy == null ? 0 : strategy.countRelationObjects(groupCode, projectId, typeEnum);
 	}
 
 	/**
@@ -102,9 +118,12 @@ public class RelationObjectContext {
 	 * @param mainContent	主对象的筛选关键字,筛选范围为id,name,local_id,local_name,cADID.为关系左侧对象
 	 * @param slaveContent	从对象的筛选关键字.objTo对应的对象,筛选范围为id,name,local_id,local_name.为关系右侧对象
 	 */
-	public List<ObjectDigital> queryAllRelations(String groupCode, String projectId, String relType, String mainContent, Set<String> slaveContent) {
+	public List<ObjectDigital> queryAllRelations(String groupCode, String projectId, String relType, String mainContent, Set<String> slaveContent, AdmRelationTypeEnum typeEnum) {
 		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
-		return strategy == null ? Lists.newArrayList() : strategy.queryAllRelations(groupCode, projectId, mainContent, slaveContent);
+		if (strategy == null && typeEnum != null) {
+			strategy = this.relationObjectStrategyMap.get(AdmRelationType.DEFAULT_RELATION_OBJECT);
+		}
+		return strategy == null ? Lists.newArrayList() : strategy.queryAllRelations(groupCode, projectId, mainContent, slaveContent, typeEnum);
 	}
 	
 	/**

+ 40 - 3
src/main/java/com/persagy/proxy/adm/strategy/relationdata/AbstractRelationObject.java

@@ -1,6 +1,7 @@
 package com.persagy.proxy.adm.strategy.relationdata;
 
 import java.util.List;
+import java.util.Set;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.dto.RequestData;
@@ -10,6 +11,7 @@ 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.AdmRelationTypeEnum;
 import com.persagy.proxy.report.model.AdmRelationObject;
 import com.persagy.proxy.report.service.IRelationReportService;
 
@@ -32,6 +34,37 @@ public abstract class AbstractRelationObject implements RelationObjectStrategy {
 	}
 	
 	@Override
+	public long countRelationObjects(String groupCode, String projectId, AdmRelationTypeEnum typeEnum) {
+		return this.countRelationObjects(groupCode, projectId);
+	}
+	
+	/**
+	 * 统计关系总数
+	 * 
+	 * @param groupCode
+	 * @param projectId
+	 * @return
+	 */
+	protected abstract long countRelationObjects(String groupCode, String projectId);
+	
+	@Override
+	public List<ObjectDigital> queryAllRelations(String groupCode, String projectId, String mainContent, Set<String> slaveContent, AdmRelationTypeEnum typeEnum) {
+		return this.queryAllRelations(groupCode, projectId, mainContent, slaveContent);
+	}
+	
+	/**
+	 * 查询出所有的关系对象数据
+	 * 
+	 * @param groupCode 集团编码
+	 * @param projectId 项目ID
+	 * @param mainContent	主对象的筛选关键字,筛选范围为id,name,local_id,local_name,cADID.为关系左侧对象
+	 * @param slaveContent	从对象的筛选关键字.objTo对应的对象,筛选范围为id,name,local_id,local_name.为关系右侧对象
+	 * @return 不会返回null
+	 */
+	protected abstract List<ObjectDigital> queryAllRelations(String groupCode, String projectId, String mainContent, Set<String> slaveContent);
+	
+	
+	@Override
 	public void queryPageRelations(List<ObjectDigital> allDigitals, RequestData requestData, String groupCode, String projectId) {
 		CommonResult<List<ObjectDigital>> queryPrototype = DigitalObjectFacade.queryObjectListByGraphCodeAndRelCodePrototype(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, requestData);
 		Long count = queryPrototype.getCount();
@@ -67,12 +100,16 @@ public abstract class AbstractRelationObject implements RelationObjectStrategy {
 	
 	@Override
 	public List<AdmRelationObject> exportRelationObject(String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override
-	public Object beforeSaveRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String code) {
-		throw new UnsupportedOperationException("未实现的策略类");
+	public Object beforeSaveRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String code, AdmRelationTypeEnum typeEnum) {
+		return this.beforeSaveRelationObject(relationObject, groupCode, projectId, code);
+	}
+	
+	protected Object beforeSaveRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String code) {
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 	
 }

+ 29 - 4
src/main/java/com/persagy/proxy/adm/strategy/relationdata/AbstractReportRelationObject.java

@@ -2,6 +2,7 @@ package com.persagy.proxy.adm.strategy.relationdata;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.digital.entity.ObjectDigital;
@@ -29,6 +30,16 @@ public abstract class AbstractReportRelationObject extends AbstractRelationObjec
 	}
 
 	@Override
+	protected long countRelationObjects(String groupCode, String projectId) {
+		throw new UnsupportedOperationException("未实现的策略方法");
+	}
+
+	@Override
+	protected List<ObjectDigital> queryAllRelations(String groupCode, String projectId, String mainContent, Set<String> slaveContent) {
+		throw new UnsupportedOperationException("未实现的策略方法");
+	}
+	
+	@Override
 	public List<AdmRelationObject> exportRelationObject(String groupCode, String projectId) {
 		List<ObjectDigital> masterObjs = this.queryAllRelations(groupCode, projectId, null, null);
 		// 转换中台数据
@@ -132,19 +143,33 @@ public abstract class AbstractReportRelationObject extends AbstractRelationObjec
 		if (!StrUtil.isAllNotBlank(relationObject.getMasterCode(), relationObject.getSlaveCode())) {
 			return "主对象或从对象的识别编码为空";
 		}
-		if (!StrUtil.isAllNotBlank(relationObject.getMasterId(), relationObject.getSlaveId())) {
+		/*if (!StrUtil.isAllNotBlank(relationObject.getMasterId(), relationObject.getSlaveId())) {
 			return "主对象或从对象的ID为空";
-		}
+		}*/
+		
+		// 获取备用的类型
+		String relationType = relationTypeEnum.getRelationType();
+		int indexOf = relationType.indexOf("_");
+		String relCodeBak = indexOf > 0 ? relationType.substring(0, indexOf) : relationType;
 		
 		String relCode = relationTypeEnum.getRelCode();
 		String relCodePrefix = ObjTypeMapping.getRelCodePrefix(relCode);
 		String masterObjType = ObjTypeMapping.PREFIX_FULLNAME.get(relCodePrefix);
 		if (StrUtil.isBlank(masterObjType)) {
-			return "边类型错误";
+			relCodePrefix = ObjTypeMapping.getRelCodePrefix(relCodeBak);
+			relCodePrefix = StrUtil.upperFirst(relCodePrefix);
+			masterObjType = ObjTypeMapping.PREFIX_FULLNAME.get(relCodePrefix);
+			if (StrUtil.isBlank(masterObjType)) {
+				return "边类型错误";
+			}
 		}
 		String slaveObjType = ObjTypeMapping.PREFIX_FULLNAME.get(ObjTypeMapping.getRelCodeSuffix(relCode));
 		if (StrUtil.isBlank(slaveObjType)) {
-			return "边类型错误";
+			String relCodeSuffix = StrUtil.upperFirst(ObjTypeMapping.getRelCodeSuffix(relCodeBak));
+			slaveObjType = ObjTypeMapping.PREFIX_FULLNAME.get(relCodeSuffix);
+			if (StrUtil.isBlank(slaveObjType)) {
+				return "边类型错误";
+			}
 		}
 		// 查询出对象信息
 		List<ObjectNode> masters = this.relationReportService.findObjectNodes(groupCode, projectId, masterObjType, code, relationObject.getMasterCode());

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

@@ -72,7 +72,7 @@ public class ConvectionNetworkMixMechRelationObject extends AbstractReportRelati
 	
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -72,7 +72,7 @@ public class ConvectionNetworkNaturalRelationObject extends AbstractReportRelati
 	
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -72,7 +72,7 @@ public class ConvectionNetworkOnewayMechRelationObject extends AbstractReportRel
 	
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -0,0 +1,82 @@
+package com.persagy.proxy.adm.strategy.relationdata;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.dto.RequestData;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.model.response.CommonResult;
+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.AdmRelationType;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.report.model.AdmRelationObject;
+import com.persagy.proxy.report.service.IRelationReportService;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.StrUtil;
+
+/**
+ * 
+ * @version 1.0.0
+ * @company persagy 
+ * @author zhangqiankun
+ * @date 2021年11月1日 上午11:42:26
+ */
+@Component(value = AdmRelationType.DEFAULT_RELATION_OBJECT)
+public class DeafultRelationObject extends AbstractReportRelationObject {
+
+	public DeafultRelationObject(IRelationReportService reportDownloadService) {
+		super(reportDownloadService);
+	}
+
+	@Override
+	public long countRelationObjects(String groupCode, String projectId, AdmRelationTypeEnum typeEnum) {
+		QueryCriteria queryCriteria = new QueryCriteria();
+		ObjectNode objectNode = OBJECT_MAPPER.createObjectNode();
+		objectNode.put("graphCode", typeEnum.getGraphCode());
+		objectNode.put("relCode", typeEnum.getRelCode());
+		objectNode.put("valid", 1);
+		queryCriteria.setCriteria(objectNode);
+		queryCriteria.setOnlyCount(true);
+		
+		CommonResult<List<ObjectRelation>> result = DigitalRelationFacade.queryPrototype(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
+		return result == null ? 0 : (result.getCount() == null ? 0 : result.getCount());
+	}
+
+	@Override
+	public List<ObjectDigital> queryAllRelations(String groupCode, String projectId, String mainContent, Set<String> slaveContent, AdmRelationTypeEnum typeEnum) {
+		RequestData requestData = new RequestData();
+		requestData.setGraphCode(typeEnum.getGraphCode());
+		requestData.setRelCode(typeEnum.getRelCode());
+		if (StrUtil.isNotBlank(mainContent)) {
+			requestData.setMainContent(mainContent);
+		}
+		if (CollectionUtil.isNotEmpty(slaveContent)) {
+			requestData.setSlaveContent(slaveContent);
+		}
+		requestData.setPage(1L);
+		requestData.setSize(500L);
+		
+		List<ObjectDigital> allDigitals = new ArrayList<ObjectDigital>();
+		this.queryPageRelations(allDigitals, requestData, groupCode, projectId);
+		return allDigitals;
+	}
+	
+	@Override
+	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
+		throw new UnsupportedOperationException("未实现的策略方法");
+	}
+	
+	@Override
+	public Object beforeSaveRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String code, AdmRelationTypeEnum typeEnum) {
+		return this.beforeSaveRelationObject(relationObject, typeEnum, groupCode, projectId, code);
+	}
+
+}

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

@@ -72,7 +72,7 @@ public class EquipPowerEqBackupRelationObject extends AbstractReportRelationObje
 	
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -72,7 +72,7 @@ public class EquipPowerEqNormalRelationObject extends AbstractReportRelationObje
 	
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -72,7 +72,7 @@ public class EquipPowerSyBackupRelationObject extends AbstractReportRelationObje
 	
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -72,7 +72,7 @@ public class EquipPowerSyNormalRelationObject extends AbstractReportRelationObje
 	
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -72,7 +72,7 @@ public class RadiationNetworkConnectRelationObject extends AbstractReportRelatio
 	
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -72,7 +72,7 @@ public class RadiationNetworkTransparentRelationObject extends AbstractReportRel
 	
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

+ 6 - 4
src/main/java/com/persagy/proxy/adm/strategy/relationdata/RelationObjectStrategy.java

@@ -10,6 +10,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.digital.entity.ObjectDigital;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.report.model.AdmRelationObject;
 
 /**
@@ -45,7 +46,7 @@ public interface RelationObjectStrategy {
 	 * @param projectId
 	 * @return
 	 */
-    long countRelationObjects(String groupCode, String projectId);
+    long countRelationObjects(String groupCode, String projectId, AdmRelationTypeEnum typeEnum);
     
 	/**
 	 * 查询出所有的关系信息
@@ -65,7 +66,7 @@ public interface RelationObjectStrategy {
 	 * @param slaveContent	从对象的筛选关键字.objTo对应的对象,筛选范围为id,name,local_id,local_name.为关系右侧对象
 	 * @return 不会返回null
 	 */
-	List<ObjectDigital> queryAllRelations(String groupCode, String projectId, String mainContent, Set<String> slaveContent);
+	List<ObjectDigital> queryAllRelations(String groupCode, String projectId, String mainContent, Set<String> slaveContent, AdmRelationTypeEnum typeEnum);
 	
 	/**
 	 * 分页查询关系对象数据
@@ -78,15 +79,16 @@ public interface RelationObjectStrategy {
 	void queryPageRelations(List<ObjectDigital> masterObjs, RequestData requestData, String groupCode, String projectId);
 	
 	/**
-	 * 保存之前校验数据的合法性
+	 * 保存之前校验数据的合法性
 	 * 
 	 * @param relationObject 需要校验的对象
 	 * @param groupCode
 	 * @param projectId
 	 * @param code 参考 OBJNAME_2_TYPE
+	 * @param typeEnum 
 	 * @return String - 校验失败的原因, ObjectNode -- BDTP接口的参数,不会返回null,请用instanceOf 判断返回值
 	 */
-	Object beforeSaveRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String code);
+	Object beforeSaveRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String code, AdmRelationTypeEnum typeEnum);
 
 	/**
 	 * 保存对象之间的关系

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

@@ -72,7 +72,7 @@ public class SensorRelationshipSs2EqRelationObject extends AbstractReportRelatio
 
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -73,7 +73,7 @@ public class SensorRelationshipSs2SpRelationObject extends AbstractReportRelatio
 
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -72,7 +72,7 @@ public class SensorRelationshipSs2SyRelationObject extends AbstractReportRelatio
 
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -72,7 +72,7 @@ public class TrafficNetworkFFCloseRelationObject extends AbstractReportRelationO
 	
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -72,7 +72,7 @@ public class TrafficNetworkFFOpenRelationObject extends AbstractReportRelationOb
 	
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

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

@@ -72,7 +72,7 @@ public class TrafficNetworkNormalRelationObject extends AbstractReportRelationOb
 	
 	@Override
 	protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
-		throw new UnsupportedOperationException("未实现的策略");
+		throw new UnsupportedOperationException("未实现的策略方法");
 	}
 
 	@Override

+ 25 - 0
src/main/java/com/persagy/proxy/adm/utils/GeoToolsUtil.java

@@ -1,5 +1,6 @@
 package com.persagy.proxy.adm.utils;
 
+import cn.hutool.core.collection.CollUtil;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.geotools.geometry.jts.JTSFactoryFinder;
 import org.locationtech.jts.geom.*;
@@ -88,4 +89,28 @@ public class GeoToolsUtil {
        return flag;
    }
 
+
+    /**
+     * 点面包含关系判断
+     * 用途:判断一个面是否包含一个点,即一个点是否在一个面内
+     * @param fromOutLines: 轮廓坐标
+     * @param toOutLines: 轮廓坐标
+     * @return
+     */
+    public static Boolean isPolyInPoly(List<ObjectNode> fromOutLines,
+                                       List<ObjectNode> toOutLines) {
+        if (CollUtil.isEmpty(fromOutLines) || CollUtil.isEmpty(toOutLines)){
+            return false;
+        }
+        //创建点
+        Polygon fromPolygon = createPolygon(fromOutLines);
+        //创建面
+        Polygon toPolygon = createPolygon(toOutLines);
+        //判断面-面包含关系
+        return fromPolygon.contains(toPolygon)
+                || fromPolygon.equalsTopo(toPolygon)
+                || fromPolygon.overlaps(toPolygon)
+                || toPolygon.contains(fromPolygon);
+    }
+
 }

+ 1 - 1
src/main/java/com/persagy/proxy/calculation/model/AdmManualRelationCalcDel.java

@@ -20,7 +20,7 @@ public class AdmManualRelationCalcDel {
     String relType;
 
     /**图类型*/
-    @NotNull(message = "图类型不可以为空")
+    //@NotNull(message = "图类型不可以为空")
     String graphicType;
 
 }

+ 18 - 19
src/main/java/com/persagy/proxy/calculation/service/impl/AdmManualRelCalServiceImpl.java

@@ -1,11 +1,12 @@
 package com.persagy.proxy.calculation.service.impl;
 
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.extra.spring.SpringUtil;
-import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.databind.JsonNode;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.stereotype.Service;
+
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -19,24 +20,23 @@ 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.AdmObjectInfoConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.constant.BusinessErrorRwdCode;
-import com.persagy.proxy.calculation.model.AdmManualRelCalRequest;
-import com.persagy.proxy.calculation.model.AdmManualRelationCalcDel;
-import com.persagy.proxy.calculation.model.AdmRelationAddRequest;
 import com.persagy.proxy.adm.request.AdmCreateResponse;
 import com.persagy.proxy.adm.request.AdmManualRelCalResponse;
 import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.calculation.model.AdmManualRelCalRequest;
+import com.persagy.proxy.calculation.model.AdmManualRelationCalcDel;
+import com.persagy.proxy.calculation.model.AdmRelationAddRequest;
 import com.persagy.proxy.calculation.service.AdmManualRelCalService;
-import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.spring.SpringUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
 /***
  * Description: 手动计算逻辑处理类
@@ -298,11 +298,10 @@ public class AdmManualRelCalServiceImpl implements AdmManualRelCalService {
     @Override
     public AdmCreateResponse delRels(InstanceUrlParam context, AdmManualRelationCalcDel admManualRelationCalcDel) {
         ObjectRelation objectRelation = new ObjectRelation();
-        Map<String, AdmRelationTypeEnum> relationTypeMap = AdmRelationTypeEnum.getRelationTypeMap();
-        if (relationTypeMap.containsKey(admManualRelationCalcDel.getRelType())){
+        AdmRelationTypeEnum relationTypeEnum = AdmCommonConstant.RELATION_TYPE_MAP.get(admManualRelationCalcDel.getRelType());
+        if (relationTypeEnum == null){
             return AdmCreateResponse.failure("不存在的关系类型");
         }
-        AdmRelationTypeEnum relationTypeEnum = relationTypeMap.get(admManualRelationCalcDel.getRelType());
         objectRelation.setGraphCode(relationTypeEnum.getGraphCode());
         objectRelation.setRelCode(relationTypeEnum.getRelCode());
         objectRelation.setObjFrom(admManualRelationCalcDel.getFromId());

+ 15 - 3
src/main/java/com/persagy/proxy/dictionary/service/impl/AbstractAdmDictBaseServiceImpl.java

@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Value;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 /**
  * @ClassName AbstractAdmDictBaseServiceImpl
@@ -43,6 +44,10 @@ import java.util.List;
 @Slf4j
 public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T> {
 
+    private static final Set<String> TABLE_INFOS=CollUtil.newHashSet("id","code","localId",
+            "localName","groupCode","projectId","objType","classCode","grouping","virtualCodes","createApp","updateApp",
+            "creator","creationTime","modifier","modifiedTime","valid","floorSequenceID");
+
     @Autowired
     private DmpRwdClient rwdClient;
 
@@ -202,10 +207,17 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
             admVO.setSort(admVO.getShowOrder());
 
             //path路径处理
-            if(StringUtils.isEmpty(admVO.getFirstName()) || AdmDictConstant.FIRST_BASE_TAG.equals(admVO.getFirstName())
-                    || AdmDictConstant.HIS_FIRST_BASE_TAG.equals(admVO.getFirstName())){
+//            if(StringUtils.isEmpty(admVO.getFirstName())
+//                    || AdmDictConstant.FIRST_BASE_TAG.equals(admVO.getFirstName())
+//                    || AdmDictConstant.HIS_FIRST_BASE_TAG.equals(admVO.getFirstName())
+//                    || AdmDictConstant.HIS_FIRST_BASE_TAG_TWO.equals(admVO.getFirstName())){
+//                admVO.setPath(admVO.getCode());
+//            }else{
+//                admVO.setPath(AdmDictConstant.INFOS_EX+admVO.getCode());
+//            }
+            if (TABLE_INFOS.contains(admVO.getCode())){
                 admVO.setPath(admVO.getCode());
-            }else{
+            }else {
                 admVO.setPath(AdmDictConstant.INFOS_EX+admVO.getCode());
             }
 

+ 61 - 27
src/main/java/com/persagy/proxy/object/controller/AdmEquipmentController.java

@@ -14,7 +14,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.Sets;
 import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.basic.model.QueryCriteria;
-import com.persagy.dmp.basic.utils.JsonNodeUtils;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.dmp.common.helper.SpringHelper;
@@ -177,15 +176,54 @@ public class AdmEquipmentController {
 			ObjectNode node = JsonNodeFactory.instance.objectNode();
 			node.put("graphCode", graphCode);
 			admEquipmentMap.keySet().stream().forEach(equipId -> {
-				node.put("relCode", "Eq2Bd");
-				node.put("objFrom", equipId);
-				criteria.setCriteria(node);
-				relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
-
-				node.put("relCode", "Eq2Fl");
-				node.put("objFrom", equipId);
-				criteria.setCriteria(node);
-				relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+				AdmEquipment admEquipment = admEquipmentMap.get(equipId);
+				//处理建筑 楼层信息点
+				int removeflBd = 0 ;//关系处理 0不删除 1删除bd 2删除fl 3都删除
+				String flowBuild = admEquipment.getFlowBuild();
+				if(StrUtil.isNotEmpty(flowBuild)){
+					if(!flowBuild.contains("-")){
+						if(flowBuild.startsWith("Bd")){
+							admEquipment.setBuildingId(flowBuild);
+							if(StrUtil.isNotEmpty(admEquipment.getFloorId())){
+								Map<String, Object> infos = new HashMap<String,Object>(16);
+								infos.put("$remove", Arrays.asList("floorId"));
+								admEquipment.setInfos(infos);
+								removeflBd = 2;
+							}
+						}
+					}else {
+						String[] str = flowBuild.split("-");
+						if(str[0].startsWith("Bd")){
+							admEquipment.setBuildingId(str[0]);
+							admEquipment.setFloorId(str[1]);
+						}else{
+							admEquipment.setBuildingId(str[1]);
+							admEquipment.setFloorId(str[0]);
+						}
+						removeflBd = 3;
+					}
+					admEquipment.setFlowBuild(null);
+				}else{
+					if(StrUtil.isAllNotEmpty(admEquipment.getBuildingId(),admEquipment.getFloorId())){
+						Map<String, Object> infos = new HashMap<String,Object>(16);
+						infos.put("$remove",Arrays.asList("floorId","buildingId"));
+						admEquipment.setInfos(infos);
+						removeflBd = 3;
+					}
+				}
+				//删除关系 然后重建
+				if(removeflBd == 3 || removeflBd == 2){
+					node.put("relCode", "Eq2Fl");
+					node.put("objFrom", equipId);
+					criteria.setCriteria(node);
+					relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+				}
+				if(removeflBd == 3 || removeflBd == 1){
+					node.put("relCode", "Eq2Bd");
+					node.put("objFrom", equipId);
+					criteria.setCriteria(node);
+					relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+				}
 			});
 
 			List<RelationDTO> relationDTOList = new ArrayList<>(vos.size());
@@ -204,27 +242,23 @@ public class AdmEquipmentController {
 				relationService.doSave(AdmContextUtil.toDmpContext(), relationDTOList);
 			}
 			//处理设备更新特殊数据
-            List<AdmEquipment> equipmentList = new ArrayList<>(vos.size());
             vos.stream().forEach(equipment -> {
-                if(CollUtil.isNotEmpty(equipment.getInfos())){
-                    AdmEquipment admEquipment = new AdmEquipment();
-                    admEquipment.setId(equipment.getId());
-                    admEquipment.setInfos(equipment.getInfos());
-                    ObjectNode objectNode = JsonNodeUtils.toObjectNode(admEquipment, "infos", null);
-                    AdmEquipment admEquipmentNew = JsonNodeUtils.toEntity(objectNode, AdmEquipment.class, "infos");
-                    if(CollUtil.isNotEmpty(equipment.getNullList())){
-                    	admEquipmentNew.setNullList(equipment.getNullList());
-					}
-                    if(StrUtil.isNotEmpty(equipment.getFloorId())){
-                    	admEquipmentNew.setFloorId(equipment.getFloorId());
+				//特殊处理位置信息
+				if(StrUtil.isNotEmpty(equipment.getBimLocation())){
+					Map<String,Object> infos = equipment.getInfos();
+					if(CollUtil.isEmpty(infos)){
+						infos = new HashMap<String, Object>();
+						infos.put("bimLocation", equipment.getBimLocation());
+						equipment.setInfos(infos);
 					}
-					if(StrUtil.isNotEmpty(equipment.getBuildingId())){
-						admEquipmentNew.setBuildingId(equipment.getBuildingId());
-					}
-                    equipmentList.add(admEquipmentNew);
+				}
+                if(CollUtil.isNotEmpty(equipment.getInfos())){
+                	Object localId = equipment.getInfos().get("localId");
+                   if(localId != null && StrUtil.isNotEmpty(localId.toString())){
+						equipment.setLocalId(localId.toString());
+				   }
                 }
             });
-            vos = equipmentList;
         }
         vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
         return AdmResponse.success(vos);

+ 8 - 8
src/main/java/com/persagy/proxy/object/controller/AdmISpaceController.java

@@ -1,15 +1,15 @@
 package com.persagy.proxy.object.controller;
 
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
-import com.persagy.proxy.object.model.AdmISpace;
+import com.persagy.dmp.common.utils.JsonHelper;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.object.service.IAdmISpaceService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
+import com.persagy.proxy.object.model.AdmISpace;
+import com.persagy.proxy.object.service.IAdmISpaceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -105,15 +105,15 @@ public class AdmISpaceController {
      */
     @PostMapping("/query")
     public AdmResponse query(@RequestBody JSONObject param) throws Exception {
-        AdmQueryCriteria request = new AdmQueryCriteria();
+        AdmQueryCriteria request = JsonHelper.toSingleEntity(param, AdmQueryCriteria.class);
         request.setName(AdmISpace.OBJ_TYPE);
-        request.setPageNumber(null==param.getInteger("pageNumber")?1:param.getInteger("pageNumber"));
-        request.setPageSize(null==param.getInteger("pageSize")?1:param.getInteger("pageSize"));
         if (StrUtil.isNotBlank(param.getString("floorId"))){
             String filters = " floorId = '"+param.getString("floorId")+"' ";
-            request.setFilters(filters);
+            request.addFilters(filters);
         }
-        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmISpace.class);
+        AdmResponse admResponse = service.doQuery(AdmContextUtil.toDmpContext(), request, AdmISpace.class);
+        admResponse.setMessage(param.getString("floorId"));
+        return admResponse;
     }
 
 }

+ 3 - 11
src/main/java/com/persagy/proxy/object/controller/AdmShaftController.java

@@ -374,20 +374,12 @@ public class AdmShaftController {
     public AdmResponse queryUnZoneSp(@QueryParam("shaftId") String shaftId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装条件
-        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
         if(!StrUtil.isNotEmpty(shaftId)) {
             return AdmResponse.failure("必填项:shaftId(竖井id)");
         }
-        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
-        ObjectNode relationTO = JsonNodeFactory.instance.objectNode();
-        ArrayNode arrayNode = relationTO.putObject("objFrom").putArray("$notcontains");
-        arrayNode.add(shaftId);
-        relationTO.put("relCode", "Sh2Sp");
-        relationTO.put("graphCode","ArchSubset");
-        criteria.putPOJO("relationTo", relationTO);
-
-        criteria.put("objType", "space");
-        queryCriteria.setCriteria(relationTO);
+        request.setName(AdmSpace.OBJ_TYPE);
+        request.resetRelationCond(false, "ArchSubset", "Sh2Sp", AdmSpace.OBJ_TYPE, shaftId, false);
+        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
         List<ObjectNode> spaceList = DigitalObjectFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(), null, queryCriteria);
         if(CollUtil.isNotEmpty(spaceList)){
             List<AdmSpace> vos = JSONUtil.toList(spaceList.toString(), AdmSpace.class);

+ 30 - 20
src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java

@@ -8,7 +8,6 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
-import com.persagy.dmp.common.model.entity.BaseEntity;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.handler.SpaceRelationInfoHandler;
 import com.persagy.proxy.adm.request.*;
@@ -89,7 +88,7 @@ public class AdmSpaceController {
             AdmResponse admResponse = AdmResponse.success(vos);
             ObjectNode admResponseObj = JsonNodeUtils.toObjectNode(admResponse, null,null);
             ArrayNode arrayNode = JsonNodeUtils.toArrayNode(vos,null,null);
-            admResponseObj.putArray("entityList").add(arrayNode);
+            admResponseObj.putPOJO("entityList",arrayNode);
             return admResponseObj;
         }else{
             return JsonNodeUtils.toObjectNode(AdmResponse.failure(msg), null,null);
@@ -125,36 +124,26 @@ public class AdmSpaceController {
     public AdmResponse update(@RequestBody AdmCreateRequest<AdmSpace> createRequest, @QueryParam("projectId") String projectId) throws Exception {
         List<AdmSpace> vos = CollUtil.newArrayList(createRequest.getContent());
         if(CollUtil.isNotEmpty(vos)) {
-            Map<String, AdmSpace> admSpaceMap = CollUtil.fieldValueMap(vos, BaseEntity.PROP_ID);
             AdmRelationTypeEnum typeEnumBd = AdmRelationTypeEnum.BD2SP;
-
             AdmRelationTypeEnum typeEnumFl = AdmRelationTypeEnum.FL2SP;
             QueryCriteria criteria = new QueryCriteria();
             ObjectNode node = JsonNodeFactory.instance.objectNode();
 
             List<RelationDTO> relationDTOList = new ArrayList<>(vos.size());
             vos.stream().forEach(admSpace -> {
-                //删除关系 然后重建
-                node.put("relCode", typeEnumBd.getRelCode());
-                node.put("objTo", admSpace.getId());
-                node.put("graphCode", typeEnumBd.getGraphCode());
-                criteria.setCriteria(node);
-                relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
-
-                node.put("relCode", typeEnumFl.getRelCode());
-                node.put("objTo",  admSpace.getId());
-                node.put("graphCode", typeEnumFl.getGraphCode());
-                criteria.setCriteria(node);
-                relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
                 //处理建筑 楼层信息点
+                int removeflBd = 0 ;//关系处理 0 不删除 1 删除bd 2 删除fl 3 都删除
                 if(StrUtil.isNotEmpty(admSpace.getFlowBuild())){
                     String flowBuild = admSpace.getFlowBuild();
                     if(!flowBuild.contains("-")){
                         if(flowBuild.startsWith("Bd")){
                             admSpace.setBuildingId(flowBuild);
-                            Map<String, Object> infos = new HashMap<String,Object>(16);
-                            infos.put("$remove", Arrays.asList("floorId"));
-                            admSpace.setInfos(infos);
+                            if(StrUtil.isNotEmpty(admSpace.getFloorId())){
+                                Map<String, Object> infos = new HashMap<String,Object>(16);
+                                infos.put("$remove", Arrays.asList("floorId"));
+                                admSpace.setInfos(infos);
+                                removeflBd = 2;
+                            }
                         }
                     }else {
                         String[] str = flowBuild.split("-");
@@ -165,12 +154,29 @@ public class AdmSpaceController {
                             admSpace.setBuildingId(str[1]);
                             admSpace.setFloorId(str[0]);
                         }
+                        removeflBd = 3;
                     }
                     admSpace.setFlowBuild(null);
                 }else{
                     Map<String, Object> infos = new HashMap<String,Object>(16);
                     infos.put("$remove",Arrays.asList("floorId","buildingId"));
                     admSpace.setInfos(infos);
+                    removeflBd = 3;
+                }
+                //删除关系 然后重建
+                if(removeflBd == 3 || removeflBd == 2){
+                    node.put("relCode", typeEnumFl.getRelCode());
+                    node.put("objTo",  admSpace.getId());
+                    node.put("graphCode", typeEnumFl.getGraphCode());
+                    criteria.setCriteria(node);
+                    relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
+                }
+                if(removeflBd == 3 || removeflBd == 1){
+                    node.put("relCode", typeEnumBd.getRelCode());
+                    node.put("objTo", admSpace.getId());
+                    node.put("graphCode", typeEnumBd.getGraphCode());
+                    criteria.setCriteria(node);
+                    relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
                 }
             });
             vos.stream().forEach(space -> {
@@ -377,12 +383,16 @@ public class AdmSpaceController {
         list.add("localId");
         list.add("localName");
         list.add("outline");
+        list.add("classCode");
+        list.add("buildingId");
+        list.add("floorId");
+        list.add("state");
         list.add("floorSequenceId");
         list.add("modelId");
         list.add("infos");
         list.add("properties");
         request.setProjection(list);
-        AdmResponse response = service.doQuerySpaces( AdmContextUtil.toDmpContext(), request);
+        AdmResponse response = service.doQuerySpaces(AdmContextUtil.toDmpContext(), request);
         ObjectNode objectNode = JsonNodeUtils.toObjectNode(response, null, null);
         if(StrUtil.isNotEmpty(request.getZoneType())){
             objectNode.put("zoneType", request.getZoneType());

+ 8 - 224
src/main/java/com/persagy/proxy/object/controller/AdmSystemController.java

@@ -38,10 +38,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.json.JsonObject;
 import javax.validation.constraints.NotNull;
 import javax.ws.rs.QueryParam;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * Adm 系统 API
@@ -55,10 +52,6 @@ public class AdmSystemController {
     @Autowired
     private IAdmSystemService service;
     @Autowired
-    private IAdmBuildingService buildingService;
-    @Autowired
-    private IAdmFloorService floorService;
-    @Autowired
     private IAdmRelationService relationService;
 
     /**
@@ -72,7 +65,7 @@ public class AdmSystemController {
     public AdmResponse count(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmSystem.OBJ_TYPE);
         request.setOnlyCount(true);
-        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
+        return service.query(request);
     }
 
     /**
@@ -184,7 +177,7 @@ public class AdmSystemController {
     @GetMapping("/export")
     public AdmResponse exportInfos(@RequestBody AdmQueryCriteria request) {
         request.setName(AdmSystem.OBJ_TYPE);
-        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
+        return service.query(request);
     }
 
     /**
@@ -242,7 +235,7 @@ public class AdmSystemController {
             response.setPageSize(request.getPageSize());
             return response;
         }else {
-            return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
+            return service.query(request);
         }
     }
 
@@ -263,218 +256,9 @@ public class AdmSystemController {
      */
     @PostMapping("/query-new")
     public AdmResponse queryNew(@QueryParam("buildingId") String buildingId,
-                                @QueryParam("floorId") String floorId, @RequestBody AdmQueryCriteria request) throws Exception {
-        request.setName(AdmSystem.OBJ_TYPE);
-        AdmResponse syses = new AdmResponse();
-        List<AdmSystem> admSystemList = new ArrayList<>();
-        if(StrUtil.isAllEmpty(buildingId,floorId)){
-            //case one 查询全部系统,级联建筑,建筑级联楼层
-
-            AdmQueryCriteria admQueryCriteriaFl = new AdmQueryCriteria();
-            admQueryCriteriaFl.setName("floorList");
-            List<AdmQueryCriteria> cascadeFlBd = new ArrayList<>(1);
-            AdmQueryCriteria admQueryCriteriaBdFl = new AdmQueryCriteria();
-            admQueryCriteriaBdFl.setName("building");
-            cascadeFlBd.add(admQueryCriteriaBdFl);
-            admQueryCriteriaFl.setCascade(cascadeFlBd);
-
-            List<AdmQueryCriteria> cascade = new ArrayList<>(1);
-            cascade.add(admQueryCriteriaFl);
-            request.setCascade(cascade);
-            syses = service.doQuery(AdmContextUtil.toDmpContext(),request,AdmSystem.class);
-            //处理数据 BuildingFloorInfo
-            if(CollUtil.isNotEmpty(syses.getContent())){
-                admSystemList = (List<AdmSystem>) syses.getContent();
-                admSystemList.stream().forEach(admSystem -> {
-                    List<ObjectNode> buildingFloorInfoList = new ArrayList<>();
-                    List<AdmFloor> admFloorList = admSystem.getFloorList();
-                    if(CollUtil.isNotEmpty(admFloorList)){
-                        admFloorList.stream().forEach(admFloor -> {
-                            ObjectNode infobd = JsonNodeFactory.instance.objectNode();
-                            infobd.put("BuildID",admFloor.getBuildingId());
-                            infobd.put("BuildName",admFloor.getBuilding() != null ? admFloor.getBuilding().getLocalName() : "");
-                            if(!buildingFloorInfoList.contains(infobd)){
-                                buildingFloorInfoList.add(infobd);
-                            }
-                            ObjectNode infobd1 = infobd.deepCopy();
-                            infobd1.put("FloorID",admFloor.getId());
-                            infobd1.put("FloorName",admFloor.getLocalName());
-                            buildingFloorInfoList.add(infobd1);
-                        });
-                    }
-                    admSystem.setFloorList(null);
-                    admSystem.setBuildingFloorInfoList(buildingFloorInfoList);
-                });
-                syses.setContent(CollUtil.isEmpty(admSystemList) ? new ArrayList<>(1) : admSystemList);
-            }
-        }else{
-            QueryCriteria rwdQueryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
-            ObjectNode criteria = rwdQueryCriteria.getCriteria();
-            if(JSONUtil.isNull(criteria)){
-                return AdmResponse.failure("请求参数错误");
-            }
-            if (StrUtil.isNotEmpty(floorId)) {
-                if(!"1".equals(floorId)){
-                    //case two 明确建筑、明确楼层的 系统
-                    JSONObject relationFrom = new JSONObject();
-                    relationFrom.put("relCode", "Sy2Fl");
-                    relationFrom.put("graphCode", "MechInArch");
-                    relationFrom.put("objTo", floorId);
-                    criteria.putPOJO("relationFrom",relationFrom);
-                    rwdQueryCriteria.setCriteria(criteria);
-                    syses = service.doQuery(AdmContextUtil.toDmpContext(), rwdQueryCriteria, AdmSystem.class);
-                    if (CollUtil.isNotEmpty(syses.getContent())) {
-                        admSystemList = (List<AdmSystem>) syses.getContent();
-                    }
-
-                }else if("1".equals(floorId)){
-                    //case three 明确建筑 不明确楼层
-                    syses = queryNotSureObj(buildingId, rwdQueryCriteria);
-                    if(null != syses && CollUtil.isNotEmpty(syses.getContent())){
-                        admSystemList = (List<AdmSystem>) syses.getContent();
-                    }
-                }
-                if(CollUtil.isNotEmpty(admSystemList)){
-                    //处理数据 BuildingFloorInfo
-                    admSystemList = dealBdFlInfo(floorId,buildingId,admSystemList);
-                    syses.setContent(admSystemList);
-                }
-            }else if(StrUtil.isEmpty(floorId) && StrUtil.isNotEmpty(buildingId)){
-                if(!"1".equals(buildingId)){
-                    //case two 明确建筑、明确楼层的 系统
-                    JSONObject relationFrom = new JSONObject();
-                    relationFrom.put("relCode", "Sy2Bd");
-                    relationFrom.put("graphCode", "MechInArch");
-                    relationFrom.put("objTo", buildingId);
-                    criteria.putPOJO("relationFrom",relationFrom);
-                    rwdQueryCriteria.setCriteria(criteria);
-                    syses = service.doQuery(AdmContextUtil.toDmpContext(), rwdQueryCriteria, AdmSystem.class);
-                }else if("1".equals(buildingId)){
-                    syses = queryNotSureObj(null, rwdQueryCriteria);
-                }
-                admSystemList = (List<AdmSystem>) syses.getContent();
-                if(CollUtil.isNotEmpty(admSystemList)){
-                    //处理数据 BuildingFloorInfo
-                    admSystemList = dealBdFlInfo(floorId,buildingId,admSystemList);
-                    syses.setContent(admSystemList);
-                }
-            }else{
-                //处理通用返回结果
-                if(StrUtil.isNotEmpty(buildingId) && buildingId.equals("1")){
-                    //case four 未明确建筑
-                    syses = queryNotSureObj(null, rwdQueryCriteria);
-                    admSystemList = (List<AdmSystem>) syses.getContent();
-                    if(CollUtil.isNotEmpty(admSystemList)){
-                        //处理数据 BuildingFloorInfo
-                        admSystemList = dealBdFlInfo(null,null, admSystemList);
-                    }
-                }
-            }
-            if(CollUtil.isNotEmpty(admSystemList))
-                syses.setTotal(admSystemList.size()*1l);
-
-        }
-        if(CollUtil.isNotEmpty(admSystemList)){
-            syses.setContent(admSystemList);
-        }else{
-            syses.setContent(new ArrayList<>(1));
-        }
-        return syses;
-    }
-
-    /**
-     * 查询不确定建筑/楼层的系统
-     * @param buildingId
-     * @param rwdQueryCriteria
-     * @return
-     */
-    private AdmResponse queryNotSureObj(String buildingId, QueryCriteria rwdQueryCriteria){
-        RequestData requestData = new RequestData();
-        String classCode = rwdQueryCriteria.getCriteria().get("classCode").textValue();
-        if(StrUtil.isNotEmpty(classCode)){
-            requestData.setClassCode(classCode);
-        }
-        if(StrUtil.isNotEmpty(buildingId)){
-            requestData.setBuildingId(buildingId);
-        }
-        requestData.setProjectId(AdmContextUtil.toDmpContext().getProjectId());
-        requestData.setGraphCode(AdmContextUtil.toDmpContext().getGroupCode());
-        requestData.setObjType(AdmSystem.OBJ_TYPE);
-        requestData.setPage(rwdQueryCriteria.getPage());
-        requestData.setSize(rwdQueryCriteria.getSize());
-        Page<Map<String,Object>> result = DigitalObjectSimpleFacade.queryNotSureSystem(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(),null, requestData);
-        if(CollUtil.isNotEmpty(result.getRecords())){
-            AdmResponse response = new AdmResponse();
-            response.setPageSize(Integer.parseInt(String.valueOf(result.getSize())));
-            response.setPageNumber(Integer.parseInt(String.valueOf(result.getCurrent())));
-            response.setResult(DmpResult.SUCCESS);
-            response.setContent(AdmEntityTransferUtil.toAdmMultiEntity(result.getRecords(),null,AdmSystem.class));
-            response.setTotal(result.getTotal());
-            return response;
-        }else{
-            return AdmResponse.success();
-        }
-    }
-
-    /**
-     * 处理建筑楼层信息 建筑确定,楼层可为空
-     * @param floorId
-     * @param buildingId
-     * @param admSystemList
-     * @return
-     */
-    private List<AdmSystem> dealBdFlInfo(String floorId, String buildingId, List<AdmSystem> admSystemList){
-        if(CollUtil.isEmpty(admSystemList)){
-            return null;
-        }
-        if(StrUtil.isEmpty(buildingId)){//处理成adm目标格式
-            List<ObjectNode> nullList = new ArrayList<>(0);
-            admSystemList.stream().forEach(admSystem -> {
-                admSystem.setBuildingFloorInfoList(nullList);
-            });
-            return admSystemList;
-        }
-        AdmResponse buildings = null;
-        if(StrUtil.isNotEmpty(buildingId)){
-            AdmQueryCriteria admQueryCriteria = getAdmQueryCriteria(AdmBuilding.OBJ_TYPE, buildingId);
-            buildings = buildingService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmBuilding.class);
-        }
-        AdmResponse floors = null;
-        if(StrUtil.isNotEmpty(floorId)){
-            AdmQueryCriteria admQueryCriteria = getAdmQueryCriteria(AdmFloor.OBJ_TYPE, floorId);
-            floors = floorService.query(admQueryCriteria);
-        }
-
-        ObjectNode buildingFloorInfo = JsonNodeFactory.instance.objectNode();
-        if (CollUtil.isNotEmpty(buildings.getContent())) {
-            AdmBuilding admBuilding = (AdmBuilding) buildings.getContent().get(0);
-            buildingFloorInfo.put("BuildID",admBuilding.getId());
-            buildingFloorInfo.put("BuildName",admBuilding.getLocalName());
-        }
-        if (null!=floors && CollUtil.isNotEmpty(floors.getContent())) {
-            ObjectNode buildingFloorInfoFl = JsonNodeFactory.instance.objectNode();
-            buildingFloorInfoFl = buildingFloorInfo.deepCopy();
-            AdmFloor floor = (AdmFloor) floors.getContent().get(0);
-            buildingFloorInfoFl.put("FloorID",floor.getId());
-            buildingFloorInfoFl.put("FloorName",floor.getLocalName());
-        }
-        if(JSONUtil.isNull(buildingFloorInfo) || buildingFloorInfo.isNull() || !buildingFloorInfo.fieldNames().hasNext()){
-            admSystemList.stream().forEach(admSystem -> {
-                admSystem.setBuildingFloorInfoList(new ArrayList<>(1));
-            });
-            return admSystemList;
-        }
-        admSystemList.stream().forEach(admSystem -> {
-            admSystem.setBuildingFloorInfoList(Arrays.asList(buildingFloorInfo));
-        });
-        return admSystemList;
-    }
-
-    private AdmQueryCriteria getAdmQueryCriteria(String objType, String Id){
-        AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
-        admQueryCriteria.setName(objType);
-        admQueryCriteria.setFilters("id = " + Id);
-        return  admQueryCriteria;
+                                @QueryParam("floorId") String floorId,
+                                @RequestBody AdmQueryCriteria request) throws Exception {
+        return service.queryNewInternal(buildingId,floorId,request);
     }
 
     /**
@@ -487,7 +271,7 @@ public class AdmSystemController {
     @PostMapping("/query-bdfl")
     public AdmResponse queryUnBdFl(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmSystem.OBJ_TYPE);
-        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
+        return service.query(request);
     }
 
     /**

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

@@ -116,6 +116,8 @@ public class AdmEquipment extends AdmBaseEntity<AdmEquipment> {
     private String objectType = OBJ_TYPE;
     /** 设备分类 */
     private Map<String, String> equipCategory;
+    /** 更新的时候使用此字段保存楼层和建筑id */
+    private String flowBuild;
 
     /** 资产信息实体类   资产对应设备设施关系 资产→设备设施*/
     @CascadeColumn(graphCode = "Property2Mech", relCode = "Pe2Eq", selectToObj = false)

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

@@ -1,5 +1,6 @@
 package com.persagy.proxy.object.model;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.proxy.adm.annotations.CascadeColumn;
 import com.persagy.proxy.adm.model.AdmBaseEntity;
@@ -81,6 +82,7 @@ public class AdmFloor extends AdmBaseEntity<AdmFloor> {
 
     /** 空间列表 非中台信息*/
     @CascadeColumn(graphCode = "ArchSubset", relCode = "Fl2Sp")
+    @JsonProperty("zoneSpaceList")
     private List<AdmSpace> spaceList;
 
     /** 楼层平面图地址 */

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

@@ -1,5 +1,6 @@
 package com.persagy.proxy.object.model;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.persagy.proxy.adm.annotations.CascadeColumn;
 import com.persagy.proxy.adm.model.AdmBaseEntity;
@@ -96,6 +97,7 @@ public class AdmSpace extends AdmBaseEntity<AdmSpace> {
     /** BIM模型中坐标 */
     private String bimLocation;
     /** 二维码图片 */
+    @JsonProperty("ai")
     private Boolean isAi = false;
     /** 垂直交通关系空间id */
     private Set<String> spaceIdList;

+ 22 - 0
src/main/java/com/persagy/proxy/object/service/IAdmSystemService.java

@@ -1,6 +1,8 @@
 package com.persagy.proxy.object.service;
 
 import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmBaseService;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.object.model.AdmSystem;
@@ -13,6 +15,15 @@ import java.util.List;
  * @date 2021/8/18
  */
 public interface IAdmSystemService extends IAdmBaseService<AdmSystem> {
+    /***
+     * Description: 查询系统数据
+     * @param request : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmResponse
+     * @author : lijie
+     * @date :2021/11/2 14:04
+     * Update By lijie 2021/11/2 14:04
+     */
+    AdmResponse query(AdmQueryCriteria request);
 
     /**
      * 补充系统分类名称属性
@@ -26,4 +37,15 @@ public interface IAdmSystemService extends IAdmBaseService<AdmSystem> {
      * @return : void
      */
     void processDmpCriteria(QueryCriteria dmpRequest);
+    /***
+     * Description: 查询系统信息-系统建筑楼层一对多
+     * @param buildingId : 建筑id
+     * @param floorId : 楼层id
+     * @param request : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmResponse  
+     * @author : lijie
+     * @date :2021/11/2 13:51
+     * Update By lijie 2021/11/2 13:51
+     */
+    AdmResponse queryNewInternal(String buildingId, String floorId, AdmQueryCriteria request);
 }

+ 17 - 7
src/main/java/com/persagy/proxy/object/service/impl/AdmSpaceServiceImpl.java

@@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.collect.Sets;
 import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.constant.CommonConstant;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.common.model.entity.BaseEntity;
@@ -76,7 +77,7 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
 
     @Override
     public List<AdmSpace> doInsertExt(InstanceUrlParam context, Class<AdmSpace> clazz, List<AdmSpace> voList) {
-        Map<String, AdmSpace> spaceMapByFlId = CollUtil.fieldValueMap(voList, "floorId");
+        Map<String, List<AdmSpace>> spaceMapByFlId = voList.stream().collect(Collectors.groupingBy(AdmSpace::getFloorId));
         //查询空间中floorId 对应的floor
         List<ObjectNode> floors = queryFloorsByFloorIds(context, spaceMapByFlId.keySet());
         if(CollUtil.isNotEmpty(floors)){
@@ -572,16 +573,25 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
      * @param floorList
      * @return
      */
-    private List<AdmSpace> processHeight(Map<String, AdmSpace> spaceMapByFlId, List<ObjectNode> floorList){
-    	List<AdmSpace> resultList = new ArrayList<AdmSpace>();
+    private List<AdmSpace> processHeight(Map<String, List<AdmSpace>> spaceMapByFlId, List<ObjectNode> floorList){
+    	List<AdmSpace> resultList = new ArrayList<>();
     	floorList.forEach(node -> {
     		try {
-    			if(node.has("height")){
+    		    if (!node.has("id")
+                        || !node.get("id").isTextual()){
+    		        return;
+                }
+                List<AdmSpace> spaces = spaceMapByFlId.get(node.get("id").asText());
+    		    if (CollUtil.isEmpty(spaces)){
+    		        return;
+                }
+                if(node.has("height")){
                 	String height = node.get("height").asText();
                 	if (StrUtil.isNotBlank(height)) {
-                		AdmSpace admSpace = spaceMapByFlId.get(node.get("id").asText());
-                        admSpace.setHeight(Float.parseFloat(height));
-                        resultList.add(admSpace);
+                        for (AdmSpace admSpace : spaces) {
+                            admSpace.setHeight(Float.parseFloat(height));
+                            resultList.add(admSpace);
+                        }
 					}
                 }
 			} catch (Exception e) {}

+ 251 - 11
src/main/java/com/persagy/proxy/object/service/impl/AdmSystemServiceImpl.java

@@ -1,28 +1,42 @@
 package com.persagy.proxy.object.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
 import com.persagy.proxy.adm.constant.GraphCodeEnum;
 import com.persagy.proxy.adm.constant.RelCodeEnum;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
+import com.persagy.proxy.adm.utils.AdmEntityTransferUtil;
+import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
+import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.dictionary.model.AdmDict;
 import com.persagy.proxy.dictionary.model.AdmObjectType;
 import com.persagy.proxy.dictionary.service.IAdmDictService;
-import com.persagy.proxy.object.model.AdmEquipment;
-import com.persagy.proxy.object.model.AdmSystem;
-import com.persagy.proxy.object.model.AdmSystemCategory;
+import com.persagy.proxy.object.model.*;
+import com.persagy.proxy.object.service.IAdmBuildingService;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
+import com.persagy.proxy.object.service.IAdmFloorService;
 import com.persagy.proxy.object.service.IAdmSystemService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -32,18 +46,27 @@ import java.util.Map;
  * @date 2021/8/18
  */
 @Service
+@RequiredArgsConstructor
+@Slf4j
 public class AdmSystemServiceImpl extends AbstractAdmBaseServiceImpl<AdmSystem> implements IAdmSystemService {
 
-    @Autowired
-    private IAdmDictService dictService;
-    @Autowired
-    private IAdmEquipmentService equipmentService;
-
+    private final IAdmDictService dictService;
+    private final IAdmEquipmentService equipmentService;
+    private final IAdmBuildingService buildingService;
+    private final IAdmFloorService floorService;
+    /***
+     * Description: 查询系统数据
+     * @param request : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmResponse
+     * @author : lijie
+     * @date :2021/11/2 14:04
+     * Update By lijie 2021/11/2 14:04
+     */
     @Override
-    public AdmResponse doQuery(InstanceUrlParam context, AdmQueryCriteria request, Class<AdmSystem> clazz) {
-        AdmResponse response = super.doQuery(context, request, clazz);
+    public AdmResponse query(AdmQueryCriteria request) {
+        AdmResponse response = this.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
         // 系统需要补充分类名称属性
-        ensureSpecialValues(context, (List<AdmSystem>) response.getContent());
+        ensureSpecialValues(AdmContextUtil.toDmpContext(), (List<AdmSystem>) response.getContent());
         return response;
     }
 
@@ -113,4 +136,221 @@ public class AdmSystemServiceImpl extends AbstractAdmBaseServiceImpl<AdmSystem>
             criteria.remove("buildingId");
         }
     }
+
+    @Override
+    public AdmResponse queryNewInternal(String buildingId, String floorId, AdmQueryCriteria request) {
+        constructQueryNewParam(buildingId,floorId,request);
+        QueryCriteria rwdQueryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
+        if(JSONUtil.isNull(rwdQueryCriteria.getCriteria())){
+            return AdmResponse.failure("请求参数错误");
+        }
+        if (StrUtil.isNotBlank(floorId) && "1".equals(floorId)){
+            // 楼层id不为空且为1
+            AdmResponse admResponse = queryNotSureObj(buildingId, rwdQueryCriteria);
+            dealBdFlInfo(floorId,buildingId, (List<AdmSystem>) admResponse.getContent());
+            return admResponse;
+        }
+        if(StrUtil.isEmpty(floorId) && StrUtil.isNotEmpty(buildingId) && "1".equals(buildingId)){
+            // 楼层id为空且建筑id不为空且建筑id为1
+            AdmResponse admResponse = queryNotSureObj(null, rwdQueryCriteria);
+            dealBdFlInfo(floorId,buildingId, (List<AdmSystem>) admResponse.getContent());
+            return admResponse;
+        }
+        return queryNewInternal(request);
+    }
+
+    /***
+     * Description: 构建query-new接口的请求参数
+     * @param buildingId : 建筑id
+     * @param floorId : 楼层id
+     * @param request : 请求参数
+     * @return : void
+     * @author : lijie
+     * @date :2021/11/2 11:57
+     * Update By lijie 2021/11/2 11:57
+     */
+    private void constructQueryNewParam(String buildingId, String floorId, AdmQueryCriteria request) {
+        request.setName(AdmSystem.OBJ_TYPE);
+        AdmQueryCriteria admQueryCriteriaFl = new AdmQueryCriteria();
+        admQueryCriteriaFl.setName("floorList");
+        List<AdmQueryCriteria> cascadeFlBd = new ArrayList<>(1);
+        AdmQueryCriteria admQueryCriteriaBdFl = new AdmQueryCriteria();
+        admQueryCriteriaBdFl.setName("building");
+        cascadeFlBd.add(admQueryCriteriaBdFl);
+        admQueryCriteriaFl.setCascade(cascadeFlBd);
+        List<AdmQueryCriteria> cascade = new ArrayList<>(1);
+        cascade.add(admQueryCriteriaFl);
+        request.setCascade(cascade);
+        // 楼层id不为空且楼层id不为1,加上关系筛选
+        if (StrUtil.isNotEmpty(floorId) && !"1".equals(floorId)) {
+            String filters = request.getFilters();
+            if (StrUtil.isNotBlank(filters)){
+                request.setFilters(filters+"; floorId='"+floorId+"'");
+            }else {
+                request.setFilters("floorId='"+floorId+"'");
+            }
+            return;
+//
+//            JSONObject relationFrom = new JSONObject();
+//            relationFrom.put("relCode", "Sy2Fl");
+//            relationFrom.put("graphCode", "MechInArch");
+//            relationFrom.put("objTo", floorId);
+//            criteria.putPOJO("relationFrom",relationFrom);
+//            rwdQueryCriteria.setCriteria(criteria);
+//            return rwdQueryCriteria;
+        }
+        // 楼层id为空且建筑id不为空且建筑id不为1,加上关系筛选
+        if(StrUtil.isEmpty(floorId) && StrUtil.isNotEmpty(buildingId) && !"1".equals(buildingId)){
+            String filters = request.getFilters();
+            if (StrUtil.isNotBlank(filters)){
+                request.setFilters(filters+";buildingId='"+buildingId+"'");
+            }else {
+                request.setFilters("buildingId='"+buildingId+"'");
+            }
+//            JSONObject relationFrom = new JSONObject();
+//            relationFrom.put("relCode", "Sy2Bd");
+//            relationFrom.put("graphCode", "MechInArch");
+//            relationFrom.put("objTo", buildingId);
+//            criteria.putPOJO("relationFrom",relationFrom);
+//            rwdQueryCriteria.setCriteria(criteria);
+//            return rwdQueryCriteria;
+        }
+    }
+
+    /***
+     * Description: 当楼层id和建筑id都为空时query-new接口的处理逻辑
+     * @param rwdQueryCriteria : 请求参数
+     * @return : com.persagy.proxy.adm.request.AdmResponse
+     * @author : lijie
+     * @date :2021/11/2 11:40
+     * Update By lijie 2021/11/2 11:40
+     */
+    private AdmResponse queryNewInternal(AdmQueryCriteria rwdQueryCriteria) {
+        AdmResponse syses = this.query(rwdQueryCriteria);
+        if (CollUtil.isEmpty(syses.getContent())){
+            syses.setContent(new ArrayList<>());
+            return syses;
+        }
+        //处理数据 BuildingFloorInfo
+        List<AdmSystem> admSystemList = (List<AdmSystem>) syses.getContent();
+        admSystemList.forEach(admSystem -> {
+            List<ObjectNode> buildingFloorInfoList = new ArrayList<>();
+            List<AdmFloor> admFloorList = admSystem.getFloorList();
+            if (CollUtil.isEmpty(admFloorList)){
+                admSystem.setFloorList(null);
+                admSystem.setBuildingFloorInfoList(buildingFloorInfoList);
+                return;
+            }
+            admFloorList.forEach(admFloor -> {
+                ObjectNode infobd = JsonNodeFactory.instance.objectNode();
+                infobd.put("BuildID",admFloor.getBuildingId());
+                infobd.put("BuildName",admFloor.getBuilding() != null ? admFloor.getBuilding().getLocalName() : "");
+                if(!buildingFloorInfoList.contains(infobd)){
+                    buildingFloorInfoList.add(infobd);
+                }
+                ObjectNode infobd1 = infobd.deepCopy();
+                infobd1.put("FloorID",admFloor.getId());
+                infobd1.put("FloorName",admFloor.getLocalName());
+                buildingFloorInfoList.add(infobd1);
+            });
+            admSystem.setFloorList(null);
+            admSystem.setBuildingFloorInfoList(buildingFloorInfoList);
+        });
+        syses.setContent(CollUtil.isEmpty(admSystemList) ? new ArrayList<>() : admSystemList);
+        return syses;
+    }
+
+    /**
+     * 查询不确定建筑/楼层的系统
+     * @param buildingId
+     * @param rwdQueryCriteria
+     * @return
+     */
+    private AdmResponse queryNotSureObj(String buildingId, QueryCriteria rwdQueryCriteria){
+        RequestData requestData = new RequestData();
+        String classCode = rwdQueryCriteria.getCriteria().get("classCode").textValue();
+        if(StrUtil.isNotEmpty(classCode)){
+            requestData.setClassCode(classCode);
+        }
+        if(StrUtil.isNotEmpty(buildingId)){
+            requestData.setBuildingId(buildingId);
+        }
+        requestData.setProjectId(AdmContextUtil.toDmpContext().getProjectId());
+        requestData.setGraphCode(AdmContextUtil.toDmpContext().getGroupCode());
+        requestData.setObjType(AdmSystem.OBJ_TYPE);
+        requestData.setPage(rwdQueryCriteria.getPage());
+        requestData.setSize(rwdQueryCriteria.getSize());
+        Page<Map<String,Object>> result = DigitalObjectSimpleFacade.queryNotSureSystem(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(),null, requestData);
+        if(CollUtil.isNotEmpty(result.getRecords())){
+            AdmResponse response = new AdmResponse();
+            response.setPageSize(Integer.parseInt(String.valueOf(result.getSize())));
+            response.setPageNumber(Integer.parseInt(String.valueOf(result.getCurrent())));
+            response.setResult(DmpResult.SUCCESS);
+            response.setContent(AdmEntityTransferUtil.toAdmMultiEntity(result.getRecords(),null,AdmSystem.class));
+            response.setTotal(result.getTotal());
+            return response;
+        }else{
+            return AdmResponse.success();
+        }
+    }
+
+    /**
+     * 处理建筑楼层信息 建筑确定,楼层可为空
+     * @param floorId
+     * @param buildingId
+     * @param admSystemList
+     * @return
+     */
+    private void dealBdFlInfo(String floorId, String buildingId, List<AdmSystem> admSystemList){
+        if(CollUtil.isEmpty(admSystemList)){
+            return;
+        }
+        if(StrUtil.isEmpty(buildingId)){//处理成adm目标格式
+            List<ObjectNode> nullList = new ArrayList<>(0);
+            admSystemList.forEach(admSystem -> {
+                admSystem.setBuildingFloorInfoList(nullList);
+            });
+            return;
+        }
+        AdmResponse buildings = null;
+        if(StrUtil.isNotEmpty(buildingId)){
+            AdmQueryCriteria admQueryCriteria = getAdmQueryCriteria(AdmBuilding.OBJ_TYPE, buildingId);
+            buildings = buildingService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmBuilding.class);
+        }
+        AdmResponse floors = null;
+        if(StrUtil.isNotEmpty(floorId)){
+            AdmQueryCriteria admQueryCriteria = getAdmQueryCriteria(AdmFloor.OBJ_TYPE, floorId);
+            floors = floorService.query(admQueryCriteria);
+        }
+
+        ObjectNode buildingFloorInfo = JsonNodeFactory.instance.objectNode();
+        if (CollUtil.isNotEmpty(buildings.getContent())) {
+            AdmBuilding admBuilding = (AdmBuilding) buildings.getContent().get(0);
+            buildingFloorInfo.put("BuildID",admBuilding.getId());
+            buildingFloorInfo.put("BuildName",admBuilding.getLocalName());
+        }
+        if (null!=floors && CollUtil.isNotEmpty(floors.getContent())) {
+            ObjectNode buildingFloorInfoFl = JsonNodeFactory.instance.objectNode();
+            buildingFloorInfoFl = buildingFloorInfo.deepCopy();
+            AdmFloor floor = (AdmFloor) floors.getContent().get(0);
+            buildingFloorInfoFl.put("FloorID",floor.getId());
+            buildingFloorInfoFl.put("FloorName",floor.getLocalName());
+        }
+        if(JSONUtil.isNull(buildingFloorInfo) || buildingFloorInfo.isNull() || !buildingFloorInfo.fieldNames().hasNext()){
+            admSystemList.forEach(admSystem -> {
+                admSystem.setBuildingFloorInfoList(new ArrayList<>(1));
+            });
+            return;
+        }
+        admSystemList.forEach(admSystem -> {
+            admSystem.setBuildingFloorInfoList(Collections.singletonList(buildingFloorInfo));
+        });
+    }
+
+    private AdmQueryCriteria getAdmQueryCriteria(String objType, String Id){
+        AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
+        admQueryCriteria.setName(objType);
+        admQueryCriteria.setFilters("id = " + Id);
+        return  admQueryCriteria;
+    }
 }

+ 36 - 9
src/main/java/com/persagy/proxy/relation/controller/RelationShContainSpBaseController.java

@@ -1,10 +1,14 @@
 package com.persagy.proxy.relation.controller;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
+import cn.hutool.core.comparator.CompareUtil;
+import cn.hutool.extra.spring.SpringUtil;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.persagy.dmp.digital.client.DigitalRelationFacade;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import org.checkerframework.checker.units.qual.C;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -138,7 +142,7 @@ public class RelationShContainSpBaseController {
         String shaftId = param.getString("shaftId");
         JSONArray spaceIdList = param.getJSONArray("spaceIdList");
         if(StrUtil.isBlank(shaftId) || CollUtil.isEmpty(spaceIdList)) {
-            return AdmResponse.failure("必填项:SpaceIdList(业务空间id列表)、ShaftID(竖井id),此方法不会覆盖以前的记录");
+            return AdmResponse.success("空间类型和空间列表不能为空");
         }
         // 创建关系对象.先删除,后添加
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
@@ -292,26 +296,49 @@ public class RelationShContainSpBaseController {
     public AdmResponse spaceTypeQuery(@RequestParam(value = "shaftId", required = false) String shaftId,
                               @RequestBody JSONObject param) throws Exception {
         // 组装上下文条件
-        //InstanceUrlParam context = AdmContextUtil.toDmpContext();
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         if (StrUtil.isBlank(shaftId)) {
         	shaftId = param.getString("shaftId");
 		}
         String groupCode = AppContext.getContext().getGroupCode();
 		String projectId = AppContext.getContext().getProjectId();
 		
-        List<ObjectTypeDefine> classList = this.relationReportService.queryClassList(groupCode, projectId, null, Sets.newHashSet(AdmObjectType.SPACE.getIndex()), null);
+        List<ObjectTypeDefine> classList = this.relationReportService.queryClassList(groupCode, projectId,
+                null, Sets.newHashSet(AdmObjectType.SPACE.getIndex()), null);
         if (CollectionUtil.isEmpty(classList)) {
         	return AdmResponse.success();
 		}
-        
-        JSONArray result = new JSONArray();
+        QueryCriteria queryCriteria = new QueryCriteria();
+        ObjectMapper objectMapper = SpringUtil.getBean(ObjectMapper.class);
+        ObjectNode objectNode = objectMapper.createObjectNode();
+        objectNode.put("graphCode", AdmRelationTypeEnum.SH2SP.getGraphCode());
+        objectNode.put("relCode", AdmRelationTypeEnum.SH2SP.getRelCode());
+        objectNode.put("objFrom", shaftId);
+        objectNode.put("valid", Boolean.TRUE);
+        queryCriteria.setCriteria(objectNode);
+        List<ObjectRelation> objectRelations = DigitalRelationFacade.query(context.getGroupCode(),
+                context.getProjectId(), context.getAppId(), context.getUserId(), queryCriteria);
+        if (CollUtil.isEmpty(objectRelations)){
+            return AdmResponse.success(new ArrayList<>());
+        }
+        Set<String> filterSpaceTypes = objectRelations.stream()
+                .filter(objectRelation -> StrUtil.isNotBlank(objectRelation.getRelValue()))
+                .map(ObjectRelation::getRelValue).collect(Collectors.toSet());
+        if (CollUtil.isEmpty(filterSpaceTypes)){
+            return AdmResponse.success(new ArrayList<>());
+        }
+        List<JSONObject> result = new ArrayList<>();
         for (ObjectTypeDefine objectTypeDefine : classList) {
+            if (!filterSpaceTypes.contains(objectTypeDefine.getCode())){
+                continue;
+            }
         	JSONObject temp = new JSONObject();
             temp.put("objectType", objectTypeDefine.getCode());
             temp.put("objectTypeName", objectTypeDefine.getName());
             result.add(temp);
 		}
-        
+        // 根据分区名称排序
+        result = result.stream().sorted(CompareUtil.comparingPinyin(obj -> obj.getString("objectTypeName"))).collect(Collectors.toList());
         return AdmResponse.success(result);
     }
 }

+ 8 - 3
src/main/java/com/persagy/proxy/relation/controller/RelationSpInSiController.java

@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.constant.CommonConstant;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.relation.model.SiInSpBase;
 import com.persagy.proxy.relation.model.SiInSpBaseList;
@@ -59,11 +60,14 @@ public class RelationSpInSiController {
         for (SiInSpBase siInSpBase : content) {
             String ispaceId = siInSpBase.getIspaceId();
             String spaceId = siInSpBase.getSpaceId();
-            String objectType = siInSpBase.getObjectType();
+            if (StrUtil.isBlank(type)){
+                type = siInSpBase.getClassCode();
+            }
             if (StrUtil.isEmpty(spaceId) || StrUtil.isBlank(ispaceId)) {
                 return AdmResponse.failure("必填项:ispaceId(元空间id)、spaceId(空间id)");
             }
-            RelationDTO relation = new RelationDTO(null, graphCode, relCode, objectType, spaceId, ispaceId);
+            RelationDTO relation = new RelationDTO(StrUtil.format(CommonConstant.DEFAULT_GRAPH_ID_FORMAT,graphCode),
+                    graphCode, relCode, type, spaceId, ispaceId);
             voList.add(relation);
         }
         service.doSave(AdmContextUtil.toDmpContext(), voList);
@@ -82,7 +86,8 @@ public class RelationSpInSiController {
         List<String> ispaceIdList = siInSpBaseList.getIspaceIdList();
         String spaceId = siInSpBaseList.getSpaceId();
         if (StrUtil.isEmpty(spaceId) || CollectionUtils.isEmpty(ispaceIdList)) {
-            return AdmResponse.failure("必填项:ispaceIdList(元空间id)、spaceId(空间id)");
+           // return AdmResponse.failure("必填项:ispaceIdList(元空间id)、spaceId(空间id)");
+            return AdmResponse.success();
         }
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SP2SI;

+ 13 - 9
src/main/java/com/persagy/proxy/relation/controller/RelationSyEqController.java

@@ -133,8 +133,8 @@ public class RelationSyEqController {
     public AdmResponse createDistinctEq(@RequestBody JSONObject param) throws Exception {
         String equipId = param.getString("equipId");
         JSONArray sysIdList = param.getJSONArray("sysIdList");
-        if(StringUtils.isEmpty(equipId) || CollUtil.isEmpty(sysIdList)) {
-            return AdmResponse.failure("必填项:EquipId(设备id)、sysIdList(系统id列表)");
+        if(StringUtils.isEmpty(equipId)) {
+            return AdmResponse.failure("必填项:EquipId(设备id)");
         }
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         QueryCriteria queryRequest = new QueryCriteria();
@@ -142,15 +142,19 @@ public class RelationSyEqController {
         node.put("graphCode", "MechSubset");
         node.put("relCode", "Sy2Eq");
         node.put("objTo", equipId);
+        //删除关系
         queryRequest.setCriteria(node);
         service.doDelete(context,queryRequest);
-        // 创建关系对象
-        List<RelationDTO> voList = new ArrayList<>();
-        sysIdList.forEach(item->{
-            voList.add(new RelationDTO(null, "MechSubset", "Sy2Eq", null, item.toString() , equipId));
-        });
-        // 组装上下文条件
-        service.doSave(context, voList);
+        if(!CollUtil.isEmpty(sysIdList)){
+            // 创建关系对象
+            List<RelationDTO> voList = new ArrayList<>();
+            sysIdList.forEach(item->{
+                voList.add(new RelationDTO(null, "MechSubset", "Sy2Eq", null, item.toString() , equipId));
+            });
+            // 组装上下文条件
+            service.doSave(context, voList);
+        }
+
         return AdmResponse.success();
     }
 

+ 64 - 19
src/main/java/com/persagy/proxy/relation/controller/RelationSyInBdController.java

@@ -1,9 +1,15 @@
 package com.persagy.proxy.relation.controller;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.spring.SpringUtil;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.constant.CommonConstant;
+import com.persagy.dmp.digital.client.DigitalRelationFacade;
+import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmRelationService;
@@ -22,6 +28,8 @@ import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * @author zhangwencheng
@@ -103,41 +111,56 @@ public class RelationSyInBdController {
 
     /**
      * 创建系统所在建筑关系
-     * @param syInFlList
-     * @param projectId
+     * @param syInFlList: 请求参数
      * @return
      * @throws Exception
      */
     @PostMapping("/link-bd")
     public AdmResponse createBd(@RequestBody SyInBdList syInFlList) throws Exception {
-        log.info("创建系统所在建筑关系createBD方法开始参数projectId为{}", AdmContextUtil.toDmpContext().getProjectId());
+        log.debug("创建系统所在建筑关系createBD方法开始参数projectId为{}", AdmContextUtil.toDmpContext().getProjectId());
+        // 原来的逻辑:2021年11月2日14:59:13 lijie修改
+        // 1.删除图类型MechInArch,边类型为Sy2Bd,系统id为sysID的关系
+        // 2.如果建筑id列表不为空,则创建对应的关系进行保存
         //系统Id
         String sysID = syInFlList.getSysId();
         //楼层
-        List<String> builds = syInFlList.getBuildingIdList();
-        if (StringUtils.isBlank(sysID) || CollectionUtils.isEmpty(builds)) {
-            return AdmResponse.failure("必填项:SysId(系统id)、buildingIdList(建筑Id)");
+        List<String> buildIds = syInFlList.getBuildingIdList();
+        if (StringUtils.isBlank(sysID)) {
+            return AdmResponse.success();
+        }
+        // 1.1 根据图类型MechInArch,边类型为Sy2Bd,系统id为sysID查询有效关系列表
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
+        List<ObjectRelation> objectRelations =
+                queryObjectRelationsByGraphCodeAndRelCodeAndSystemId(AdmRelationTypeEnum.SY2BD_MECHINARCH.getGraphCode(),
+                    AdmRelationTypeEnum.SY2BD_MECHINARCH.getRelCode(), sysID);
+        if (CollUtil.isNotEmpty(objectRelations)){
+            // 1.2 收集关系的主键列表
+            List<String> relIds = objectRelations.stream()
+                    .filter(objectRelation -> StrUtil.isNotBlank(objectRelation.getId()))
+                    .map(ObjectRelation::getId).collect(Collectors.toList());
+            // 1.3 删除关系
+            DigitalRelationFacade.delete(context.getGroupCode(),context.getProjectId(),
+                    context.getAppId(),context.getUserId(),relIds);
+        }
+        if (CollUtil.isEmpty(buildIds)){
+            return AdmResponse.success(new ArrayList<>());
         }
         List<RelationDTO> voList = new ArrayList<>();
-        AdmRelationTypeEnum sy2bdMechinarch = AdmRelationTypeEnum.SY2BD_MECHINARCH;
-        String graphCode = sy2bdMechinarch.getGraphCode();
-        String relCode = sy2bdMechinarch.getRelCode();
-        for (String buildId : builds) {
-            RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysID, buildId);
+        for (String buildId : buildIds) {
+            RelationDTO relation = new RelationDTO(StrUtil
+                    .format(CommonConstant.DEFAULT_GRAPH_ID_FORMAT,AdmRelationTypeEnum.SY2BD_MECHINARCH.getGraphCode()),
+                    AdmRelationTypeEnum.SY2BD_MECHINARCH.getGraphCode(),
+                    AdmRelationTypeEnum.SY2BD_MECHINARCH.getRelCode(), null, sysID, buildId);
             voList.add(relation);
         }
-        // 组装上下文条件
-        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doSave(context, voList);
-        log.info("创建系统所在建筑关系createBD方法结束");
+        log.debug("创建系统所在建筑关系createBD方法结束");
         return AdmResponse.success();
     }
 
-
     /**
      * 创建系统所在建筑关系 同上
-     * @param syInFlList
-     * @param projectId
+     * @param syInFlList:请求参数
      * @return
      * @throws Exception
      */
@@ -166,7 +189,6 @@ public class RelationSyInBdController {
         return AdmResponse.success();
     }
 
-
     /**
      * 创建所在建筑的系统关系
      * @param bdInSyList
@@ -238,5 +260,28 @@ public class RelationSyInBdController {
         return AdmResponse.success();
     }
 
-
+    /***
+     * Description: 根据图类型,边类型,系统id查询有效关系
+     * @param graphCode : 图类型
+     * @param relCode : 边类型
+     * @param systemId : 系统id
+     * @return : void
+     * @author : lijie
+     * @date :2021/11/2 15:07
+     * Update By lijie 2021/11/2 15:07
+     */
+    private List<ObjectRelation> queryObjectRelationsByGraphCodeAndRelCodeAndSystemId(String graphCode, String relCode, String systemId) {
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
+        QueryCriteria queryCriteria = new QueryCriteria();
+        ObjectMapper mapper = SpringUtil.getBean(ObjectMapper.class);
+        ObjectNode criteria = mapper.createObjectNode();
+        criteria.put("graphCode",graphCode);
+        criteria.put("relCode",relCode);
+        criteria.put("objFrom",systemId);
+        criteria.put("valid",Boolean.TRUE);
+        queryCriteria.setCriteria(criteria);
+        // 根据systemId,图类型,边类型查询有效的数据
+        return DigitalRelationFacade.query(context.getGroupCode(), context.getProjectId(),
+                context.getAppId(), context.getUserId(), queryCriteria);
+    }
 }

+ 45 - 34
src/main/java/com/persagy/proxy/relation/controller/RelationSyInFlController.java

@@ -2,11 +2,16 @@ package com.persagy.proxy.relation.controller;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.spring.SpringUtil;
 import com.alibaba.excel.util.CollectionUtils;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.constant.ResponseCode;
+import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.digital.client.DigitalRelationFacade;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.request.AdmResponse;
@@ -87,53 +92,59 @@ public class RelationSyInFlController {
         String sysId = syInFlList.getSysId();
         //楼层Id
         List<String> floorIdList = syInFlList.getFloorIdList();
-        if (StringUtils.isBlank(sysId) || CollectionUtils.isEmpty(floorIdList)) {
+        if (StringUtils.isBlank(sysId)) {
             //return AdmResponse.failure("必填项:sysId(系统id)、floorIdList(楼层Id)");
             //兼容adm历史逻辑,若楼层id为空时,返回success
             return AdmResponse.success();
         }
-
+        // 按原有逻辑接口处理:2021年11月2日16:52:13 by lijie
+        // 1.根据系统id,图类型编码为MechInArch,边类型为Sy2Fl删除关系
+        // 1.1 组装删除参数
+        QueryCriteria deleteQueryCriteria = new QueryCriteria();
+        ObjectMapper mapper = SpringUtil.getBean(ObjectMapper.class);
+        ObjectNode criteria = mapper.createObjectNode();
+        criteria.put("graphCode",AdmRelationTypeEnum.SY2FL.getGraphCode());
+        criteria.put("relCode",AdmRelationTypeEnum.SY2FL.getRelCode());
+        criteria.put("objFrom",sysId);
+        criteria.put("valid",Boolean.TRUE);
+        deleteQueryCriteria.setCriteria(criteria);
+        // 1.2 根据参数删除关系
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
+        CommonResult<List<ObjectRelation>> commonResult = DigitalRelationFacade.deleteByCriteria(context.getGroupCode(),
+                context.getProjectId(), context.getAppId(), context.getUserId(), deleteQueryCriteria);
+        if (!ResponseCode.A00000.getDesc().equals(commonResult.getResult())){
+            return AdmResponse.failure(commonResult.getMessage());
+        }
+        if (CollUtil.isEmpty(floorIdList)){
+            return AdmResponse.success(new ArrayList<>());
+        }
+        // 2.创建系统所属楼层关系
         List<RelationDTO> voList = new ArrayList<>();
         AdmRelationTypeEnum sy2fl = AdmRelationTypeEnum.SY2FL;
         String graphCode = sy2fl.getGraphCode();
         String relCode = sy2fl.getRelCode();
-
-        //需要解绑关系
-        QueryCriteria queryCriteria = new QueryCriteria();
-        ObjectNode criteriaDel = JsonNodeFactory.instance.objectNode();
-        criteriaDel.put("graphCode", graphCode);
-        criteriaDel.put("relCode", relCode);
-        criteriaDel.put("objFrom", sysId);
-        queryCriteria.setCriteria(criteriaDel);
-        service.doDelete(AdmContextUtil.toDmpContext(), queryCriteria);
-
-        criteriaDel.put("relCode", "Sy2Bd");
-        queryCriteria.setCriteria(criteriaDel);
-        service.doDelete(AdmContextUtil.toDmpContext(), queryCriteria);
-
         for (String floorId : floorIdList) {
             RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysId, floorId);
             voList.add(relation);
         }
-        //查询 floor所属的建筑 增加关系
-        QueryCriteria criteriaQuery = new QueryCriteria();
-        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
-        criteria.put(ObjectRelation.REL_CODE_HUM, "Bd2Fl");
-        criteria.put(ObjectRelation.GRAPH_CODE_HUM, "ArchSubset");
-        ArrayNode arrayNode = criteria.putObject("objTo").putArray("$in");
-        floorIdList.stream().forEach(floorId -> arrayNode.add(floorId));
-        criteriaQuery.setCriteria(criteria);
-        List<ObjectRelation> relationList = service.queryByCondition(AdmContextUtil.toDmpContext(), criteriaQuery);
-        if(CollUtil.isNotEmpty(relationList)){
-            Map<String,ObjectRelation> objectRelationMap = CollUtil.fieldValueMap(relationList, "objFrom");
-            for (String buildingId : objectRelationMap.keySet()) {
-                RelationDTO relation = new RelationDTO(null, graphCode, "Sy2Bd", null, sysId, buildingId);
-                voList.add(relation);
-            }
-        }
+        //查询 floor所属的建筑 增加关系:页面交互的/rel/sy-in-bd/link-bd接口会创建系统所属建筑的关系,该处省略.防止重复创建
+//        QueryCriteria criteriaQuery = new QueryCriteria();
+//        ObjectNode buildCriteria = JsonNodeFactory.instance.objectNode();
+//        buildCriteria.put(ObjectRelation.REL_CODE_HUM, "Bd2Fl");
+//        buildCriteria.put(ObjectRelation.GRAPH_CODE_HUM, "ArchSubset");
+//        ArrayNode arrayNode = buildCriteria.putObject("objTo").putArray("$in");
+//        floorIdList.stream().forEach(floorId -> arrayNode.add(floorId));
+//        criteriaQuery.setCriteria(buildCriteria);
+//        List<ObjectRelation> relationList = service.queryByCondition(AdmContextUtil.toDmpContext(), criteriaQuery);
+//        if(CollUtil.isNotEmpty(relationList)){
+//            Map<String,ObjectRelation> objectRelationMap = CollUtil.fieldValueMap(relationList, "objFrom");
+//            for (String buildingId : objectRelationMap.keySet()) {
+//                RelationDTO relation = new RelationDTO(null, graphCode, "Sy2Bd", null, sysId, buildingId);
+//                voList.add(relation);
+//            }
+//        }
         // 组装上下文条件
-        InstanceUrlParam context = AdmContextUtil.toDmpContext();
-        service.doSave(context, voList);
+        service.doSave(AdmContextUtil.toDmpContext(), voList);
         log.info("创建系统所在楼层关系link-fl方法结束");
         return AdmResponse.success();
     }

+ 3 - 0
src/main/java/com/persagy/proxy/relation/model/SiInSpBase.java

@@ -32,4 +32,7 @@ public class SiInSpBase {
     /** 计算标记 1 为手动 2为自动 */
     private Integer sign;
 
+    /** 计算标记 1 为手动 2为自动 */
+    private String classCode;
+
 }

+ 13 - 5
src/main/java/com/persagy/proxy/report/controller/AdmEquipShaftController.java

@@ -2,9 +2,11 @@ package com.persagy.proxy.report.controller;
 
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.comparator.CompareUtil;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.text.TextSimilarity;
 import cn.hutool.core.util.BooleanUtil;
+import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -57,7 +59,7 @@ public class AdmEquipShaftController {
         request.setName(AdmSystem.OBJ_TYPE);
         // 设置关系条件
         request.resetRelationCond(true, "MechInArch", "Sy2Sh", shaftId, false);
-        return systemService.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
+        return systemService.query(request);
     }
 
     /**
@@ -166,7 +168,7 @@ public class AdmEquipShaftController {
                     continue;
                 }
                 // 设置垂直交通关系
-                spInSh.setSpaceIdList(trafficMap.get(spInFlId));
+                spInSh.setSpaceIdList(trafficMap.getOrDefault(spInFlId,new HashSet<>()));
                 spaceList.add(spInSh);
                 // 获取此空间匹配的空间
                 List<AdmSpace> matchSpaces = aiSpaceMap.get(spInFlId);
@@ -176,15 +178,17 @@ public class AdmEquipShaftController {
                 for(AdmSpace matchSpace:matchSpaces) {
                     if(spaceList.add(matchSpace)) {
                         // 设置垂直交通关系
-                        matchSpace.setSpaceIdList(trafficMap.get(matchSpace.getId()));
+                        matchSpace.setSpaceIdList(trafficMap.getOrDefault(matchSpace.getId(),new HashSet<>()));
                     }
                 }
             }
             if(CollUtil.isEmpty(spaceList)) {
+                floor.setSpaceList(new ArrayList<>());
                 continue;
             }
             floor.setSpaceList(CollUtil.newArrayList(spaceList));
         }
+        floors.sort((f1,f2)-> CompareUtil.compare(f2.getFloorSequenceID(),f1.getFloorSequenceID(),false));
     }
 
     /**
@@ -210,8 +214,12 @@ public class AdmEquipShaftController {
                     continue;
                 }
                 // 字符串匹配度大于0.9的保留
-                if (TextSimilarity.similar(space.getLocalId(), spInBd.getLocalId()) > matchingPercent
-                        || TextSimilarity.similar(space.getLocalName(), spInBd.getLocalName()) > matchingPercent) {
+                if ((StrUtil.isNotBlank(space.getLocalId())
+                      && StrUtil.isNotBlank(spInBd.getLocalId())
+                      && TextSimilarity.similar(space.getLocalId(), spInBd.getLocalId()) > matchingPercent)
+                        || ( StrUtil.isNotBlank(space.getLocalName())
+                          && StrUtil.isNotBlank(spInBd.getLocalName())
+                          && TextSimilarity.similar(space.getLocalName(), spInBd.getLocalName()) > matchingPercent)) {
                     List<AdmSpace> ais = aiSpaceMap.get(space.getId());
                     if (CollUtil.isEmpty(ais)) {
                         ais = new ArrayList<>();

+ 74 - 84
src/main/java/com/persagy/proxy/report/controller/AdmReportEquipController.java

@@ -37,6 +37,7 @@ import com.persagy.proxy.object.service.IAdmComponentService;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
 import com.persagy.proxy.object.service.IAdmSystemService;
 import com.persagy.proxy.report.model.AdmGatherInfoPoint;
+import com.persagy.proxy.report.model.AdmInfoPoint;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -755,9 +756,7 @@ public class AdmReportEquipController {
         if(StrUtil.isEmpty(AdmContextUtil.toDmpContext().getProjectId())){
             return AdmResponse.failure(ResponseCode.A0400.getCode());
         }
-        Integer controlInfoCounts = controlInfoCounts(AdmEquipment.OBJ_TYPE);
-        AdmGatherInfoPoint gatherInfoPoint = new AdmGatherInfoPoint();
-        gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
+        AdmInfoPoint infoPoint = new AdmInfoPoint();
         // 根据objType获取定义 获取采集的设备的classcode
         Set<String> objTypes = new HashSet<>(1);
         objTypes.add(AdmEquipment.OBJ_TYPE);
@@ -767,16 +766,16 @@ public class AdmReportEquipController {
             codes.stream().forEach(stringObjectMap -> classCodeSet.add(stringObjectMap.get("code").toString()));
 
             //项目下所有已采集的动态信息点编码
-            List<ObjectInfoDefine> dynamicInfoPointCodes = gatherDynamicInfoCode(false, classCodeSet);
+            List<ObjectInfoDefine> dynamicInfoPointCodes = gatherDynamicInfoCode(false, classCodeSet, false);
             //项目下所有已采集静态信息点编码
-            List<ObjectInfoDefine> staticInfoPointCodes = gatherStaticInfoCode(false, classCodeSet);
+            List<ObjectInfoDefine> staticInfoPointCodes = gatherStaticInfoCode(false, classCodeSet, false);
             //项目下所有的设备  分页查询
             AdmQueryCriteria admQueryCriteriaObj = new AdmQueryCriteria();
             admQueryCriteriaObj.setPageNumber(1);
             admQueryCriteriaObj.setPageSize(500);
             admQueryCriteriaObj.setName(AdmEquipment.OBJ_TYPE);
 
-            admQueryCriteriaObj.setProjection(Arrays.asList("id", "name", "localId", "localName", "cadId", "bimId", "bimLocation", "infos", "classCode", "equipSerial", "bimFamilyName", "bimFamilySymbol"));
+            //admQueryCriteriaObj.setProjection(Arrays.asList("id", "name", "localId", "localName", "cadId", "bimId", "bimLocation", "infos", "classCode", "equipSerial", "bimFamilyName", "bimFamilySymbol"));
             AdmResponse admResponse = equipmentService.query(admQueryCriteriaObj);
 
             Map<String, Integer> hashMap = new HashMap<>();
@@ -794,19 +793,12 @@ public class AdmReportEquipController {
                     calculate(dynamicInfoPointCodes, staticInfoPointCodes, projectEquipment, 0, hashMap);
                 }
             }
-            gatherInfoPoint.setDynamicInfoPointCounts(dynamicInfoPointCodes.size());
-            gatherInfoPoint.setStaticInfoPointCounts(staticInfoPointCodes.size());
-            gatherInfoPoint.setGatherCustomInfoPointCounts(hashMap.get("customInfoPoint"));
-            gatherInfoPoint.setGatherDynamicInfoPointCounts(hashMap.get("dynamicInfoPoint"));
-            gatherInfoPoint.setGatherStaticInfoPointCounts(hashMap.get("staticInfoPoint"));
-        }else{
-            gatherInfoPoint.setDynamicInfoPointCounts(0);
-            gatherInfoPoint.setStaticInfoPointCounts(0);
-            gatherInfoPoint.setGatherCustomInfoPointCounts(0);
-            gatherInfoPoint.setGatherDynamicInfoPointCounts(0);
-            gatherInfoPoint.setGatherStaticInfoPointCounts(0);
+            infoPoint.setDynamicInfoPointCounts(dynamicInfoPointCodes.size());
+            infoPoint.setStaticInfoPointCounts(staticInfoPointCodes.size());
+            infoPoint.setDynamicInfoPoint(hashMap.get("dynamicInfoPoint"));
+            infoPoint.setStaticInfoPoint(hashMap.get("staticInfoPoint"));
         }
-        return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
+        return AdmResponse.success(CollUtil.newArrayList(infoPoint));
     }
 
     /**
@@ -818,9 +810,9 @@ public class AdmReportEquipController {
         if(StrUtil.isEmpty(AdmContextUtil.toDmpContext().getProjectId())){
             return AdmResponse.failure(ResponseCode.A0400.getCode());
         }
+        Integer controlInfoCounts = controlInfoCounts(AdmEquipment.OBJ_TYPE, false);
         AdmGatherInfoPoint gatherInfoPoint = new AdmGatherInfoPoint();
-
-        Integer controlInfoCounts = controlInfoCounts(AdmEquipment.OBJ_TYPE);
+        gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
         // 根据objType获取定义 获取采集的设备的classcode
         Set<String> objTypes = new HashSet<>(1);
         objTypes.add(AdmEquipment.OBJ_TYPE);
@@ -830,9 +822,9 @@ public class AdmReportEquipController {
             codes.stream().forEach(stringObjectMap -> classCodeSet.add(stringObjectMap.get("code").toString()));
 
             //项目下所有已采集的动态信息点编码
-            List<ObjectInfoDefine> gatherDynamicInfoCode = gatherDynamicInfoCode(true, classCodeSet);
+            List<ObjectInfoDefine> gatherDynamicInfoCode = gatherDynamicInfoCode(true, classCodeSet, false);
             //项目下所有已采集静态信息点编码
-            List<ObjectInfoDefine> gatherStaticInfoCode =  gatherStaticInfoCode(true, classCodeSet);
+            List<ObjectInfoDefine> gatherStaticInfoCode =  gatherStaticInfoCode(true, classCodeSet, false);
 
             //项目下所有的设备  分页查询
             AdmQueryCriteria admQueryCriteriaObj =  new AdmQueryCriteria();
@@ -840,7 +832,7 @@ public class AdmReportEquipController {
             admQueryCriteriaObj.setPageSize(500);
             admQueryCriteriaObj.setName(AdmEquipment.OBJ_TYPE);
 
-            admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","bimLocation","infos","classCode","equipSerial","bimFamilyName","bimFamilySymbol"));
+            //admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","bimLocation","infos","classCode","equipSerial","bimFamilyName","bimFamilySymbol"));
             AdmResponse admResponse = equipmentService.query(admQueryCriteriaObj);
 
             Map<String,Integer> hashMap = new HashMap<>();
@@ -858,14 +850,9 @@ public class AdmReportEquipController {
                     calculate(gatherDynamicInfoCode, gatherStaticInfoCode, projectEquipment,0, hashMap);
                 }
             }
-            gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
             gatherInfoPoint.setGatherCustomInfoPointCounts(hashMap.get("customInfoPoint"));
             gatherInfoPoint.setGatherDynamicInfoPointCounts(hashMap.get("dynamicInfoPoint"));
-        }else{
-            gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
-            gatherInfoPoint.setGatherCustomInfoPointCounts(0);
-            gatherInfoPoint.setGatherDynamicInfoPointCounts(0);
-            gatherInfoPoint.setGatherStaticInfoPointCounts(0);
+            gatherInfoPoint.setGatherStaticInfoPointCounts(hashMap.get("staticInfoPoint"));
         }
         return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
     }
@@ -877,7 +864,8 @@ public class AdmReportEquipController {
     @PostMapping("/system-info-point")
     public AdmResponse systemInfoPoin() {
         AdmGatherInfoPoint gatherInfoPoint = new AdmGatherInfoPoint();
-        Integer controlInfoCounts = controlInfoCounts(AdmEquipment.OBJ_TYPE);
+        Integer controlInfoCounts = controlInfoCounts(AdmSystem.OBJ_TYPE, true);
+        gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
         // 根据objType获取定义 获取采集的设备的classcode
         Set<String> objTypes = new HashSet<>(1);
         objTypes.add(AdmSystem.OBJ_TYPE);
@@ -887,18 +875,18 @@ public class AdmReportEquipController {
             codes.stream().forEach(stringObjectMap -> classCodeSet.add(stringObjectMap.get("code").toString()));
 
             //项目下所有已采集的动态信息点编码
-            List<ObjectInfoDefine> gatherDynamicInfoCode = gatherDynamicInfoCode(true, classCodeSet);
+            List<ObjectInfoDefine> gatherDynamicInfoCode = gatherDynamicInfoCode(true, classCodeSet, true);
             //项目下所有已采集静态信息点编码
-            List<ObjectInfoDefine> gatherStaticInfoCode =  gatherStaticInfoCode(true, classCodeSet);
+            List<ObjectInfoDefine> gatherStaticInfoCode =  gatherStaticInfoCode(true, classCodeSet, true);
 
             //项目下所有的设备  分页查询
             AdmQueryCriteria admQueryCriteriaObj =  new AdmQueryCriteria();
             admQueryCriteriaObj.setPageNumber(1);
             admQueryCriteriaObj.setPageSize(500);
-            admQueryCriteriaObj.setName(AdmEquipment.OBJ_TYPE);
+            admQueryCriteriaObj.setName(AdmSystem.OBJ_TYPE);
 
-            admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","infos","classCode"));
-            AdmResponse admResponse = systemService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmSystem.class);
+            //admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","infos","classCode"));
+            AdmResponse admResponse = systemService.query(admQueryCriteriaObj);
 
             Map<String,Integer> hashMap = new HashMap<>();
             List<AdmSystem> admSystemList = (List<AdmSystem>) admResponse.getContent();
@@ -909,21 +897,15 @@ public class AdmReportEquipController {
             if(page >= 2){
                 for(long i = 2; i <= page; i++){
                     admQueryCriteriaObj.setPageNumber(Integer.parseInt(String.valueOf(i)));
-                    admResponse = systemService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmSystem.class);
+                    admResponse = systemService.query(admQueryCriteriaObj);
                     admSystemList = (List<AdmSystem>) admResponse.getContent();
                     projectEquipment = JsonNodeUtils.toListNode(admSystemList,null,null);
                     calculate(gatherDynamicInfoCode, gatherStaticInfoCode, projectEquipment,1, hashMap);
                 }
             }
-            gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
             gatherInfoPoint.setGatherCustomInfoPointCounts(hashMap.get("customInfoPoint"));
             gatherInfoPoint.setGatherDynamicInfoPointCounts(hashMap.get("dynamicInfoPoint"));
             gatherInfoPoint.setGatherStaticInfoPointCounts(hashMap.get("staticInfoPoint"));
-        }else{
-            gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
-            gatherInfoPoint.setGatherCustomInfoPointCounts(0);
-            gatherInfoPoint.setGatherDynamicInfoPointCounts(0);
-            gatherInfoPoint.setGatherStaticInfoPointCounts(0);
         }
         return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
     }
@@ -982,6 +964,7 @@ public class AdmReportEquipController {
 
     /**
      * 计算动态、静态信息点
+     * num 0 设备, 1 系统
      */
     private void calculate(List<ObjectInfoDefine> dynamicInfoPointCodes, List<ObjectInfoDefine> staticInfoPointCodes, List<ObjectNode> objList, Integer num, Map<String, Integer> hashMap) {
         int dynamicInfoPoint = hashMap.get("dynamicInfoPoint") == null ? 0 : hashMap.get("dynamicInfoPoint");
@@ -990,73 +973,73 @@ public class AdmReportEquipController {
 
         if(CollUtil.isNotEmpty(objList)) {
             for (int i = 0; i < objList.size(); i++) {
-                JsonNode objectNode = JsonNodeUtils.toObjectNode(objList.get(i), "infos", null);
+                JsonNode jsonNode = objList.get(i);
                 Iterator<ObjectInfoDefine> iterator1 = staticInfoPointCodes.iterator();
                 while (iterator1.hasNext()) {
                     ObjectInfoDefine infoDefine = iterator1.next();
-                    if(!objectNode.get("classCode").textValue().equals(infoDefine.getClassCode())){
+                    if(!jsonNode.get("classCode").textValue().equals(infoDefine.getClassCode())){
                         continue;
                     }
-                    if (objectNode.get("id") != null && "id".equals(infoDefine.getCode())) {
+                    if (jsonNode.get("id") != null && "id".equals(infoDefine.getCode())) {
                         staticInfoPoint++;
                         iterator1.remove();
                         continue;
                     }
-                    if (objectNode.get("name") != null && "name".equals(infoDefine.getCode())) {
+                    if (jsonNode.get("name") != null && "name".equals(infoDefine.getCode())) {
                         staticInfoPoint++;
                         iterator1.remove();
                         continue;
                     }
-                    if (objectNode.get("localId") != null && "localId".equals(infoDefine.getCode())) {
+                    if (jsonNode.get("localId") != null && "localId".equals(infoDefine.getCode())) {
                         staticInfoPoint++;
                         iterator1.remove();
                         continue;
                     }
-                    if (objectNode.get("localName") != null && "localName".equals(infoDefine.getCode())) {
+                    if (jsonNode.get("localName") != null && "localName".equals(infoDefine.getCode())) {
                         staticInfoPoint++;
                         iterator1.remove();
                         continue;
                     }
-                    if (objectNode.get("qrCode") != null && "qRCode".equals(infoDefine.getCode())) {
+                    if (jsonNode.get("qrCode") != null && "qRCode".equals(infoDefine.getCode())) {
                         staticInfoPoint++;
                         iterator1.remove();
                         continue;
                     }
-                    if (objectNode.get("cADID") != null && "cADID".equals(infoDefine.getCode()) && num == 0) {
+                    if (jsonNode.get("cADID") != null && "cADID".equals(infoDefine.getCode()) && num == 0) {
                         staticInfoPoint++;
                         iterator1.remove();
                     }
-                    if (objectNode.get("bimId") != null && "bimId".equals(infoDefine.getCode()) && num == 0) {
+                    if (jsonNode.get("bimId") != null && "bimId".equals(infoDefine.getCode()) && num == 0) {
                         staticInfoPoint++;
                         iterator1.remove();
                         continue;
                     }
-                    if (objectNode.get("bimLocation") != null && "bimLocation".equals(infoDefine.getCode())) {
+                    if (jsonNode.get("bimLocation") != null && "bimLocation".equals(infoDefine.getCode())) {
                         staticInfoPoint++;
                         iterator1.remove();
                         continue;
                     }
-                    if (objectNode.get("equipSerial") != null && "equipSerial".equals(infoDefine.getCode())) {
+                    if (jsonNode.get("equipSerial") != null && "equipSerial".equals(infoDefine.getCode())) {
                         staticInfoPoint++;
                         iterator1.remove();
                         continue;
                     }
-                    if (objectNode.get("bimFamilyName") != null && "bimFamilyName".equals(infoDefine.getCode())) {
+                    if (jsonNode.get("bimFamilyName") != null && "bimFamilyName".equals(infoDefine.getCode())) {
                         staticInfoPoint++;
                         iterator1.remove();
                         continue;
                     }
-                    if (objectNode.get("bimFamilySymbol") != null && "bimFamilySymbol".equals(infoDefine.getCode())) {
+                    if (jsonNode.get("bimFamilySymbol") != null && "bimFamilySymbol".equals(infoDefine.getCode())) {
                         staticInfoPoint++;
                         iterator1.remove();
                         continue;
                     }
                 }
 
-                JsonNode objectNode1 = JsonNodeUtils.toObjectNode(objList.get(i), null, null);
-                if (!JSONUtil.isNull(objectNode1.get("infos")) && StrUtil.isNotEmpty(objectNode1.get("infos").textValue())) {
-                    Map<String, Object> dynamic = calculateInfoPoints(objectNode1.get("infos").toString(), objectNode1.get("classCode").textValue(), dynamicInfoPointCodes);
-                    Map<String, Object> staticMap = calculateInfoPoints(objectNode1.get("infos").toString(), objectNode1.get("classCode").textValue(), staticInfoPointCodes);
+                ObjectNode infos = (ObjectNode) jsonNode.get("infos");
+                if (!JSONUtil.isNull(infos) && !infos.toString().equals("{}")) {
+                    Map<String, Object> dynamic = calculateInfoPoints(infos.toString(), jsonNode.get("classCode").textValue(), dynamicInfoPointCodes);
+                    Map<String, Object> staticMap = calculateInfoPoints(infos.toString(), jsonNode.get("classCode").textValue(), staticInfoPointCodes);
                     dynamicInfoPoint += Integer.parseInt(dynamic.get("counts").toString());
                     staticInfoPoint += Integer.parseInt(staticMap.get("counts").toString());
                     dynamicInfoPointCodes.remove(dynamic.get("next"));
@@ -1072,21 +1055,23 @@ public class AdmReportEquipController {
 
     /**
      * 计算信息点
-     * @param str infos
-     * @param type classCode
+     * @param infos
+     * @param classCode
      * @param infoPointCodes
      * @return
      */
-    private Map<String,Object> calculateInfoPoints(String str, String type, List<ObjectInfoDefine> infoPointCodes) {
+    private Map<String,Object> calculateInfoPoints(String infos, String classCode, List<ObjectInfoDefine> infoPointCodes) {
         int counts = 0;
         Map<String,Object> hashMap = new HashMap<String,Object>();
-        Iterator<ObjectInfoDefine> iterator = infoPointCodes.iterator();
-        while (iterator.hasNext()){
-            ObjectInfoDefine nextInfo = iterator.next();
-            if(str.contains(nextInfo.getCode()) && type.equals(nextInfo.getClassCode())){
-                counts ++;
-                hashMap.put("next", nextInfo);
-                iterator.remove();
+        if(!infos.equals("{}")){
+            Iterator<ObjectInfoDefine> iterator = infoPointCodes.iterator();
+            while (iterator.hasNext()){
+                ObjectInfoDefine nextInfo = iterator.next();
+                if(infos.contains(nextInfo.getCode()) && classCode.equals(nextInfo.getClassCode())){
+                    counts ++;
+                    hashMap.put("next", nextInfo);
+                    iterator.remove();
+                }
             }
         }
         hashMap.put("counts", counts);
@@ -1098,53 +1083,58 @@ public class AdmReportEquipController {
      * @param objtype
      * @return
      */
-    private Integer controlInfoCounts(String objtype){
+    private Integer controlInfoCounts(String objtype, Boolean common){
         AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
         admQueryCriteria.setOnlyCount(true);
+        if(common){
+            admQueryCriteria.setFilters(" projectId = '0' and groupCode = '0' ");
+        }
         AdmResponse response = dictService.doQueryObjectInfo(AdmContextUtil.toDmpContext(), admQueryCriteria, objtype, AdmObjectInfo.class);
         return response.getTotal().intValue();
     }
 
     /** 项目下所有已采集的动态信息点编码
-     *
+     * common flase 全部  true 通用
      */
-    private List<ObjectInfoDefine> gatherDynamicInfoCode(Boolean visible, Set<String> classCodeSet){
+    private List<ObjectInfoDefine> gatherDynamicInfoCode(Boolean visible, Set<String> classCodeSet, Boolean common){
         //获取信息点
         AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
-
-        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
-        ArrayNode arrayNode = criteria.putObject("classCode").putArray("$in");
-        classCodeSet.stream().forEach(classCode -> arrayNode.add(classCode));
         //静态信息点
-        String filters = "groupCode='0' and projectId='0' and category != 'STATIC'";
+        String filters = " category != 'STATIC'";
         if(visible){
             filters = filters + " and valid = '1' ";
         }
+        if(common){
+            filters = filters +" and projectId = '0' and groupCode = '0' ";
+        }
         filters = filters +" and classCode in ['"+StrUtil.join("','",classCodeSet)+"']";
         admQueryCriteria.setFilters(filters);
-        System.out.println(filters);
-        AdmResponse dynamicInfoCode = dictService.doQueryObjectInfo(AdmContextUtil.toDmpContext(), admQueryCriteria,null, AdmObjectInfo.class);
-        return (List<ObjectInfoDefine>) dynamicInfoCode.getContent();
+        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(admQueryCriteria);
+        queryCriteria.setOnlyCount(false);
+        List<ObjectInfoDefine> staticInfoCode = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
+        return staticInfoCode;
     }
 
     /** 项目下所有已采集静态信息点编码
-     *
+     * common flase 全部  true 通用
      */
-    private List<ObjectInfoDefine> gatherStaticInfoCode(Boolean visible, Set<String> classCodeSet){
+    private List<ObjectInfoDefine> gatherStaticInfoCode(Boolean visible, Set<String> classCodeSet, Boolean common){
         //获取信息点
         QueryCriteria queryCriteria = new QueryCriteria();
         ObjectNode criteria = JsonNodeFactory.instance.objectNode();
         ArrayNode arrayNode = criteria.putObject("classCode").putArray("$in");
         classCodeSet.stream().forEach(classCode -> arrayNode.add(classCode));
         //静态信息点
-        criteria.put("groupCode","0");
-        criteria.put("projectId","0");
         criteria.put("category","STATIC");
         if(visible){
             criteria.put("valid", "1");
         }else{
             criteria.remove("valid");
         }
+        if(common){
+            criteria.put("projectId", "0");
+            criteria.put("groupCode", "0");
+        }
         queryCriteria.setOnlyCount(false);
         queryCriteria.setCriteria(criteria);
         List<ObjectInfoDefine> staticInfoCode = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);

+ 57 - 39
src/main/java/com/persagy/proxy/report/controller/AdmSpaceInfoController.java

@@ -1,52 +1,32 @@
 package com.persagy.proxy.report.controller;
 
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.QueryParam;
-
 import cn.hutool.core.collection.CollUtil;
-import com.persagy.dmp.basic.dto.RequestData;
-import com.persagy.dmp.digital.client.DigitalObjectFacade;
-import com.persagy.dmp.digital.entity.ObjectDigital;
-import com.persagy.proxy.object.model.AdmSpace;
-import com.persagy.proxy.object.service.IAdmSpaceService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Sets;
 import com.persagy.dmp.common.constant.ResponseCode;
-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.digital.entity.ObjectRelation;
-import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
-import com.persagy.proxy.adm.constant.GraphCodeEnum;
-import com.persagy.proxy.adm.constant.RelCodeEnum;
 import com.persagy.proxy.adm.request.AdmDCSQueryRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
+import com.persagy.proxy.adm.utils.GeoToolsUtil;
 import com.persagy.proxy.object.model.AdmEquipment;
+import com.persagy.proxy.object.model.AdmFloor;
 import com.persagy.proxy.object.model.AdmISpace;
 import com.persagy.proxy.object.model.AdmSystem;
-import com.persagy.proxy.object.service.IAdmEquipmentService;
-import com.persagy.proxy.object.service.IAdmISpaceService;
-import com.persagy.proxy.object.service.IAdmSystemService;
-
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.util.StrUtil;
+import com.persagy.proxy.object.service.*;
 import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.QueryParam;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
 
 /**
  *
@@ -61,6 +41,7 @@ import lombok.RequiredArgsConstructor;
 public class AdmSpaceInfoController {
 
 	private final IAdmISpaceService ispaceService;
+	private final IAdmFloorService floorService;
 	private final IAdmSystemService systemService;
 	private final IAdmEquipmentService equipmentService;
 	private final IAdmSpaceService spaceService;
@@ -105,7 +86,7 @@ public class AdmSpaceInfoController {
 		request.setName(AdmSystem.OBJ_TYPE);
 		// 设置关系条件
 		request.resetRelationCond(true, "MechInArch", "Sy2Sp", spaceId, false);
-		return systemService.doQuery(AdmContextUtil.toDmpContext(),request, AdmSystem.class);
+		return systemService.query(request);
 	}
 
 	/**
@@ -150,22 +131,59 @@ public class AdmSpaceInfoController {
 	 */
 	@PostMapping("/unspace-ispace")
 	public AdmResponse unSpaceIspace(@QueryParam("objectType") String objectType, @RequestBody AdmDCSQueryRequest request) {
+		// 查询楼层信息 需要楼层信息中的outline modelId
+		AdmQueryCriteria admQueryCriteriaFl = new AdmQueryCriteria();
+		admQueryCriteriaFl.setName(AdmFloor.OBJ_TYPE);
+		admQueryCriteriaFl.setFilters(" id = '"+request.getFloorId()+"' ");
+		AdmResponse responseFl = floorService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaFl, AdmFloor.class);
+		if(CollUtil.isEmpty(responseFl.getContent())){
+			return AdmResponse.failure("flooId 为空");
+		}
+		AdmFloor floor = (AdmFloor) responseFl.getContent().get(0);
+
 		request.setName(AdmISpace.OBJ_TYPE);
 		// 设置关系条件
 		request.resetRelationCond(true, null, "Si2Sp", objectType, null, false);
 		StringBuilder sb = new StringBuilder();
 		// 补充filter条件
 		if(StrUtil.isNotBlank(request.getFilters())) {
-			sb.append(request.getFilters()).append(";");
+			sb.append(request.getFilters()).append("; ");
 		}
 		// 补充楼层条件
 		if(StrUtil.isNotBlank(request.getFloorId())) {
-			sb.append("floorId = '").append(request.getFloorId()).append("';");
+			sb.append("floorId = '").append(request.getFloorId()).append("'; ");
+		}
+		// 补充模型条件
+		if(StrUtil.isNotBlank(floor.getModelId())) {
+			sb.append("modelId = '").append(floor.getModelId()).append("'; ");
 		}
 		if(sb.length() > 0) {
 			request.setFilters(sb.substring(0, sb.length() - 1));
 		}
-		return ispaceService.doQuery(AdmContextUtil.toDmpContext(),request, AdmISpace.class);
+		AdmResponse responseIspace = ispaceService.doQuery(AdmContextUtil.toDmpContext(),request, AdmISpace.class);
+		// 按照楼层轮廓线计算出不在轮廓线内的空间
+		if(CollUtil.isNotEmpty(floor.getOutline())){
+			// 计算ispace.outLine 在floor.outLine 内的ispace
+			List<AdmISpace> iSpaceListTarget = new ArrayList<>(responseIspace.getTotal().intValue());
+			List<AdmISpace> iSpaceList = (List<AdmISpace>) responseIspace.getContent();
+			for(AdmISpace iSpace : iSpaceListTarget){
+				if(CollUtil.isEmpty(iSpace.getOutline())){
+					continue;
+				}
+				List<ObjectNode> ispaceOutLine = JSONArray.parseArray(iSpace.getOutline().toString(), ObjectNode.class);
+				if(GeoToolsUtil.isPolyInPoly(ispaceOutLine, floor.getOutline())){
+					iSpaceList.add(iSpace);
+				}
+			}
+			AdmResponse admResponse = AdmResponse.success(iSpaceList);
+			admResponse.setFloorId(request.getFloorId());
+			admResponse.setZoneType(objectType);
+			return admResponse;
+		}else{
+			responseIspace.setFloorId(request.getFloorId());
+			responseIspace.setZoneType(objectType);
+			return responseIspace;
+		}
 	}
 
 	private AdmResponse unSpaceEq(String type, String spaceId, AdmQueryCriteria request, String graphCode) {

+ 13 - 10
src/main/java/com/persagy/proxy/report/controller/ComponentStatisticsController.java

@@ -8,14 +8,16 @@ 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.SpaceTypeEnum;
-import com.persagy.proxy.object.model.AdmEquipment;
 import com.persagy.proxy.adm.request.AdmCountResponse;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.object.service.IAdmEquipmentService;
-import com.persagy.proxy.report.service.IRelationReportService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.object.model.AdmEquipment;
+import com.persagy.proxy.object.model.AdmShaft;
+import com.persagy.proxy.object.service.IAdmEquipmentService;
+import com.persagy.proxy.object.service.IAdmShaftService;
+import com.persagy.proxy.report.service.IRelationReportService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -40,6 +42,8 @@ public class ComponentStatisticsController {
 
 	@Autowired
 	private IRelationReportService relationReportService;
+	@Autowired
+	private IAdmShaftService shaftService;
 	
 	/**
 	 * 台账中待删除的对象
@@ -149,17 +153,16 @@ public class ComponentStatisticsController {
 	
 	/**
 	 * 竖井-关联业务空间完成度
-	 * @param request
 	 * @return
 	 */
 	@RequestMapping(value = "/shaft2sp-count")
-	public AdmCountResponse shaft2spCount(HttpServletRequest request) {
-		String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
-		String projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
-		
-		long count = this.relationReportService.countRelationObject(groupCode, projectId, AdmRelationTypeEnum.SH2SP.getGraphCode(), 
+	public AdmResponse shaft2spCount() {
+		AdmQueryCriteria request = new AdmQueryCriteria();
+		request.setName("shaft");
+		request.setOnlyCount(true);
+		request.resetRelationCond(true, AdmRelationTypeEnum.SH2SP.getGraphCode(),
 				AdmRelationTypeEnum.SH2SP.getRelCode(), null);
-		return AdmCountResponse.success(count);
+		return shaftService.doQuery(AdmContextUtil.toDmpContext(), request, AdmShaft.class);
 	}
 	
 	/**

+ 13 - 6
src/main/java/com/persagy/proxy/report/controller/RelationReportController.java

@@ -204,7 +204,7 @@ public class RelationReportController {
 		//String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
 		//String projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
 		//List<ObjectNode> relationProjectCal = this.relationReportService.getAllRelationProjectCal(groupCode, projectId);
-		return AdmResponse.success(null);
+		return AdmResponse.success(new ArrayList<>());
 	}
 	
 	/**
@@ -488,8 +488,8 @@ public class RelationReportController {
 	 * @param response
 	 */
 	@RequestMapping("/graphic/import")
-	public AdmResponse importFile(@RequestParam("file") MultipartFile file, @RequestParam String relType, @RequestParam(required = false) String zoneType, 
-			HttpServletRequest request, HttpServletResponse response) {
+	public AdmResponse importFile(@RequestParam("file") MultipartFile file, @RequestParam String relType, 
+			@RequestParam(required = false) String zoneType, HttpServletRequest request, HttpServletResponse response) {
 		String failure = null;
 		XSSFWorkbook workbook = null;
 		FileOutputStream fileOutputStream = null;
@@ -512,6 +512,7 @@ public class RelationReportController {
 			List<ObjectNode> relationObjects = new ArrayList<ObjectNode>();
 			
 			String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
+			groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
 			String projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
 			
 			workbook = new XSSFWorkbook(file.getInputStream());
@@ -537,7 +538,7 @@ public class RelationReportController {
 		    	relationObject.setSlaveId(slaveIdCell == null ? null : slaveIdCell.getStringCellValue());
 		    	
 		    	// 校验数据
-				Object result = this.relationObjectContext.checkRelationObject(relationObject, groupCode, projectId, graphAndRelKey, code);
+				Object result = this.relationObjectContext.checkRelationObject(relationObject, groupCode, projectId, graphAndRelKey, code, typeEnum);
 				if (result instanceof String) {
 					failurNum++;
 					xssfRow.createCell(16).setCellValue((String)result);
@@ -553,10 +554,13 @@ public class RelationReportController {
 					boolean objects = this.relationObjectContext.saveRelationObjects(relationObjects, groupCode, projectId, graphAndRelKey);
 					if (objects) {
 						successNum += relationObjects.size();
+						for (int rowNum : rowNums) {
+							sheet.getRow(rowNum).createCell(16).setCellValue("关联成功");
+						}
 					} else {
 						failurNum += relationObjects.size();
 						for (int rowNum : rowNums) {
-							sheet.getRow(rowNum).createCell(16).setCellValue("调用中台,存储失败");
+							sheet.getRow(rowNum).createCell(16).setCellValue("关联失败");
 						}
 					}
 					rowNums.clear();
@@ -568,10 +572,13 @@ public class RelationReportController {
 		    	boolean objects = this.relationObjectContext.saveRelationObjects(relationObjects, groupCode, projectId, graphAndRelKey);
 				if (objects) {
 					successNum += relationObjects.size();
+					for (int rowNum : rowNums) {
+						sheet.getRow(rowNum).createCell(16).setCellValue("关联成功");
+					}
 				} else {
 					failurNum += relationObjects.size();
 					for (int rowNum : rowNums) {
-						sheet.getRow(rowNum).createCell(16).setCellValue("调用中台,存储失败");
+						sheet.getRow(rowNum).createCell(16).setCellValue("关联失败");
 					}
 				}
 			}

+ 4 - 6
src/main/java/com/persagy/proxy/report/model/AdmGatherInfoPoint.java

@@ -11,16 +11,14 @@ import lombok.Data;
 @Data
 public class AdmGatherInfoPoint {
     /** 信息点总数(数字字典+自定义信息点) */
-    private Integer gatherInfoPointCounts;
-    private Integer dynamicInfoPointCounts;
-    private Integer staticInfoPointCounts;
+    private Integer gatherInfoPointCounts = 0;
 
     /** 已采集的动态信息点总数 */
-    private Integer gatherDynamicInfoPointCounts;
+    private Integer gatherDynamicInfoPointCounts = 0;
 
     /** 已采集的静态信息点总数 */
-    private Integer gatherStaticInfoPointCounts;
+    private Integer gatherStaticInfoPointCounts = 0;
 
     /** 已采集的自定义信息点总数 */
-    private Integer gatherCustomInfoPointCounts;
+    private Integer gatherCustomInfoPointCounts = 0;
 }

+ 28 - 0
src/main/java/com/persagy/proxy/report/model/AdmInfoPoint.java

@@ -0,0 +1,28 @@
+package com.persagy.proxy.report.model;
+
+import lombok.Data;
+
+/**
+ * @author lvxy
+ * @date 2021/11/1
+ */
+@Data
+public class AdmInfoPoint {
+    /** 自定义信息点总数 */
+    private Integer customInfoPointCounts = 0;
+
+    /** 项目中设备用到的自定义信息点数 */
+    private Integer customInfoPoint = 0;
+
+    /** 动态信息点总数 */
+    private Integer dynamicInfoPointCounts = 0;
+
+    /** 设备用到的动态信息点数 */
+    private Integer dynamicInfoPoint = 0;
+
+    /** 静态信息点总数 */
+    private Integer staticInfoPointCounts = 0;
+
+    /** 设备用到的静态信息点数 */
+    private Integer staticInfoPoint = 0;
+}

+ 2 - 0
src/main/java/com/persagy/proxy/report/service/impl/RelationReportService.java

@@ -754,6 +754,8 @@ public class RelationReportService implements IRelationReportService {
 		result.put("graphicId", graphicId);
 		result.put("statistics", new JSONObject());
 		result.put("conneObject", relationDefine.getTargetObjs());
+		
+		result.put("computingTime", relationProject.has("computingTime") ? DateUtil.parse(relationProject.get("computingTime").asText(), "yyyyMMddHHmmss").toString() : null);
 		result.put("computationalState",relationProject.has("computationalState")?relationProject.get("computationalState").asText():null);
 		result.put("id",relationProject.has("id")?relationProject.get("id").asText():null);
 		result.put("manual",relationProject.has("manual")?relationProject.get("manual").asLong():null);