瀏覽代碼

添加关系

zhangwencheng 3 年之前
父節點
當前提交
4243dcd871
共有 56 個文件被更改,包括 3619 次插入2 次删除
  1. 5 2
      src/main/java/com/persagy/proxy/adm/constant/AdmRelationTypeEnum.java
  2. 40 0
      src/main/java/com/persagy/proxy/adm/controller/AdmEquipFloorController.java
  3. 395 0
      src/main/java/com/persagy/proxy/adm/controller/AdmEquipShaftController.java
  4. 187 0
      src/main/java/com/persagy/proxy/adm/controller/RelationEqForBdController.java
  5. 161 0
      src/main/java/com/persagy/proxy/adm/controller/RelationEqForFlController.java
  6. 156 0
      src/main/java/com/persagy/proxy/adm/controller/RelationEqForShController.java
  7. 140 0
      src/main/java/com/persagy/proxy/adm/controller/RelationFlAndBuController.java
  8. 63 0
      src/main/java/com/persagy/proxy/adm/controller/RelationShInBdController.java
  9. 182 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSpInSiController.java
  10. 194 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyForSpController.java
  11. 240 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyInBdController.java
  12. 184 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyInFlController.java
  13. 242 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyInShController.java
  14. 163 0
      src/main/java/com/persagy/proxy/adm/controller/RelationSyInSpController.java
  15. 147 0
      src/main/java/com/persagy/proxy/adm/controller/RelationTnInSpController.java
  16. 38 0
      src/main/java/com/persagy/proxy/adm/model/equip/ShaftSpaceVertical.java
  17. 30 0
      src/main/java/com/persagy/proxy/adm/model/equip/SpVerticalSp.java
  18. 35 0
      src/main/java/com/persagy/proxy/adm/model/relation/BaseEntity.java
  19. 27 0
      src/main/java/com/persagy/proxy/adm/model/relation/BdForEqList.java
  20. 24 0
      src/main/java/com/persagy/proxy/adm/model/relation/BdInSyList.java
  21. 30 0
      src/main/java/com/persagy/proxy/adm/model/relation/DeleteSyInSpBase.java
  22. 34 0
      src/main/java/com/persagy/proxy/adm/model/relation/EqForBd.java
  23. 26 0
      src/main/java/com/persagy/proxy/adm/model/relation/EqForBdList.java
  24. 35 0
      src/main/java/com/persagy/proxy/adm/model/relation/EqForFl.java
  25. 27 0
      src/main/java/com/persagy/proxy/adm/model/relation/EqForFlList.java
  26. 34 0
      src/main/java/com/persagy/proxy/adm/model/relation/EqForSh.java
  27. 23 0
      src/main/java/com/persagy/proxy/adm/model/relation/EqForShList.java
  28. 24 0
      src/main/java/com/persagy/proxy/adm/model/relation/FlForEqList.java
  29. 25 0
      src/main/java/com/persagy/proxy/adm/model/relation/FlInSyList.java
  30. 0 0
      src/main/java/com/persagy/proxy/adm/model/relation/FloorQueryRequest.java
  31. 32 0
      src/main/java/com/persagy/proxy/adm/model/relation/ShContainSpBase.java
  32. 28 0
      src/main/java/com/persagy/proxy/adm/model/relation/ShContainSpBaseList.java
  33. 23 0
      src/main/java/com/persagy/proxy/adm/model/relation/ShForEqList.java
  34. 25 0
      src/main/java/com/persagy/proxy/adm/model/relation/ShInBdList.java
  35. 27 0
      src/main/java/com/persagy/proxy/adm/model/relation/ShInSyList.java
  36. 35 0
      src/main/java/com/persagy/proxy/adm/model/relation/SiInSpBase.java
  37. 28 0
      src/main/java/com/persagy/proxy/adm/model/relation/SiInSpBaseList.java
  38. 25 0
      src/main/java/com/persagy/proxy/adm/model/relation/SpForSyBaseList.java
  39. 30 0
      src/main/java/com/persagy/proxy/adm/model/relation/SpInSyBaseList.java
  40. 34 0
      src/main/java/com/persagy/proxy/adm/model/relation/Sy2Sp.java
  41. 33 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyForSpBase.java
  42. 29 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyForSpBaseList.java
  43. 29 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInBd.java
  44. 21 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInBdList.java
  45. 39 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInFl.java
  46. 26 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInFlList.java
  47. 36 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInSh.java
  48. 26 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInShList.java
  49. 35 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInSpBase.java
  50. 27 0
      src/main/java/com/persagy/proxy/adm/model/relation/SyInSpBaseList.java
  51. 33 0
      src/main/java/com/persagy/proxy/adm/model/relation/TnInSpBase.java
  52. 23 0
      src/main/java/com/persagy/proxy/adm/model/relation/TnInSpBaseList.java
  53. 26 0
      src/main/java/com/persagy/proxy/adm/model/relation/UpDataFloorAndBuilding.java
  54. 10 0
      src/main/java/com/persagy/proxy/adm/service/IAdmSpVerticalSpService.java
  55. 15 0
      src/main/java/com/persagy/proxy/adm/service/ISyForSpService.java
  56. 13 0
      src/main/java/com/persagy/proxy/adm/service/impl/AdmSpVerticalSpServiceImpl.java

+ 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;
     /**图类型编码*/

+ 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;
+    }
+
+}

+ 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);
+    }
+}

+ 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);
+    }
+}

+ 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();
+    }
+
+}

+ 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();
+    }
+}

+ 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);
+    }
+
+
+}

+ 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;
+}

+ 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();
+}

+ 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 {
+}