浏览代码

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

# Conflicts:
#	src/main/java/com/persagy/proxy/adm/constant/AdmCommonConstant.java
lijie 3 年之前
父节点
当前提交
f746481842
共有 93 个文件被更改,包括 7654 次插入39 次删除
  1. 2 2
      pom.xml
  2. 5 2
      src/main/java/com/persagy/proxy/adm/constant/AdmCommonConstant.java
  3. 5 2
      src/main/java/com/persagy/proxy/adm/constant/AdmRelationTypeEnum.java
  4. 3 0
      src/main/java/com/persagy/proxy/adm/constant/enums/AdmDictCategoryEnum.java
  5. 47 5
      src/main/java/com/persagy/proxy/adm/controller/AdmDictController.java
  6. 40 0
      src/main/java/com/persagy/proxy/adm/controller/AdmEquipFloorController.java
  7. 395 0
      src/main/java/com/persagy/proxy/adm/controller/AdmEquipShaftController.java
  8. 98 0
      src/main/java/com/persagy/proxy/adm/controller/AdmLabslController.java
  9. 68 0
      src/main/java/com/persagy/proxy/adm/controller/AdmPlanarController.java
  10. 1045 0
      src/main/java/com/persagy/proxy/adm/controller/AdmReportEquipController.java
  11. 0 2
      src/main/java/com/persagy/proxy/adm/controller/AdmShaftController.java
  12. 56 12
      src/main/java/com/persagy/proxy/adm/controller/AdmSystemController.java
  13. 187 0
      src/main/java/com/persagy/proxy/adm/controller/RelationEqForBdController.java
  14. 161 0
      src/main/java/com/persagy/proxy/adm/controller/RelationEqForFlController.java
  15. 156 0
      src/main/java/com/persagy/proxy/adm/controller/RelationEqForShController.java
  16. 160 0
      src/main/java/com/persagy/proxy/adm/controller/RelationEqInShController.java
  17. 140 0
      src/main/java/com/persagy/proxy/adm/controller/RelationFlAndBuController.java
  18. 164 0
      src/main/java/com/persagy/proxy/adm/controller/RelationFlThroughFlController.java
  19. 309 0
      src/main/java/com/persagy/proxy/adm/controller/RelationShContainSpBaseController.java
  20. 63 0
      src/main/java/com/persagy/proxy/adm/controller/RelationShInBdController.java
  21. 163 0
      src/main/java/com/persagy/proxy/adm/controller/RelationShaftThroughShaftController.java
  22. 139 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSpInBdOrFlController.java
  23. 182 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSpInSiController.java
  24. 258 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSpaceConnectionController.java
  25. 198 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyForBdController.java
  26. 196 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyForFlController.java
  27. 192 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyForShController.java
  28. 194 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyForSpController.java
  29. 240 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyInBdController.java
  30. 184 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyInFlController.java
  31. 242 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyInShController.java
  32. 163 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyInSpController.java
  33. 147 0
      src/main/java/com/persagy/proxy/adm/controller/RelationTnInSpController.java
  34. 5 0
      src/main/java/com/persagy/proxy/adm/model/AdmBuildingFloorInfo.java
  35. 10 0
      src/main/java/com/persagy/proxy/adm/model/AdmEquipTypeLabsl.java
  36. 50 0
      src/main/java/com/persagy/proxy/adm/model/AdmEquipment.java
  37. 2 2
      src/main/java/com/persagy/proxy/adm/model/AdmObjectInfo.java
  38. 36 0
      src/main/java/com/persagy/proxy/adm/model/AdmPlanarEquipRequests.java
  39. 8 0
      src/main/java/com/persagy/proxy/adm/model/AdmSystem.java
  40. 22 0
      src/main/java/com/persagy/proxy/adm/model/AdmZoneEquipQueryRequest.java
  41. 80 0
      src/main/java/com/persagy/proxy/adm/model/equip/EquipUpDateEnclosure.java
  42. 38 0
      src/main/java/com/persagy/proxy/adm/model/equip/ShaftSpaceVertical.java
  43. 30 0
      src/main/java/com/persagy/proxy/adm/model/equip/SpVerticalSp.java
  44. 35 0
      src/main/java/com/persagy/proxy/adm/model/relation/BaseEntity.java
  45. 27 0
      src/main/java/com/persagy/proxy/adm/model/relation/BdForEqList.java
  46. 24 0
      src/main/java/com/persagy/proxy/adm/model/relation/BdInSyList.java
  47. 30 0
      src/main/java/com/persagy/proxy/adm/model/relation/DeleteSyInSpBase.java
  48. 34 0
      src/main/java/com/persagy/proxy/adm/model/relation/EqForBd.java
  49. 26 0
      src/main/java/com/persagy/proxy/adm/model/relation/EqForBdList.java
  50. 35 0
      src/main/java/com/persagy/proxy/adm/model/relation/EqForFl.java
  51. 27 0
      src/main/java/com/persagy/proxy/adm/model/relation/EqForFlList.java
  52. 34 0
      src/main/java/com/persagy/proxy/adm/model/relation/EqForSh.java
  53. 23 0
      src/main/java/com/persagy/proxy/adm/model/relation/EqForShList.java
  54. 24 0
      src/main/java/com/persagy/proxy/adm/model/relation/FlForEqList.java
  55. 25 0
      src/main/java/com/persagy/proxy/adm/model/relation/FlInSyList.java
  56. 0 0
      src/main/java/com/persagy/proxy/adm/model/relation/FloorQueryRequest.java
  57. 32 0
      src/main/java/com/persagy/proxy/adm/model/relation/ShContainSpBase.java
  58. 28 0
      src/main/java/com/persagy/proxy/adm/model/relation/ShContainSpBaseList.java
  59. 23 0
      src/main/java/com/persagy/proxy/adm/model/relation/ShForEqList.java
  60. 25 0
      src/main/java/com/persagy/proxy/adm/model/relation/ShInBdList.java
  61. 27 0
      src/main/java/com/persagy/proxy/adm/model/relation/ShInSyList.java
  62. 35 0
      src/main/java/com/persagy/proxy/adm/model/relation/SiInSpBase.java
  63. 28 0
      src/main/java/com/persagy/proxy/adm/model/relation/SiInSpBaseList.java
  64. 25 0
      src/main/java/com/persagy/proxy/adm/model/relation/SpForSyBaseList.java
  65. 30 0
      src/main/java/com/persagy/proxy/adm/model/relation/SpInSyBaseList.java
  66. 34 0
      src/main/java/com/persagy/proxy/adm/model/relation/Sy2Sp.java
  67. 33 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyForSpBase.java
  68. 29 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyForSpBaseList.java
  69. 29 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInBd.java
  70. 21 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInBdList.java
  71. 39 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInFl.java
  72. 26 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInFlList.java
  73. 36 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInSh.java
  74. 26 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInShList.java
  75. 35 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInSpBase.java
  76. 27 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInSpBaseList.java
  77. 33 0
      src/main/java/com/persagy/proxy/adm/model/relation/TnInSpBase.java
  78. 23 0
      src/main/java/com/persagy/proxy/adm/model/relation/TnInSpBaseList.java
  79. 26 0
      src/main/java/com/persagy/proxy/adm/model/relation/UpDataFloorAndBuilding.java
  80. 8 0
      src/main/java/com/persagy/proxy/adm/service/IAdmBaseService.java
  81. 11 1
      src/main/java/com/persagy/proxy/adm/service/IAdmDictService.java
  82. 47 0
      src/main/java/com/persagy/proxy/adm/service/IAdmLabslService.java
  83. 32 0
      src/main/java/com/persagy/proxy/adm/service/IAdmPlanarService.java
  84. 10 0
      src/main/java/com/persagy/proxy/adm/service/IAdmSpVerticalSpService.java
  85. 15 0
      src/main/java/com/persagy/proxy/adm/service/ISyForSpService.java
  86. 32 0
      src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmBaseServiceImpl.java
  87. 8 1
      src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmDictBaseServiceImpl.java
  88. 131 9
      src/main/java/com/persagy/proxy/adm/service/impl/AdmDictServiceImpl.java
  89. 229 0
      src/main/java/com/persagy/proxy/adm/service/impl/AdmLabslServiceImpl.java
  90. 0 1
      src/main/java/com/persagy/proxy/adm/service/impl/AdmManualRelCalServiceImpl.java
  91. 219 0
      src/main/java/com/persagy/proxy/adm/service/impl/AdmPlanarServiceImpl.java
  92. 13 0
      src/main/java/com/persagy/proxy/adm/service/impl/AdmSpVerticalSpServiceImpl.java
  93. 2 0
      src/main/java/com/persagy/proxy/adm/service/impl/AdmSpaceServiceImpl.java

+ 2 - 2
pom.xml

@@ -54,12 +54,12 @@
 		<dependency>
 			<groupId>com.persagy</groupId>
 			<artifactId>integrated-config-client</artifactId>
-			<exclusions>
+			<!-- <exclusions>
 				<exclusion>
 					<artifactId>objenesis</artifactId>
 					<groupId>org.objenesis</groupId>
 				</exclusion>
-			</exclusions>
+			</exclusions> -->
 		</dependency>
         <dependency>
             <groupId>com.persagy</groupId>

+ 5 - 2
src/main/java/com/persagy/proxy/adm/constant/AdmCommonConstant.java

