Browse Source

查询系统所在楼层,建筑相关接口projectId,groupCode从header获取

linhuili 3 năm trước cách đây
mục cha
commit
fb565c3fac

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

@@ -1,10 +1,10 @@
 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.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.common.entity.RelationDTO;
 import lombok.extern.slf4j.Slf4j;
@@ -38,7 +38,7 @@ public class RelationShInBdController {
      */
 
     @PostMapping("link-bd")
-    public AdmResponse createBd(@RequestBody ShInBdList shInBdList, @RequestParam("projectId") String projectId){
+    public AdmResponse createBd(@RequestBody ShInBdList shInBdList){
         log.info("创建系统所在建筑关系link-bd");
         List<String> buildingIdList = shInBdList.getBuildingIdList();
         String shaftId = shInBdList.getShaftId();
@@ -55,7 +55,7 @@ public class RelationShInBdController {
             RelationDTO relation = new RelationDTO(null, graphCode, relCode, "", shaftId,buildingId);
             voList.add(relation);
         }
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doSave(context, voList);
         return AdmResponse.success();
     }

+ 16 - 15
src/main/java/com/persagy/proxy/adm/controller/RelationSyInBdController.java

@@ -9,6 +9,7 @@ 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.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.common.entity.RelationDTO;
 import lombok.extern.slf4j.Slf4j;
@@ -45,8 +46,8 @@ public class RelationSyInBdController {
      * @throws Exception
      */
     @PostMapping("/link")
-    public AdmResponse create(@RequestBody SyInBd syInBd, @RequestParam("projectId") String projectId) throws Exception {
-        log.info("创建系统所在建筑关系create方法开始参数projectId为{}", projectId);
+    public AdmResponse create(@RequestBody SyInBd syInBd) throws Exception {
+        log.info("创建系统所在建筑关系create方法开始参数projectId为{}", AdmContextUtil.toDmpContext().getProjectId());
         //系统Id
         String sysID = syInBd.getSysId();
         //建筑Id
@@ -61,7 +62,7 @@ public class RelationSyInBdController {
         RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysID, buildingId);
         voList.add(relation);
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doSave(context, voList);
         log.info("创建系统所在建筑create方法结束");
         return AdmResponse.success();
@@ -107,8 +108,8 @@ public class RelationSyInBdController {
      * @throws Exception
      */
     @PostMapping("/link-bd")
-    public AdmResponse createBd(@RequestBody SyInBdList syInFlList, @RequestParam("projectId") String projectId) throws Exception {
-        log.info("创建系统所在建筑关系createBD方法开始参数projectId为{}", projectId);
+    public AdmResponse createBd(@RequestBody SyInBdList syInFlList) throws Exception {
+        log.info("创建系统所在建筑关系createBD方法开始参数projectId为{}", AdmContextUtil.toDmpContext().getProjectId());
         //系统Id
         String sysID = syInFlList.getSysId();
         //楼层
@@ -125,7 +126,7 @@ public class RelationSyInBdController {
             voList.add(relation);
         }
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doSave(context, voList);
         log.info("创建系统所在建筑关系createBD方法结束");
         return AdmResponse.success();
@@ -140,8 +141,8 @@ public class RelationSyInBdController {
      * @throws Exception
      */
     @PostMapping("/link-bd-sy")
-    public AdmResponse createSyBd(@RequestBody SyInBdList syInFlList, @RequestParam("projectId") String projectId) throws Exception {
-        log.info("创建系统所在建筑关系createSyBd方法开始参数projectId为{}", projectId);
+    public AdmResponse createSyBd(@RequestBody SyInBdList syInFlList) throws Exception {
+        log.info("创建系统所在建筑关系createSyBd方法开始参数projectId为{}", AdmContextUtil.toDmpContext().getProjectId());
         //系统Id
         String sysID = syInFlList.getSysId();
         //楼层
@@ -158,7 +159,7 @@ public class RelationSyInBdController {
             voList.add(relation);
         }
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doSave(context, voList);
         log.info("创建系统所在建筑关系createSyBd方法结束");
         return AdmResponse.success();
@@ -173,8 +174,8 @@ public class RelationSyInBdController {
      * @throws Exception
      */
     @PostMapping("/link-sy")
-    public AdmResponse createSyBd(@RequestBody BdInSyList bdInSyList, @RequestParam("projectId") String projectId) throws Exception {
-        log.info("创建系统所在建筑关系createSyBd方法开始参数projectId为{}", projectId);
+    public AdmResponse createSyBd(@RequestBody BdInSyList bdInSyList) throws Exception {
+        log.info("创建系统所在建筑关系createSyBd方法开始参数projectId为{}", AdmContextUtil.toDmpContext().getProjectId());
         //建筑Id
         String buildingId = bdInSyList.getBuildingId();
         //系统
@@ -191,7 +192,7 @@ public class RelationSyInBdController {
             voList.add(relation);
         }
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doSave(context, voList);
         log.info("创建系统所在建筑关系createSyBd方法结束");
         return AdmResponse.success();
@@ -207,8 +208,8 @@ public class RelationSyInBdController {
      * @throws Exception
      */
     @PostMapping("/unlink")
-    public AdmResponse delete(@RequestBody SyInBd syInBd, @RequestParam("projectId") String projectId) throws Exception {
-        log.info("创建系统所在建筑关系delete方法开始参数projectId为{}", projectId);
+    public AdmResponse delete(@RequestBody SyInBd syInBd) throws Exception {
+        log.info("创建系统所在建筑关系delete方法开始参数projectId为{}", AdmContextUtil.toDmpContext().getProjectId());
         //系统Id
         String sysID = syInBd.getSysId();
         //建筑Id
@@ -230,7 +231,7 @@ public class RelationSyInBdController {
         node.put("objTo", buildingId);
         criteria.setCriteria(node);
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doDelete(context,criteria);
         log.info("创建系统服务于业务空间关系delete方法结束");
         return AdmResponse.success();

+ 14 - 13
src/main/java/com/persagy/proxy/adm/controller/RelationSyInFlController.java

@@ -12,6 +12,7 @@ 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.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.common.entity.RelationDTO;
 import lombok.extern.slf4j.Slf4j;
@@ -47,7 +48,7 @@ public class RelationSyInFlController {
      * @throws Exception
      */
     @PostMapping("/link")
-    public AdmResponse create(@RequestBody SyInFl syInFl, @RequestParam("projectId") String projectId) throws Exception {
+    public AdmResponse create(@RequestBody SyInFl syInFl) throws Exception {
         //系统Id
         String sysID = syInFl.getSysId();
         //楼层Id
@@ -64,7 +65,7 @@ public class RelationSyInFlController {
         RelationDTO relation = new RelationDTO(null, graphCode, relCode, type, sysID, floorId);
         voList.add(relation);
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doSave(context, voList);
         return AdmResponse.success();
     }
@@ -78,8 +79,8 @@ public class RelationSyInFlController {
      * @throws Exception
      */
     @PostMapping("/link-fl")
-    public AdmResponse createSy(@RequestBody SyInFlList syInFlList, @RequestParam("projectId") String projectId) throws Exception {
-        log.info("创建系统所在楼层关系link-fl方法开始,参数projectId为{}", projectId);
+    public AdmResponse createSy(@RequestBody SyInFlList syInFlList) throws Exception {
+        log.info("创建系统所在楼层关系link-fl方法开始,参数projectId为{}", AdmContextUtil.toDmpContext().getProjectId());
         //系统Id
         String sysId = syInFlList.getSysId();
         //楼层Id
@@ -96,7 +97,7 @@ public class RelationSyInFlController {
             voList.add(relation);
         }
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doSave(context, voList);
         log.info("创建系统所在楼层关系link-fl方法结束");
         return AdmResponse.success();
@@ -107,8 +108,8 @@ public class RelationSyInFlController {
      * 所在楼层的系统,楼层一对多系统
      */
     @PostMapping("/link-sy")
-    public AdmResponse createSy(@RequestBody FlInSyList flInSyList, @RequestParam("projectId") String projectId) {
-        log.info("创建系统所在楼层关系link-sy方法开始,参数projectId为{}", projectId);
+    public AdmResponse createSy(@RequestBody FlInSyList flInSyList) {
+        log.info("创建系统所在楼层关系link-sy方法开始,参数projectId为{}", AdmContextUtil.toDmpContext().getProjectId());
         String floorId = flInSyList.getFloorId();
         List<String> sysIdList = flInSyList.getSysIdList();
         if (StringUtils.isBlank(floorId) || CollectionUtils.isEmpty(sysIdList)) {
@@ -122,7 +123,7 @@ public class RelationSyInFlController {
             RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysId, floorId);
             voList.add(relation);
         }
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doSave(context, voList);
         log.info("创建系统所在楼层关系link-sy方法结束");
         return AdmResponse.success();
@@ -133,8 +134,8 @@ public class RelationSyInFlController {
      * 系统所在楼层,系统一对多楼层,此方法不会覆盖
      */
     @PostMapping("/link-fl-sy")
-    public AdmResponse createSyFl(@RequestBody SyInFlList syInFlList, @RequestParam("projectId") String projectId) {
-        log.info("创建系统所在楼层关系link-fl-sy方法开始,参数projectId为{}", projectId);
+    public AdmResponse createSyFl(@RequestBody SyInFlList syInFlList) {
+        log.info("创建系统所在楼层关系link-fl-sy方法开始,参数projectId为{}", AdmContextUtil.toDmpContext().getProjectId());
         List<String> floorIdList = syInFlList.getFloorIdList();
         String sysId = syInFlList.getSysId();
         if (StringUtils.isBlank(sysId) || CollectionUtils.isEmpty(floorIdList)) {
@@ -148,7 +149,7 @@ public class RelationSyInFlController {
             RelationDTO relation = new RelationDTO(null, graphCode, relCode, null, sysId, floorId);
             voList.add(relation);
         }
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doSave(context, voList);
         log.info("创建系统所在楼层关系link-fl-sy方法结束");
         return AdmResponse.success();
@@ -160,7 +161,7 @@ public class RelationSyInFlController {
      * @return
      */
     @PostMapping("/unlink")
-    public AdmResponse delete(@RequestBody SyInFl syInFl, @RequestParam("projectId") String projectId) {
+    public AdmResponse delete(@RequestBody SyInFl syInFl) {
         String floorId = syInFl.getFloorId();
         String sysId = syInFl.getSysId();
         AdmRelationTypeEnum sy2fl = AdmRelationTypeEnum.SY2FL;
@@ -176,7 +177,7 @@ public class RelationSyInFlController {
         QueryCriteria criteria = new QueryCriteria();
         criteria.setCriteria(node);
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doDelete(context,criteria);
         return AdmResponse.success();
     }