@@ -20,8 +20,11 @@ public interface AdmCommonConstant {
     String APP_ID = "ADM";
     
     /** 默认的userId */
-    String USER_ID = "0";
-    
+    String USER_ID = "systemId";
+
+    /** 默认项目id */
+    String PROJECTID = "system";
+
     /** 集团编码 header key*/
     String GROUP_CODE_HEADER = "groupCode";
 

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

@@ -242,8 +242,11 @@ public enum AdmRelationTypeEnum {
     /**通风不确定-通风相关设备-*/
     EQ2EQ_VENTNETWORK_3("eq2eq_VentNetwork_3","VentNetwork","Uncertain",AdmObjectType.EQUIPMENT.getIndex(),AdmObjectType.EQUIPMENT.getIndex(),false,true,false,false,false,false),
     /**高压变配电普通连接-高压变配电相关设备,沿电流方向-【调研录入参考资料CAD图纸】*/
-    EQ2EQ_HUDISTRIBUTION_1("eq2eq_HUDistribution_1","HUDistribution","Normal",AdmObjectType.EQUIPMENT.getIndex(),AdmObjectType.EQUIPMENT.getIndex(),false,true,false,false,false,false);
-
+    EQ2EQ_HUDISTRIBUTION_1("eq2eq_HUDistribution_1","HUDistribution","Normal",AdmObjectType.EQUIPMENT.getIndex(),AdmObjectType.EQUIPMENT.getIndex(),false,true,false,false,false,false),
+    /**
+     *业务空间内的元空间关系 20210914新增-不对请修改
+     */
+    SP2SI("","MechInArch","Sp2Si","","",false,true,false,false,false,false);
     /**数据中心的关系类型*/
     private String relationType;
     /**图类型编码*/

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

@@ -11,6 +11,9 @@ import java.util.List;
  * @Version V1.0
  **/
 public enum AdmDictCategoryEnum {
+    PROJECT("project", "项目"),
+    BUILDING("building", "建筑"),
+    FLOOR("floor", "楼层"),
     EQUIPMENT("equipment", "设备"),
     COMPONENT("component", "组件"),
     SYSTEM("system", "系统"),

+ 47 - 5
src/main/java/com/persagy/proxy/adm/controller/AdmDictController.java

@@ -1,12 +1,12 @@
 package com.persagy.proxy.adm.controller;
 
+import cn.hutool.core.collection.CollUtil;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.constant.AdmDictConstant;
 import com.persagy.proxy.adm.model.*;
 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.adm.service.IAdmDictBaseService;
 import com.persagy.proxy.adm.service.IAdmDictService;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import lombok.extern.slf4j.Slf4j;
@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.ws.rs.QueryParam;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @ClassName AdmDictController
@@ -39,9 +40,6 @@ public class AdmDictController {
     @Autowired
     private IAdmDictService service;
 
-    @Autowired
-    private IAdmDictBaseService baseService;
-
     /**
      * 字典类型查询:所有设备类型、部件类型、系统类型、专业类型
      * @param projectId
@@ -91,7 +89,7 @@ public class AdmDictController {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         request.setName(request.getType());
-        return baseService.doQueryObjectInfo(context, request, AdmDictConstant.CLASS_CODE, AdmObjectInfo.class);
+        return service.doQueryObjectInfo(context, request, AdmDictConstant.CLASS_CODE, AdmObjectInfo.class);
     }
 
     /**
@@ -175,4 +173,48 @@ public class AdmDictController {
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         return AdmResponse.success(new ArrayList<>());
     }
+
+    /**
+     * 查询类型下所有字典信息 M 和 L 类型,包括自定义信息点
+     * @param projectId
+     * @param dictTypeList
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/morl/query")
+    @Deprecated
+    public AdmResponse queryMorlDict(@QueryParam("projectId") String projectId,
+                                                @RequestBody List<String> dictTypeList) throws Exception {
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        if(CollUtil.isEmpty(dictTypeList)){
+            return AdmResponse.success(new ArrayList<>());
+        }
+        //查询指定类型下的信息点
+        return service.queryMorlDict(context,dictTypeList);
+    }
+
+    /**
+     * 获取不能同步到物理世界对象的数量
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/data-count")
+    @Deprecated
+    public AdmResponse queryNotSyncDmpObjects(@RequestBody AdmDictQueryCriteria request) throws Exception {
+        return AdmResponse.success(new ArrayList<>());
+    }
+
+    /**
+     * 需采集信息同步到所有项目
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/syn-dic-project")
+    @Deprecated
+    public AdmResponse syncProjectObjectInfo() throws Exception {
+        return AdmResponse.success(new ArrayList<>());
+    }
+
 }

+ 40 - 0
src/main/java/com/persagy/proxy/adm/controller/AdmEquipFloorController.java

@@ -0,0 +1,40 @@
+package com.persagy.proxy.adm.controller;
+
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.model.AdmFloor;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmFloorService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import javax.ws.rs.QueryParam;
+
+/**
+ * @author zhangwencheng
+ * 楼层相关接口
+ */
+
+@RestController
+@RequestMapping("/floor")
+public class AdmEquipFloorController {
+
+    @Autowired
+    private IAdmFloorService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+    /**
+     * 查询楼层信息
+     * 查询楼层信息,以及使用同一个模型文件处理情况
+     *级联对象:建筑(building)、项目(project)、楼层贯通关系(floorThroughList)
+     */
+    @PostMapping("/query")
+    public AdmResponse query(@RequestBody AdmQueryCriteria criteria,  @RequestParam("projectId") String projectId) {
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        criteria.setName(AdmFloor.OBJ_TYPE);
+        return service.doQuery(context, criteria, AdmFloor.class);
+    }
+}

+ 395 - 0
src/main/java/com/persagy/proxy/adm/controller/AdmEquipShaftController.java

@@ -0,0 +1,395 @@
+package com.persagy.proxy.adm.controller;
+
+
+import cn.hutool.core.text.TextSimilarity;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+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.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.model.*;
+import com.persagy.proxy.adm.model.equip.ShaftSpaceVertical;
+import com.persagy.proxy.adm.model.equip.SpVerticalSp;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.*;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.ws.rs.QueryParam;
+import java.util.*;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.stream.Collectors;
+
+/**
+ * @author zhangwencheng
+ * 竖井相关接口
+ */
+
+@RestController
+@RequestMapping("/shaft")
+public class AdmEquipShaftController {
+
+    @Autowired
+    private IAdmSystemService systemService;
+
+    @Autowired
+    private IAdmEquipmentService equipmentService;
+
+    @Autowired
+    private IAdmShaftService shaftService;
+
+    @Autowired
+    private IAdmBuildingService buildingService;
+
+    @Autowired
+    private IAdmSpVerticalSpService spVerticalSpService;
+
+    @Autowired
+    private IAdmSpaceService spaceService;
+
+    @Autowired
+    private IAdmRelationService relationService;
+
+    @Autowired
+    private IAdmFloorService floorService;
+
+    @Autowired
+    private IAdmDtRelationService dtRelationService;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 查询没有和当前竖井绑定的系统
+     *
+     * @param param 竖井
+     */
+    @PostMapping("/unshaft-in-sys")
+    public AdmResponse unShaftSys(@RequestBody JSONObject param, @RequestParam("projectId") String projectId) {
+        //根据竖井Id,查询系统Id
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria queryRequest = new QueryCriteria();
+        String shaftId = param.getString("shaftId");
+        ObjectNode criteriaRel = JsonNodeFactory.instance.objectNode();
+        criteriaRel.put("graphCode", "MechInArch");
+        criteriaRel.put("relCode", "Sy2Sh");
+        criteriaRel.put("objTo", shaftId);
+        queryRequest.setCriteria(criteriaRel);
+        List<ObjectRelation> objectRelations = relationService.queryByCondition(context, queryRequest);
+       List<String> sysIds = objectRelations.stream().map(ObjectRelation::getObjFrom).collect(Collectors.toList());
+//        String filter = "id = '" + shaftId + "'";
+//        //根据竖井Id查询竖井
+//        JSONObject request = param.getJSONObject("request");
+//        AdmQueryCriteria criteria = JSONObject.toJavaObject(request, AdmQueryCriteria.class);
+//        criteria.setFilters(filter);
+//        AdmResponse admResponse = shaftService.doQuery(context, criteria, AdmShaft.class);
+//        List<AdmShaft> admShafts = (List<AdmShaft>) admResponse.getContent();
+//        List<String> sysIds = new ArrayList<>();
+//        //获取竖井下的系统
+//        for (AdmShaft admShaft : admShafts) {
+//            List<AdmSystem> systemList = admShaft.getSystemList();
+//            if (!CollectionUtils.isEmpty(systemList)) {
+//                for (AdmSystem admSystem : systemList) {
+//                    sysIds.add(admSystem.getId());
+//                }
+//            }
+//        }
+        JSONObject request = param.getJSONObject("request");
+        AdmQueryCriteria criteria = JSONObject.toJavaObject(request, AdmQueryCriteria.class);
+        //查询全量系统
+        String filter = null;
+        criteria.setFilters(filter);
+        criteria.setName(AdmSystem.OBJ_TYPE);
+        AdmResponse admResponse = systemService.doQuery(context, criteria, AdmSystem.class);
+        List<AdmSystem> admSystems = (List<AdmSystem>) admResponse.getContent();
+        Iterator<AdmSystem> iterator = admSystems.iterator();
+        //去除竖井下的系统
+        while (iterator.hasNext()) {
+            AdmSystem next = iterator.next();
+            if (sysIds.contains(next.getId())) {
+                iterator.remove();
+            }
+        }
+        admResponse.setContent(admSystems);
+        return admResponse;
+    }
+
+    /**
+     * 查询没有和当前竖井绑定的设备
+     */
+    @PostMapping(value = "/unshaft-in-eq")
+    public AdmResponse unShaftEq(@RequestBody JSONObject param, @QueryParam("projectId") String projectId) {
+        String shaftId = param.getString("shaftId");
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria queryRequest = new QueryCriteria();
+        ObjectNode criteriaRel = JsonNodeFactory.instance.objectNode();
+        criteriaRel.put("graphCode", "MechInArch");
+        criteriaRel.put("relCode", "Eq2Sh");
+        criteriaRel.put("objTo", shaftId);
+        queryRequest.setCriteria(criteriaRel);
+        List<ObjectRelation> objectRelations = relationService.queryByCondition(context, queryRequest);
+        List<String> equipIds = objectRelations.stream().map(ObjectRelation::getObjFrom).collect(Collectors.toList());
+
+//        String filter = "id = '" + shaftId + "'";
+//        //根据竖井Id查询
+//        JSONObject request = param.getJSONObject("request");
+//        AdmQueryCriteria criteria = JSONObject.toJavaObject(request, AdmQueryCriteria.class);
+//        criteria.setFilters(filter);
+//        AdmResponse admResponse = shaftService.doQuery(context, criteria, AdmShaft.class);
+//        List<AdmShaft> admShafts = (List<AdmShaft>) admResponse.getContent();
+//        List<String> equipIds = new ArrayList<>();
+//        //获取竖井下的设备Id
+//        for (AdmShaft admShaft : admShafts) {
+//            List<AdmEquipment> equipmentList = admShaft.getEquipmentList();
+//            if (!CollectionUtils.isEmpty(equipmentList)) {
+//                for (AdmEquipment equipment : equipmentList) {
+//                    equipIds.add(equipment.getId());
+//                }
+//            }
+//        }
+        //查询所有设备
+        JSONObject request = param.getJSONObject("request");
+        AdmQueryCriteria criteria = JSONObject.toJavaObject(request, AdmQueryCriteria.class);
+        criteria.setFilters(null);
+        criteria.setName(AdmEquipment.OBJ_TYPE);
+        AdmResponse equipments = equipmentService.doQuery(context, criteria, AdmEquipment.class);
+        List<AdmEquipment> admEquipments = (List<AdmEquipment>) equipments.getContent();
+        //去除重复,竖井Id下的设备
+        Iterator<AdmEquipment> iterator = admEquipments.iterator();
+        while (iterator.hasNext()) {
+            AdmEquipment next = iterator.next();
+            if (equipIds.contains(next.getId())) {
+                iterator.remove();
+            }
+        }
+        equipments.setContent(admEquipments);
+        return equipments;
+    }
+
+    /**
+     * 查询没有和当前竖井贯通的其它竖井
+     */
+    @PostMapping(value = "/unshaft-through-shaft")
+    public AdmResponse unShaftThroughShaft(@RequestBody JSONObject param, @RequestParam("projectId") String projectId) {
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        String shaftId = param.getString("shaftId");
+        JSONObject request = param.getJSONObject("request");
+
+//        (graphCode = "ThroughRelationship", relCode = "Sh2Sh")
+        QueryCriteria queryRequest = new QueryCriteria();
+        ObjectNode criteriaRel = JsonNodeFactory.instance.objectNode();
+        criteriaRel.put("graphCode", "ThroughRelationship");
+        criteriaRel.put("relCode", "Sh2Sh");
+        criteriaRel.put("objTo", shaftId);
+        queryRequest.setCriteria(criteriaRel);
+        List<ObjectRelation> objectRelations = relationService.queryByCondition(context, queryRequest);
+        List<String> shaftIds = objectRelations.stream().map(ObjectRelation::getObjFrom).collect(Collectors.toList());
+        queryRequest = new QueryCriteria();
+        criteriaRel = JsonNodeFactory.instance.objectNode();
+        criteriaRel.put("graphCode", "ThroughRelationship");
+        criteriaRel.put("relCode", "Sh2Sh");
+        criteriaRel.put("objFrom", shaftId);
+        queryRequest.setCriteria(criteriaRel);
+        List<ObjectRelation> objectRel = relationService.queryByCondition(context, queryRequest);
+        List<String> shaftIdTos = objectRel.stream().map(ObjectRelation::getObjTo).collect(Collectors.toList());
+        shaftIds.addAll(shaftIdTos);
+        shaftIds.add(shaftId);
+
+        AdmQueryCriteria criteria = JSONObject.toJavaObject(request, AdmQueryCriteria.class);
+        criteria.setName(AdmShaft.OBJ_TYPE);
+        AdmResponse admResponse = shaftService.doQuery(context, criteria, AdmShaft.class);
+        List<AdmShaft> admShafts = (List<AdmShaft>) admResponse.getContent();
+        Iterator<AdmShaft> iterator = admShafts.iterator();
+        //去除竖井和竖井Id相同的竖井,一部分是关联数据
+        while (iterator.hasNext()) {
+            AdmShaft admShaft = iterator.next();
+            List<AdmShaft> shaftThroughList = admShaft.getShaftThroughList();
+            if (shaftIds.contains(admShaft.getId())) {
+                iterator.remove();
+                continue;
+            }
+//            for (AdmShaft shaft : shaftThroughList) {
+//                if (shaft.getId().equals(shaftId)) {
+//                    iterator.remove();
+//                    break;
+//                }
+//            }
+        }
+        admResponse.setContent(admShafts);
+        return admResponse;
+    }
+
+    /**
+     * 查询竖井关联的空间垂直交通关系
+     */
+    @PostMapping("/shaft-vertical-space")
+    public AdmResponse shaftSpaceVertical(@RequestBody ShaftSpaceVertical shaftSpaceVertical, @RequestParam("projectId") String projectId) {
+        String buildingId = shaftSpaceVertical.getBuildingId();
+        String shaftId = shaftSpaceVertical.getShaftId();
+        String objectType = shaftSpaceVertical.getObjectType();
+        Boolean aiSwitch = shaftSpaceVertical.getAiSwitch();
+        if (StrUtil.isBlank(buildingId) || StrUtil.isBlank(shaftId)) {
+            return AdmResponse.failure("必填项:buildingId(建筑id)、shaftId(竖井Id)");
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria queryRequest = new QueryCriteria();
+        ObjectNode criteriaRel = JsonNodeFactory.instance.objectNode();
+        criteriaRel.put("graphCode", "ArchSubset");
+        criteriaRel.put("relCode", "Bd2Fl");
+        criteriaRel.put("objFrom", buildingId);
+        queryRequest.setCriteria(criteriaRel);
+        List<ObjectRelation> objectRelations = relationService.queryByCondition(context, queryRequest);
+//        putString(criteria, "graphCode", anno.graphCode());
+//        putString(criteria, "relCode", anno.relCode());
+//        putString(criteria, "relValue", anno.relValue());
+//        ArrayNode array = criteria.putObject(isSelectTo?"objFrom":"objTo").putArray("$in");
+//        idList.forEach(id -> array.add(id));
+        List<String> floorIds = objectRelations.stream().map(ObjectRelation::getObjTo).collect(Collectors.toList());
+        AdmQueryCriteria criteria = new AdmQueryCriteria();
+        String filter = " id in ('" + StrUtil.join("','", floorIds) + "') ";
+        criteria.setFilters(filter);
+        AdmResponse admBuild = floorService.doQuery(context, criteria, AdmFloor.class);
+        List<AdmFloor> floor = (List<AdmFloor>) admBuild.getContent();
+        //建筑下的楼层
+        AdmResponse admResult = new AdmResponse();
+        if (CollectionUtils.isEmpty(floor)) {
+            return admResult;
+        }
+        List<AdmSpace> spaceList = new ArrayList<>();
+        //3 如果开关为true
+        if (aiSwitch) {
+            //1.查询竖井下的空间
+//            and relValue = " + objectType + "
+            filter = "graphCode = 'ArchSubset' and relCode = 'Sh2Sp' and projectId = " + projectId + " and objFrom =" + shaftId + " and valid = 1";
+            criteria.setFilters(filter);
+            AdmResponse admResponse = dtRelationService.doQuery(context, criteria, AdmDtRelation.class);
+            List<AdmDtRelation> dtRelations = (List<AdmDtRelation>) admResponse.getContent();
+            List<String> spaceIdss = dtRelations.stream().map(AdmDtRelation::getObj_to).collect(Collectors.toList());
+            filter = " id in ('" + StrUtil.join("','", spaceIdss) + "') ";
+            criteria.setFilters(filter);
+            admResponse= spaceService.doQuery(context,criteria,AdmSpace.class);
+            spaceList = (List<AdmSpace>) admResponse.getContent();
+            //2.排除不在buildingId下的
+            Iterator<AdmSpace> iterator = spaceList.iterator();
+            while (iterator.hasNext()) {
+                AdmSpace admSpace = iterator.next();
+                if (!buildingId.equals(admSpace.getBuildingId())) {
+                    iterator.remove();
+                }
+            }
+            List<AdmSpace> copy = spaceList.stream().collect(Collectors.toList());
+
+            List<String> classCodes = spaceList.stream().map(AdmSpace::getClassCode).collect(Collectors.toList());
+            //查询建筑下所有指定类型空间
+            String classCodeStr = "('" + StrUtil.join("','", classCodes) + "') ";
+            //查询空间对象
+            filter = "projectId = " + projectId + " and buildingId = " + buildingId + " and classCode in " + classCodeStr + " and valid = 1";
+            criteria.setFilters(filter);
+            AdmResponse admSpaceRes = spaceService.doQuery(context, criteria, AdmSpace.class);
+            List<AdmSpace> spaces = (List<AdmSpace>) admSpaceRes.getContent();
+            for (AdmSpace space : spaces) {
+                boolean flag = false;
+                String localId = space.getLocalId();
+                String localName = space.getLocalName();
+                if (StrUtil.isBlank(localId) || StrUtil.isBlank(localName)) {
+                    for (AdmSpace admSpace : copy) {
+                        admSpace.getLocalId();
+                        admSpace.getLocalName();
+                        //如果名称或id匹配的大于90%
+                        if (TextSimilarity.similar(admSpace.getLocalId(), localId) > 0.9 || TextSimilarity.similar(admSpace.getLocalName(), localName) > 0.9) {
+                            flag = true;
+                            break;
+                        }
+                    }
+                    if (flag) {
+                        spaceList.add(space);
+                    }
+                }
+            }
+            //4 查询交通关系
+            classCodes = spaceList.stream().map(AdmSpace::getClassCode).collect(Collectors.toList());
+            classCodeStr = "('" + StrUtil.join("','", classCodes) + "') ";
+            filter = "graphCode = TrafficNetwork and projectId = " + projectId + " and (objFrom in " + classCodeStr + " or objTo in " + classCodeStr + ") and valid = 1";
+            criteria.setFilters(filter);
+            AdmResponse admSp = spVerticalSpService.doQuery(context, criteria, SpVerticalSp.class);
+            List<SpVerticalSp> spVerticalSps = (List<SpVerticalSp>) admSp.getContent();
+            List<String> spaceIds = spVerticalSps.stream().map(SpVerticalSp::getSpaceId).collect(Collectors.toList());
+            String id = " id in ('" + StrUtil.join("','", spaceIds) + "') ";
+            criteria.setFilters(id);
+            admSpaceRes = spaceService.doQuery(context, criteria, AdmSpace.class);
+            spaces = (List<AdmSpace>) admSpaceRes.getContent();
+            spaceList.addAll(spaces);
+            Set<String> ids = new HashSet<>();
+            Iterator<AdmSpace> iter = spaceList.iterator();
+            while (iter.hasNext()) {
+                AdmSpace next = iter.next();
+                //去除重复
+                if (ids.contains(next.getId())) {
+                    iter.remove();
+                }
+                ids.add(next.getId());
+            }
+        }
+        //6将spaceList按照floor分组返回floor对象
+        if (!CollectionUtils.isEmpty(spaceList)) {
+            Map<String, List<AdmSpace>> map = new HashMap<>();
+            for (AdmSpace admSpace : spaceList) {
+                String floorId = admSpace.getFloorId();
+                List<AdmSpace> spaces = new ArrayList<>();
+                if (map.containsKey(floorId)) {
+                    spaces = map.get(floorId);
+                }
+                spaces.add(admSpace);
+                map.put(floorId, spaces);
+            }
+            Iterator<AdmFloor> iterator = floor.iterator();
+            while (iterator.hasNext()) {
+                AdmFloor admFloor = iterator.next();
+                String id = admFloor.getId();
+                List<AdmSpace> spaces = map.get(id);
+                if (CollectionUtils.isEmpty(spaces)) {
+                    iterator.remove();
+                    continue;
+                }
+                admFloor.setSpaceList(spaces);
+            }
+        }
+
+        admResult.setContent(floor);
+        return admResult;
+    }
+
+    /**
+     * 计算 和当前竖井有关联的空间的垂直交通关系
+     */
+    @PostMapping("/vertical-space")
+    public AdmResponse shaftVerticalSp(@RequestBody ShaftSpaceVertical shaftSpaceVertical, @RequestParam("projectId") String projectId) {
+        String buildingId = shaftSpaceVertical.getBuildingId();
+        String shaftId = shaftSpaceVertical.getShaftId();
+        String objectType = shaftSpaceVertical.getObjectType();
+        if (StrUtil.isBlank(buildingId) || StrUtil.isBlank(shaftId) || StrUtil.isBlank(objectType)) {
+            return AdmResponse.failure("必填项:buildingId(建筑id)、shaftId(竖井Id),objectType(空间类型)");
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        AdmQueryCriteria criteria = new AdmQueryCriteria();
+        String filter = "graphCode = 'ArchSubset' and relCode = 'Sh2Sp' and projectId = " + projectId + " and objFrom =" + shaftId + " and valid = 1";
+        criteria.setFilters(filter);
+        AdmResponse admResponse = dtRelationService.doQuery(context, criteria, AdmDtRelation.class);
+        List<AdmDtRelation> dtRelations = (List<AdmDtRelation>) admResponse.getContent();
+        List<String> spaceIdss = dtRelations.stream().map(AdmDtRelation::getObj_to).collect(Collectors.toList());
+        filter = " id in ('" + StrUtil.join("','", spaceIdss) + "') ";
+        criteria.setFilters(filter);
+        admResponse= spaceService.doQuery(context,criteria,AdmSpace.class);
+        AdmResponse admResult = new AdmResponse();
+        return admResult;
+    }
+
+}

+ 98 - 0
src/main/java/com/persagy/proxy/adm/controller/AdmLabslController.java

@@ -0,0 +1,98 @@
+package com.persagy.proxy.adm.controller;
+
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.model.AdmObjectInfo;
+import com.persagy.proxy.adm.model.AdmObjectType;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmLabslService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+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.ws.rs.QueryParam;
+import java.util.List;
+
+/**
+ * @ClassName AdmLabslController
+ * @Description: 蜡笔森林定制接口
+ * @Author linhuili
+ * @Date 2021/9/17 20:01
+ * @Version V1.0
+ **/
+@RestController
+@RequestMapping("/labsl")
+@Slf4j
+public class AdmLabslController {
+
+
+    @Autowired
+    private IAdmLabslService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 查询项目下的设备类型
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/category")
+    public AdmResponse queryCategory() throws Exception {
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, AdmCommonConstant.PROJECTID, AdmCommonConstant.APP_ID);
+        return service.queryCategory(context, AdmObjectInfo.class);
+    }
+
+
+    /**
+     * 查询项目下的空间类型
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/zone/type")
+    public AdmResponse queryZoneType() throws Exception {
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, AdmCommonConstant.PROJECTID, AdmCommonConstant.APP_ID);
+        return service.queryZoneType(context, AdmObjectInfo.class);
+    }
+
+    /**
+     * 查询项目下的建筑楼层
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/building/floor")
+    public AdmResponse queryBuildFloor(@QueryParam("projectId") String projectId) throws Exception {
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        return service.queryBuildFloor(context, AdmObjectInfo.class);
+    }
+
+
+    /**
+     * 查询设备包含设备类型
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/query/equip")
+    public AdmResponse queryEquipType(@QueryParam("projectId") String projectId) throws Exception {
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        return service.queryBuildFloor(context, AdmObjectInfo.class);
+    }
+
+
+    /**
+     * 根据设备id统计设备所属的专业
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/major/category")
+    public AdmResponse queryMajorCategory(@QueryParam("projectId") String projectId,
+                                          @RequestBody List<String> ids) throws Exception {
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        return service.queryMajorCategory(context, ids , AdmObjectType.class);
+    }
+
+}

+ 68 - 0
src/main/java/com/persagy/proxy/adm/controller/AdmPlanarController.java

@@ -0,0 +1,68 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.model.*;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmPlanarService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+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.ws.rs.QueryParam;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName AdmLabslController
+ * @Description: 平面图接口
+ * @Author linhuili
+ * @Date 2021/9/18 13:01
+ * @Version V1.0
+ **/
+@RestController
+@RequestMapping("/planar")
+@Slf4j
+public class AdmPlanarController {
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    @Autowired
+    private IAdmPlanarService service;
+
+    /**
+     * 查询平面图设备信息
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/equip")
+    public AdmResponse queryPlanarEquip(@QueryParam("projectId") String projectId,
+                                          @RequestBody AdmPlanarEquipRequests requests) throws Exception {
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        if(requests == null){
+            throw new Exception("请求参数不能为空");
+        }
+        return service.queryPlanarEquip(context,requests, AdmEquipment.class);
+    }
+
+    /**
+     * 查询平面图空间信息
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/space")
+    public AdmResponse queryPlanarSpace(@QueryParam("projectId") String projectId,
+                                  @RequestBody AdmPlanarEquipRequests requests) throws Exception {
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        if(requests == null){
+            throw new Exception("请求参数不能为空");
+        }
+        return service.queryPlanarSpace(context,requests, AdmSpace.class);
+    }
+}

文件差异内容过多而无法显示
+ 1045 - 0
src/main/java/com/persagy/proxy/adm/controller/AdmReportEquipController.java


+ 0 - 2
src/main/java/com/persagy/proxy/adm/controller/AdmShaftController.java

@@ -52,8 +52,6 @@ public class AdmShaftController {
     private IAdmRelationService relationService;
     @Autowired
     private IAdmBuildingService buildingService;
-    @Autowired
-    private IAdmDictBaseService dictBaseService;
     @Value("${middleware.group.code}")
     private String groupCode;
 

+ 56 - 12
src/main/java/com/persagy/proxy/adm/controller/AdmSystemController.java

@@ -2,7 +2,6 @@ package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
-import cn.hutool.json.JSONUtil;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -12,13 +11,14 @@ import com.persagy.dmp.define.client.DigitalDefineFacade;
 import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
-import com.persagy.dmp.digital.entity.ObjectDigital;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.*;
 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.adm.service.IAdmBuildingService;
+import com.persagy.proxy.adm.service.IAdmFloorService;
 import com.persagy.proxy.adm.service.IAdmSystemService;
 import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
@@ -30,8 +30,9 @@ import org.springframework.web.bind.annotation.*;
 import javax.json.JsonObject;
 import javax.validation.constraints.NotNull;
 import javax.ws.rs.QueryParam;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 /**
  * Adm 系统 API
@@ -44,6 +45,10 @@ import java.util.stream.Collectors;
 public class AdmSystemController {
     @Autowired
     private IAdmSystemService service;
+    @Autowired
+    private IAdmBuildingService buildingService;
+    @Autowired
+    private IAdmFloorService floorService;
     @Value("${middleware.group.code}")
     private String groupCode;
 
@@ -220,6 +225,45 @@ public class AdmSystemController {
         }
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        if(StrUtil.isAllNotEmpty(buildingId, floorId) && !"1".equals(buildingId) && !"1".equals(floorId)){
+            //系统级联建筑 楼层
+            AdmResponse syses = service.doQuery(context, request, AdmSystem.class);
+            if(CollUtil.isEmpty(syses.getContent())){
+                return syses;
+            }
+            AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
+            admQueryCriteria.setName(AdmBuilding.OBJ_TYPE);
+            admQueryCriteria.setFilters("id = "+buildingId);
+            AdmResponse buildings = buildingService.doQuery(context, request, AdmBuilding.class);
+
+            admQueryCriteria = new AdmQueryCriteria();
+            admQueryCriteria.setName(AdmFloor.OBJ_TYPE);
+            admQueryCriteria.setFilters("id = "+floorId);
+            AdmResponse floors = floorService.doQuery(context, request, AdmFloor.class);
+            //处理数据 BuildingFloorInfo
+            AdmBuildingFloorInfo buildingFloorInfo = new AdmBuildingFloorInfo();
+            if(CollUtil.isNotEmpty(floors.getContent())){
+                AdmFloor floor = (AdmFloor) floors.getContent().get(0);
+                buildingFloorInfo.setFloorName(floor.getLocalName());
+                buildingFloorInfo.setFloorID(floorId);
+            }
+            if(CollUtil.isNotEmpty(buildings.getContent())){
+                AdmBuilding building = (AdmBuilding) floors.getContent().get(0);
+                buildingFloorInfo.setBuildName(building.getLocalName());
+                buildingFloorInfo.setBuildID(buildingId);
+            }
+            List<AdmSystem> admSystemList = (List<AdmSystem>) syses.getContent();
+            admSystemList.stream().forEach( admSystem -> {
+                admSystem.setBuildingFloorInfoList(CollUtil.newArrayList(buildingFloorInfo));
+            });
+            syses.setContent(admSystemList);
+            return syses;
+        }
+
+
+
+        return null;
+       /*
         QueryCriteria queryCriteria_sysInFl = new QueryCriteria();
         ObjectNode criteria_sysInFl = JsonNodeFactory.instance.objectNode();
         criteria_sysInFl.put("relCode","Sy2Fl");
@@ -237,7 +281,7 @@ public class AdmSystemController {
         Set<String> sysIds = new HashSet<>();
         List<ObjectRelation> relations_SysInFl = null;
         if(StrUtil.isAllNotEmpty(buildingId,floorId)&&!floorId.equals("1")){
-            /** 楼层id不为空且不为1,建筑id为空 ---> 系统和楼层关系表 取系统id  408 --> 明确建筑明确楼层->空间*/
+            *//** 楼层id不为空且不为1,建筑id为空 ---> 系统和楼层关系表 取系统id  408 --> 明确建筑明确楼层->空间*//*
             criteria_sysInFl.put("objTo", floorId);
             queryCriteria_sysInFl.setCriteria(criteria_sysInFl);
             relations_SysInFl = DigitalRelationFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteria_sysInFl);
@@ -246,7 +290,7 @@ public class AdmSystemController {
             }
             ensureCondion(context, null, sysIds, criteria_obj,true);
         }else if(StrUtil.isAllNotEmpty(buildingId,floorId)&&floorId.equals("1")&&!buildingId.equals("1")){
-            /** 楼层id为空,建筑id不为空且不为1 ---> 系统和建筑关系表 取系统id  421*/
+            *//** 楼层id为空,建筑id不为空且不为1 ---> 系统和建筑关系表 取系统id  421*//*
             // 明确建筑 未明确楼层
             relations_SysInFl = DigitalRelationFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteria_sysInFl);
             if(CollUtil.isNotEmpty(relations_SysInFl)){
@@ -258,16 +302,16 @@ public class AdmSystemController {
                 ensureCondion(context, queryCriteria_sysInBd, sysIds, criteria_obj,true);
             }
         }else if(StrUtil.isEmpty(floorId) && StrUtil.isNotEmpty(buildingId) && buildingId.equals("1")){
-            /** 楼层id为1,建筑id为1 ---> 系统id不在(系统和楼层关系表 取系统id  系统和建筑关系表 取系统id)之内 450*/
+            *//** 楼层id为1,建筑id为1 ---> 系统id不在(系统和楼层关系表 取系统id  系统和建筑关系表 取系统id)之内 450*//*
             //未明确建筑 没有Sy2Bd关系的系统
             ensureCondion(context, queryCriteria_sysInBd, sysIds, criteria_obj,false);
         }else if(StrUtil.isEmpty(floorId) && StrUtil.isNotEmpty(buildingId) && !buildingId.equals("1")){
-            /** 楼层id不为空,建筑id不为空 ---> 系统和楼层关系表 取系统id  将建筑id作为条件 461*/
+            *//** 楼层id不为空,建筑id不为空 ---> 系统和楼层关系表 取系统id  将建筑id作为条件 461*//*
             criteria_sysInBd.put("objTo", buildingId);
             queryCriteria_sysInBd.setCriteria(criteria_sysInBd);
             ensureCondion(context, queryCriteria_sysInBd, sysIds, criteria_obj,true);
         } else if(StrUtil.isAllEmpty(floorId, buildingId)){
-            /** 楼层id为空,建筑id为空 ---> 查询所有 */
+            *//** 楼层id为空,建筑id为空 ---> 查询所有 *//*
         }
         queryCriteriaObj.setCriteria(criteria_obj);
         List<ObjectNode> systems = DigitalObjectFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteriaObj);
@@ -314,10 +358,10 @@ public class AdmSystemController {
             return AdmResponse.success(systems);
         }else{
             return AdmResponse.success();
-        }
+        }*/
     }
 
-    private void ensureCondion(InstanceUrlParam context, QueryCriteria queryCriteria_sysInBd, Set<String>sysIds, ObjectNode criteria_obj, boolean ifInCondition){
+    /*private void ensureCondion(InstanceUrlParam context, QueryCriteria queryCriteria_sysInBd, Set<String>sysIds, ObjectNode criteria_obj, boolean ifInCondition){
         if(queryCriteria_sysInBd != null){
             List<ObjectRelation> relations_SysInBd = DigitalRelationFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteria_sysInBd);
             if(CollUtil.isNotEmpty(relations_SysInBd)){
@@ -332,7 +376,7 @@ public class AdmSystemController {
                 sysIds.stream().forEach(id -> arrayNode.add(id));
             }
         }
-    }
+    }*/
 
     /**
      * 查询系统信息-试图级联建筑楼层 暂未使用

+ 187 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationEqForBdController.java

@@ -0,0 +1,187 @@
+package com.persagy.proxy.adm.controller;
+
+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.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.relation.BdForEqList;
+import com.persagy.proxy.adm.model.relation.EqForBd;
+import com.persagy.proxy.adm.model.relation.EqForBdList;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 设备服务于建筑
+ *
+ * @author zhangwencheng
+ */
+@RestController
+@RequestMapping("/rel/eq-for-bd")
+public class RelationEqForBdController {
+
+    @Autowired
+    private IAdmRelationService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 创建设备服务于建筑关系
+     * 必填项:EquipId(设备id)、BuildingId(建筑id)
+     *
+     * @param eq2Bd 设备和建筑的关系对象
+     * @return 创建的结果信息
+     */
+    @PostMapping("/link")
+    public AdmResponse create(@RequestBody EqForBd eq2Bd, @RequestParam("projectId") String projectId) {
+        String buildingId = eq2Bd.getBuildingId();
+        String equipId = eq2Bd.getEquipId();
+        //检验输入参数
+        if (StrUtil.isEmpty(buildingId) || StrUtil.isEmpty(equipId)) {
+            return AdmResponse.failure("必填项:equipId(设备id)、buildingId(建筑id列表)");
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2BD;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        RelationDTO relation = new RelationDTO(null, graphCode, relCode, "", equipId, buildingId);
+        voList.add(relation);
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 设备服务于建筑,设备一对多
+     * 必填项:BuildingIdList(建筑id列表)、EquipId(设备id),测方法会覆盖以前的记录
+     *
+     * @param eqForBdList
+     * @return 创建的结果信息
+     */
+    @PostMapping("link-bd")
+    public AdmResponse createBd(@RequestBody EqForBdList eqForBdList, @RequestParam("projectId") String projectId) {
+        List<String> buildingIdList = eqForBdList.getBuildingIdList();
+        String equipId = eqForBdList.getEquipId();
+        //检验输入参数
+        if (CollectionUtils.isEmpty(buildingIdList) || StrUtil.isEmpty(equipId)) {
+            return AdmResponse.failure("必填项:equipId(设备id)、buildingIdList(建筑id列表)");
+        }
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2BD;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        //根据设备删除以前信息
+        deleteByEquipId(equipId, typeEnum, context);
+        for (String buildingId : buildingIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, equipId, buildingId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 根据设备Id删除信息
+     *
+     * @param equipId
+     * @param typeEnum
+     * @param context
+     */
+    private void deleteByEquipId(String equipId, AdmRelationTypeEnum typeEnum, InstanceUrlParam context) {
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", typeEnum.getGraphCode());
+        node.put("relCode", typeEnum.getRelCode());
+        node.put("objFrom", equipId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+    }
+
+    /**
+     * 服务于建筑的设备,建筑一对多
+     * 必填项:EquipIdList(设备id列表)、BuildingId(建筑id)
+     *
+     * @param bdForEqList 设备和建筑关系对象
+     * @return 创建的结果信息
+     */
+    @PostMapping("link-sy")
+    public AdmResponse createSy(@RequestBody BdForEqList bdForEqList, @RequestParam("projectId") String projectId) {
+        String buildingId = bdForEqList.getBuildingId();
+        List<String> equipIdList = bdForEqList.getEquipIdList();
+        //检验输入参数
+        if (CollectionUtils.isEmpty(equipIdList) || StrUtil.isEmpty(buildingId)) {
+            return AdmResponse.failure("必填项:equipIdList(设备id列表)、buildingId(建筑id)");
+        }
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2BD;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        deleteByBuildId(buildingId, typeEnum, context);
+        for (String equipId : equipIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, equipId, buildingId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 根据建筑Id删除设备和建筑关系
+     *
+     * @param buildingId
+     * @param typeEnum
+     * @param context
+     */
+    private void deleteByBuildId(String buildingId, AdmRelationTypeEnum typeEnum, InstanceUrlParam context) {
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", typeEnum.getGraphCode());
+        node.put("relCode", typeEnum.getRelCode());
+        node.put("objTo", buildingId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+    }
+
+    /**
+     * 根据对象删除设备服务于建筑的关系,只针对一个对象
+     * 必填项:EquipId(设备id)、BuildingId(建筑id)
+     *
+     * @param eqForBd 对象
+     * @return 删除的结果信息
+     */
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestBody EqForBd eqForBd, @RequestParam("projectId") String projectId) {
+        String equipId = eqForBd.getEquipId();
+        String buildingId = eqForBd.getBuildingId();
+        //检验输入参数
+        if (StrUtil.isEmpty(equipId) || StrUtil.isEmpty(buildingId)) {
+            return AdmResponse.failure("必填项:equipId(设备id)、buildingId(建筑id)");
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2BD;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", graphCode);
+        node.put("relCode", relCode);
+        node.put("objTo", buildingId);
+        node.put("objFrom", equipId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+        return AdmResponse.success();
+    }
+}

+ 161 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationEqForFlController.java

@@ -0,0 +1,161 @@
+package com.persagy.proxy.adm.controller;
+
+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.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.relation.EqForFl;
+import com.persagy.proxy.adm.model.relation.EqForFlList;
+import com.persagy.proxy.adm.model.relation.FlForEqList;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 037 -设备服务于楼层
+ *
+ * @author zhangwencheng
+ */
+
+@Slf4j
+@RestController
+@RequestMapping("/rel/eq-for-fl")
+public class RelationEqForFlController {
+
+    @Autowired
+    private IAdmRelationService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 创建设备服务于楼层关系
+     * 必填项:EquipId(设备id)、FloorId(楼层id)
+     *
+     * @param eqForFl 设备和楼层的关系对象
+     * @return 创建的结果信息
+     */
+    @PostMapping("/link")
+    public AdmResponse create(@RequestBody EqForFl eqForFl, @RequestParam("projectId") String projectId) {
+        String equipId = eqForFl.getEquipId();
+        String floorId = eqForFl.getFloorId();
+        //检验输入参数
+        if (StrUtil.isEmpty(equipId) || StrUtil.isEmpty(floorId)) {
+            return AdmResponse.failure("必填项:equipId(设备id)、buildingId(建筑id)");
+        }
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2FL_FOR;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        RelationDTO relation = new RelationDTO(null, graphCode, relCode, "", equipId, floorId);
+        voList.add(relation);
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+
+    /**
+     * 创建服务于楼层的设备关系
+     *
+     * @param flForEqList 设备和楼层关系对象
+     * @return 创建的结果信息
+     */
+    @PostMapping("link-eq")
+    public AdmResponse createEq(@RequestBody FlForEqList flForEqList, @RequestParam("projectId") String projectId) {
+        List<String> equipIdList = flForEqList.getEquipIdList();
+        String floorId = flForEqList.getFloorId();
+        //检验输入参数
+        if (CollectionUtils.isEmpty(equipIdList) || StrUtil.isEmpty(floorId)) {
+            return AdmResponse.failure("必填项:equipId(设备id)、equipIdList(设备Id列表)");
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2FL_FOR;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        //根据floorId删除信息
+        deleteByObjId(null, floorId, typeEnum, context);
+        for (String equipId : equipIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, "", equipId, floorId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 设备服务于楼层,设备一对多
+     * 必填项:FloorIdList(楼层id列表)、EquipId(设备id),测方法会覆盖以前的记录
+     *
+     * @return 创建的结果信息
+     */
+    @PostMapping("link-fl")
+    public AdmResponse createFl(@RequestBody EqForFlList eqForFlList, @RequestParam("projectId") String projectId) {
+        String equipId = eqForFlList.getEquipId();
+        List<String> floorIdList = eqForFlList.getFloorIdList();
+        //检验输入参数
+        if (CollectionUtils.isEmpty(floorIdList) || StrUtil.isEmpty(equipId)) {
+            return AdmResponse.failure("必填项:equipId(设备id)、floorIdList(楼层Id列表)");
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2FL_FOR;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        deleteByObjId(equipId, null, typeEnum, context);
+        for (String floorId : floorIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, "", equipId, floorId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 根据对象删除设备服务于楼层的关系,只针对一个对象
+     * 必填项:EquipId(设备id)、FloorId(楼层id)
+     * @param   eqForFl      对象
+     * @return                删除的结果信息
+     */
+    @PostMapping(value = "/unlink")
+    public AdmResponse delete(@RequestBody EqForFl eqForFl, @RequestParam("projectId") String projectId){
+        String floorId = eqForFl.getFloorId();
+        String equipId = eqForFl.getEquipId();
+        if (StrUtil.isEmpty(floorId) || StrUtil.isEmpty(equipId)) {
+            return AdmResponse.failure("必填项:equipId(设备id)、floorId(楼层floorId)");
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2FL_FOR;
+        deleteByObjId(equipId, floorId, typeEnum, context);
+        return  AdmResponse.success();
+    }
+    /**
+     * 根据楼层Id删除
+     *
+     * @param typeEnum
+     * @param context
+     */
+    private void deleteByObjId(String equipId, String floorId, AdmRelationTypeEnum typeEnum, InstanceUrlParam context) {
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", typeEnum.getGraphCode());
+        node.put("relCode", typeEnum.getRelCode());
+        node.put("objFrom", equipId);
+        node.put("objTo", floorId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+    }
+
+}

+ 156 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationEqForShController.java

@@ -0,0 +1,156 @@
+package com.persagy.proxy.adm.controller;
+
+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.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.relation.EqForSh;
+import com.persagy.proxy.adm.model.relation.EqForShList;
+import com.persagy.proxy.adm.model.relation.ShForEqList;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ * 设备服务于竖井
+ */
+@RestController
+@RequestMapping("/rel/eq-for-sh")
+public class RelationEqForShController {
+
+    @Autowired
+    private IAdmRelationService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 创建设备服务于竖井关系
+     * 必填项:EquipId(设备id)、ShaftId(竖井id)
+     *
+     * @return 创建的结果信息
+     */
+    @PostMapping("/link")
+    public AdmResponse create(@RequestBody EqForSh eqForSh, @RequestParam("projectId") String projectId) {
+        String equipId = eqForSh.getEquipId();
+        String shaftId = eqForSh.getShaftId();
+        String type = eqForSh.getType();
+        //检验输入参数
+        if (StrUtil.isEmpty(equipId) || StrUtil.isEmpty(shaftId)) {
+            return AdmResponse.failure("必填项:equipId(设备id)、shaftId(竖井Id)");
+        }
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2SH_FOR;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        RelationDTO relation = new RelationDTO(null, graphCode, relCode, type, equipId, shaftId);
+        voList.add(relation);
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 创建设备服务于竖井关系
+     * 必填项:ShaftIdList(竖井id列表)、EquipId(设备id),测方法会覆盖以前的记录
+     *
+     * @param
+     * @return 创建的结果信息
+     */
+    @PostMapping("/link-sh")
+    public AdmResponse createSh(@RequestBody EqForShList eqForShList, @RequestParam("projectId") String projectId) {
+        String equipId = eqForShList.getEquipId();
+        List<String> shaftIdList = eqForShList.getShaftIdList();
+        //检验输入参数
+        if (StrUtil.isEmpty(equipId) || CollectionUtils.isEmpty(shaftIdList)) {
+            return AdmResponse.failure("必填项:equipId(设备id)、shaftIdList(竖井Id列表)");
+        }
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2SH_FOR;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        deleteByObjId(equipId, null, null, typeEnum, context);
+        List<RelationDTO> voList = new ArrayList<>();
+        for (String shaftId : shaftIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, "", equipId, shaftId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 服务于竖井的设备,竖井一对多
+     * 必填项:ShaftId(竖井id)、EquipIdList(设备id列表),测方法会覆盖以前的记录
+     *
+     * @param shForEqList 设备和竖井的关系对象
+     * @return 创建的结果信息
+     */
+    @PostMapping("/link-eq")
+    public AdmResponse createEq(@RequestBody ShForEqList shForEqList, @RequestParam("projectId") String projectId) {
+        List<String> equipIdList = shForEqList.getEquipIdList();
+        String shaftId = shForEqList.getShaftId();
+        //检验输入参数
+        if (StrUtil.isEmpty(shaftId) || CollectionUtils.isEmpty(equipIdList)) {
+            return AdmResponse.failure("必填项:equipId(设备id)、shaftIdList(竖井Id列表)");
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2SH_FOR;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        deleteByObjId(null, shaftId, null, typeEnum, context);
+        List<RelationDTO> voList = new ArrayList<>();
+        for (String equipId : equipIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, "", equipId, shaftId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 根据对象删除设备服务于竖井关系,只针对一个对象
+     * 必填项:EquipId(设备id)、shaftId(竖井id)
+     *
+     * @param eqForSh 对象
+     * @return 删除的结果信息
+     */
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestBody EqForSh eqForSh, @RequestParam("projectId") String projectId) {
+        String shaftId = eqForSh.getShaftId();
+        String equipId = eqForSh.getEquipId();
+        //检验输入参数
+        if (StrUtil.isEmpty(equipId) || StrUtil.isEmpty(shaftId)) {
+            return AdmResponse.failure("必填项:equipId(设备id)、shaftId(竖井Id)");
+        }
+        String type = eqForSh.getType();
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2SH_FOR;
+        deleteByObjId(equipId, shaftId, type, typeEnum, context);
+        return AdmResponse.success();
+    }
+
+
+    private void deleteByObjId(String objFrom, String objTo, String type, AdmRelationTypeEnum typeEnum, InstanceUrlParam context) {
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", typeEnum.getGraphCode());
+        node.put("relCode", typeEnum.getRelCode());
+        node.put("relValue", type);
+        node.put("objFrom", objFrom);
+        node.put("objTo", objTo);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+    }
+}

+ 160 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationEqInShController.java

@@ -0,0 +1,160 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description:020、关系-设备所在竖井
+ * @author:lgy
+ * @data:2021/9/13 10:00
+ */
+@RequestMapping("/rel/eq-in-sh")
+@RestController
+public class RelationEqInShController {
+    @Autowired
+    private IAdmRelationService service;
+    @Value("${middleware.group.code}")
+    private String groupCode;
+    /**
+     * 创建设备所在竖井关系,累计添加不会覆盖以前记录
+     * @param param
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = {"/link"})
+    public AdmResponse create(@RequestParam("projectId") String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        String equipId = param.getString("equipId");
+        String shaftId = param.getString("shaftId");
+        if(!StrUtil.isAllNotEmpty(equipId,shaftId)) {
+            return AdmResponse.failure("必填项:EquipId(设备id)、ShaftId(竖井id)");
+        }
+        // 创建关系对象  EquipinShaft
+        List<RelationDTO> voList = new ArrayList<>();
+        voList.add(new RelationDTO(null, "MechInArch", "Eq2Sh", null, equipId , shaftId));
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+    /**
+     * 根据对象删除设备所在竖井关系,只针对一个对象
+     * @param   param      对象
+     * @return             删除的结果信息
+     */
+
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestParam String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        if(CollUtil.isEmpty(param)) {
+            return AdmResponse.success();
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        // 组装条件
+        QueryCriteria criteria = new QueryCriteria();
+        String equipId = param.getString("equipId");
+        String shaftId = param.getString("shaftId");
+        if(!StrUtil.isAllNotEmpty(equipId,shaftId)) {
+            return AdmResponse.failure("必填项:EquipId(设备id)、shaftId(竖井id)");
+        }
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", "MechInArch");
+        node.put("relCode", "Eq2Sh");
+        node.put("objFrom", equipId);
+        node.put("objTo",shaftId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+        return AdmResponse.success();
+    }
+    /**
+     * 设备所在竖井,设备一对多,此方法会覆盖以前的记录
+     * @param param
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/link-sh")
+    public AdmResponse createSh(@RequestParam("projectId") String projectId,
+                                @RequestBody JSONObject param) throws Exception {
+        String equipId = param.getString("equipId");
+        JSONArray shaftIdList = param.getJSONArray("shaftIdList");
+        if(StrUtil.isBlank(equipId) || CollUtil.isEmpty(shaftIdList)) {
+            return AdmResponse.failure("必填项:EquipId(设备id)、ShaftIdList(竖井id列表),此方法会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < shaftIdList.size();i++) {
+            String shaftId = shaftIdList.getString(i);
+            if(StrUtil.isBlank(shaftId)) {
+                continue;
+            }
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", "MechInArch");
+            node.put("relCode", "Eq2Sh");
+            node.put("objFrom", equipId);
+            node.put("objTo", shaftId);
+            queryRequest.setCriteria(node);
+            service.doDelete(context,queryRequest);
+            // 创建关系对象 - 参考(datasyn中DataCenterSync.kt)
+            voList.add(new RelationDTO(null, "MechInArch", "Eq2Sh", null, equipId, shaftId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+    /**
+     * 所在竖井的设备,竖井一对多,此方法会覆盖以前的记录
+     * @param param
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = {"/link-eq","/link-eq-sh"})
+    public AdmResponse createEq(@RequestParam("projectId") String projectId,
+                                @RequestBody JSONObject param) throws Exception {
+        String shaftId = param.getString("shaftId");
+        JSONArray equipIdList = param.getJSONArray("shaftIdList");
+        if(StrUtil.isBlank(shaftId) || CollUtil.isEmpty(equipIdList)) {
+            return AdmResponse.failure("必填项:EquipIdList(设备id列表)、ShaftId(竖井id),此方法会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < equipIdList.size();i++) {
+            String equipId = equipIdList.getString(i);
+            if(StrUtil.isBlank(shaftId)) {
+                continue;
+            }
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", "MechInArch");
+            node.put("relCode", "Eq2Sh");
+            node.put("objFrom", equipId);
+            node.put("objTo", shaftId);
+            queryRequest.setCriteria(node);
+            service.doDelete(context,queryRequest);
+            // 创建关系对象 - 参考(datasyn中DataCenterSync.kt)
+            voList.add(new RelationDTO(null, "MechInArch", "Eq2Sh", null, equipId, shaftId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+}

+ 140 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationFlAndBuController.java

@@ -0,0 +1,140 @@
+package com.persagy.proxy.adm.controller;
+
+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.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.AdmSpace;
+import com.persagy.proxy.adm.model.relation.UpDataFloorAndBuilding;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.adm.service.IAdmSpaceService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * 关系-修改对象的建筑楼层信息
+ *
+ * @author zhangwencheng
+ */
+
+@RestController
+@RequestMapping("/update-relationship")
+public class RelationFlAndBuController {
+
+    @Autowired
+    private IAdmRelationService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    @Autowired
+    private IAdmSpaceService spaceService;
+
+    /**
+     * 修改空间和楼层建筑的关系
+     * spaceId 业务空间id,id 楼层或建筑id,type  业务空间的类型
+     */
+    @PostMapping("/update-sp")
+    public AdmResponse spFloorAndBuilding(@RequestBody List<UpDataFloorAndBuilding> upDataFloorAndBuildings, @RequestParam("projectId") String projectId) {
+        if (CollectionUtils.isEmpty(upDataFloorAndBuildings)) {
+            return AdmResponse.failure("修改内容不能为空");
+        }
+        AdmRelationTypeEnum bd2sp = AdmRelationTypeEnum.BD2SP;
+        AdmRelationTypeEnum fl2sp = AdmRelationTypeEnum.FL2SP;
+        List<RelationDTO> voList = new ArrayList<>();
+        List<String> idList = new ArrayList<>();
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        for (UpDataFloorAndBuilding upDataFloorAndBuilding : upDataFloorAndBuildings) {
+            String id = upDataFloorAndBuilding.getId();
+            String spaceId = upDataFloorAndBuilding.getSpaceId();
+            idList.add(spaceId);
+            if (id.startsWith("Bd")) {
+                deleteByObjId(null, spaceId, null, bd2sp, context);
+                RelationDTO relation = new RelationDTO(null, bd2sp.getGraphCode(), bd2sp.getRelCode(), null, id, spaceId);
+                voList.add(relation);
+            } else if (id.startsWith("Fl")) {
+                deleteByObjId(null, spaceId, null, fl2sp, context);
+                RelationDTO relation = new RelationDTO(null, fl2sp.getGraphCode(), fl2sp.getRelCode(), null, id, spaceId);
+                voList.add(relation);
+            } else {
+                deleteByObjId(null, spaceId, null, bd2sp, context);
+                deleteByObjId(null, spaceId, null, fl2sp, context);
+            }
+        }
+        if (!CollectionUtils.isEmpty(voList)) {
+            service.doSave(context, voList);
+        }
+        String filter = " id in ('" + StrUtil.join("','", idList) + "') ";
+        AdmQueryCriteria criteria = new AdmQueryCriteria();
+        criteria.setFilters(filter);
+        AdmResponse rs = spaceService.doQuery(AdmContextUtil.toDmpContext(), criteria, AdmSpace.class);
+        List<AdmSpace> spaces = (List<AdmSpace>) rs.getContent();
+        Map<String, AdmSpace> admSpaceMap = spaces.stream().collect(Collectors.toMap(AdmSpace::getId, Function.identity()));
+        List<AdmSpace> updateSpace = new ArrayList<>();
+        List<AdmSpace> deleteSpace = new ArrayList<>();
+        for (UpDataFloorAndBuilding upDataFloorAndBuilding : upDataFloorAndBuildings) {
+            String spaceId = upDataFloorAndBuilding.getSpaceId();
+            AdmSpace admSpace = admSpaceMap.get(spaceId);
+            if (Objects.isNull(admSpace)) {
+                continue;
+            }
+            String id = upDataFloorAndBuilding.getId();
+            if (id.startsWith("Bd")) {
+                admSpace.setBuildingId(id);
+                updateSpace.add(admSpace);
+            } else if (id.startsWith("Fl")) {
+                admSpace.setFloorId(id);
+                updateSpace.add(admSpace);
+            } else {
+                deleteSpace.add(admSpace);
+            }
+        }
+        //更新空间
+        if (!CollectionUtils.isEmpty(updateSpace)) {
+            spaceService.doUpdate(context, AdmSpace.class, updateSpace);
+        }
+        //删除空间
+        if (!CollectionUtils.isEmpty(deleteSpace)) {
+            spaceService.doDelete(context, deleteSpace);
+        }
+
+        return AdmResponse.success();
+    }
+
+    /**
+     * 删除对象关系
+     *
+     * @param objFrom
+     * @param objTo
+     * @param type
+     * @param typeEnum
+     * @param context
+     */
+    private void deleteByObjId(String objFrom, String objTo, String type, AdmRelationTypeEnum typeEnum, InstanceUrlParam context) {
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", typeEnum.getGraphCode());
+        node.put("relCode", typeEnum.getRelCode());
+        node.put("relValue", type);
+        node.put("objFrom", objFrom);
+        node.put("objTo", objTo);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+    }
+}

+ 164 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationFlThroughFlController.java

@@ -0,0 +1,164 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description: 021关系-楼层的贯通
+ * @author:lgy
+ * @data:2021/9/13 11:02
+ */
+@RestController
+@RequestMapping("/rel/fl-through-fl")
+public class RelationFlThroughFlController {
+    @Autowired
+    private IAdmRelationService service;
+    @Value("${middleware.group.code}")
+    private String groupCode;
+    /**
+     * 创建楼层的贯通关系
+     * @param param
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = {"/link"})
+    public AdmResponse create(@RequestParam("projectId") String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        String floorId = param.getString("floorId");
+        String floorOtherId = param.getString("floorOtherId");
+        if(!StrUtil.isAllNotEmpty(floorId,floorOtherId)) {
+            return AdmResponse.failure("必填项:FloorId(楼层id)、FloorOtherId(其他楼层id)");
+        }
+        // 创建关系对象
+        List<RelationDTO> voList = new ArrayList<>();
+        voList.add(new RelationDTO(null, "ThroughRelationship", "Fl2Fl", null, floorId , floorOtherId));
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+    /**
+     * 根据对象删除关系
+     * 根据对象删除楼层的贯通关系,只针对一个对象
+     * @param   param      对象
+     * @return             删除的结果信息
+     */
+
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestParam String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        if(CollUtil.isEmpty(param)) {
+            return AdmResponse.success();
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        // 组装条件
+        QueryCriteria criteria = new QueryCriteria();
+        String floorId = param.getString("floorId");
+        String floorOtherId = param.getString("floorOtherId");
+        if(!StrUtil.isAllNotEmpty(floorId,floorOtherId)) {
+            return AdmResponse.failure("必填项:FloorId(楼层id)、FloorOtherId(其他楼层id)");
+        }
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", "ThroughRelationship");
+        node.put("relCode", "Fl2Fl");
+        node.put("objFrom", floorId);
+        node.put("objTo",floorOtherId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+        return AdmResponse.success();
+    }
+    /**
+     * 创建楼层的贯通关系
+     * 楼层的贯通,楼层一对多
+     * @param param 楼层和其他楼层列表关系对象r
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/link-or")
+    public AdmResponse createFloorOtherIdList(@RequestParam("projectId") String projectId,
+                                @RequestBody JSONObject param) throws Exception {
+        String floorId = param.getString("floorId");
+        JSONArray floorOtherIdList = param.getJSONArray("floorOtherIdList");
+        if(StrUtil.isBlank(floorId) || CollUtil.isEmpty(floorOtherIdList)) {
+            return AdmResponse.failure("必填项:FloorId(楼层id)、FloorOtherIdList(其他楼层id列表),测方法会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < floorOtherIdList.size();i++) {
+            String floorOtherId = floorOtherIdList.getString(i);
+            if(StrUtil.isBlank(floorOtherId)) {
+                continue;
+            }
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", "ThroughRelationship");
+            node.put("relCode", "Fl2Fl");
+            node.put("objFrom", floorId);
+            node.put("objTo", floorOtherId);
+            queryRequest.setCriteria(node);
+            service.doDelete(context,queryRequest);
+            // 创建关系对象 - 参考(datasyn中DataCenterSync.kt)
+            voList.add(new RelationDTO(null, "ThroughRelationship", "Fl2Fl", null, floorId, floorOtherId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 楼层的贯通,其他楼层一对多
+     * @param param 楼层和其他楼层列表关系对象r
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/link-fl")
+    public AdmResponse createFloorIdList(@RequestParam("projectId") String projectId,
+                                              @RequestBody JSONObject param) throws Exception {
+        String floorOtherId = param.getString("floorOtherId");
+        JSONArray floorIdList = param.getJSONArray("floorIdList");
+        if(StrUtil.isBlank(floorOtherId) || CollUtil.isEmpty(floorIdList)) {
+            return AdmResponse.failure("必填项:FloorIdList(楼层id列表)、FloorOtherId(其他楼层id),测方法会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < floorIdList.size();i++) {
+            String floorId = floorIdList.getString(i);
+            if(StrUtil.isBlank(floorId)) {
+                continue;
+            }
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", "ThroughRelationship");
+            node.put("relCode", "Fl2Fl");
+            node.put("objFrom", floorId);
+            node.put("objTo", floorOtherId);
+            queryRequest.setCriteria(node);
+            service.doDelete(context,queryRequest);
+            // 创建关系对象 - 参考(datasyn中DataCenterSync.kt)
+            voList.add(new RelationDTO(null, "ThroughRelationship", "Fl2Fl", null, floorId, floorOtherId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+}

+ 309 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationShContainSpBaseController.java

@@ -0,0 +1,309 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+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.digital.client.DigitalObjectFacade;
+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.enums.AdmDictCategoryEnum;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.client.DmpRwdClient;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * @description:023、关系-竖井下的业务空间
+ * @author:lgy
+ * @data:2021/9/13 14:49
+ */
+@RestController
+@RequestMapping("/rel/sh-contain-sp-base")
+public class RelationShContainSpBaseController {
+
+    @Autowired
+    private IAdmRelationService service;
+    @Autowired
+    DmpRwdClient rwdClient;
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 默认图类型
+     */
+    public static String DEFAULT_GRAPH_CODE = "ArchSubset";
+    /**
+     * 默认边类型
+     */
+    public static String DEFAULT_REL_CODE = "Sh2Sp";
+
+    /**
+     * 创建竖井下的业务空间关系
+     * @param param 竖井和业务空间的关系对象
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = {"/link"})
+    public AdmResponse create(@RequestParam("projectId") String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        String shaftId = param.getString("shaftId");
+        String spaceId = param.getString("spaceId");
+        String type = param.getString("objectType");
+        if(!StrUtil.isAllNotEmpty(shaftId,spaceId)) {
+            return AdmResponse.failure("必填项:ShaftID(竖井id)、SpaceID(业务空间id)");
+        }
+        // 创建关系对象
+        List<RelationDTO> voList = new ArrayList<>();
+        voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, type, shaftId , spaceId));
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 根据对象删除关系
+     *根据对象删除竖井下的业务空间关系,只针对一个对象
+     * @param    param    对象
+     * @param   type                 空间类型
+     * @return                       删除的结果信息
+     */
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestParam String projectId,
+                              @RequestParam(value = "type", required = false) String type,
+                              @RequestBody JSONObject param) throws Exception {
+        if(CollUtil.isEmpty(param)) {
+            return AdmResponse.success();
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        // 组装条件
+        QueryCriteria criteria = new QueryCriteria();
+        String shaftId = param.getString("shaftId");
+        String spaceId = param.getString("spaceId");
+        if(!StrUtil.isAllNotEmpty(shaftId,spaceId)) {
+            return AdmResponse.failure("必填项:ShaftID(竖井id)、SpaceID(业务空间id)");
+        }
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", DEFAULT_GRAPH_CODE);
+        node.put("relCode", DEFAULT_REL_CODE);
+        node.put("relValue", type);
+        node.put("objFrom", shaftId);
+        node.put("objTo",spaceId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 创建竖井下的业务空间关系
+     *
+     * @param   param     竖井和业务空间的关系对象
+     * @param   type                 空间类型
+     * @return                       创建的结果信息
+     */
+    @PostMapping("/link-shsps")
+    public AdmResponse createShsps(@RequestParam("projectId") String projectId,
+                                @RequestParam(value = "type", required = false) String type,
+                                @RequestBody JSONObject param) throws Exception {
+        String shaftId = param.getString("shaftId");
+        JSONArray spaceIdList = param.getJSONArray("spaceIdList");
+        if(StrUtil.isBlank(shaftId) || CollUtil.isEmpty(spaceIdList)) {
+            return AdmResponse.failure("必填项:SpaceIdList(业务空间id列表)、ShaftID(竖井id),此方法不会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < spaceIdList.size();i++) {
+            String spaceId = spaceIdList.getString(i);
+            if(StrUtil.isBlank(spaceId)) {
+                continue;
+            }
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", DEFAULT_GRAPH_CODE);
+            node.put("relCode", DEFAULT_REL_CODE);
+            node.put("relValue", type);
+            node.put("objFrom", shaftId);
+            node.put("objTo", spaceId);
+            queryRequest.setCriteria(node);
+            service.doDelete(context,queryRequest);
+            // 创建关系对象 - 参考(datasyn中DataCenterSync.kt)
+            voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, type, shaftId, spaceId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 竖井下的业务空间,空间一对多
+     *
+     * @param   param     竖井和业务空间的关系对象
+     * @param   type                 空间类型
+     * @return                       创建的结果信息
+     */
+    @PostMapping("/link-spshs")
+    public AdmResponse createSpshs(@RequestParam("projectId") String projectId,
+                                   @RequestParam(value = "type", required = false) String type,
+                                   @RequestBody JSONObject param) throws Exception {
+        String spaceId = param.getString("spaceId");
+        JSONArray shaftIdList = param.getJSONArray("shaftIdList");
+        if(StrUtil.isBlank(spaceId) || CollUtil.isEmpty(shaftIdList)) {
+            return AdmResponse.failure("必填项:SpaceId(业务空间id)、ShaftIDList(竖井id列表)");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < shaftIdList.size();i++) {
+            String shaftId = shaftIdList.getString(i);
+            if(StrUtil.isBlank(shaftId)) {
+                continue;
+            }
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", DEFAULT_GRAPH_CODE);
+            node.put("relCode", DEFAULT_REL_CODE);
+            node.put("relValue", type);
+            node.put("objFrom", shaftId);
+            node.put("objTo", spaceId);
+            queryRequest.setCriteria(node);
+            service.doDelete(context,queryRequest);
+            // 创建关系对象 - 参考(datasyn中DataCenterSync.kt)
+            voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, type, shaftId, spaceId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 创建竖井下的业务空间,竖井一对多,此方法会覆盖以前的记录
+     *
+     * @param   param     竖井和业务空间的关系对象
+     * @param   type                 空间类型
+     * @return                       创建的结果信息
+     */
+    @PostMapping("/link-shsps-replace")
+    public AdmResponse createShSpsReplace(@RequestParam("projectId") String projectId,
+                                   @RequestParam(value = "Type", required = false) String type,
+                                   @RequestParam(value = "BuildingId", required = false) String buildingId,
+                                   @RequestParam(value = "FloorId", required = false) String floorId,
+                                   @RequestBody JSONObject param) throws Exception {
+        String shaftId = param.getString("shaftId");
+        JSONArray spaceIdList = param.getJSONArray("spaceIdList");
+        if(StrUtil.isBlank(shaftId) || CollUtil.isEmpty(spaceIdList)) {
+            return AdmResponse.failure("必填项:SpaceIdList(业务空间id列表)、ShaftID(竖井id),此方法会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        RequestData requestData = RequestData.builder().buildingId(buildingId).classCode(type).floorId(floorId).projectId(projectId).objType(AdmDictCategoryEnum.SPACE.getValue()).build();
+        QueryCriteria queryRequestTmp = new QueryCriteria();
+        ObjectNode nodeTmp = JsonNodeFactory.instance.objectNode();
+        nodeTmp.put("graphCode", DEFAULT_GRAPH_CODE);
+        nodeTmp.put("relCode", DEFAULT_REL_CODE);
+        nodeTmp.put("relValue", type);
+        nodeTmp.put("objFrom", shaftId);
+        queryRequestTmp.setCriteria(nodeTmp);
+        //关系查询空间id
+        Set<String> oldSpaceIds = service.queryByCondition(context,queryRequestTmp).stream().map(ObjectRelation::getObjTo).collect(Collectors.toSet());
+        List<ObjectDigital> objectDigitals = DigitalObjectFacade.queryObjectListSuperiorId(groupCode, projectId, AdmCommonConstant.APP_ID, null, requestData);
+        //楼层、建筑、对象类查询的空间id
+        Set<String> spaceIdSet = objectDigitals.stream().map(ObjectDigital::getId).collect(Collectors.toSet());
+        //空间id取交集
+        if(ObjectUtil.isNotEmpty(oldSpaceIds)){
+            spaceIdSet.retainAll(oldSpaceIds);
+        }
+        //删除空间关系
+        for (String oldSpaceId : spaceIdSet) {
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", DEFAULT_GRAPH_CODE);
+            node.put("relCode", DEFAULT_REL_CODE);
+            node.put("relValue", type);
+            node.put("objFrom", shaftId);
+            node.put("objTo", oldSpaceId);
+            queryRequest.setCriteria(node);
+            service.doDelete(context,queryRequest);
+        }
+        //替换空间关系
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < spaceIdList.size();i++) {
+            String spaceId = spaceIdList.getString(i);
+            if(StrUtil.isBlank(spaceId)) {
+                continue;
+            }
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", DEFAULT_GRAPH_CODE);
+            node.put("relCode", DEFAULT_REL_CODE);
+            node.put("relValue", type);
+            node.put("objFrom", shaftId);
+            node.put("objTo", spaceId);
+            queryRequest.setCriteria(node);
+            service.doDelete(context,queryRequest);
+            // 创建关系对象 - 参考(datasyn中DataCenterSync.kt)
+            voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, type, shaftId, spaceId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 查询空间类型和名称
+     * @param projectId projectId
+     * @param shaftId shaftId 竖井id
+     * @param param param
+     * @return {@link AdmResponse}
+     * @author lgy
+     * @date 2021/9/23 18:37
+     */
+    @PostMapping("/space-type-query")
+    public AdmResponse spaceTypeQuery(@RequestParam String projectId,
+                              @RequestParam(value = "shaftId", required = false) String shaftId,
+                              @RequestBody JSONObject param) throws Exception {
+
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        // 组装条件
+        QueryCriteria queryRequestTmp = new QueryCriteria();
+        ObjectNode nodeTmp = JsonNodeFactory.instance.objectNode();
+        nodeTmp.put("graphCode", DEFAULT_GRAPH_CODE);
+        nodeTmp.put("relCode", DEFAULT_REL_CODE);
+        nodeTmp.put("objFrom", shaftId);
+        queryRequestTmp.setCriteria(nodeTmp);
+        //关系查询空间id
+        Set<String> relValue = service.queryByCondition(context,queryRequestTmp).stream().map(ObjectRelation::getRelValue).collect(Collectors.toSet());
+        JSONObject queryCriteria = new JSONObject();
+        JSONObject criteria = new JSONObject();
+        criteria.put("code",relValue);
+        queryCriteria.put("criteria",criteria);
+        JSONArray dmpResult = rwdClient.queryDefClass(context, queryCriteria).getData(JSONArray.class);
+        JSONArray result = new JSONArray();
+        for (int i = 0; i < dmpResult.size(); i++) {
+            JSONObject defClass = dmpResult.getJSONObject(i);
+            JSONObject temp = new JSONObject();
+            temp.put("objectType",defClass.getString("code"));
+            temp.put("objectTypeName",defClass.getString("name"));
+            result.add(temp);
+        }
+        return AdmResponse.success(result);
+    }
+}

+ 63 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationShInBdController.java

@@ -0,0 +1,63 @@
+package com.persagy.proxy.adm.controller;
+
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.relation.ShInBdList;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ *关系-竖井所在建筑
+ */
+@Slf4j
+@RestController
+@RequestMapping("/rel/sh-in-bd")
+public class RelationShInBdController {
+
+    @Autowired
+    private IAdmRelationService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+    /**
+     * 创建竖井所在建筑关系
+     * @param shInBdList
+     * @return
+     */
+
+    @PostMapping("link-bd")
+    public AdmResponse createBd(@RequestBody ShInBdList shInBdList, @RequestParam("projectId") String projectId){
+        log.info("创建系统所在建筑关系link-bd");
+        List<String> buildingIdList = shInBdList.getBuildingIdList();
+        String shaftId = shInBdList.getShaftId();
+        //检验输入参数
+        if(CollectionUtils.isEmpty(buildingIdList)|| StringUtils.isEmpty(shaftId)){
+            return AdmResponse.failure("必填项:shaftId(竖井id)、BuildingIdList(建筑id列表)");
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.BD2SH_ARCHFORARCH;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        for (String buildingId : buildingIdList) {
+                                                                 //ArchForArch
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, "", shaftId,buildingId);
+            voList.add(relation);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+}

+ 163 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationShaftThroughShaftController.java

@@ -0,0 +1,163 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description:022、关系-竖井的贯通关系
+ * @author:lgy
+ * @data:2021/9/13 13:06
+ */
+@RestController
+@RequestMapping("/rel/sh-through-sh")
+public class RelationShaftThroughShaftController {
+    @Autowired
+    private IAdmRelationService service;
+    @Value("${middleware.group.code}")
+    private String groupCode;
+    /**
+     * 创建竖井的贯通关系
+     * @param param
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = {"/link"})
+    public AdmResponse create(@RequestParam("projectId") String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        String shaftId = param.getString("shaftId");
+        String shaftOtherId = param.getString("shaftOtherId");
+        if(!StrUtil.isAllNotEmpty(shaftId,shaftOtherId)) {
+            return AdmResponse.failure("必填项:ShaftId(竖井id)、ShaftOtherId(其他竖井id)");
+        }
+        // 创建关系对象
+        List<RelationDTO> voList = new ArrayList<>();
+        voList.add(new RelationDTO(null, "ThroughRelationship", "Sh2Sh", null, shaftId , shaftOtherId));
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+    /**
+     * 根据对象删除关系
+     * 根据对象删除竖井的贯通关系,只针对一个对象
+     * @param   param      对象
+     * @return             删除的结果信息
+     */
+
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestParam String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        if(CollUtil.isEmpty(param)) {
+            return AdmResponse.success();
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        // 组装条件
+        QueryCriteria criteria = new QueryCriteria();
+        String shaftId = param.getString("shaftId");
+        String shaftOtherId = param.getString("shaftOtherId");
+        if(!StrUtil.isAllNotEmpty(shaftId,shaftOtherId)) {
+            return AdmResponse.failure("必填项:ShaftId(竖井id)、ShaftOtherId(其他数据竖井id)");
+        }
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", "ThroughRelationship");
+        node.put("relCode", "Sh2Sh");
+        node.put("objFrom", shaftId);
+        node.put("objTo",shaftOtherId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+        return AdmResponse.success();
+    }
+    /**
+     * 创建竖井的贯通关系
+     * 竖井的贯通,竖井一对多,此方法会覆盖以前的记录
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/link-or")
+    public AdmResponse createFloorOtherIdList(@RequestParam("projectId") String projectId,
+                                              @RequestBody JSONObject param) throws Exception {
+        String shaftId = param.getString("shaftId");
+        JSONArray shaftOtherIdList = param.getJSONArray("shaftOtherIdList");
+        if(StrUtil.isBlank(shaftId) || CollUtil.isEmpty(shaftOtherIdList)) {
+            return AdmResponse.failure("必填项:ShaftId(竖井id)、ShaftOtherIdList(其他竖井id列表),此方法会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < shaftOtherIdList.size();i++) {
+            String shaftOtherId = shaftOtherIdList.getString(i);
+            if(StrUtil.isBlank(shaftOtherId)) {
+                continue;
+            }
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", "ThroughRelationship");
+            node.put("relCode", "Sh2Sh");
+            node.put("objFrom", shaftId);
+            node.put("objTo", shaftOtherId);
+            queryRequest.setCriteria(node);
+            service.doDelete(context,queryRequest);
+            // 创建关系对象 - 参考(datasyn中DataCenterSync.kt)
+            voList.add(new RelationDTO(null, "ThroughRelationship", "Sh2Sh", null, shaftId, shaftOtherId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 创建竖井的贯通关系
+     * 竖井的贯通,竖井一对多,此方法会覆盖以前的记录
+     * @param param 竖井和其他竖井列表关系对象r
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/link-shaft")
+    public AdmResponse createFloorIdList(@RequestParam("projectId") String projectId,
+                                         @RequestBody JSONObject param) throws Exception {
+        String shaftId = param.getString("shaftId");
+        JSONArray shaftOtherIdList = param.getJSONArray("shaftOtherIdList");
+        if(StrUtil.isBlank(shaftId) || CollUtil.isEmpty(shaftOtherIdList)) {
+            return AdmResponse.failure("必填项:ShaftId(竖井id)、ShaftOtherIdList(其他竖井id列表)");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < shaftOtherIdList.size();i++) {
+            String shaftOtherId = shaftOtherIdList.getString(i);
+            if(StrUtil.isBlank(shaftOtherId)) {
+                continue;
+            }
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", "ThroughRelationship");
+            node.put("relCode", "Sh2Sh");
+            node.put("objFrom", shaftId);
+            node.put("objTo", shaftOtherId);
+            queryRequest.setCriteria(node);
+            service.doDelete(context,queryRequest);
+            // 创建关系对象 - 参考(datasyn中DataCenterSync.kt)
+            voList.add(new RelationDTO(null, "ThroughRelationship", "Sh2Sh", null, shaftId, shaftOtherId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+}

+ 139 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationSpInBdOrFlController.java

@@ -0,0 +1,139 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.client.DmpRwdClient;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description:025、关系-业务空间所在的建筑楼层
+ * @author:lgy
+ * @data:2021/9/24 19:46
+ */
+@RestController
+@RequestMapping("/rel/sp-in")
+public class RelationSpInBdOrFlController {
+    @Autowired
+    private IAdmRelationService service;
+    @Autowired
+    DmpRwdClient rwdClient;
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 默认图类型
+     */
+    public static String DEFAULT_GRAPH_CODE = "ArchSubset";
+    /**
+     * 默认边类型
+     */
+    public static String DEFAULT_REL_CODE = "Bd2Sp";
+    /**
+     * 创建业务空间和建筑的关系
+     * @param param
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = {"/bd-create"})
+    public AdmResponse spInBdCreate(@RequestParam("projectId") String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        String buildingId = param.getString("buildingId");
+        String spaceId = param.getString("spaceId");
+        String type = param.getString("objectType");
+        if(!StrUtil.isAllNotEmpty(buildingId,spaceId,type)) {
+            return AdmResponse.failure("必填项:buildingId(竖井id)、spaceId(业务空间id),objectType");
+        }
+        // 创建关系对象
+        List<RelationDTO> voList = new ArrayList<>();
+        voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, type, buildingId , spaceId));
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 删除业务空间和建筑的关系
+     * @param    paramList    对象
+     * @return                       删除的结果信息
+     */
+    @PostMapping("/bd-del")
+    public AdmResponse delete(@RequestParam String projectId,
+                              @RequestBody JSONArray paramList) throws Exception {
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        for (int i = 0; i < paramList.size(); i++) {
+            JSONObject param = paramList.getJSONObject(i);
+            String buildingId = param.getString("buildingId");
+            String spaceId = param.getString("spaceId");
+            String type = param.getString("objectType");
+            if(!StrUtil.isAllNotEmpty(buildingId,spaceId)) {
+                return AdmResponse.failure("spaceId和buildingId 不可以为空");
+            }
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", DEFAULT_GRAPH_CODE);
+            node.put("relCode", DEFAULT_REL_CODE);
+            node.put("objFrom", buildingId);
+            node.put("objTo",spaceId);
+            QueryCriteria criteria = new QueryCriteria();
+            criteria.setCriteria(node);
+            service.doDelete(context, criteria);
+        }
+        return AdmResponse.success();
+    }
+
+    /**
+     * 修改业务空间所在的建筑
+     * @param    requestParam    对象
+     * @return                       删除的结果信息
+     */
+    @PostMapping("/bd-del")
+    public AdmResponse delete(@RequestParam String projectId,
+                              @RequestBody JSONObject requestParam) throws Exception {
+        JSONArray content = requestParam.getJSONArray("content");
+        for (int i = 0; i < content.size(); i++) {
+            JSONObject param = content.getJSONObject(i);
+            String buildingId = param.getString("buildingId");
+            String spaceId = param.getString("spaceId");
+            String type = param.getString("objectType");
+            if(!StrUtil.isAllNotEmpty(buildingId,spaceId,type)) {
+                return AdmResponse.failure("buildingId、spaceId、objectType 不能为空");
+            }
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        for (int i = 0; i < content.size(); i++) {
+            JSONObject param = content.getJSONObject(i);
+            String buildingId = param.getString("buildingId");
+            String spaceId = param.getString("spaceId");
+            String type = param.getString("objectType");
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", DEFAULT_GRAPH_CODE);
+            node.put("relCode", DEFAULT_REL_CODE);
+            node.put("objFrom", buildingId);
+            node.put("objTo",spaceId);
+            QueryCriteria criteria = new QueryCriteria();
+            criteria.setCriteria(node);
+            service.doDelete(context, criteria);
+            // 创建关系对象
+            List<RelationDTO> voList = new ArrayList<>();
+            voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, type, buildingId , spaceId));
+            service.doSave(context, voList);
+        }
+        return AdmResponse.success();
+    }
+}

+ 182 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationSpInSiController.java

@@ -0,0 +1,182 @@
+package com.persagy.proxy.adm.controller;
+
+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.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.relation.SiInSpBase;
+import com.persagy.proxy.adm.model.relation.SiInSpBaseList;
+import com.persagy.proxy.adm.request.AdmCreateRequest;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * @author zhangwencheng
+ * 业务空间内的元空间
+ */
+
+@Slf4j
+@RestController
+@RequestMapping("/rel/si-in-sp-base")
+public class RelationSpInSiController {
+
+    @Autowired
+    private IAdmRelationService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 创建业务空间内的元空间关系
+     *
+     * @param siInSpBaseRequest 元空间内的业务空间关系对象
+     * @return 创建的结果信息
+     */
+    @PostMapping("/link-list")
+    public AdmResponse create(@RequestParam(value = "type",required = false) String type, @RequestBody AdmCreateRequest<SiInSpBase> siInSpBaseRequest, @RequestParam("projectId") String projectId) {
+        List<SiInSpBase> content = siInSpBaseRequest.getContent();
+        if (CollectionUtils.isEmpty(content)) {
+            return AdmResponse.failure("content不能为空");
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SP2SI;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        for (SiInSpBase siInSpBase : content) {
+            String ispaceId = siInSpBase.getIspaceId();
+            String spaceId = siInSpBase.getSpaceId();
+            String objectType = siInSpBase.getObjectType();
+            if (StrUtil.isEmpty(spaceId) || StrUtil.isBlank(ispaceId)) {
+                return AdmResponse.failure("必填项:ispaceId(元空间id)、spaceId(空间id)");
+            }
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, objectType, spaceId, ispaceId);
+            voList.add(relation);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 创建业务空间内的元空间关系-此方法会覆盖以前的记录
+     *
+     * @param siInSpBaseList 业务空间和元空间的关系对象
+     * @return 创建的结果信息
+     */
+    @PostMapping("/link-sp")
+    public AdmResponse createSp(@RequestParam(value = "type", required = false) String type, @RequestBody SiInSpBaseList siInSpBaseList, @RequestParam("projectId") String projectId) {
+        List<String> ispaceIdList = siInSpBaseList.getIspaceIdList();
+        String spaceId = siInSpBaseList.getSpaceId();
+        if (StrUtil.isEmpty(spaceId) || CollectionUtils.isEmpty(ispaceIdList)) {
+            return AdmResponse.failure("必填项:ispaceIdList(元空间id)、spaceId(空间id)");
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SP2SI;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        deleteBySpaceId(spaceId, context, typeEnum);
+        List<RelationDTO> voList = new ArrayList<>();
+        for (String ispaceId : ispaceIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, siInSpBaseList.getZoneType(), spaceId, ispaceId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 删除信息
+     *
+     * @param spaceId
+     * @param context
+     * @param typeEnum
+     */
+    private void deleteBySpaceId(String spaceId, InstanceUrlParam context, AdmRelationTypeEnum typeEnum) {
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", typeEnum.getGraphCode());
+        node.put("relCode", typeEnum.getRelCode());
+        node.put("objFrom", spaceId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+    }
+
+
+    /**
+     * 业务空间内的元空间,业务空间一对多,累计添加不会覆盖以前记录
+     *
+     * @param       siInSpBaseList  业务空间和元空间的关系对象
+     * @return                  创建的结果信息
+     */
+    @PostMapping("/link-si-sp")
+    public AdmResponse createSpSi(@RequestParam(value = "type",required = false) String type, @RequestBody SiInSpBaseList siInSpBaseList, @RequestParam("projectId") String projectId){
+        List<String> ispaceIdList = siInSpBaseList.getIspaceIdList();
+        String spaceId = siInSpBaseList.getSpaceId();
+        if (StrUtil.isEmpty(spaceId) || CollectionUtils.isEmpty(ispaceIdList)) {
+            return AdmResponse.failure("必填项:ispaceIdList(元空间id)、spaceId(空间id)");
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SP2SI;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        for (String ispaceId : ispaceIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, siInSpBaseList.getZoneType(), spaceId, ispaceId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        return  AdmResponse.success();
+    }
+
+    /**
+     * 根据对象删除业务空间内的元空间关系
+     *
+     * @param    siInSpBases    对象
+     * @return                  删除的结果信息
+     */
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestParam(value = "type",required = false)  String type, @RequestBody List<SiInSpBase> siInSpBases,@RequestParam("projectId") String projectId) {
+        if(CollectionUtils.isEmpty(siInSpBases)){
+            return AdmResponse.failure("必填项:siInSpBases不能为空");
+        }
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SP2SI;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        List<QueryCriteria> queryCriteriaList = new ArrayList<>();
+        for (SiInSpBase siInSpBase : siInSpBases) {
+            String spaceId = siInSpBase.getSpaceId();
+            String ispaceId = siInSpBase.getIspaceId();
+            String objectType = siInSpBase.getObjectType();
+            if (StrUtil.isBlank(spaceId) || StrUtil.isEmpty(ispaceId)) {
+                return AdmResponse.failure("必填项:ispaceId(元空间)、spaceId(空间id)");
+            }
+            QueryCriteria criteria = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", graphCode);
+            node.put("relCode", relCode);
+            node.put("relValue", objectType);
+            node.put("objFrom", spaceId);
+            node.put("objTo", ispaceId);
+            criteria.setCriteria(node);
+            queryCriteriaList.add(criteria);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        for (QueryCriteria queryCriteria : queryCriteriaList) {
+            service.doDelete(context, queryCriteria);
+        }
+        return  AdmResponse.success();
+    }
+}

+ 258 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationSpaceConnectionController.java

@@ -0,0 +1,258 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+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.digital.client.DigitalObjectFacade;
+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.enums.AdmDictCategoryEnum;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.client.DmpRwdClient;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * @description:024、关系-空间关系
+ * @author:lgy
+ * @data:2021/9/24 11:53
+ */
+@RestController
+@RequestMapping("/rel/sp-rel")
+public class RelationSpaceConnectionController {
+
+    @Autowired
+    private IAdmRelationService service;
+    @Autowired
+    DmpRwdClient rwdClient;
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+//    //默认图类型 业务空间(同类)邻接关系
+//    public static final String DEFAULT_GRAPH_CODE = "SpaceNeighborhood";
+//    //None	空间隔断无门窗
+//    public static final String REL_CODE_NONE = "None";
+//    //Door	空间隔断有门
+//    public static final String REL_CODE_DOOR = "Door";
+//    //Window	空间隔断有窗
+//    public static final String REL_CODE_WINDOW = "Window";
+//    //DoorWindow	空间隔断有门窗
+//    public static final String REL_CODE_DOORWINDOW = "DoorWindow";
+//    //Connect	空间连通
+//    public static final String REL_CODE_CONNECT = "Connect";
+
+    /**
+     * 创创建邻接关系
+     * 图类型 GraphType:空间邻接关系 SpaceNeighborhood 建筑交通关系 TrafficNetwork  空气流通关系  ConvectionNetwork  光照辐射关系  RadiationNetwork
+     *
+     * @param param
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = {"/space-neighborhood-Create"})
+    public AdmResponse spaceNeighborhood(@RequestParam("projectId") String projectId,
+                                         @RequestBody JSONObject param) throws Exception {
+        JSONArray contentList = param.getJSONArray("content");
+        for (int i = 0; i < contentList.size(); i++) {
+            JSONObject content = contentList.getJSONObject(i);
+            String spaceIdOne = content.getString("spaceIdOne");
+            String spaceIdTwo = content.getString("spaceIdTwo");
+            String graphType = content.getString("graphType");
+            String relType = content.getString("relType");
+            String zoneType = content.getString("zoneType");
+            if (!StrUtil.isAllNotEmpty(graphType, spaceIdTwo, spaceIdOne, relType)) {
+                return AdmResponse.failure("请检查数据的完整性");
+            }
+            if (StrUtil.isEmpty(zoneType)) {
+                QueryCriteria queryCriteria = new QueryCriteria();
+                ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+                criteria.put("id", spaceIdOne);
+                queryCriteria.setCriteria(criteria);
+                List<ObjectNode> objectNodeList = DigitalObjectFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, null, queryCriteria);
+                if (CollUtil.isNotEmpty(objectNodeList)) {
+                    String classCode = objectNodeList.get(0).get("classCode").asText();
+                    content.put("zoneType", classCode);
+                }
+            }
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        for (int i = 0; i < contentList.size(); i++) {
+            JSONObject content = contentList.getJSONObject(i);
+            String spaceIdOne = content.getString("spaceIdOne");
+            String spaceIdTwo = content.getString("spaceIdTwo");
+            String graphType = content.getString("graphType");
+            String relType = content.getString("relType");
+            String zoneType = content.getString("zoneType");
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", graphType);
+            node.put("relCode", relType);
+            node.put("relValue", zoneType);
+            node.put("objFrom", spaceIdOne);
+            node.put("objTo", spaceIdTwo);
+            queryRequest.setCriteria(node);
+            service.doDelete(context, queryRequest);
+            // 创建关系对象
+            List<RelationDTO> voList = new ArrayList<>();
+            voList.add(new RelationDTO(null, graphType, relType, zoneType, spaceIdOne, spaceIdTwo));
+            service.doSave(context, voList);
+        }
+        return AdmResponse.success();
+    }
+
+    /**
+     * 查询空间关系
+     * " 楼层id FloorId   图类型 GraphType:空间邻接关系 SpaceNeighborhood 建筑交通关系 TrafficNetwork  空气流通关系  ConvectionNetwork  光照辐射关系  RadiationNetwork ,边类型RelType
+     *
+     * @param param
+     * @return 创建的结果信息
+     */
+    @PostMapping("/space-neighborhood-query")
+    public AdmResponse spaceNeighborhoodQuery(@RequestParam("projectId") String projectId,
+                                              @RequestBody JSONObject param) throws Exception {
+        //原接口传入一个filter进行过滤,不清楚具体参数前无法兼容该接口
+        //TODO:
+        return AdmResponse.failure("不支持该接口");
+    }
+
+    /**
+     * 删除某一个关系
+     * 为了防止误删,边类型也改成了必填项
+     *
+     * @param paramList 对象
+     * @return 删除的结果信息
+     */
+    @PostMapping("/delete")
+    public AdmResponse delete(@RequestParam String projectId,
+                              @RequestBody JSONArray paramList) throws Exception {
+        if (CollUtil.isEmpty(paramList)) {
+            return AdmResponse.success();
+        }
+        for (int i = 0; i < paramList.size(); i++) {
+            JSONObject param = paramList.getJSONObject(i);
+            String spaceIdOne = param.getString("spaceIdOne");
+            String spaceIdTwo = param.getString("spaceIdTwo");
+            String graphType = param.getString("graphType");
+            String relType = param.getString("relType");
+            String zoneType = param.getString("zoneType");
+            if (!StrUtil.isAllNotEmpty(spaceIdOne, spaceIdTwo, graphType, relType, zoneType)) {
+                return AdmResponse.failure("必填: SpaceIdOne、SpaceIdTwo、GraphType、ZoneType、relType");
+            }
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        for (int i = 0; i < paramList.size(); i++) {
+            JSONObject param = paramList.getJSONObject(i);
+            String spaceIdOne = param.getString("spaceIdOne");
+            String spaceIdTwo = param.getString("spaceIdTwo");
+            String graphType = param.getString("graphType");
+            String relType = param.getString("relType");
+            String zoneType = param.getString("zoneType");
+            if (!StrUtil.isAllNotEmpty(spaceIdOne, spaceIdTwo, graphType, relType, zoneType)) {
+                return AdmResponse.failure("必填: SpaceIdOne、SpaceIdTwo、GraphType、ZoneType、relType");
+            }
+            QueryCriteria criteria = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", graphType);
+            node.put("relCode", relType);
+            node.put("relValue", zoneType);
+            node.put("objFrom", spaceIdOne);
+            node.put("objTo", spaceIdTwo);
+            criteria.setCriteria(node);
+            service.doDelete(context, criteria);
+            //无方向的关系应该只删除一次,下面的应该不需要,为了防止可能出现的有方向的关系,此处额外删除一次
+            ObjectNode node2 = JsonNodeFactory.instance.objectNode();
+            node2.put("graphCode", graphType);
+            node2.put("relCode", relType);
+            node2.put("relValue", zoneType);
+            node2.put("objFrom", spaceIdTwo);
+            node2.put("objTo", spaceIdOne);
+            criteria.setCriteria(node2);
+            service.doDelete(context, criteria);
+        }
+        return AdmResponse.success();
+    }
+
+    /**
+     * 清除某个楼层下的数据
+     *
+     * @param param 竖井和业务空间的关系对象
+     * @return 创建的结果信息
+     */
+    @PostMapping("/delete-floor")
+    public AdmResponse createSpshs(@RequestParam("projectId") String projectId,
+                                   @RequestBody JSONObject param) throws Exception {
+        String graphType = param.getString("graphType");
+        String relType = param.getString("relType");
+        String zoneType = param.getString("zoneType");
+        String floorId = param.getString("floorId");
+        if (!StrUtil.isAllNotEmpty(graphType, relType, zoneType, floorId)) {
+            return AdmResponse.failure("必填 graphType、floorId、ZoneType、relType");
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        RequestData requestData = RequestData.builder().classCode(zoneType).floorId(floorId).projectId(projectId).objType(AdmDictCategoryEnum.SPACE.getValue()).build();
+        //关系查询空间id
+        List<ObjectDigital> objectDigitals = DigitalObjectFacade.queryObjectListSuperiorId(groupCode, projectId, AdmCommonConstant.APP_ID, null, requestData);
+        //楼层、建筑、对象类查询的空间id
+        Set<String> spaceIdSet = objectDigitals.stream().map(ObjectDigital::getId).collect(Collectors.toSet());
+        HashMap<String, ObjectRelation> distinctMap = new HashMap<>(spaceIdSet.size());
+        for (String spaceId : spaceIdSet) {
+            QueryCriteria queryRequestTmp = new QueryCriteria();
+            ObjectNode nodeTmp = JsonNodeFactory.instance.objectNode();
+            nodeTmp.put("graphCode", graphType);
+            nodeTmp.put("relCode", relType);
+            nodeTmp.put("relValue", zoneType);
+            nodeTmp.put("objFrom", spaceId);
+            queryRequestTmp.setCriteria(nodeTmp);
+            //关系查询空间id
+            List<ObjectRelation> objectRelations = service.queryByCondition(context, queryRequestTmp);
+            for (ObjectRelation objectRelation : objectRelations) {
+                String key = StrUtil.format("{}_{}_{}_{}_{}", objectRelation.getGraphCode(), objectRelation.getRelCode(), objectRelation.getRelValue(), objectRelation.getObjFrom(), objectRelation.getObjTo());
+                distinctMap.put(key, objectRelation);
+            }
+            nodeTmp = JsonNodeFactory.instance.objectNode();
+            nodeTmp.put("graphCode", graphType);
+            nodeTmp.put("relCode", relType);
+            nodeTmp.put("relValue", zoneType);
+            nodeTmp.put("objTo",spaceId);
+            queryRequestTmp.setCriteria(nodeTmp);
+            //关系查询空间id
+            objectRelations = service.queryByCondition(context, queryRequestTmp);
+            for (ObjectRelation objectRelation : objectRelations) {
+                String key = StrUtil.format("{}_{}_{}_{}_{}", objectRelation.getGraphCode(), objectRelation.getRelCode(), objectRelation.getRelValue(), objectRelation.getObjFrom(), objectRelation.getObjTo());
+                distinctMap.put(key, objectRelation);
+            }
+        }
+        for (ObjectRelation objectRelation : distinctMap.values()) {
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", objectRelation.getGraphCode());
+            node.put("relCode", objectRelation.getRelCode());
+            node.put("relValue", objectRelation.getRelValue());
+            node.put("objFrom", objectRelation.getObjFrom());
+            node.put("objTo", objectRelation.getObjTo());
+            queryRequest.setCriteria(node);
+            service.doDelete(context, queryRequest);
+        }
+        return AdmResponse.success();
+    }
+
+
+}

+ 198 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationSyForBdController.java

@@ -0,0 +1,198 @@
+package com.persagy.proxy.adm.controller;
+
+
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+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.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.client.DmpRwdClient;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description:026、关系-系统服务于建筑
+ * @author:lgy
+ * @data:2021/9/24 20:29
+ */
+@RestController
+@RequestMapping("/rel/sy-for-bd")
+public class RelationSyForBdController {
+    @Autowired
+    private IAdmRelationService service;
+    @Autowired
+    DmpRwdClient rwdClient;
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 默认图类型
+     */
+    public static String DEFAULT_GRAPH_CODE = "MechForArch";
+    /**
+     * 默认边类型
+     */
+    public static String DEFAULT_REL_CODE = "Sy2Bd";
+
+    /**
+     * 创建系统服务于建筑关系
+     * @param param
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = {"/link"})
+    public AdmResponse create(@RequestParam("projectId") String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        String sysId = param.getString("sysId");
+        String buildingId = param.getString("buildingId");
+        if(!StrUtil.isAllNotEmpty(buildingId,sysId)) {
+            return AdmResponse.failure("必填项:SysId(系统id)、BuildingId(建筑id)");
+        }
+        // 创建关系对象
+        List<RelationDTO> voList = new ArrayList<>();
+        voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, null, sysId , buildingId));
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 根据对象删除关系
+     * 根据对象删除系统服务于建筑的关系,只针对一个对象
+     * @param    param    对象
+     * @return                       删除的结果信息
+     */
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestParam String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        if(CollUtil.isEmpty(param)) {
+            return AdmResponse.success();
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        // 组装条件
+        QueryCriteria criteria = new QueryCriteria();
+        String sysId = param.getString("sysId");
+        String buildingId = param.getString("buildingId");
+        if(!StrUtil.isAllNotEmpty(buildingId,sysId)) {
+            return AdmResponse.failure("必填项:SysId(系统id)、BuildingId(建筑id)");
+        }
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", DEFAULT_GRAPH_CODE);
+        node.put("relCode", DEFAULT_REL_CODE);
+        node.put("objFrom", sysId);
+        node.put("objTo",buildingId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 创建系统服务于建筑关系
+     * 系统服务于建筑,系统一对多
+     * @param   param
+     * @return                       创建的结果信息
+     */
+    @PostMapping("/link-shsps")
+    public AdmResponse createBd(@RequestParam("projectId") String projectId,
+                                   @RequestBody JSONObject param) throws Exception {
+        String sysId = param.getString("sysId");
+        JSONArray buildingIdList = param.getJSONArray("buildingIdList");
+        if(StrUtil.isBlank(sysId) || CollUtil.isEmpty(buildingIdList)) {
+            return AdmResponse.failure("必填项:BuildingIdList(建筑id列表)、SysId(系统id),测方法会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria queryRequestTmp = new QueryCriteria();
+        ObjectNode nodeTmp = JsonNodeFactory.instance.objectNode();
+        nodeTmp.put("graphCode", DEFAULT_GRAPH_CODE);
+        nodeTmp.put("relCode", DEFAULT_REL_CODE);
+        nodeTmp.put("objFrom", sysId);
+        queryRequestTmp.setCriteria(nodeTmp);
+        //关系之前的关系,并且删除
+        List<ObjectRelation> objectRelations = service.queryByCondition(context, queryRequestTmp);
+        for (ObjectRelation objectRelation : objectRelations) {
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", objectRelation.getGraphCode());
+            node.put("relCode", objectRelation.getRelCode());
+            node.put("relValue", objectRelation.getRelValue());
+            node.put("objFrom", objectRelation.getObjFrom());
+            node.put("objTo", objectRelation.getObjTo());
+            queryRequest.setCriteria(node);
+            service.doDelete(context, queryRequest);
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < buildingIdList.size();i++) {
+            String buildingId = buildingIdList.getString(i);
+            if(StrUtil.isBlank(buildingId)) {
+                continue;
+            }
+            voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, null, sysId, buildingId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 服务于建筑的系统,建筑一对多
+     * @param   param
+     * @return                       创建的结果信息
+     */
+    @PostMapping("/link-sy")
+    public AdmResponse createSy(@RequestParam("projectId") String projectId,
+                                @RequestBody JSONObject param) throws Exception {
+        String buildingId = param.getString("buildingId");
+        JSONArray sysIdList = param.getJSONArray("sysIdList");
+        if(StrUtil.isBlank(buildingId) || CollUtil.isEmpty(sysIdList)) {
+            return AdmResponse.failure("必填项:sysIdList(系统id列表)、BuildingId(建筑id),测方法会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria queryRequestTmp = new QueryCriteria();
+        ObjectNode nodeTmp = JsonNodeFactory.instance.objectNode();
+        nodeTmp.put("graphCode", DEFAULT_GRAPH_CODE);
+        nodeTmp.put("relCode", DEFAULT_REL_CODE);
+        nodeTmp.put("objTo", buildingId);
+        queryRequestTmp.setCriteria(nodeTmp);
+        //关系之前的关系,并且删除
+        List<ObjectRelation> objectRelations = service.queryByCondition(context, queryRequestTmp);
+        for (ObjectRelation objectRelation : objectRelations) {
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", objectRelation.getGraphCode());
+            node.put("relCode", objectRelation.getRelCode());
+            node.put("relValue", objectRelation.getRelValue());
+            node.put("objFrom", objectRelation.getObjFrom());
+            node.put("objTo", objectRelation.getObjTo());
+            queryRequest.setCriteria(node);
+            service.doDelete(context, queryRequest);
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < sysIdList.size();i++) {
+            String sysId = sysIdList.getString(i);
+            if(StrUtil.isBlank(sysId)) {
+                continue;
+            }
+            voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, null, sysId, buildingId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+}

+ 196 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationSyForFlController.java

@@ -0,0 +1,196 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+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.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.client.DmpRwdClient;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description:027、关系-系统服务于楼层
+ * @author:lgy
+ * @data:2021/9/26 10:04
+ */
+@RestController
+@RequestMapping("/rel/sy-for-fl")
+public class RelationSyForFlController {
+
+    @Autowired
+    private IAdmRelationService service;
+    @Autowired
+    DmpRwdClient rwdClient;
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 默认图类型
+     */
+    public static String DEFAULT_GRAPH_CODE = "MechForArch";
+    /**
+     * 默认边类型
+     */
+    public static String DEFAULT_REL_CODE = "Sy2Fl";
+
+
+    /**
+     * 创建系统服务于楼层关系
+     * @param param
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = {"/link"})
+    public AdmResponse create(@RequestParam("projectId") String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        String sysId = param.getString("sysId");
+        String floorId = param.getString("floorId");
+        if(!StrUtil.isAllNotEmpty(floorId,sysId)) {
+            return AdmResponse.failure("必填项:SysId(系统id)、FloorId(楼层id)");
+        }
+        // 创建关系对象
+        List<RelationDTO> voList = new ArrayList<>();
+        voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, null, sysId , floorId));
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 根据对象删除系统服务于楼层的关系,只针对一个对象
+     * @param    param    对象
+     * @return                       删除的结果信息
+     */
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestParam String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        if(CollUtil.isEmpty(param)) {
+            return AdmResponse.success();
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        // 组装条件
+        QueryCriteria criteria = new QueryCriteria();
+        String sysId = param.getString("sysId");
+        String floorId = param.getString("floorId");
+        if(!StrUtil.isAllNotEmpty(floorId,sysId)) {
+            return AdmResponse.failure("必填项:SysId(系统id)、FloorId(楼层id)");
+        }
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", DEFAULT_GRAPH_CODE);
+        node.put("relCode", DEFAULT_REL_CODE);
+        node.put("objFrom", sysId);
+        node.put("objTo",floorId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 创建系统服务于楼层,系统一对多
+     * @param   param
+     * @return                       创建的结果信息
+     */
+    @PostMapping("/link-fl")
+    public AdmResponse createBd(@RequestParam("projectId") String projectId,
+                                @RequestBody JSONObject param) throws Exception {
+        String sysId = param.getString("sysId");
+        JSONArray floorIdList = param.getJSONArray("floorIdList");
+        if(StrUtil.isBlank(sysId) || CollUtil.isEmpty(floorIdList)) {
+            return AdmResponse.failure("必填项:FloorIdList(楼层id列表)、SysId(系统id),测方法会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria queryRequestTmp = new QueryCriteria();
+        ObjectNode nodeTmp = JsonNodeFactory.instance.objectNode();
+        nodeTmp.put("graphCode", DEFAULT_GRAPH_CODE);
+        nodeTmp.put("relCode", DEFAULT_REL_CODE);
+        nodeTmp.put("objFrom", sysId);
+        queryRequestTmp.setCriteria(nodeTmp);
+        //关系之前的关系,并且删除
+        List<ObjectRelation> objectRelations = service.queryByCondition(context, queryRequestTmp);
+        for (ObjectRelation objectRelation : objectRelations) {
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", objectRelation.getGraphCode());
+            node.put("relCode", objectRelation.getRelCode());
+            node.put("relValue", objectRelation.getRelValue());
+            node.put("objFrom", objectRelation.getObjFrom());
+            node.put("objTo", objectRelation.getObjTo());
+            queryRequest.setCriteria(node);
+            service.doDelete(context, queryRequest);
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < floorIdList.size();i++) {
+            String floorId = floorIdList.getString(i);
+            if(StrUtil.isBlank(floorId)) {
+                continue;
+            }
+            voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, null, sysId, floorId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 创建服务于楼层的系统,楼层一对多
+     * @param   param
+     * @return                       创建的结果信息
+     */
+    @PostMapping("/link-sy")
+    public AdmResponse createSy(@RequestParam("projectId") String projectId,
+                                @RequestBody JSONObject param) throws Exception {
+        String floorId = param.getString("floorId");
+        JSONArray sysIdList = param.getJSONArray("sysIdList");
+        if(StrUtil.isBlank(floorId) || CollUtil.isEmpty(sysIdList)) {
+            return AdmResponse.failure("必填项:FloorId(楼层id)、sysIdList(系统id列表),测方法会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria queryRequestTmp = new QueryCriteria();
+        ObjectNode nodeTmp = JsonNodeFactory.instance.objectNode();
+        nodeTmp.put("graphCode", DEFAULT_GRAPH_CODE);
+        nodeTmp.put("relCode", DEFAULT_REL_CODE);
+        nodeTmp.put("objTo", floorId);
+        queryRequestTmp.setCriteria(nodeTmp);
+        //关系之前的关系,并且删除
+        List<ObjectRelation> objectRelations = service.queryByCondition(context, queryRequestTmp);
+        for (ObjectRelation objectRelation : objectRelations) {
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", objectRelation.getGraphCode());
+            node.put("relCode", objectRelation.getRelCode());
+            node.put("relValue", objectRelation.getRelValue());
+            node.put("objFrom", objectRelation.getObjFrom());
+            node.put("objTo", objectRelation.getObjTo());
+            queryRequest.setCriteria(node);
+            service.doDelete(context, queryRequest);
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < sysIdList.size();i++) {
+            String sysId = sysIdList.getString(i);
+            if(StrUtil.isBlank(sysId)) {
+                continue;
+            }
+            voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, null, sysId, floorId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+}

+ 192 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationSyForShController.java

@@ -0,0 +1,192 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+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.digital.entity.ObjectRelation;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.client.DmpRwdClient;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description:028、关系-系统服务于竖井
+ * @author:lgy
+ * @data:2021/9/26 10:19
+ */
+@RestController
+@RequestMapping("/rel/sy-for-sh")
+public class RelationSyForShController {
+
+    @Autowired
+    private IAdmRelationService service;
+    @Autowired
+    DmpRwdClient rwdClient;
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 默认图类型
+     */
+    public static String DEFAULT_GRAPH_CODE = "MechForArch";
+    /**
+     * 默认边类型
+     */
+    public static String DEFAULT_REL_CODE = "Sy2Sh";
+
+    /**
+     * 创建系统服务于竖井关系
+     * @param param
+     * @return
+     * @throws Exception
+     */
+    @PostMapping(value = {"/link"})
+    public AdmResponse create(@RequestParam("projectId") String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        String sysId = param.getString("sysId");
+        String shaftId = param.getString("shaftId");
+        if(!StrUtil.isAllNotEmpty(shaftId,sysId)) {
+            return AdmResponse.failure("必填项:SysId(系统id)、ShaftId(竖井id)");
+        }
+        // 创建关系对象
+        List<RelationDTO> voList = new ArrayList<>();
+        voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, null, sysId , shaftId));
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+    /**
+     * 根据对象删除系统服务于竖井的关系,只针对一个对象
+     * @param    param    对象
+     * @return                       删除的结果信息
+     */
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestParam String projectId,
+                              @RequestBody JSONObject param) throws Exception {
+        if(CollUtil.isEmpty(param)) {
+            return AdmResponse.success();
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        // 组装条件
+        QueryCriteria criteria = new QueryCriteria();
+        String sysId = param.getString("sysId");
+        String shaftId = param.getString("shaftId");
+        if(!StrUtil.isAllNotEmpty(shaftId,sysId)) {
+            return AdmResponse.failure("必填项:SysId(系统id)、ShaftId(竖井id)");
+        }
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", DEFAULT_GRAPH_CODE);
+        node.put("relCode", DEFAULT_REL_CODE);
+        node.put("objFrom", sysId);
+        node.put("objTo",shaftId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+        return AdmResponse.success();
+    }
+    /**
+     * 创建系统服务于楼层,系统一对多
+     * @param   param
+     * @return                       创建的结果信息
+     */
+    @PostMapping("/link-sh")
+    public AdmResponse createSh(@RequestParam("projectId") String projectId,
+                                @RequestBody JSONObject param) throws Exception {
+        String sysId = param.getString("sysId");
+        JSONArray shaftIdList = param.getJSONArray("shaftIdList");
+        if(StrUtil.isBlank(sysId) || CollUtil.isEmpty(shaftIdList)) {
+            return AdmResponse.failure("必填项:ShaftIdList(竖井id列表)、SysId(系统id),测方法会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria queryRequestTmp = new QueryCriteria();
+        ObjectNode nodeTmp = JsonNodeFactory.instance.objectNode();
+        nodeTmp.put("graphCode", DEFAULT_GRAPH_CODE);
+        nodeTmp.put("relCode", DEFAULT_REL_CODE);
+        nodeTmp.put("objFrom", sysId);
+        queryRequestTmp.setCriteria(nodeTmp);
+        //关系之前的关系,并且删除
+        List<ObjectRelation> objectRelations = service.queryByCondition(context, queryRequestTmp);
+        for (ObjectRelation objectRelation : objectRelations) {
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", objectRelation.getGraphCode());
+            node.put("relCode", objectRelation.getRelCode());
+            node.put("relValue", objectRelation.getRelValue());
+            node.put("objFrom", objectRelation.getObjFrom());
+            node.put("objTo", objectRelation.getObjTo());
+            queryRequest.setCriteria(node);
+            service.doDelete(context, queryRequest);
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        for(int i = 0;i < shaftIdList.size();i++) {
+            String shaftId = shaftIdList.getString(i);
+            if(StrUtil.isBlank(shaftId)) {
+                continue;
+            }
+            voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, null, sysId, shaftId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+    /**
+     * 服务于竖井的系统,竖井一对多
+     * @param   param
+     * @return                       创建的结果信息
+     */
+    @PostMapping("/link-sy")
+    public AdmResponse createSy(@RequestParam("projectId") String projectId,
+                                @RequestBody JSONObject param) throws Exception {
+        String shaftId = param.getString("shaftId");
+        JSONArray sysIdList = param.getJSONArray("sysIdList");
+        if (StrUtil.isBlank(shaftId) || CollUtil.isEmpty(sysIdList)) {
+            return AdmResponse.failure("必填项:ShaftId(竖井id)、sysIdList(系统id列表),测方法会覆盖以前的记录");
+        }
+        // 创建关系对象.先删除,后添加
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria queryRequestTmp = new QueryCriteria();
+        ObjectNode nodeTmp = JsonNodeFactory.instance.objectNode();
+        nodeTmp.put("graphCode", DEFAULT_GRAPH_CODE);
+        nodeTmp.put("relCode", DEFAULT_REL_CODE);
+        nodeTmp.put("objTo", shaftId);
+        queryRequestTmp.setCriteria(nodeTmp);
+        //关系之前的关系,并且删除
+        List<ObjectRelation> objectRelations = service.queryByCondition(context, queryRequestTmp);
+        for (ObjectRelation objectRelation : objectRelations) {
+            QueryCriteria queryRequest = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", objectRelation.getGraphCode());
+            node.put("relCode", objectRelation.getRelCode());
+            node.put("relValue", objectRelation.getRelValue());
+            node.put("objFrom", objectRelation.getObjFrom());
+            node.put("objTo", objectRelation.getObjTo());
+            queryRequest.setCriteria(node);
+            service.doDelete(context, queryRequest);
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        for (int i = 0; i < sysIdList.size(); i++) {
+            String sysId = sysIdList.getString(i);
+            if (StrUtil.isBlank(sysId)) {
+                continue;
+            }
+            voList.add(new RelationDTO(null, DEFAULT_GRAPH_CODE, DEFAULT_REL_CODE, null, sysId, shaftId));
+        }
+        // 组装上下文条件
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+}

+ 194 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationSyForSpController.java

@@ -0,0 +1,194 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.AdmFloor;
+import com.persagy.proxy.adm.model.AdmRelationAddRequest;
+import com.persagy.proxy.adm.model.relation.*;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.ws.rs.QueryParam;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+
+
+/**
+ * @author zhangwencheng
+ * 系统服务于业务空间
+ */
+
+
+@Slf4j
+@RestController
+@RequestMapping("/rel/sy-for-sp-base")
+public class RelationSyForSpController {
+
+
+
+    @Autowired
+    private IAdmRelationService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+
+/**
+     * 创建系统服务于业务空间关系
+     *
+     * @param rSyForSpBase
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+
+    @PostMapping("/link")
+    public AdmResponse create(@RequestBody SyForSpBase rSyForSpBase, @RequestParam("projectId") String projectId) throws Exception {
+        log.info("创建系统服务于业务空间关系create方法开始参数projectId为{}", projectId);
+        //系统Id
+        String sysID = rSyForSpBase.getSysId();
+        //业务空间Id
+        String spaceId = rSyForSpBase.getSpaceId();
+        if (StrUtil.isBlank(sysID) || StrUtil.isBlank(spaceId)) {
+            return AdmResponse.failure("必填项:sysID(系统id)、SpaceId(业务空间id)");
+        }
+        AdmRelationTypeEnum sy2spFor = AdmRelationTypeEnum.SY2SP_FOR;
+        String graphCode = sy2spFor.getGraphCode();
+        String relCode = sy2spFor.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        RelationDTO relation = new RelationDTO(null, graphCode, relCode, rSyForSpBase.getObjectType(), sysID, spaceId);
+        voList.add(relation);
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        log.info("创建系统服务于业务空间关系create方法结束");
+        return AdmResponse.success();
+    }
+
+
+/**
+     * 系统服务于业务空间关系,系统一对多
+     *
+     * @return
+     * @throws Exception
+     */
+
+    @PostMapping("/link-sp")
+    public AdmResponse createSp(@RequestBody SyForSpBaseList syForSpBaseList, @RequestParam("projectId") String projectId) throws Exception {
+        log.info("创建系统空间关系createSp开始");
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        List<String> spaceIdList = syForSpBaseList.getSpaceIdList();
+        String sysId = syForSpBaseList.getSysId();
+        List<RelationDTO> voList = new ArrayList<>();
+        AdmRelationTypeEnum sy2spFor = AdmRelationTypeEnum.SY2SP_FOR;
+        String graphCode = sy2spFor.getGraphCode();
+        String relCode = sy2spFor.getRelCode();
+        //校验输入参数
+        if (CollectionUtils.isEmpty(spaceIdList) || StringUtils.isEmpty(sysId)) {
+            return AdmResponse.failure("必填项:SpaceIdList(业务空间id列表)、SysID(系统id)");
+        }
+        for (String spaceId : spaceIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, "", sysId, spaceId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        log.info("创建系统空间关系createSp结束");
+        return AdmResponse.success();
+    }
+
+
+/**
+     * 服务于业务空间的系统,业务空间一对多
+     *
+     * @param spForSyBaseList
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+
+    @PostMapping("/link-sy")
+    public AdmResponse createSy(@RequestBody SpForSyBaseList spForSyBaseList, @RequestParam("projectId") String projectId) throws Exception {
+        log.info("创建系统空间关系业务空间一对多link-sy开始");
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        List<String> sysIdList = spForSyBaseList.getSysIdList();
+        String spaceId = spForSyBaseList.getSpaceId();
+        List<RelationDTO> voList = new ArrayList<>();
+        if (CollectionUtils.isEmpty(sysIdList) || StringUtils.isEmpty(spaceId)) {
+            return AdmResponse.failure("必填项:spaceId业务空间id,SysIDList(系统id列表))");
+        }
+        AdmRelationTypeEnum sy2spFor = AdmRelationTypeEnum.SY2SP_FOR;
+        String graphCode = sy2spFor.getGraphCode();
+        String relCode = sy2spFor.getRelCode();
+        for (String sysId: sysIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, "", sysId, spaceId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        log.info("创建系统空间关系业务空间一对多link-sy结束");
+        return AdmResponse.success();
+    }
+
+
+
+/**
+     * 根据对象删除系统服务于业务空间关系,只针对一个对象
+     * @param syForSpBase
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestBody SyForSpBase syForSpBase, @RequestParam("projectId") String projectId) throws Exception {
+        log.info("创建系统服务于业务空间关系create方法开始参数projectId为{}", projectId);
+        //系统Id
+        String sysID = syForSpBase.getSysId();
+        //业务空间Id
+        String spaceId = syForSpBase.getSpaceId();
+        if (StrUtil.isBlank(sysID) || StrUtil.isBlank(spaceId)) {
+            return AdmResponse.failure("必填项:sysID(系统id)、SpaceId(业务空间id)");
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        AdmRelationTypeEnum sy2spFor = AdmRelationTypeEnum.SY2SP_FOR;
+        String graphCode = sy2spFor.getGraphCode();
+        String relCode = sy2spFor.getRelCode();
+        node.put("graphCode", graphCode);
+        node.put("relCode", relCode);
+//        node.put("relValue", syForSpBase.getObjectType());
+        node.put("objFrom", sysID);
+        node.put("objTo", spaceId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+        log.info("创建系统服务于业务空间关系create方法结束");
+        return AdmResponse.success();
+    }
+
+
+
+
+
+
+}
+

+ 240 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationSyInBdController.java

@@ -0,0 +1,240 @@
+package com.persagy.proxy.adm.controller;
+
+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.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.relation.*;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ * 系统所在建筑
+ */
+@Slf4j
+@RestController
+@RequestMapping("/rel/sy-in-bd")
+public class RelationSyInBdController {
+
+    @Autowired
+    private IAdmRelationService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 系统所在建筑
+     *
+     * @param syInBd
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/link")
+    public AdmResponse create(@RequestBody SyInBd syInBd, @RequestParam("projectId") String projectId) throws Exception {
+        log.info("创建系统所在建筑关系create方法开始参数projectId为{}", projectId);
+        //系统Id
+        String sysID = syInBd.getSysId();
+        //建筑Id
+        String buildingId = syInBd.getBuildingId();
+        if (StrUtil.isBlank(sysID) || StrUtil.isBlank(buildingId)) {
+            return AdmResponse.failure("必填项:SysId(系统id)、BuildingId(建筑id)");
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        AdmRelationTypeEnum sy2bdMechinarch = AdmRelationTypeEnum.SY2BD_MECHINARCH;
+        String graphCode = sy2bdMechinarch.getGraphCode();
+        String relCode = sy2bdMechinarch.getRelCode();
+        RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysID, buildingId);
+        voList.add(relation);
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        log.info("创建系统所在建筑create方法结束");
+        return AdmResponse.success();
+    }
+
+
+//    /**
+//     * 系统和楼层的关系对象
+//     *
+//     * @param syInFlList
+//     * @param projectId
+//     * @return
+//     * @throws Exception
+//     */
+//    @PostMapping("/link-fl")
+//    public AdmResponse createSy(@RequestBody SyInFlList syInFlList, @RequestParam("projectId") String projectId) throws Exception {
+//        log.info("创建系统所在建筑关系create方法开始参数projectId为{}", projectId);
+//        //系统Id
+//        String sysID = syInFlList.getSysId();
+//        //楼层
+//        List<String> floors = syInFlList.getFloorIdList();
+//        if (StringUtils.isBlank(sysID) || CollectionUtils.isEmpty(floors)) {
+//            return AdmResponse.failure("必填项:SysId(系统id)、floorIdList(楼层)");
+//        }
+//        List<RelationDTO> voList = new ArrayList<>();
+//        for (String floorId : floors) {
+//            //todo graphCode
+//            RelationDTO relation = new RelationDTO(null, "MechInArch", "Eq2Sp", null, sysID, floorId);
+//            voList.add(relation);
+//        }
+//        // 组装上下文条件
+//        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+//        service.doSave(context, voList);
+//        log.info("创建系统服务于业务空间关系create方法结束");
+//        return AdmResponse.success();
+//    }
+
+    /**
+     * 创建系统所在建筑关系
+     * @param syInFlList
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/link-bd")
+    public AdmResponse createBd(@RequestBody SyInBdList syInFlList, @RequestParam("projectId") String projectId) throws Exception {
+        log.info("创建系统所在建筑关系createBD方法开始参数projectId为{}", projectId);
+        //系统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<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);
+            voList.add(relation);
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        log.info("创建系统所在建筑关系createBD方法结束");
+        return AdmResponse.success();
+    }
+
+
+    /**
+     * 创建系统所在建筑关系 同上
+     * @param syInFlList
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/link-bd-sy")
+    public AdmResponse createSyBd(@RequestBody SyInBdList syInFlList, @RequestParam("projectId") String projectId) throws Exception {
+        log.info("创建系统所在建筑关系createSyBd方法开始参数projectId为{}", projectId);
+        //系统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<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);
+            voList.add(relation);
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        log.info("创建系统所在建筑关系createSyBd方法结束");
+        return AdmResponse.success();
+    }
+
+
+    /**
+     * 创建所在建筑的系统关系
+     * @param bdInSyList
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/link-sy")
+    public AdmResponse createSyBd(@RequestBody BdInSyList bdInSyList, @RequestParam("projectId") String projectId) throws Exception {
+        log.info("创建系统所在建筑关系createSyBd方法开始参数projectId为{}", projectId);
+        //建筑Id
+        String buildingId = bdInSyList.getBuildingId();
+        //系统
+        List<String> sysIdList = bdInSyList.getSysIdList();
+        if (StringUtils.isBlank(buildingId) || CollectionUtils.isEmpty(sysIdList)) {
+            return AdmResponse.failure("必填项:buildingId(建筑id)、sysIdList(系统Id)");
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        AdmRelationTypeEnum sy2bdMechinarch = AdmRelationTypeEnum.SY2BD_MECHINARCH;
+        String graphCode = sy2bdMechinarch.getGraphCode();
+        String relCode = sy2bdMechinarch.getRelCode();
+        for (String sysId : sysIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysId, buildingId);
+            voList.add(relation);
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        log.info("创建系统所在建筑关系createSyBd方法结束");
+        return AdmResponse.success();
+    }
+
+
+    /**
+     * 系统所在建筑
+     *
+     * @param syInBd
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestBody SyInBd syInBd, @RequestParam("projectId") String projectId) throws Exception {
+        log.info("创建系统所在建筑关系delete方法开始参数projectId为{}", projectId);
+        //系统Id
+        String sysID = syInBd.getSysId();
+        //建筑Id
+        String buildingId = syInBd.getBuildingId();
+        if (StrUtil.isBlank(sysID) || StrUtil.isBlank(buildingId)) {
+            return AdmResponse.failure("必填项:SysId(系统id)、BuildingId(建筑id)");
+        }
+        QueryCriteria criteria = new QueryCriteria();
+//        RelationDTO relation = new RelationDTO(null, "MechInArch", "Eq2Sp", null, sysID, buildingId);
+        AdmRelationTypeEnum sy2bdMechinarch = AdmRelationTypeEnum.SY2BD_MECHINARCH;
+        String graphCode = sy2bdMechinarch.getGraphCode();
+        String relCode = sy2bdMechinarch.getRelCode();
+        // 组装上下文条件
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", graphCode);
+        node.put("relCode", relCode);
+//        node.put("relValue", );
+        node.put("objFrom", sysID);
+        node.put("objTo", buildingId);
+        criteria.setCriteria(node);
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doDelete(context,criteria);
+        log.info("创建系统服务于业务空间关系delete方法结束");
+        return AdmResponse.success();
+    }
+
+
+}

+ 184 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationSyInFlController.java

@@ -0,0 +1,184 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.excel.util.CollectionUtils;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.relation.FlInSyList;
+import com.persagy.proxy.adm.model.relation.SyInFl;
+import com.persagy.proxy.adm.model.relation.SyInFlList;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ * 系统所在楼层相关接口
+ */
+@Slf4j
+@RestController
+@RequestMapping("/rel/sy-in-fl")
+public class RelationSyInFlController {
+
+    @Autowired
+    private IAdmRelationService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 创建系统所在楼层关系
+     *
+     * @param syInFl
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/link")
+    public AdmResponse create(@RequestBody SyInFl syInFl, @RequestParam("projectId") String projectId) throws Exception {
+        //系统Id
+        String sysID = syInFl.getSysId();
+        //楼层Id
+        String floorId = syInFl.getFloorId();
+        //
+        String type = syInFl.getType();
+        if (StrUtil.isBlank(sysID) || StrUtil.isBlank(floorId)) {
+            return AdmResponse.failure("必填项:SysId(系统id)、floorId(楼层id)");
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        AdmRelationTypeEnum sy2fl = AdmRelationTypeEnum.SY2FL;
+        String graphCode = sy2fl.getGraphCode();
+        String relCode = sy2fl.getRelCode();
+        RelationDTO relation = new RelationDTO(null, graphCode, relCode, type, sysID, floorId);
+        voList.add(relation);
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+
+    /**
+     * 创建所在系统和楼层的关系 系统楼层一对多
+     *
+     * @param projectId
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/link-fl")
+    public AdmResponse createSy(@RequestBody SyInFlList syInFlList, @RequestParam("projectId") String projectId) throws Exception {
+        log.info("创建系统所在楼层关系link-fl方法开始,参数projectId为{}", projectId);
+        //系统Id
+        String sysId = syInFlList.getSysId();
+        //楼层Id
+        List<String> floorIdList = syInFlList.getFloorIdList();
+        if (StringUtils.isBlank(sysId) || CollectionUtils.isEmpty(floorIdList)) {
+            return AdmResponse.failure("必填项:sysId(系统id)、floorIdList(楼层Id)");
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        AdmRelationTypeEnum sy2fl = AdmRelationTypeEnum.SY2FL;
+        String graphCode = sy2fl.getGraphCode();
+        String relCode = sy2fl.getRelCode();
+        for (String floorId : floorIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysId, floorId);
+            voList.add(relation);
+        }
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        log.info("创建系统所在楼层关系link-fl方法结束");
+        return AdmResponse.success();
+    }
+
+
+    /**
+     * 所在楼层的系统,楼层一对多系统
+     */
+    @PostMapping("/link-sy")
+    public AdmResponse createSy(@RequestBody FlInSyList flInSyList, @RequestParam("projectId") String projectId) {
+        log.info("创建系统所在楼层关系link-sy方法开始,参数projectId为{}", projectId);
+        String floorId = flInSyList.getFloorId();
+        List<String> sysIdList = flInSyList.getSysIdList();
+        if (StringUtils.isBlank(floorId) || CollectionUtils.isEmpty(sysIdList)) {
+            return AdmResponse.failure("必填项:sysIdList(系统id不能为空)、floorId(楼层Id)");
+        }
+        AdmRelationTypeEnum sy2fl = AdmRelationTypeEnum.SY2FL;
+        String graphCode = sy2fl.getGraphCode();
+        String relCode = sy2fl.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        for (String sysId : sysIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysId, floorId);
+            voList.add(relation);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        log.info("创建系统所在楼层关系link-sy方法结束");
+        return AdmResponse.success();
+    }
+
+
+    /**
+     * 系统所在楼层,系统一对多楼层,此方法不会覆盖
+     */
+    @PostMapping("/link-fl-sy")
+    public AdmResponse createSyFl(@RequestBody SyInFlList syInFlList, @RequestParam("projectId") String projectId) {
+        log.info("创建系统所在楼层关系link-fl-sy方法开始,参数projectId为{}", projectId);
+        List<String> floorIdList = syInFlList.getFloorIdList();
+        String sysId = syInFlList.getSysId();
+        if (StringUtils.isBlank(sysId) || CollectionUtils.isEmpty(floorIdList)) {
+            return AdmResponse.failure("必填项:sysId(系统sysId不能为空)、floorIdList(楼层Id不能为空)");
+        }
+        AdmRelationTypeEnum sy2fl = AdmRelationTypeEnum.SY2FL;
+        String graphCode = sy2fl.getGraphCode();
+        String relCode = sy2fl.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        for (String floorId : floorIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysId, floorId);
+            voList.add(relation);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        log.info("创建系统所在楼层关系link-fl-sy方法结束");
+        return AdmResponse.success();
+    }
+
+    /**
+     * 根据对象删除
+     *
+     * @return
+     */
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestBody SyInFl syInFl, @RequestParam("projectId") String projectId) {
+        String floorId = syInFl.getFloorId();
+        String sysId = syInFl.getSysId();
+        AdmRelationTypeEnum sy2fl = AdmRelationTypeEnum.SY2FL;
+        String graphCode = sy2fl.getGraphCode();
+        String relCode = sy2fl.getRelCode();
+        String type = syInFl.getType();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", graphCode);
+        node.put("relCode", relCode);
+        node.put("relValue",type);
+        node.put("objFrom", sysId);
+        node.put("objTo", floorId);
+        QueryCriteria criteria = new QueryCriteria();
+        criteria.setCriteria(node);
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doDelete(context,criteria);
+        return AdmResponse.success();
+    }
+
+}

+ 242 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationSyInShController.java

@@ -0,0 +1,242 @@
+package com.persagy.proxy.adm.controller;
+
+
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.excel.util.CollectionUtils;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.relation.ShInSyList;
+import com.persagy.proxy.adm.model.relation.SyInSh;
+import com.persagy.proxy.adm.model.relation.SyInShList;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ * 系统所在楼层相关接口-032
+ */
+@Slf4j
+@RestController
+@RequestMapping("/rel/sy-in-sh")
+public class RelationSyInShController {
+
+    @Autowired
+    private IAdmRelationService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 创建系统所在竖井关系
+     *
+     * @param syInSh 系统和竖井的关系对象
+     * @return project 创建的结果信息
+     */
+    @PostMapping(value = "/link")
+    public AdmResponse create(@RequestBody SyInSh syInSh, @RequestParam("projectId") String projectId) {
+        //系统Id
+        String sysID = syInSh.getSysId();
+        //楼层Id
+        String shaftId = syInSh.getShaftId();
+        //
+        String type = syInSh.getType();
+        if (StrUtil.isBlank(sysID) || StrUtil.isBlank(shaftId)) {
+            return AdmResponse.failure("必填项:SysId(系统id)、shaftId(竖井id)");
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SY2SH;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        RelationDTO relation = new RelationDTO(null, graphCode, relCode, type, sysID, shaftId);
+        voList.add(relation);
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 根据对象删除
+     *
+     * @param syInSh
+     * @param projectId
+     * @return
+     */
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestBody SyInSh syInSh, @RequestParam("projectId") String projectId) {
+        String sysID = syInSh.getSysId();
+        //楼层Id
+        String shaftId = syInSh.getShaftId();
+        //
+//        String type = syInSh.getType();
+        if (StrUtil.isBlank(sysID) || StrUtil.isBlank(shaftId)) {
+            return AdmResponse.failure("必填项:SysId(系统id)、shaftId(竖井id)");
+        }
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SY2SH;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", graphCode);
+        node.put("relCode", relCode);
+//        node.put("relValue", type);
+        node.put("objFrom", sysID);
+        node.put("objTo", shaftId);
+        QueryCriteria criteria = new QueryCriteria();
+        criteria.setCriteria(node);
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doDelete(context, criteria);
+        return AdmResponse.success();
+    }
+
+
+    /**
+     * 创建系统所在竖井关系
+     *
+     * @param syInShList 系统和竖井的关系对象
+     * @return 创建的结果信息
+     */
+    @PostMapping(value = "/link-sh")
+    public AdmResponse createSh(@RequestBody SyInShList syInShList, @RequestParam("projectId") String projectId) {
+        String sysId = syInShList.getSysId();
+        List<String> shaftIdList = syInShList.getShaftIdList();
+        if (StringUtils.isBlank(sysId) || CollectionUtils.isEmpty(shaftIdList)) {
+            return AdmResponse.failure("必填项:sysId(系统sysId不能为空)、shaftIdList(竖井Id不能为空)");
+        }
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SY2SH;
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        deleteBySysId(typeEnum,sysId,context);
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        for (String shaftId : shaftIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysId, shaftId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 根据系统Id删除关系
+     * @param typeEnum
+     * @param sysId
+     * @param context
+     */
+    private void deleteBySysId(AdmRelationTypeEnum typeEnum, String sysId, InstanceUrlParam context) {
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", typeEnum.getGraphCode());
+        node.put("relCode", typeEnum.getRelCode());
+        node.put("objFrom", sysId);
+        QueryCriteria criteria = new QueryCriteria();
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+    }
+
+
+    /**
+     * 创建所在竖井的系统关系 先删除以前的竖井在增加新的关系
+     *
+     * @param     shInSyList    系统和竖井的关系对象
+     * @return               创建的结果信息
+     */
+    @PostMapping(value = "/link-sy")
+    public AdmResponse createSy(@RequestBody ShInSyList shInSyList,@RequestParam("projectId") String projectId){
+        List<String> sysIdList = shInSyList.getSysIdList();
+        String shaftId = shInSyList.getShaftId();
+        if (StringUtils.isBlank(shaftId) || CollectionUtils.isEmpty(sysIdList)) {
+            return AdmResponse.failure("必填项:shaftId(竖井shaftId不能为空)、sysIdList(系统Id不能为空)");
+        }
+        //先删除以前竖井
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SY2SH;
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        deleteByShaftId(shaftId,typeEnum,context);
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        for (String sysId : sysIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysId, shaftId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        return  AdmResponse.success();
+    }
+
+    /**
+     * 根据竖井Id删除竖井关系
+     * @param shaftId
+     */
+    private void deleteByShaftId(String shaftId,AdmRelationTypeEnum typeEnum,InstanceUrlParam context) {
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", typeEnum.getGraphCode());
+        node.put("relCode", typeEnum.getRelCode());
+        node.put("objTo", shaftId);
+        QueryCriteria criteria = new QueryCriteria();
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+    }
+
+    /**
+     * 创建所在竖井的系统关系
+     *
+     * @param     shInSyList    系统和竖井的关系对象
+     * @return               创建的结果信息
+     */
+    @PostMapping("/link-sy-sh")
+    public AdmResponse createSySh(@RequestBody ShInSyList shInSyList,@RequestParam("projectId") String projectId){
+        String shaftId = shInSyList.getShaftId();
+        List<String> sysIdList = shInSyList.getSysIdList();
+        if (StringUtils.isBlank(shaftId) || CollectionUtils.isEmpty(sysIdList)) {
+            return AdmResponse.failure("必填项:shaftId(竖井shaftId不能为空)、sysIdList(系统Id不能为空)");
+        }
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SY2SH;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        for (String sysId : sysIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysId, shaftId);
+            voList.add(relation);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return   AdmResponse.success();
+    }
+
+    /**
+     * 系统所在竖井,系统一对多,不覆盖
+     *
+     * @param    syInShList    系统和竖井的关系对象
+     * @return              创建的结果信息
+     */
+    @PostMapping("/link-sy-shs")
+    public AdmResponse createSyShs(@RequestBody  SyInShList syInShList,@RequestParam("projectId") String projectId ){
+        String sysId = syInShList.getSysId();
+        List<String> shaftIdList = syInShList.getShaftIdList();
+        if (StringUtils.isBlank(sysId) || CollectionUtils.isEmpty(shaftIdList)) {
+            return AdmResponse.failure("必填项:shaftId(竖井shaftId不能为空)、sysId(系统Id不能为空)");
+        }
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SY2SH;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        for (String shaftId : shaftIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysId, shaftId);
+            voList.add(relation);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+}

+ 163 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationSyInSpController.java

@@ -0,0 +1,163 @@
+package com.persagy.proxy.adm.controller;
+
+
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.relation.*;
+import com.persagy.proxy.adm.request.AdmCreateRequest;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ * 关系-系统所在业务空间-033
+ */
+@Slf4j
+@RestController
+@RequestMapping("/rel/sy-in-sp-base")
+public class RelationSyInSpController {
+
+    @Autowired
+    private IAdmRelationService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    @PostMapping("/link-list")
+    public AdmResponse create(@RequestBody AdmCreateRequest<SyInSpBase> syInSpBase, @RequestParam("projectId") String projectId) {
+        List<SyInSpBase> syInSpBases = syInSpBase.getContent();
+        List<RelationDTO> voList = new ArrayList<>();
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SY2SP;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        for (SyInSpBase inSpBase : syInSpBases) {
+            String spaceId = inSpBase.getSpaceId();
+            String sysId = inSpBase.getSysId();
+            String objectType = inSpBase.getObjectType();
+            if (StrUtil.isBlank(spaceId) || StrUtil.isBlank(sysId) ) {
+                return AdmResponse.failure("必填项:SysId(系统id)、spaceId(空间id)");
+            }
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, objectType, sysId, spaceId);
+            voList.add(relation);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 处理所有空间分区和系统关系 系统所在的业务空间关系,空间分区一对多,累计叠加,不覆盖
+     */
+    @PostMapping(value = "/link-sp-sys")
+    public AdmResponse createsSpSys( @RequestBody JSONObject param ,  @RequestParam("projectId") String projectId) {
+        JSONObject rSyIn = param.getJSONObject("rSyInSpBase");
+        String type = param.getString("type");
+        SpInSyBaseList rSyInSpBase = JSON.toJavaObject(rSyIn, SpInSyBaseList.class);
+        String spaceId = rSyInSpBase.getSpaceId();
+        List<String> sysIdList = rSyInSpBase.getSysIdList();
+        if (StrUtil.isBlank(spaceId) || CollectionUtils.isEmpty(sysIdList)) {
+            return AdmResponse.failure("必填项:SysId(系统id)、spaceId(空间id)");
+        }
+        List<RelationDTO> voList = new ArrayList<>();
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SY2SP;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        for (String sysId : sysIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, type, sysId, spaceId);
+            voList.add(relation);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 创建系统所在业务空间关系
+     * 系统所在业务空间关系,系统一对多,不覆盖
+     *
+     * @param param 系统和业务空间的关系对象
+     * @return 创建的结果信息
+     */
+    @PostMapping(value = "/link-sy-sps")
+    public AdmResponse createSySps( @RequestBody JSONObject param, @RequestParam("projectId") String projectId) {
+        JSONObject rSyIn = param.getJSONObject("rSyInSpBase");
+        String type = param.getString("type");
+        SyInSpBaseList  syInSpBaseList= JSON.toJavaObject(rSyIn, SyInSpBaseList.class);
+        List<String> spaceIdList = syInSpBaseList.getSpaceIdList();
+        String sysId = syInSpBaseList.getSysId();
+        List<RelationDTO> voList = new ArrayList<>();
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SY2SP;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        for (String spaceId : spaceIdList) {
+            if (StrUtil.isBlank(spaceId) || StrUtil.isEmpty(sysId)) {
+                return AdmResponse.failure("必填项:SysId(系统id)、spaceId(空间id)");
+            }
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, type, sysId, spaceId);
+            voList.add(relation);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    /**
+     * 根据对象删除系统所在业务空间关系
+     *
+     * @param
+     * @return 删除的结果信息
+     */
+    @PostMapping("/unlink-list")
+    public AdmResponse delete(@RequestBody JSONObject param, @RequestParam("projectId") String projectId) {
+        JSONArray jsonArray = param.getJSONArray("rSyInSpBase");
+        List<SyInSpBase> syInSpBases = JSONArray.parseArray(jsonArray.toJSONString(),SyInSpBase.class);
+        String type = param.getString("type");
+//        String type = deleteSyInSpBase.getType();
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.SY2SP;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        List<QueryCriteria> queryCriteriaList = new ArrayList<>();
+        if(CollectionUtils.isEmpty(syInSpBases)){
+            return AdmResponse.failure("必填项:syInSpBases");
+        }
+        for (SyInSpBase syInSpBase : syInSpBases) {
+            String sysId = syInSpBase.getSysId();
+            String spaceId = syInSpBase.getSpaceId();
+            if (StrUtil.isBlank(spaceId) || StrUtil.isEmpty(sysId)) {
+                return AdmResponse.failure("必填项:SysId(系统id)、spaceId(空间id)");
+            }
+            QueryCriteria criteria = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", graphCode);
+            node.put("relCode", relCode);
+            node.put("relValue", type);
+            node.put("objFrom", sysId);
+            node.put("objTo", spaceId);
+            criteria.setCriteria(node);
+            queryCriteriaList.add(criteria);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        for (QueryCriteria queryCriteria : queryCriteriaList) {
+            //问题:如何调用一次接口,如何保证一起成功
+            service.doDelete(context, queryCriteria);
+        }
+        return AdmResponse.success();
+    }
+}

+ 147 - 0
src/main/java/com/persagy/proxy/adm/controller/RelationTnInSpController.java

@@ -0,0 +1,147 @@
+package com.persagy.proxy.adm.controller;
+
+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.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.model.relation.TnInSpBase;
+import com.persagy.proxy.adm.model.relation.TnInSpBaseList;
+import com.persagy.proxy.adm.request.AdmCreateRequest;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.RelationDTO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 租户所租用的业务空间
+ *
+ * @author zhangwencheng
+ */
+@Slf4j
+@RestController
+@RequestMapping("/rel/tn-in-sp-base")
+public class RelationTnInSpController {
+
+    @Autowired
+    private IAdmRelationService service;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /**
+     * 创建租户所租用的业务空间关系
+     *
+     * @param tnInSpBase 租户和业务空间的关系对象
+     * @return 创建的结果信息
+     */
+    @PostMapping("/link")
+    public AdmResponse create( @RequestBody AdmCreateRequest<TnInSpBase> tnInSpBase,@RequestParam("projectId") String projectId) {
+        List<TnInSpBase> content = tnInSpBase.getContent();
+        if(CollectionUtils.isEmpty(content)){
+            return AdmResponse.failure("content不能为空");
+        }
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.TN2SP;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        List<RelationDTO> voList = new ArrayList<>();
+        for (TnInSpBase inSpBase : content) {
+            String spaceId = inSpBase.getSpaceId();
+            String tenantId = inSpBase.getTenantId();
+            String objectType = inSpBase.getObjectType();
+            if(StrUtil.isEmpty(spaceId)||StrUtil.isBlank(tenantId)){
+                return AdmResponse.failure("必填项:tenantId(租户Id)、spaceIdList(空间id)");
+            }
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, objectType, tenantId, spaceId);
+            voList.add(relation);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+
+    @PostMapping("/unlink")
+    public AdmResponse delete(@RequestParam(value = "type",required = false) String type,@RequestBody List<TnInSpBase> tnInSpBases,@RequestParam("projectId") String projectId) {
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.TN2SP;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        if(CollectionUtils.isEmpty(tnInSpBases)){
+            return AdmResponse.failure("tnInSpBases不能为空");
+        }
+        List<QueryCriteria> queryCriteriaList = new ArrayList<>();
+        for (TnInSpBase tnInSpBase : tnInSpBases) {
+            String tenantId = tnInSpBase.getTenantId();
+            String spaceId = tnInSpBase.getSpaceId();
+            if (StrUtil.isBlank(spaceId) || StrUtil.isEmpty(tenantId)) {
+                return AdmResponse.failure("必填项:tenantId(租户Id)、spaceId(空间id)");
+            }
+            QueryCriteria criteria = new QueryCriteria();
+            ObjectNode node = JsonNodeFactory.instance.objectNode();
+            node.put("graphCode", graphCode);
+            node.put("relCode", relCode);
+            node.put("relValue", type);
+            node.put("objFrom", tenantId);
+            node.put("objTo", spaceId);
+            criteria.setCriteria(node);
+            queryCriteriaList.add(criteria);
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        for (QueryCriteria queryCriteria : queryCriteriaList) {
+            //问题:如何调用一次接口,如何保证一起成功
+            service.doDelete(context, queryCriteria);
+        }
+        return AdmResponse.success();
+    }
+
+    /**
+     * 创建租户所租用的业务空间关系
+     *
+     * @param    tnInSpBaseList    租户和业务空间的关系对象
+     * @return                  创建的结果信息
+     */
+    @PostMapping("/link-sp")
+    public AdmResponse createSp(@RequestParam(value = "type",required = false) String type, @RequestBody TnInSpBaseList tnInSpBaseList,@RequestParam("projectId") String projectId) {
+        List<String> spaceIdList = tnInSpBaseList.getSpaceIdList();
+        String tenantId = tnInSpBaseList.getTenantId();
+        if(CollectionUtils.isEmpty(spaceIdList)||StrUtil.isBlank(tenantId)){
+            return AdmResponse.failure("必填项:tenantId(租户Id)、spaceIdList(空间id)");
+        }
+        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.TN2SP;
+        String graphCode = typeEnum.getGraphCode();
+        String relCode = typeEnum.getRelCode();
+        deleteByTenantId(tenantId,typeEnum,context);
+        List<RelationDTO> voList = new ArrayList<>();
+        for (String spaceId : spaceIdList) {
+            RelationDTO relation = new RelationDTO(null, graphCode, relCode, type, tenantId, spaceId);
+            voList.add(relation);
+        }
+        service.doSave(context, voList);
+        return AdmResponse.success();
+    }
+
+    //根据租户Id删除
+    private void deleteByTenantId(String tenantId,AdmRelationTypeEnum typeEnum,InstanceUrlParam context) {
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("graphCode", typeEnum.getGraphCode());
+        node.put("relCode", typeEnum.getRelCode());
+//        node.put("relValue", type);
+        node.put("objFrom", tenantId);
+//        node.put("objTo", spaceId);
+        criteria.setCriteria(node);
+        service.doDelete(context, criteria);
+    }
+
+
+}

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

@@ -1,5 +1,6 @@
 package com.persagy.proxy.adm.model;
 
+import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Data;
 
 /**
@@ -10,14 +11,18 @@ import lombok.Data;
 @Data
 public class AdmBuildingFloorInfo {
     /** 建筑体ID */
+    @JSONField(name = "BuildID")
     private String buildID;
 
     /** 建筑体名称 */
+    @JSONField(name = "BuildName")
     private String buildName;
 
     /** 楼层ID */
+    @JSONField(name = "FloorID")
     private String floorID;
 
     /** 楼层名称 */
+    @JSONField(name = "FloorName")
     private String floorName;
 }

+ 10 - 0
src/main/java/com/persagy/proxy/adm/model/AdmEquipTypeLabsl.java

@@ -0,0 +1,10 @@
+package com.persagy.proxy.adm.model;
+
+import lombok.Data;
+
+@Data
+public class AdmEquipTypeLabsl {
+    /** 类型名称 */
+    private String codeName;
+
+}

+ 50 - 0
src/main/java/com/persagy/proxy/adm/model/AdmEquipment.java

@@ -1,9 +1,12 @@
 package com.persagy.proxy.adm.model;
 
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.annotation.JSONField;
 import com.persagy.proxy.adm.annotations.CascadeColumn;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import javax.persistence.Column;
 import java.util.List;
 
 /**
@@ -26,6 +29,7 @@ public class AdmEquipment extends AdmSBaseEntity<AdmEquipment>{
     /** 设计图纸中编码 */
     private String cadId;
     /** RFID标识 */
+    @JSONField(name = "rFID")
     private String rfId;
 
 
@@ -121,6 +125,24 @@ public class AdmEquipment extends AdmSBaseEntity<AdmEquipment>{
     private AdmProject project;
     /**BIM模型中坐标json,坐标x,y,z */
     private AdmBIMLocation locationJson;
+    public AdmBIMLocation getLocationJson() {
+        if (StrUtil.isNotEmpty(bimLocation)){
+            String[] split = bimLocation.split(",");
+            AdmBIMLocation bimLocation = new AdmBIMLocation();
+            if (split.length == 3){
+                bimLocation.setX(Double.valueOf(split[0]));
+                bimLocation.setY(Double.valueOf(split[1]));
+                bimLocation.setZ(Double.valueOf(split[2]));
+            }else if (split.length == 2){
+                bimLocation.setX(Double.valueOf(split[0]));
+                bimLocation.setY(Double.valueOf(split[1]));
+                bimLocation.setZ(0.0);
+            }
+            return bimLocation;
+        }
+        return null;
+    }
+
     /** 级联-设备服务所在的空 */
     @CascadeColumn(graphCode = "MechForArch", relCode = "Eq2Sp")
     private List<AdmSpace> zoneSpaceForBase;
@@ -137,4 +159,32 @@ public class AdmEquipment extends AdmSBaseEntity<AdmEquipment>{
     @CascadeColumn(graphCode = "MechSubset", relCode = "Eq2Ec")
     private List<AdmComponent> component;
 
+    /******************************** 报表使用 **************************************/
+    /** 资产id */
+    @Column(name = "link_id")
+    private String linkId;
+
+    /** 资产名称 */
+    @Column(name = "link_name")
+    private String linkEquipName;
+
+    /** 资产本地名称 */
+    @Column(name = "link_local_name")
+    private String linkEquipLocalName;
+
+    /** 资产分类 */
+    @Column(name = "link_family")
+    private String linkFamily;
+
+    /** 系统对象 */
+    @CascadeColumn(graphCode = "MechSubset", relCode = "Sy2Eq", selectToObj = false)
+    private List<AdmSystem> linkSystem;
+
+    /** 部件数量 */
+    private Integer count = 0;
+
+    /** 级联-部件   table  对应关系表   idColumn 对应 本类的id    childIdColumn 级联对象的关系id */
+    //@CascadeColumn(table="equipment", idColumn="class_code", childIdColumn="parent_id")
+    private List<AdmObjectType> componentCategory;
+
 }

+ 2 - 2
src/main/java/com/persagy/proxy/adm/model/AdmObjectInfo.java

@@ -119,8 +119,8 @@ public class AdmObjectInfo {
 
     /**路径 :
      * 若firstName == "基本信息"|| firstName.isNullOrEmpty()||firstName == "基本参数 path为code编码,否则,path为infos.$code */
-    private String path;
+   private String path;
 
     /** 字典内容 */
-    private List<AdmObjectInfo> content;
+   private List<AdmObjectInfo> content;
 }

+ 36 - 0
src/main/java/com/persagy/proxy/adm/model/AdmPlanarEquipRequests.java

@@ -0,0 +1,36 @@
+package com.persagy.proxy.adm.model;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName AdmPlanarEquipRequests
+ * @Description: 平面图设备查询请求参数
+ * @Author linhuili
+ * @Date 2021/9/22 14:15
+ * @Version V1.0
+ **/
+@Data
+public class AdmPlanarEquipRequests {
+
+    /** 设备类型 */
+    private List<String> equipTypes;
+
+    /** 空间类型 */
+    private List<String> zoneTypes;
+
+    /** 空间 id */
+    private List<String> spaceIds;
+
+    /** 空间功能区类型 */
+    private List<String> funcTypes;
+
+    /** 楼层 id */
+    private String floorId;
+
+    /** 建筑 id */
+    private String buildingId;
+
+}

+ 8 - 0
src/main/java/com/persagy/proxy/adm/model/AdmSystem.java

@@ -59,4 +59,12 @@ public class AdmSystem extends AdmSBaseEntity<AdmSystem> {
     private List<AdmBuilding> buildingList;
     /** 建筑楼层 */
     private List<AdmBuildingFloorInfo> buildingFloorInfoList;
+
+    /** 供展示使用,并非实体中的字段 **/
+    /** 设备id*/
+    private String equipId;
+    /** 设备名称*/
+    private String equipName;
+    /** 设备本地名称*/
+    private String equipLocalName;
 }

+ 22 - 0
src/main/java/com/persagy/proxy/adm/model/AdmZoneEquipQueryRequest.java

@@ -0,0 +1,22 @@
+package com.persagy.proxy.adm.model;
+
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * @author lvxy
+ * @date 2021/9/24
+ */
+@Data
+@EqualsAndHashCode(callSuper=true)
+public class AdmZoneEquipQueryRequest extends AdmQueryCriteria {
+    /**所属业务空间类型", example = "TenantZone" */
+    private String zoneType;
+
+    /** "所属业务空间Id", example = "Sp*****" */
+    private String zoneId;
+
+    /**"不在任何业务空间内的设备或部件(true)", example = "true" */
+    private Boolean notInZone = false;
+}

+ 80 - 0
src/main/java/com/persagy/proxy/adm/model/equip/EquipUpDateEnclosure.java

@@ -0,0 +1,80 @@
+package com.persagy.proxy.adm.model.equip;
+
+import com.persagy.proxy.adm.model.AdmTaskPic;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author lvxy
+ * @date 2021/9/27
+ * 增量附件
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class EquipUpDateEnclosure implements Serializable {
+
+    /** 设备id */
+    private String  equipId;
+
+    /** 保险文件 */
+    private List<AdmTaskPic> insuranceFile;
+
+    /** 设备铭牌照片 */
+    private List<AdmTaskPic> nameplate;
+
+    /** 设备照片 */
+    private List<AdmTaskPic> pic;
+
+    /** 设备图纸 */
+    private List<AdmTaskPic> drawing;
+
+    /** 设备文档 */
+    private List<AdmTaskPic> archive;
+
+    /** 安装照片 */
+    private List<AdmTaskPic> installPic;
+
+    /** 安装图纸 */
+    private List<AdmTaskPic> installDrawing;
+
+    /** 安装质检报告 */
+    private List<AdmTaskPic> checkReport;
+
+    /** 操作说明书 */
+    private List<AdmTaskPic> operationManual;
+
+    /** 产品合格证 */
+    private List<AdmTaskPic> productCertification;
+
+    /** 维修保养手册 */
+    private List<AdmTaskPic> maintainManual;
+
+    /** 安装说明书 */
+    private List<AdmTaskPic> installInstruction;
+
+    /** 验收报告 */
+    private List<AdmTaskPic> acceptanceReport;
+
+    /** 进场验收单 */
+    private List<AdmTaskPic> approachingAcceptance;
+
+    /** 供应合同 */
+    private List<AdmTaskPic> supplierContract;
+
+    /** 检测报告 */
+    private List<AdmTaskPic> testReport;
+
+    /** 原厂证明 */
+    private List<AdmTaskPic> originalCertificate;
+
+    /** 原厂证明 */
+    private List<AdmTaskPic> fanCharacterCurve;
+
+    /** 原厂证明 */
+    private List<AdmTaskPic> designIDGraph;
+}

+ 38 - 0
src/main/java/com/persagy/proxy/adm/model/equip/ShaftSpaceVertical.java

@@ -0,0 +1,38 @@
+package com.persagy.proxy.adm.model.equip;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+/**
+ * @author zhangwencheng
+ * 和竖井关联的空间垂直交通关系
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class ShaftSpaceVertical implements Serializable {
+
+    /**
+     * 建筑体id
+     */
+    private String buildingId;
+
+    /**
+     * 竖井id
+     */
+    private String shaftId;
+
+    /**
+     * 空间类型
+     */
+    private String objectType;
+
+    /**
+     * AI开关
+     */
+    private Boolean aiSwitch;
+}

+ 30 - 0
src/main/java/com/persagy/proxy/adm/model/equip/SpVerticalSp.java

@@ -0,0 +1,30 @@
+package com.persagy.proxy.adm.model.equip;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ *
+ * @author zhangwencheng
+ *空间的垂直交通关系
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class SpVerticalSp {
+    /** 空间id space_id*/
+    private String spaceId;
+
+    /** 关系空间id space_other_id */
+    private String spaceOtherId;
+
+    /** 项目id project_id*/
+    private String projectId;
+
+    /** 空间类型 object_type*/
+    private String objectType;
+
+    /** 标记手动 1 自动 2 */
+    private Integer sign;
+}

+ 35 - 0
src/main/java/com/persagy/proxy/adm/model/relation/BaseEntity.java

@@ -0,0 +1,35 @@
+package com.persagy.proxy.adm.model.relation;
+
+import com.alibaba.excel.annotation.format.DateTimeFormat;
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 系统服务于业务空间  实体类基类
+ * @author zhangwencheng
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@ToString
+public class BaseEntity {
+
+    /** 统计信息 */
+    private Map<String, Object> statistics;
+
+    /** 最后更新日期  last_update*/
+    private String lastUpdate;
+
+    /** 创建时间  create_time*/
+    private String createTime;
+
+
+}

+ 27 - 0
src/main/java/com/persagy/proxy/adm/model/relation/BdForEqList.java

@@ -0,0 +1,27 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * 服务于建筑的设备  一对多  一个建筑对应多个设备
+ * @author zhangwencheng
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@ToString
+public class BdForEqList {
+
+    /** 建筑id */
+    private String buildingId;
+
+    /** 设备id列表 */
+    private List<String> equipIdList;
+}
+
+

+ 24 - 0
src/main/java/com/persagy/proxy/adm/model/relation/BdInSyList.java

@@ -0,0 +1,24 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * 所在建筑的系统  一对多  一个建筑对应多个系统
+ * @author zhangwencheng
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@ToString
+public class BdInSyList {
+    /** 建筑id */
+    private String buildingId;
+
+    /** 系统id列表 */
+    private List<String> sysIdList;
+}

+ 30 - 0
src/main/java/com/persagy/proxy/adm/model/relation/DeleteSyInSpBase.java

@@ -0,0 +1,30 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ * 删除空间用的实体
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class DeleteSyInSpBase {
+
+    /**
+     * 类型
+     */
+    private String type;
+
+    /**
+     * 系统所在的业务空间
+     */
+    private List<SyInSpBase> rSyInSpBase;
+}

+ 34 - 0
src/main/java/com/persagy/proxy/adm/model/relation/EqForBd.java

@@ -0,0 +1,34 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ * @author zhangwencheng
+ * 设备设施服务于建筑实体类
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class EqForBd {
+    /** 设备Id */
+    private String equipId;
+
+    /** 建筑Id */
+    private String buildingId;
+
+    /** 项目Id */
+    private String projectId;
+
+    /** 图类型 */
+    private String graphCode;
+
+    /** 边类型 */
+    private String type;
+
+    /** 计算标记 1 为手动 2为自动 */
+    private Integer sign;
+}

+ 26 - 0
src/main/java/com/persagy/proxy/adm/model/relation/EqForBdList.java

@@ -0,0 +1,26 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ * 设备对建筑
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class EqForBdList {
+
+    /** 设备id */
+    private String equipId;
+
+    /** 建筑id列表 */
+    private List<String> buildingIdList;
+
+}

+ 35 - 0
src/main/java/com/persagy/proxy/adm/model/relation/EqForFl.java

@@ -0,0 +1,35 @@
+package com.persagy.proxy.adm.model.relation;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ * @author zhangwencheng
+ * 设备服务于楼层实体类
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class EqForFl {
+    /** 设备id */
+    private String equipId;
+
+    /** 楼层id */
+    private String floorId;
+
+    /** 项目id */
+    private String projectId;
+
+    /** 图类型 */
+    private String graphCode;
+
+    /** 边类型 */
+    private String type;
+
+    /** 计算标记 1 为手动 2为自动 */
+    private Integer sign;
+}

+ 27 - 0
src/main/java/com/persagy/proxy/adm/model/relation/EqForFlList.java

@@ -0,0 +1,27 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * 设备设施服务于楼层  一对多  一个设备对应多个楼层
+ * @author zhangwencheng
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class EqForFlList {
+
+    /** 设备id */
+    private String equipId;
+
+    /** 楼层id列表 */
+    private List<String> floorIdList;
+}
+

+ 34 - 0
src/main/java/com/persagy/proxy/adm/model/relation/EqForSh.java

@@ -0,0 +1,34 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ * @author zhangwencheng
+ * 设备服务于竖井实体类
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class EqForSh {
+    /** 设备id */
+    private String equipId;
+
+    /** 竖井id */
+    private String shaftId;
+
+    /** 项目id */
+    private String projectId;
+
+    /** 图类型编码 */
+    private String graphCode;
+
+    /** 边类型 */
+    private  String type;
+
+    /** 计算标记 1 为手动 2为自动 */
+    private Integer sign;
+}

+ 23 - 0
src/main/java/com/persagy/proxy/adm/model/relation/EqForShList.java

@@ -0,0 +1,23 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ * 设施设备服务于竖井  一对多  一个设备对应多个竖井
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class EqForShList {
+    /** 设备id */
+    private String equipId;
+
+    /** 竖井id列表 */
+    private List<String> shaftIdList;
+}

+ 24 - 0
src/main/java/com/persagy/proxy/adm/model/relation/FlForEqList.java

@@ -0,0 +1,24 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ * 设备服务于楼层实体类
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class FlForEqList {
+    /** 楼层id */
+    private String floorId;
+
+    /** 设备id列表 */
+    private List<String> equipIdList;
+}

+ 25 - 0
src/main/java/com/persagy/proxy/adm/model/relation/FlInSyList.java

@@ -0,0 +1,25 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ *所在楼层的系统  一对多  一个楼层对应多个系统
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class FlInSyList {
+
+    /** 楼层id */
+    private String floorId;
+
+    /** 系统id列表 */
+    private List<String> sysIdList;
+}

+ 0 - 0
src/main/java/com/persagy/proxy/adm/model/relation/FloorQueryRequest.java


+ 32 - 0
src/main/java/com/persagy/proxy/adm/model/relation/ShContainSpBase.java

@@ -0,0 +1,32 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ * 竖井下的业务空间
+ * @author zhangwencheng
+ */
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class ShContainSpBase {
+
+    /** 竖井id */
+    private String shaftId;
+
+    /** 业务空间  space_id*/
+    private String spaceId;
+
+    /** 项目id  project_id*/
+    private String projectId;
+
+    /** 对象类型 object_type*/
+    private String objectType;
+
+    /** sign 计算标记 1 为手动 2为自动 */
+    private Integer sign;
+}

+ 28 - 0
src/main/java/com/persagy/proxy/adm/model/relation/ShContainSpBaseList.java

@@ -0,0 +1,28 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ * 竖井下的业务空间,一对多,一个竖井对应多个业务空间
+ */
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class ShContainSpBaseList extends BaseEntity{
+
+    /** 竖井id */
+    private String shaftId;
+
+    /** 业务空间id列表 */
+    private List<String> spaceIdList;
+
+    /** 竖井类型 */
+    private String zoneType;
+}

+ 23 - 0
src/main/java/com/persagy/proxy/adm/model/relation/ShForEqList.java

@@ -0,0 +1,23 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * 服务于竖井的设备  一对多  一个竖井对应多个设备
+ * @author zhangwencheng
+ */
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class ShForEqList {
+
+    /** 竖井id */
+    private String shaftId;
+
+    /** 设备id列表 */
+    private List<String> equipIdList;
+}

+ 25 - 0
src/main/java/com/persagy/proxy/adm/model/relation/ShInBdList.java

@@ -0,0 +1,25 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ *竖井所在的建筑
+ */
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class ShInBdList {
+
+    /** 竖井id */
+    private String shaftId;
+
+    /** 建筑id列表 */
+    private List<String> buildingIdList;
+}

+ 27 - 0
src/main/java/com/persagy/proxy/adm/model/relation/ShInSyList.java

@@ -0,0 +1,27 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * 所在竖井的系统  一对多  一个竖井对应多个系统
+ *
+ * @author zhangwencheng
+ */
+
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class ShInSyList {
+
+    /** 竖井id */
+    private String shaftId;
+
+    /** 系统id列表 */
+    private List<String> sysIdList;
+}

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

@@ -0,0 +1,35 @@
+package com.persagy.proxy.adm.model.relation;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ * @author zhangwencheng
+ *业务空间内的元空间基类
+ */
+
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class SiInSpBase {
+
+    /** 元空间id */
+    private String ispaceId;
+
+    /** 业务空间id */
+    private String spaceId;
+
+    /** 业务空间类型 */
+    private String objectType;
+
+    /** 项目id */
+    private String projectId;
+
+    /** 计算标记 1 为手动 2为自动 */
+    private Integer sign;
+
+}

+ 28 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SiInSpBaseList.java

@@ -0,0 +1,28 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ * 业务空间内的元空间 一对多  一个业务空间对应多个元空间
+ */
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class SiInSpBaseList extends BaseEntity{
+
+    /** 元空间id列表 */
+    private List<String> ispaceIdList;
+
+    /** 业务空间id */
+    private  String spaceId;
+
+    /** 空间类型 */
+    private String zoneType;
+}

+ 25 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SpForSyBaseList.java

@@ -0,0 +1,25 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ *服务于业务空间的系统  一对多  一个业务空间对应多个系统
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class SpForSyBaseList extends BaseEntity{
+
+    /** 业务空间id */
+    private String spaceId;
+
+    /** 系统id列表 */
+    private List<String> sysIdList;
+}

+ 30 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SpInSyBaseList.java

@@ -0,0 +1,30 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ * 所在业务空间的系统  一对多  一个业务空间对应多个系统
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class SpInSyBaseList extends BaseEntity {
+
+    /**
+     * 业务空间id
+     */
+    private String spaceId;
+
+    /**
+     * 系统id列表
+     */
+    private List<String> sysIdList;
+}

+ 34 - 0
src/main/java/com/persagy/proxy/adm/model/relation/Sy2Sp.java

@@ -0,0 +1,34 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ * @author zhangwencheng
+ *系统空间分区关系
+ */
+@Data
+@ToString
+@AllArgsConstructor
+@NoArgsConstructor
+public class Sy2Sp {
+    /** 系统Id sy_id*/
+    private String  id1;
+
+    /** 空间Id sp_id*/
+    private String id2;
+
+    /** 项目Id project_id*/
+    private String projectId;
+
+    /** 类型 type*/
+    private String type;
+
+    /** 空间类型 zone_type*/
+    private String zoneType;
+
+    /** 计算标记 1 为手动 2为自动 sign*/
+    private int sign;
+}

+ 33 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SyForSpBase.java

@@ -0,0 +1,33 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ *系统服务于业务空间
+ * @author zhangwencheng
+ */
+
+@Data
+@ToString
+@AllArgsConstructor
+@NoArgsConstructor
+public class SyForSpBase {
+
+    /** 系统id  sys_id  Id*/
+    private String sysId;
+
+    /** 业务空间 space_id*/
+    private String spaceId;
+
+    /** 业务空间类型 object_type*/
+    private String  objectType;
+
+    /** 项目id project_id*/
+    private String  projectId;
+
+    /** 计算标记 1 为手动 2为自动 sign*/
+     private int sign;
+}

+ 29 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SyForSpBaseList.java

@@ -0,0 +1,29 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author zhangwencheng
+ *系统服务于业务空间  一对多  一个系统对应多个业务空间
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class SyForSpBaseList extends BaseEntity{
+
+    /**
+     *系统Id
+     */
+    private String sysId;
+
+    /**
+     *业务空间Id列表
+     */
+    private List<String> spaceIdList;
+}

+ 29 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SyInBd.java

@@ -0,0 +1,29 @@
+package com.persagy.proxy.adm.model.relation;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ * @author zhangwencheng
+ *系统所在的建筑实体类
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class SyInBd {
+    /** 系统id  sys_id*/
+    private String sysId;
+
+    /** 建筑id building_id*/
+    private String buildingId;
+
+    /** 项目id project_id*/
+    private String projectId;
+
+    /** 计算标记 1 为手动 2为自动 */
+    private Integer sign;
+}

+ 21 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SyInBdList.java

@@ -0,0 +1,21 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class SyInBdList {
+    /** 系统id */
+    private String sysId;
+
+    /** 建筑id列表 */
+    private List<String> buildingIdList;
+}

+ 39 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SyInFl.java

@@ -0,0 +1,39 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+/**
+ * @author zhangwencheng
+ *系统所在的楼层实体类
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class SyInFl {
+
+    /**
+     * 系统Id
+     */
+    private String sysId;
+
+    /** 楼层id */
+    private String floorId;
+
+    /** 建筑id */
+    private String  buildingId;
+
+    /** 项目id */
+    private String projectId;
+
+    /** 计算标记 1 为手动 2为自动 */
+    private Integer sign;
+
+    /** 类型 */
+    private String type;
+
+    /** 图类型编码 */
+    private String graphCode;
+}

+ 26 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SyInFlList.java

@@ -0,0 +1,26 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+
+/**
+ * @author zhangwencheng
+ *系统所在的楼层  一对多  一个系统对应多个楼层
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class SyInFlList {
+    /** 系统id */
+    private String sysId;
+
+    /** 楼层id列表 */
+    private List<String> floorIdList;
+
+}

+ 36 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SyInSh.java

@@ -0,0 +1,36 @@
+package com.persagy.proxy.adm.model.relation;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ * @author zhangwencheng
+ * 系统所在的竖井实体类
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class SyInSh {
+
+    /** 系统id */
+    private String sysId;
+
+    /** 竖井id */
+    private String shaftId;
+
+    /** 类型 */
+    private String type;
+
+    /** 图类型编码 */
+    private String graphCode;
+
+    /** 项目id */
+    private String projectId;
+
+    /** 计算标记 1 为手动 2为自动 */
+    private Integer sign;
+}

+ 26 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SyInShList.java

@@ -0,0 +1,26 @@
+package com.persagy.proxy.adm.model.relation;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+
+/**
+ * @author zhangwencheng
+ *系统所在竖井  一对多  一个系统对应多个竖井
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class SyInShList {
+    /** 系统id */
+    private  String sysId;
+
+    /** 竖井id列表 */
+    private List<String> shaftIdList;
+}

+ 35 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SyInSpBase.java

@@ -0,0 +1,35 @@
+package com.persagy.proxy.adm.model.relation;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+
+/**
+ * 系统所在的业务空间 基类
+ * @author zhangwencheng
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class SyInSpBase {
+
+    /** 系统id */
+    private String sysId;
+
+    /** 业务空间id */
+    private String spaceId;
+
+    /** 业务空间类型 */
+    private String objectType;
+
+    /** 项目id */
+    private String projectId;
+
+    /** 计算标记 1 为手动 2为自动 */
+    private Integer sign;
+}

+ 27 - 0
src/main/java/com/persagy/proxy/adm/model/relation/SyInSpBaseList.java

@@ -0,0 +1,27 @@
+package com.persagy.proxy.adm.model.relation;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+
+/**
+ * 系统所在业务空间  一对多  一个系统对应多个业务空间
+ *
+ * @author zhangwencheng
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class SyInSpBaseList extends BaseEntity{
+    /** 系统id */
+    private String sysId;
+
+    /** 业务空间id列表 */
+    private List<String> spaceIdList;
+}

+ 33 - 0
src/main/java/com/persagy/proxy/adm/model/relation/TnInSpBase.java

@@ -0,0 +1,33 @@
+package com.persagy.proxy.adm.model.relation;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ * @author zhangwencheng
+ * 租户所租用的业务空间 基类
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class TnInSpBase {
+
+    /** 租户id */
+    private String tenantId;
+
+    /** 业务空间id */
+    private String spaceId;
+
+    /** 业务空间类型 */
+    private String objectType;
+
+    /** 项目id */
+    private String projectId;
+
+    /** 计算标记 1 为手动 2为自动 */
+    private Integer sign;
+}

+ 23 - 0
src/main/java/com/persagy/proxy/adm/model/relation/TnInSpBaseList.java

@@ -0,0 +1,23 @@
+package com.persagy.proxy.adm.model.relation;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.List;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ToString
+public class TnInSpBaseList {
+    /** 租户id */
+    private String tenantId;
+
+    /** 业务空间id列表 */
+    private List<String> spaceIdList;
+
+    /** 楼层id*/
+    private String floorId;
+}

+ 26 - 0
src/main/java/com/persagy/proxy/adm/model/relation/UpDataFloorAndBuilding.java

@@ -0,0 +1,26 @@
+package com.persagy.proxy.adm.model.relation;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ * @author zhangwencheng
+ * 更新楼层建筑关系
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class UpDataFloorAndBuilding extends BaseEntity{
+
+    /** 业务空间id */
+    private String spaceId;
+
+    /** 建筑或楼层id */
+    private String id;
+
+    /** 业务空间类型 */
+    private String  type;
+}

+ 8 - 0
src/main/java/com/persagy/proxy/adm/service/IAdmBaseService.java

@@ -1,5 +1,6 @@
 package com.persagy.proxy.adm.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.common.entity.InstanceUrlParam;
@@ -45,4 +46,11 @@ public interface IAdmBaseService<T> {
      * @return
      */
     void doDelete(InstanceUrlParam context, List<T> voList);
+
+    /**
+     * 根据物理世界对象查询条件查询
+     * @param request
+     * @return
+     */
+    AdmResponse doQuery(InstanceUrlParam context, QueryCriteria request, Class<T> clazz);
 }

+ 11 - 1
src/main/java/com/persagy/proxy/adm/service/IAdmDictService.java

@@ -8,6 +8,8 @@ import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 
+import java.util.List;
+
 /**
  * @ClassName IAdmDictService
  * @Description: 字典查询
@@ -15,7 +17,7 @@ import com.persagy.proxy.common.entity.InstanceUrlParam;
  * @Date 2021/8/31 14:30
  * @Version V1.0
  **/
-public interface IAdmDictService<T> {
+public interface IAdmDictService<T> extends IAdmDictBaseService<T>{
 
     /**
      * 查询字典分类
@@ -46,4 +48,12 @@ public interface IAdmDictService<T> {
      */
     AdmResponse settingDicProject(InstanceUrlParam context , AdmCreateRequest<AdmObjectInfo> request, Class<T> clazz) throws Exception;
 
+
+    /**
+     * 查询所有字典信息 M 和 L 类型,包括自定义信息点
+     * @param context
+     * @param dictTypeList
+     * @return
+     */
+    AdmResponse queryMorlDict(InstanceUrlParam context,List<String> dictTypeList);
 }

+ 47 - 0
src/main/java/com/persagy/proxy/adm/service/IAdmLabslService.java

@@ -0,0 +1,47 @@
+package com.persagy.proxy.adm.service;
+
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+
+import java.util.List;
+
+/**
+ * @ClassName IAdmLabslService
+ * @Description: 蜡笔森林定制接口
+ * @Author linhuili
+ * @Date 2021/9/17 20:01
+ * @Version V1.0
+ **/
+public interface IAdmLabslService<T> extends IAdmDictBaseService<T> {
+
+    /**
+     * 查询项目下的设备类型
+     * @return
+     * @throws Exception
+     */
+    AdmResponse queryCategory(InstanceUrlParam context , Class<T> clazz) throws Exception;
+
+    /**
+     * 查询项目下的空间类型
+     * @return
+     * @throws Exception
+     */
+    AdmResponse queryZoneType(InstanceUrlParam context , Class<T> clazz) throws Exception;
+
+    /**
+     * 查询项目下的建筑楼层
+     * @return
+     * @throws Exception
+     */
+    AdmResponse queryBuildFloor(InstanceUrlParam context , Class<T> clazz) throws Exception;
+
+    /**
+     * 根据设备id统计设备所属的专业
+     * @param context
+     * @param ids
+     * @param clazz
+     * @return
+     * @throws Exception
+     */
+    AdmResponse queryMajorCategory(InstanceUrlParam context ,List<String> ids , Class<T> clazz) throws Exception;
+}

+ 32 - 0
src/main/java/com/persagy/proxy/adm/service/IAdmPlanarService.java

@@ -0,0 +1,32 @@
+package com.persagy.proxy.adm.service;
+
+import com.persagy.proxy.adm.model.AdmEquipment;
+import com.persagy.proxy.adm.model.AdmPlanarEquipRequests;
+import com.persagy.proxy.adm.model.AdmSpace;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+
+public interface IAdmPlanarService {
+
+
+    /**
+     * 查询平面图设备信息
+     * @param context
+     * @param requests
+     * @param clazz
+     * @return
+     * @throws Exception
+     */
+    AdmResponse queryPlanarEquip(InstanceUrlParam context , AdmPlanarEquipRequests requests,Class<AdmEquipment> clazz) throws Exception;
+
+    /**
+     * 查询平面图空间信息
+     * @param context
+     * @param requests
+     * @param clazz
+     * @return
+     * @throws Exception
+     */
+    AdmResponse queryPlanarSpace(InstanceUrlParam context , AdmPlanarEquipRequests requests,Class<AdmSpace> clazz) throws Exception;
+
+}

+ 10 - 0
src/main/java/com/persagy/proxy/adm/service/IAdmSpVerticalSpService.java

@@ -0,0 +1,10 @@
+package com.persagy.proxy.adm.service;
+
+import com.persagy.proxy.adm.model.equip.SpVerticalSp;
+
+/**
+ * @author zhangwencheng
+ * 空间的垂直交通关系
+ */
+public interface IAdmSpVerticalSpService extends IAdmBaseService<SpVerticalSp> {
+}

+ 15 - 0
src/main/java/com/persagy/proxy/adm/service/ISyForSpService.java

@@ -0,0 +1,15 @@
+package com.persagy.proxy.adm.service;
+
+import com.persagy.proxy.adm.model.relation.SyForSpBase;
+
+/**
+ * @author zhangwencheng
+ * 创建系统服务于业务空间
+ */
+public interface ISyForSpService {
+    /**
+     *创建系统服务于业务空间关系
+     * @return
+     */
+    SyForSpBase create();
+}

+ 32 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmBaseServiceImpl.java

@@ -370,4 +370,36 @@ public class AbstractAdmBaseServiceImpl<T> implements IAdmBaseService<T> {
             throw new RuntimeException("调用中台查询接口出错:" + response.getMessage());
         }
     }
+
+    /**
+     * 根据物理世界查询条件查询对象信息
+     * @param context
+     * @param dmpRequest
+     * @param clazz
+     * @return
+     */
+    @Override
+    public AdmResponse doQuery(InstanceUrlParam context, QueryCriteria dmpRequest, Class<T> clazz) {
+        // 转换参数
+        JSONObject para = null;
+        try {
+            para = JsonHelper.toJSONObject(dmpRequest);
+        } catch (IOException e) {
+            log.error(e.getMessage(), e);
+            return null;
+        }
+        // 调用中台查询
+        DmpResult<JSONArray> dmpResult = rwdClient.queryObject(context, para);
+        JSONArray data = dmpResult.getData();
+        List<T> admVOs = new ArrayList<>();
+        if(CollUtil.isNotEmpty(data)){
+            admVOs = data.toJavaList(clazz);
+        }
+        // 设置返回值
+        AdmResponse response = AdmResponse.success(admVOs);
+        Long total = dmpResult.getCount() == null ? null : dmpResult.getCount().longValue();
+        response.setTotal(total);
+        return response;
+    }
+
 }

+ 8 - 1
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmDictBaseServiceImpl.java

@@ -26,6 +26,7 @@ import com.persagy.proxy.common.entity.InstanceUrlParam;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -95,7 +96,10 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         // 调用中台查询
         DmpResult<JSONArray> dmpResult = rwdClient.queryObjectType(context, para);
         JSONArray data = dmpResult.getData();
-        List<T> admVOs = data.toJavaList(clazz);
+        List<T> admVOs = new ArrayList<>();
+        if(CollUtil.isNotEmpty(data)){
+            admVOs = data.toJavaList(clazz);
+        }
         // 设置返回值
         AdmResponse response = AdmResponse.success(admVOs);
         Long total = dmpResult.getCount() == null ? null : dmpResult.getCount().longValue();
@@ -180,6 +184,9 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
      * @param admVOs
      */
     private void handleObjectInfoResult(List<AdmObjectInfo> admVOs){
+        if(CollUtil.isEmpty(admVOs)){
+            return;
+        }
         for (AdmObjectInfo admVO : admVOs) {
             admVO.setFirstName(admVO.getFirstTag());
             admVO.setSecondName(admVO.getSecondTag());

+ 131 - 9
src/main/java/com/persagy/proxy/adm/service/impl/AdmDictServiceImpl.java

@@ -2,17 +2,23 @@ package com.persagy.proxy.adm.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
 
+import cn.hutool.core.util.StrUtil;
+import com.fasterxml.jackson.databind.JsonNode;
+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.proxy.adm.constant.AdmDictConstant;
 import com.persagy.proxy.adm.constant.enums.AdmDictCategoryEnum;
 import com.persagy.proxy.adm.model.*;
 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.adm.service.IAdmDictService;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
+import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
@@ -25,8 +31,8 @@ import java.util.stream.Collectors;
  * @Date 2021/8/31 18:21
  * @Version V1.0
  **/
-@Service
 @Slf4j
+@Service
 public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> implements IAdmDictService<T> {
 
     /**
@@ -60,10 +66,9 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
 
         if(AdmDictCategoryEnum.EQUIPMENT_AND_COMPONENT.getValue().equals(type)){
             //查询设备类型:equipment,部件类型:component,输入系统类型:system,输入专业类型:major,业务空间类型 space ,资产 property
-            List<String> objTypes = new ArrayList<>();
-            objTypes.add(AdmDictCategoryEnum.EQUIPMENT.getValue());
-            objTypes.add(AdmDictCategoryEnum.COMPONENT.getValue());
-            node.put("objType",objTypes.toString());
+            ArrayNode arrayNode = node.putObject("objType").putArray("$in");
+            arrayNode.add(AdmDictCategoryEnum.COMPONENT.getValue());
+            arrayNode.add(AdmDictCategoryEnum.EQUIPMENT.getValue());
             criteria.setCriteria(node);
             return doQueryObjectType(context, criteria, clazz);
         }
@@ -94,18 +99,19 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
                                                          .collect(Collectors.groupingBy(AdmObjectType::getObjType));
         //获取专业-设备类关系
         List<AdmObjectType> equipments = objectTypeMap.get(AdmDictCategoryEnum.EQUIPMENT.getValue());
-        Map<String,List<AdmObjectType>> majorEquipMap = equipments.stream().collect(Collectors.groupingBy(item -> item.getMajorCode()));
+        Map<String,List<AdmObjectType>> majorEquipMap = equipments.stream().filter(k->StringUtils.isNotEmpty(k.getMajorCode()))
+                                                         .collect(Collectors.groupingBy(item -> item.getMajorCode()));
 
         //获取专业-系统类关系
         List<AdmObjectType> systems = objectTypeMap.get(AdmDictCategoryEnum.SYSTEM.getValue());
-        Map<String, List<AdmObjectType>> majorSystemMap = systems.stream().collect(Collectors.groupingBy(item -> item.getMajorCode()));
+        Map<String, List<AdmObjectType>> majorSystemMap = systems.stream().filter(k->StringUtils.isNotEmpty(k.getMajorCode())).collect(Collectors.groupingBy(item -> item.getMajorCode()));
 
         //获取系统-设备类关系
-        Map<String, List<AdmObjectType>> systemEquipMap = equipments.stream().collect(Collectors.groupingBy(item -> item.getSystemCode()));
+        Map<String, List<AdmObjectType>> systemEquipMap = equipments.stream().filter(k->StringUtils.isNotEmpty(k.getSystemCode())).collect(Collectors.groupingBy(item -> item.getSystemCode()));
 
         //获取设备类-部件关系
         List<AdmObjectType> components = objectTypeMap.get(AdmDictCategoryEnum.COMPONENT.getValue());
-        Map<String, List<AdmObjectType>> equipComponentMap = components.stream().collect(Collectors.groupingBy(item -> item.getEquipmentCode()));
+        Map<String, List<AdmObjectType>> equipComponentMap = components.stream().filter(k->StringUtils.isNotEmpty(k.getEquipmentCode())).collect(Collectors.groupingBy(item -> item.getEquipmentCode()));
 
         List<AdmObjectType> content = new ArrayList<>();
         if(AdmDictCategoryEnum.MAJOR_SYSTEM.getValue().equals(type)){
@@ -268,6 +274,122 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
     }
 
     /**
+     * 查询所有字典信息 M 和 L 类型,包括自定义信息点
+     * @param context
+     * @param dictTypeList
+     * @return
+     */
+    @Override
+    public AdmResponse queryMorlDict(InstanceUrlParam context, List<String> dictTypeList) {
+
+        List<AdmObjectInfo> result = new ArrayList<>();
+        for (String type : dictTypeList) {
+            List<String> classCodes = new ArrayList<>();
+            String name = null;
+            //项目
+            if(AdmDictCategoryEnum.PROJECT.getValue().equals(type)){
+               name = AdmDictCategoryEnum.PROJECT.getDesc();
+               classCodes.add(AdmDictCategoryEnum.PROJECT.getValue());
+            }
+            //建筑
+            if(AdmDictCategoryEnum.BUILDING.getValue().equals(type)){
+                name = AdmDictCategoryEnum.BUILDING.getDesc();
+                classCodes.add(AdmDictCategoryEnum.BUILDING.getValue());
+            }
+            //楼层
+            if(AdmDictCategoryEnum.FLOOR.getValue().equals(type)){
+                name = AdmDictCategoryEnum.FLOOR.getDesc();
+                classCodes.add(AdmDictCategoryEnum.FLOOR.getValue());
+            }
+            //设备
+            if(AdmDictCategoryEnum.EQUIPMENT.getValue().equals(type)){
+                name = AdmDictCategoryEnum.EQUIPMENT.getDesc();
+                classCodes.addAll(queryDefClassType(context, AdmDictCategoryEnum.EQUIPMENT.getValue()));
+            }
+            //部件
+            if(AdmDictCategoryEnum.COMPONENT.getValue().equals(type)){
+                name = AdmDictCategoryEnum.COMPONENT.getDesc();
+                classCodes.addAll(queryDefClassType(context, AdmDictCategoryEnum.COMPONENT.getValue()));
+            }
+            //系统
+            if(AdmDictCategoryEnum.SYSTEM.getValue().equals(type)){
+                name = AdmDictCategoryEnum.SYSTEM.getDesc();
+                classCodes.addAll(queryDefClassType(context, AdmDictCategoryEnum.SYSTEM.getValue()));
+            }
+            //空间
+            if(AdmDictCategoryEnum.SPACE.getValue().equals(type)){
+                name = AdmDictCategoryEnum.SPACE.getDesc();
+                classCodes.addAll(queryDefClassType(context, AdmDictCategoryEnum.SPACE.getValue()));
+            }
+            //查询类型下的信息点
+            statisticObjectInfo(context,type, name, classCodes,result);
+        }
+        AdmResponse response = AdmResponse.success(result);
+        response.setTotal(Long.valueOf(result.size()));
+        return response;
+    }
+
+
+    /**
+     * 统计类型下的非静态信息点
+     * @param context
+     * @param code
+     * @param name
+     * @param result
+     */
+    private void statisticObjectInfo(InstanceUrlParam context,String code,String name,List<String> classCode,List<AdmObjectInfo> result){
+        //根据类型查询信息点
+        AdmQueryCriteria criteria = new AdmQueryCriteria();
+        StringBuilder stringBuilder = new StringBuilder();
+        classCode.stream().forEach(item -> {
+            stringBuilder.append("'").append(item).append("'").append(",");
+        });
+        String filters = StrUtil.sub(stringBuilder.toString(),0, -1);
+        criteria.setFilters("classCode in ["+filters+"]");
+        AdmResponse response = doQueryObjectInfo(context, criteria, AdmDictConstant.CLASS_CODE, (Class<T>) AdmObjectInfo.class);
+        List<AdmObjectInfo> content = (List<AdmObjectInfo>) response.getContent();
+        if(CollUtil.isEmpty(content)){
+            return ;
+        }
+        //过滤不需要的信息点
+        Iterator<AdmObjectInfo> iterator = content.iterator();
+        while (iterator.hasNext()){
+            AdmObjectInfo objectInfo = iterator.next();
+            if(StringUtils.isNotEmpty(objectInfo.getCategory()) && "STATIC".equals(objectInfo.getCategory())){
+                iterator.remove();
+            }
+        }
+        //返回结果拼装
+        AdmObjectInfo admObjectInfo = new AdmObjectInfo();
+        admObjectInfo.setCode(code);
+        admObjectInfo.setName(name);
+        admObjectInfo.setContent(content);
+        result.add(admObjectInfo);
+    }
+
+
+    /**
+     * 查询对象类型
+     * @param context
+     * @param code
+     * @return
+     */
+    private List<String> queryDefClassType(InstanceUrlParam context,String code){
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        node.put("parentCode",code);
+        criteria.setCriteria(node);
+
+        AdmResponse response = doQueryObjectType(context, criteria, (Class<T>) AdmObjectType.class);
+        List<AdmObjectType> content = (List<AdmObjectType>) response.getContent();
+        if(CollUtil.isEmpty(content)){
+            return new ArrayList<>();
+        }
+        return content.stream().map(AdmObjectType::getCode).collect(Collectors.toList());
+    }
+
+
+    /**
      * 信息点转换为中台格式
      * @param content
      * @param dmpObjectInfos

+ 229 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AdmLabslServiceImpl.java

@@ -0,0 +1,229 @@
+package com.persagy.proxy.adm.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
+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.proxy.adm.constant.enums.AdmDictCategoryEnum;
+import com.persagy.proxy.adm.model.*;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.*;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Primary;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @ClassName AdmLabslServiceImpl
+ * @Description: 蜡笔森林定制接口
+ * @Author linhuili
+ * @Date 2021/9/17 20:01
+ * @Version V1.0
+ **/
+@Slf4j
+@Service
+public class AdmLabslServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> implements IAdmLabslService<T>{
+
+    @Autowired
+    private IAdmBuildingService buildingService;
+
+    @Autowired
+    private IAdmEquipmentService equipmentService;
+
+    /**
+     * 查询项目下的设备类型
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public AdmResponse queryCategory(InstanceUrlParam context , Class<T> clazz) throws Exception {
+
+        List<AdmObjectInfo> result = new ArrayList<>();
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        //查询所有的专业
+        node.put("type",AdmDictCategoryEnum.MAJOR.getValue());
+        criteria.setCriteria(node);
+        AdmResponse majorResonse = doQueryDictData(context, criteria, clazz);
+
+        if(CollUtil.isNotEmpty(majorResonse.getContent())){
+            List<AdmObjectInfo> content = (List<AdmObjectInfo>) majorResonse.getContent();
+            result.addAll(content);
+        }
+
+        //查询所有的系统,设备类
+        ArrayNode arrayNode = node.putObject("objType").putArray("$in");
+        arrayNode.add(AdmDictCategoryEnum.SYSTEM.getValue());
+        arrayNode.add(AdmDictCategoryEnum.EQUIPMENT.getValue());
+
+        criteria.setCriteria(node);
+        AdmResponse equipResponse = doQueryObjectType(context, criteria, clazz);
+
+        if(CollUtil.isNotEmpty(equipResponse.getContent())){
+            List<AdmObjectInfo> content = (List<AdmObjectInfo>) equipResponse.getContent();
+            result.addAll(content);
+        }
+        return AdmResponse.success(result);
+    }
+
+    /**
+     * 查询项目下的空间类型
+     * @param context
+     * @param clazz
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public AdmResponse queryZoneType(InstanceUrlParam context, Class<T> clazz) throws Exception {
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+
+        //查询所有的空间类型
+        //List<String> objTypes = new ArrayList<>();
+        //objTypes.add(AdmDictCategoryEnum.SPACE.getValue());
+        node.put("objType",AdmDictCategoryEnum.SPACE.getValue());
+        criteria.setCriteria(node);
+        AdmResponse response = doQueryObjectType(context, criteria, clazz);
+
+        List<AdmObjectInfo> content = (List<AdmObjectInfo>) response.getContent();
+        response.setContent(content);
+        return response;
+    }
+
+    /**
+     * 查询项目下的建筑楼层
+     * @param context
+     * @param clazz
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public AdmResponse queryBuildFloor(InstanceUrlParam context, Class<T> clazz) throws Exception {
+        List<AdmBuilding> admBuildings = new ArrayList<>();
+        //添加未明确建筑
+        AdmBuilding admBuilding = new AdmBuilding();
+        admBuilding.setId("fisnull");
+        admBuilding.setName("未明确建筑");
+        admBuilding.setLocalName("未明确建筑");
+        admBuildings.add(admBuilding);
+
+        //添加未明确楼层
+        ArrayList<AdmFloor> admFloors = new ArrayList<>();
+        AdmFloor admFloor = new AdmFloor();
+        admFloor.setId("fisnull");
+        admFloor.setName("未明确楼层");
+        admFloor.setLocalName("未明确楼层");
+        admFloors.add(admFloor);
+
+        //获取项目下的建筑,建筑下的楼层
+        AdmQueryCriteria request = new AdmQueryCriteria();
+        request.setName(AdmBuilding.OBJ_TYPE);
+
+        //设置建筑->楼层级联查询参数
+        AdmQueryCriteria cascade = new AdmQueryCriteria();
+        cascade.setName(AdmFloor.OBJ_TYPE);
+        List<AdmQueryCriteria> cascadeList = new ArrayList<>();
+        cascadeList.add(cascade);
+        request.setCascade(cascadeList);
+
+        AdmResponse buildResponse = buildingService.doQuery(context, request, AdmBuilding.class);
+        if(CollUtil.isEmpty(buildResponse.getContent())){
+            return AdmResponse.success(admBuildings);
+        }
+
+        //建筑下的楼层添加默认"未明确楼层"
+        List<AdmBuilding> buildContent = (List<AdmBuilding>)buildResponse.getContent();
+        if(CollUtil.isNotEmpty(buildContent)){
+            admBuildings.addAll(buildContent);
+        }
+        for (AdmBuilding building : admBuildings) {
+            List<AdmFloor> floor = building.getFloor();
+            if(CollUtil.isNotEmpty(floor)){
+                floor.add(admFloor);
+            }
+        }
+        return AdmResponse.success(admBuildings);
+    }
+
+    /**
+     * 根据设备id统计设备所属的专业
+     * @param context
+     * @param ids
+     * @param clazz
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public AdmResponse queryMajorCategory(InstanceUrlParam context, List<String> ids, Class<T> clazz) throws Exception {
+
+        //根据id查询对应的设备类型
+        AdmQueryCriteria request = new AdmQueryCriteria();
+        request.setName(AdmEquipment.OBJ_TYPE);
+
+        StringBuilder stringBuilder = new StringBuilder();
+        ids.stream().forEach(item -> {
+            stringBuilder.append("'").append(item).append("'").append(",");
+        });
+        String filters = StrUtil.sub(stringBuilder.toString(),0, -1);
+        request.setFilters("id in ["+filters+"]");
+        AdmResponse equipResponse = equipmentService.doQuery(context, request, AdmEquipment.class);
+        if(CollUtil.isEmpty(equipResponse.getContent())){
+            throw new Exception("设备不存在");
+        }
+        List<AdmEquipment> equipments = (List<AdmEquipment>)equipResponse.getContent();
+        Set<String> classCodes = equipments.stream().map(k -> k.getClassCode()).collect(Collectors.toSet());
+
+        //根据设备类型查询设备所属专业
+        QueryCriteria dictCriteria = new QueryCriteria();
+        ObjectNode node = JsonNodeFactory.instance.objectNode();
+        ArrayNode array = node.putObject("code").putArray("$in");
+        classCodes.forEach(code -> array.add(code));
+
+        dictCriteria.setCriteria(node);
+        AdmResponse dictResponse = doQueryObjectType(context, dictCriteria, clazz);
+        if(CollUtil.isEmpty(dictResponse.getContent())){
+            throw new Exception("项目下没有设备类型");
+        }
+
+        //获取设备类对应的专业编码
+        List<AdmObjectType> classCodeList = (List<AdmObjectType>)dictResponse.getContent();
+        Map<String, List<AdmObjectType>> classCodeMap = classCodeList.stream().collect(Collectors.groupingBy(k->k.getMajorCode()));
+
+        Set<String> majors = classCodeList.stream().map(k -> k.getMajorCode()).collect(Collectors.toSet());
+        if(CollUtil.isEmpty(majors)){
+            return AdmResponse.success(new ArrayList<>());
+        }
+
+        //查询字典中的专业
+        QueryCriteria criteria = new QueryCriteria();
+        ObjectNode majorNode = JsonNodeFactory.instance.objectNode();
+        majorNode.put("type",AdmDictCategoryEnum.MAJOR.getValue());
+        criteria.setCriteria(majorNode);
+        AdmResponse majorResonse = doQueryDictData(context, criteria, clazz);
+        List<AdmObjectType> dictMajorList = (List<AdmObjectType>)majorResonse.getContent();
+        Map<String, List<AdmObjectType>> dictMajorMap = dictMajorList.stream().collect(Collectors.groupingBy(k->k.getCode()));
+
+        List<AdmObjectType> result = new ArrayList<>();
+        //组装成专业-设备类返回结果
+        for (String major : majors) {
+            List<AdmObjectType> objectTypes = dictMajorMap.get(major);
+            if(CollUtil.isNotEmpty(objectTypes)){
+                AdmObjectType objectType = objectTypes.get(0);
+                objectType.setChildren(classCodeMap.get(major));
+                result.add(objectType);
+            }
+        }
+        return AdmResponse.success(result);
+    }
+
+}

+ 0 - 1
src/main/java/com/persagy/proxy/adm/service/impl/AdmManualRelCalServiceImpl.java

@@ -7,7 +7,6 @@ import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.digital.client.DigitalObjectClient;
-import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.client.DigitalRelationCaclClient;
 import com.persagy.dmp.digital.entity.ObjectDigital;
 import com.persagy.dmp.digital.entity.ObjectRelation;

+ 219 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AdmPlanarServiceImpl.java

@@ -0,0 +1,219 @@
+package com.persagy.proxy.adm.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+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.proxy.adm.model.AdmEquipment;
+import com.persagy.proxy.adm.model.AdmPlanarEquipRequests;
+import com.persagy.proxy.adm.model.AdmSpace;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmEquipmentService;
+import com.persagy.proxy.adm.service.IAdmPlanarService;
+import com.persagy.proxy.adm.service.IAdmSpaceService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import org.apache.commons.lang.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+/**
+ * @ClassName AdmPlanarServiceImpl
+ * @Description: 平面图接口
+ * @Author linhuili
+ * @Date 2021/9/22 14:17
+ * @Version V1.0
+ **/
+@Service
+public class AdmPlanarServiceImpl extends AbstractAdmBaseServiceImpl<T> implements IAdmPlanarService {
+
+    @Autowired
+    private IAdmSpaceService spaceService;
+
+    @Autowired
+    private IAdmEquipmentService equipmentService;
+    
+    /**
+     * 查询平面图设备信息
+     * @param context
+     * @param requests
+     * @param clazz
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public AdmResponse queryPlanarEquip(InstanceUrlParam context, AdmPlanarEquipRequests requests, Class<AdmEquipment> clazz) throws Exception {
+        List<AdmSpace> spaces = new ArrayList<>();
+        //获取空间信息
+        if(CollUtil.isEmpty(requests.getSpaceIds())){
+            //查询建筑/楼层下的空间信息
+            spaces = querySpInFl(context, requests, AdmSpace.class);
+        }else{
+            //根据空间功能类型等过滤空间信息
+            spaces = queryDmpSpace(context, requests, AdmSpace.class);
+        }
+        if(CollUtil.isEmpty(spaces)){
+            return AdmResponse.success(new ArrayList<>());
+        }
+        List<String> spaceIds = spaces.stream().map(k -> k.getId()).collect(Collectors.toList());
+        requests.setSpaceIds(spaceIds);
+        //查询空间下的设备
+        List<AdmEquipment> result = queryEqInSp(context, requests, AdmEquipment.class);
+        AdmResponse response = AdmResponse.success(result);
+        response.setTotal(result == null ? 0 : Long.valueOf(result.size()));
+        return response;
+    }
+
+    /**
+     * 查询平面图空间
+     * @param context
+     * @param requests
+     * @param clazz
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public AdmResponse queryPlanarSpace(InstanceUrlParam context, AdmPlanarEquipRequests requests, Class<AdmSpace> clazz) throws Exception {
+        List<AdmSpace> spaces = new ArrayList<>();
+        //获取空间信息
+        if(CollUtil.isEmpty(requests.getSpaceIds())){
+            //查询建筑/楼层下的空间信息
+            spaces = querySpInFl(context, requests, AdmSpace.class);
+        }else{
+            //根据空间功能类型等过滤空间信息
+            spaces = queryDmpSpace(context, requests, AdmSpace.class);
+        }
+        AdmResponse response = AdmResponse.success(spaces);
+        response.setTotal(spaces == null ? 0 : Long.valueOf(spaces.size()));
+        return response;
+    }
+
+    /**
+     * 查询楼层下的空间
+     * @param context
+     * @param requests
+     * @return
+     */
+    private List<AdmSpace> querySpInFl(InstanceUrlParam context, AdmPlanarEquipRequests requests, Class<AdmSpace> clazz){
+
+        //设置空间基础查询条件
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        if(CollUtil.isNotEmpty(requests.getZoneTypes())){
+            ArrayNode array = criteria.putObject("objType").putArray("$in");
+            requests.getZoneTypes().forEach(code -> array.add(code));
+        }
+
+        if(CollUtil.isNotEmpty(requests.getFuncTypes())){
+            ArrayNode array = criteria.putObject("roomFuncType").putArray("$in");
+            requests.getFuncTypes().forEach(code -> array.add(code));
+        }
+        if(CollUtil.isNotEmpty(requests.getEquipTypes())){
+            ArrayNode array = criteria.putObject("classCode").putArray("$in");
+            requests.getEquipTypes().forEach(code -> array.add(code));
+        }
+
+        //设置空间关系查询条件
+        QueryCriteria dmpRequest = new QueryCriteria();
+        if(StringUtils.isEmpty(requests.getFloorId())){
+            dmpRequest = transDmpRelationCriteria(criteria,"ArchSubset", "Bd2Sp", requests.getBuildingId(), 0);
+        }else{
+            dmpRequest = transDmpRelationCriteria(criteria,"ArchSubset", "Fl2Sp", requests.getFloorId(), 0);
+        }
+
+        //查询物理世界空间信息
+        AdmResponse response = spaceService.doQuery(context, dmpRequest, clazz);
+        return (List<AdmSpace>)response.getContent();
+    }
+
+    /**
+     * 查询空间下的设备
+     * @param context
+     * @param requests
+     * @param clazz
+     * @return
+     */
+    private List<AdmEquipment> queryEqInSp(InstanceUrlParam context,AdmPlanarEquipRequests requests,Class<AdmEquipment> clazz){
+        List<String> spaceIds = requests.getSpaceIds();
+        if(CollUtil.isEmpty(spaceIds)){
+            return new ArrayList<>();
+        }
+        //默认业务空间数量不会太多,若多的话后期进行优化
+        List<AdmEquipment> result = new ArrayList<>();
+        for (String spaceId : spaceIds) {
+            ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+            //设置设备关系查询条件
+            QueryCriteria dmpRequest = transDmpRelationCriteria(criteria,"MechInArch", "Eq2Sp", spaceId, 1);
+            //查询物理世界对象信息
+            AdmResponse response = equipmentService.doQuery(context, dmpRequest, clazz);
+            List<AdmEquipment> content = (List<AdmEquipment>) response.getContent();
+            if(CollUtil.isNotEmpty(content)){
+                result.addAll(content);
+            }
+        }
+        return result;
+    }
+
+    /**
+     * 查询中台空间信息
+     * @param context
+     * @param requests
+     * @return
+     */
+    private List<AdmSpace> queryDmpSpace(InstanceUrlParam context, AdmPlanarEquipRequests requests, Class<AdmSpace> clazz){
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        if(CollUtil.isNotEmpty(requests.getSpaceIds())){
+            ArrayNode array = criteria.putObject("id").putArray("$in");
+            requests.getZoneTypes().forEach(code -> array.add(code));
+        }
+        if(CollUtil.isNotEmpty(requests.getFuncTypes())){
+            ArrayNode array = criteria.putObject("roomFuncType").putArray("$in");
+            requests.getFuncTypes().forEach(code -> array.add(code));
+        }
+        if(CollUtil.isNotEmpty(requests.getZoneTypes())){
+            ArrayNode array = criteria.putObject("objType").putArray("$in");
+            requests.getZoneTypes().forEach(code -> array.add(code));
+        }
+        if(CollUtil.isNotEmpty(requests.getEquipTypes())){
+            ArrayNode array = criteria.putObject("classCode").putArray("$in");
+            requests.getEquipTypes().forEach(code -> array.add(code));
+        }
+        QueryCriteria dmpRequest = new QueryCriteria();
+        dmpRequest.setCriteria(criteria);
+
+        //查询物理世界空间信息
+        AdmResponse response = spaceService.doQuery(context, dmpRequest, clazz);
+        return (List<AdmSpace>)response.getContent();
+    }
+
+    /**
+     * 获取关系查询条件
+     * @param graphCode
+     * @param relCode
+     * @param id (fromID/targetID)
+     * @param direct  0 正向 1反向
+     * @return
+     */
+    public static QueryCriteria transDmpRelationCriteria(ObjectNode objectNode,String graphCode, String relCode, String id, Integer direct){
+        QueryCriteria queryCriteria = new QueryCriteria();
+
+        ObjectNode object = JsonNodeFactory.instance.objectNode();
+        object.put("graphCode", graphCode);
+        object.put("relCode", relCode);
+        if(direct == 0){
+            //正向查询 objFrom->objTo
+            object.put("objFrom", id);
+            objectNode.put("relationTo",object);
+        }else{
+            //反向查询 objTo->objFrom
+            object.put("objTo", id);
+            objectNode.put("relationFrom",object);
+        }
+        queryCriteria.setCriteria(objectNode);
+        return queryCriteria;
+    }
+
+}

+ 13 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AdmSpVerticalSpServiceImpl.java

@@ -0,0 +1,13 @@
+package com.persagy.proxy.adm.service.impl;
+
+import com.persagy.proxy.adm.model.equip.SpVerticalSp;
+import com.persagy.proxy.adm.service.IAdmSpVerticalSpService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author zhangwencheng
+ * 空间的垂直交通关系
+ */
+@Service
+public class AdmSpVerticalSpServiceImpl extends AbstractAdmBaseServiceImpl<SpVerticalSp> implements IAdmSpVerticalSpService {
+}

+ 2 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AdmSpaceServiceImpl.java

@@ -337,6 +337,7 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
 
     private JSONObject addXParam(String relCode, String masterObjType, String slaveObjType, JSONObject requestData){
         requestData.put("relCode", "Bd2Sp");
+        requestData.put("graphCode", "ArchSubset");
         requestData.put("masterObjType", masterObjType);
         requestData.put("slaveObjType", slaveObjType);
         return requestData;
@@ -410,6 +411,7 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
     private void addRelationTo(QueryCriteria rwdQueryCriteria, String objFrom, String relCode){
         ObjectNode relationTO = JsonNodeFactory.instance.objectNode();
         relationTO.put("relCode", relCode);
+        relationTO.put("graphCode", "ArchSubset");
         relationTO.put("objFrom", objFrom);
         ObjectNode criteria = rwdQueryCriteria.getCriteria();
         criteria.putPOJO("relationTo", relationTO);