Explorar el Código

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

lijie hace 3 años
padre
commit
76db7300d8
Se han modificado 35 ficheros con 693 adiciones y 763 borrados
  1. 12 26
      src/main/java/com/persagy/proxy/adm/controller/AdmBuildingController.java
  2. 11 26
      src/main/java/com/persagy/proxy/adm/controller/AdmComponentController.java
  3. 15 15
      src/main/java/com/persagy/proxy/adm/controller/AdmDictController.java
  4. 23 45
      src/main/java/com/persagy/proxy/adm/controller/AdmEquipmentController.java
  5. 22 39
      src/main/java/com/persagy/proxy/adm/controller/AdmFloorController.java
  6. 13 30
      src/main/java/com/persagy/proxy/adm/controller/AdmISpaceController.java
  7. 6 5
      src/main/java/com/persagy/proxy/adm/controller/AdmLabslController.java
  8. 10 6
      src/main/java/com/persagy/proxy/adm/controller/AdmLocationPointController.java
  9. 3 2
      src/main/java/com/persagy/proxy/adm/controller/AdmPlanarController.java
  10. 4 14
      src/main/java/com/persagy/proxy/adm/controller/AdmProjectController.java
  11. 13 28
      src/main/java/com/persagy/proxy/adm/controller/AdmPropertyController.java
  12. 2 1
      src/main/java/com/persagy/proxy/adm/controller/AdmRelationController.java
  13. 3 2
      src/main/java/com/persagy/proxy/adm/controller/AdmRelationObjectController.java
  14. 60 78
      src/main/java/com/persagy/proxy/adm/controller/AdmReportEquipController.java
  15. 40 72
      src/main/java/com/persagy/proxy/adm/controller/AdmShaftController.java
  16. 37 71
      src/main/java/com/persagy/proxy/adm/controller/AdmSpaceController.java
  17. 238 217
      src/main/java/com/persagy/proxy/adm/controller/AdmSystemController.java
  18. 14 34
      src/main/java/com/persagy/proxy/adm/controller/AdmTenantController.java
  19. 6 5
      src/main/java/com/persagy/proxy/adm/controller/AdmVirtualWallController.java
  20. 6 5
      src/main/java/com/persagy/proxy/adm/controller/AdmWindowController.java
  21. 6 2
      src/main/java/com/persagy/proxy/adm/controller/ComponentBuildingController.java
  22. 6 0
      src/main/java/com/persagy/proxy/adm/model/AdmObjectType.java
  23. 2 0
      src/main/java/com/persagy/proxy/adm/model/AdmSBaseEntity.java
  24. 1 1
      src/main/java/com/persagy/proxy/adm/model/AdmSystem.java
  25. 2 4
      src/main/java/com/persagy/proxy/adm/model/relation/ShContainSpBaseList.java
  26. 2 4
      src/main/java/com/persagy/proxy/adm/model/relation/SiInSpBaseList.java
  27. 2 4
      src/main/java/com/persagy/proxy/adm/model/relation/SpForSyBaseList.java
  28. 2 4
      src/main/java/com/persagy/proxy/adm/model/relation/SpInSyBaseList.java
  29. 2 4
      src/main/java/com/persagy/proxy/adm/model/relation/SyForSpBaseList.java
  30. 2 4
      src/main/java/com/persagy/proxy/adm/model/relation/SyInSpBaseList.java
  31. 2 1
      src/main/java/com/persagy/proxy/adm/model/relation/UpDataFloorAndBuilding.java
  32. 10 4
      src/main/java/com/persagy/proxy/adm/request/AdmResponse.java
  33. 8 3
      src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmBaseServiceImpl.java
  34. 101 6
      src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmDictBaseServiceImpl.java
  35. 7 1
      src/main/java/com/persagy/proxy/adm/utils/AdmQueryCriteriaHelper.java

+ 12 - 26
src/main/java/com/persagy/proxy/adm/controller/AdmBuildingController.java

@@ -3,17 +3,15 @@ package com.persagy.proxy.adm.controller;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.persagy.dmp.common.model.entity.BaseEntity;
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.*;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.*;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
 import com.persagy.proxy.common.entity.DmpResult;
-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.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -42,8 +40,6 @@ public class AdmBuildingController {
     private IAdmISpaceService iAdmISpaceService;
     @Autowired
     private IAdmSpaceService spaceService;
-    @Value("${middleware.group.code}")
-    private String groupCode;
 
     /**
      * 创建
@@ -52,16 +48,14 @@ public class AdmBuildingController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmResponse create(@RequestBody AdmCreateRequest<AdmBuilding> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse create(@RequestBody AdmCreateRequest<AdmBuilding> createRequest) throws Exception {
         List<AdmBuilding> vos = CollUtil.newArrayList(createRequest.getContent());
         vos.stream().forEach(admBuilding -> {
             if (StrUtil.isEmpty(admBuilding.getName())){
                 admBuilding.setName(ObjectNameUtil.objectName("建筑-"));
             }
         });
-        vos = service.doInsert(context, AdmBuilding.class, vos);
+        vos = service.doInsert(AdmContextUtil.toDmpContext(), AdmBuilding.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -73,8 +67,6 @@ public class AdmBuildingController {
      */
     @PostMapping("/delete")
     public AdmResponse delete(@RequestBody List<AdmBuilding> vos) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, null, AdmCommonConstant.APP_ID);
         if(CollUtil.isEmpty(vos)){
             return AdmResponse.failure("参数不能为空");
         }
@@ -93,27 +85,27 @@ public class AdmBuildingController {
 
         admQueryCriteria.setFilters(filters);
         admQueryCriteria.setName(AdmFloor.OBJ_TYPE);
-        AdmResponse admResponseF = floorService.doQuery(context, admQueryCriteria, AdmFloor.class);
+        AdmResponse admResponseF = floorService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmFloor.class);
         if(DmpResult.SUCCESS.equals(admResponseF.getResult()) && CollUtil.isNotEmpty(admResponseF.getContent())){
             return AdmResponse.failure(msg);
         }
         admQueryCriteria.setName(AdmSpace.OBJ_TYPE);
-        AdmResponse admResponseSpace = spaceService.doQuery(context, admQueryCriteria, AdmSpace.class);
+        AdmResponse admResponseSpace = spaceService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmSpace.class);
         if(admResponseSpace.getResult().equals(DmpResult.SUCCESS) && CollUtil.isNotEmpty(admResponseSpace.getContent())){
             return AdmResponse.failure(msg);
         }
         admQueryCriteria.setName(AdmISpace.OBJ_TYPE);
-        AdmResponse admResponseISpace = iAdmISpaceService.doQuery(context, admQueryCriteria, AdmISpace.class);
+        AdmResponse admResponseISpace = iAdmISpaceService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmISpace.class);
         if(admResponseISpace.getResult().equals(DmpResult.SUCCESS) && CollUtil.isNotEmpty(admResponseISpace.getContent())){
             return AdmResponse.failure(msg);
         }
 
         admQueryCriteria.setName(AdmEquipment.OBJ_TYPE);
-        AdmResponse admResponseEuip = equipmentService.doQuery(context, admQueryCriteria, AdmEquipment.class);
+        AdmResponse admResponseEuip = equipmentService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmEquipment.class);
         if(admResponseEuip.getResult().equals(DmpResult.SUCCESS) && CollUtil.isNotEmpty(admResponseEuip.getContent())){
             return AdmResponse.failure(msg);
         }
-        service.doDelete(context, vos);
+        service.doDelete(AdmContextUtil.toDmpContext(), vos);
         return AdmResponse.success();
     }
 
@@ -136,16 +128,14 @@ public class AdmBuildingController {
      * @throws Exception
      */
     @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmBuilding> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmBuilding> createRequest) throws Exception {
         List<AdmBuilding> vos = CollUtil.newArrayList(createRequest.getContent());
         vos.forEach(admBuilding -> {
             if(StrUtil.isEmpty(admBuilding.getName())){
                 admBuilding.setName(ObjectNameUtil.objectName("建筑-"));
             }
         });
-        vos = service.doUpdate(context, AdmBuilding.class, vos);
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmBuilding.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -159,10 +149,8 @@ public class AdmBuildingController {
     @PostMapping("/query")
     public AdmResponse query(@QueryParam("projectId") String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         request.setName(AdmBuilding.OBJ_TYPE);
-        return service.doQuery(context, request, AdmBuilding.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmBuilding.class);
     }
 
     /**
@@ -175,10 +163,8 @@ public class AdmBuildingController {
     @PostMapping("/count")
     public AdmResponse count(@QueryParam("projectId") String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         request.setName(AdmBuilding.OBJ_TYPE);
         request.setOnlyCount(true);
-        return service.doQuery(context, request, AdmBuilding.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmBuilding.class);
     }
 }

+ 11 - 26
src/main/java/com/persagy/proxy/adm/controller/AdmComponentController.java

@@ -1,15 +1,13 @@
 package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.AdmComponent;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmComponentService;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -29,24 +27,20 @@ import java.util.List;
 public class AdmComponentController {
     @Autowired
     private IAdmComponentService service;
-    @Value("${middleware.group.code}")
-    private String groupCode;
 
     /**
      * 统计
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId,
+    public AdmResponse count(
                              @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         request.setName(AdmComponent.OBJ_TYPE);
         request.setOnlyCount(true);
-        return service.doQuery(context, request, AdmComponent.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmComponent.class);
     }
     /**
      * 创建
@@ -56,10 +50,8 @@ public class AdmComponentController {
      */
     @PostMapping("/create")
     public AdmResponse create(@RequestBody AdmCreateRequest<AdmComponent> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmComponent> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doInsertExt(context, AdmComponent.class, vos);
+        vos = service.doInsertExt(AdmContextUtil.toDmpContext(), AdmComponent.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -70,10 +62,8 @@ public class AdmComponentController {
      * @throws Exception
      */
     @PostMapping("/delete")
-    public AdmResponse delete(@QueryParam("projectId") String projectId, @RequestBody List<AdmComponent> vos) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        service.doDelete(context, vos);
+    public AdmResponse delete( @RequestBody List<AdmComponent> vos) throws Exception {
+        service.doDelete(AdmContextUtil.toDmpContext(), vos);
         return AdmResponse.success();
     }
 
@@ -85,26 +75,21 @@ public class AdmComponentController {
      */
     @PostMapping("/update")
     public AdmResponse update(@RequestBody AdmCreateRequest<AdmComponent> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmComponent> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doUpdate(context, AdmComponent.class, vos);
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmComponent.class, vos);
         return AdmResponse.success(vos);
     }
 
     /**
      * 查询
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse query(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmComponent.OBJ_TYPE);
-        return service.doQuery(context, request, AdmComponent.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmComponent.class);
     }
 }

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

@@ -3,11 +3,13 @@ package com.persagy.proxy.adm.controller;
 import cn.hutool.core.collection.CollUtil;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.constant.AdmDictConstant;
+import com.persagy.proxy.adm.constant.enums.AdmDictCategoryEnum;
 import com.persagy.proxy.adm.model.*;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmDictService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
@@ -34,9 +36,6 @@ import java.util.List;
 @Slf4j
 public class AdmDictController {
 
-    @Value("${middleware.group.code}")
-    private String groupCode;
-
     @Autowired
     private IAdmDictService service;
 
@@ -51,7 +50,7 @@ public class AdmDictController {
     public AdmResponse queryCategory(@QueryParam("projectId") String projectId,
                                      @RequestBody AdmDict request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         if(StringUtils.isEmpty(request.getType())){
             throw new Exception("type不能为空");
         }
@@ -70,7 +69,7 @@ public class AdmDictController {
     public AdmResponse dictBatch(@QueryParam("projectId") String projectId,
                                      @RequestBody AdmCreateRequest<AdmDictBatch> request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         //方案设定:方案id :全新设定(schemeZero)、方案1(schemeOne)、方案2(schemeTwo),
         //"注意SchemeId为必填字段 ,优先级在列表中[R,S,M] ,一级标签[技术参数,基本参数] 列表为String类型
         return AdmResponse.success(new ArrayList<>());
@@ -87,7 +86,7 @@ public class AdmDictController {
     public AdmResponse query(@QueryParam("projectId") String projectId,
                              @RequestBody AdmDictQueryCriteria request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         request.setName(request.getType());
         return service.doQueryObjectInfo(context, request, AdmDictConstant.CLASS_CODE, AdmObjectInfo.class);
     }
@@ -104,7 +103,7 @@ public class AdmDictController {
     public AdmResponse familyQuery(@QueryParam("projectId") String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return AdmResponse.success(new ArrayList<>());
     }
 
@@ -119,7 +118,7 @@ public class AdmDictController {
     public AdmResponse resetDic(@QueryParam("projectId") String projectId,
                                    @RequestBody AdmDictQueryCriteria request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return service.resetDic(context,request,null,AdmObjectInfo.class);
     }
 
@@ -135,7 +134,7 @@ public class AdmDictController {
     public AdmResponse resetType(@QueryParam("projectId") String projectId,
                                 @RequestBody AdmDictQueryCriteria request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         if(StringUtils.isEmpty(request.getType())){
             throw new Exception("type不能为空");
         }
@@ -154,12 +153,12 @@ public class AdmDictController {
     public AdmResponse settingDicProject(@QueryParam("projectId") String projectId,
                                  @RequestBody AdmCreateRequest<AdmObjectInfo> request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return service.settingDicProject(context,request,AdmObjectInfo.class);
     }
 
     /**
-     * 查询项目下已有的设备类型带系统(废弃:数据中心无此接口)
+     * 查询项目下已有的设备类型带系统
      * @param projectId
      * @param request
      * @return
@@ -168,10 +167,11 @@ public class AdmDictController {
     @PostMapping("/system/equip/category")
     @Deprecated
     public AdmResponse querySystemEquipCategory(@QueryParam("projectId") String projectId,
-                                 @RequestBody AdmDictQueryCriteria request) throws Exception {
+                                 @RequestBody AdmDict request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        return AdmResponse.success(new ArrayList<>());
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
+        request.setType(AdmDictCategoryEnum.SYSTEM_EQUIP.getValue());
+        return service.queryCategory(context,request,AdmObjectType.class);
     }
 
     /**
@@ -186,7 +186,7 @@ public class AdmDictController {
     public AdmResponse queryMorlDict(@QueryParam("projectId") String projectId,
                                                 @RequestBody List<String> dictTypeList) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         if(CollUtil.isEmpty(dictTypeList)){
             return AdmResponse.success(new ArrayList<>());
         }

+ 23 - 45
src/main/java/com/persagy/proxy/adm/controller/AdmEquipmentController.java

@@ -2,18 +2,15 @@ package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.AdmEquipment;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmEquipmentService;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 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;
 import java.util.List;
 
 /**
@@ -27,24 +24,20 @@ import java.util.List;
 public class AdmEquipmentController {
     @Autowired
     private IAdmEquipmentService service;
-    @Value("${middleware.group.code}")
-    private String groupCode;
 
     /**
      * 统计
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId,
+    public AdmResponse count(
                              @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         request.setName(AdmEquipment.OBJ_TYPE);
         request.setOnlyCount(true);
-        return service.doQuery(context, request, AdmEquipment.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmEquipment.class);
     }
 
     /**
@@ -54,11 +47,9 @@ public class AdmEquipmentController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmResponse create(@RequestBody AdmCreateRequest<AdmEquipment> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse create(@RequestBody AdmCreateRequest<AdmEquipment> createRequest) throws Exception {
         List<AdmEquipment> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doInsertEuip(context, AdmEquipment.class, vos);
+        vos = service.doInsertEuip(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -69,10 +60,9 @@ public class AdmEquipmentController {
      * @throws Exception
      */
     @PostMapping("/delete")
-    public AdmResponse delete(@QueryParam("projectId") String projectId, @RequestBody List<AdmEquipment> vos) throws Exception {
+    public AdmResponse delete( @RequestBody List<AdmEquipment> vos) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        service.doDelete(context, vos);
+        service.doDelete(AdmContextUtil.toDmpContext(), vos);
         return AdmResponse.success();
     }
 
@@ -84,29 +74,25 @@ public class AdmEquipmentController {
      * @throws Exception
      */
     @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmEquipment> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmEquipment> createRequest) throws Exception {
         List<AdmEquipment> vos = CollUtil.newArrayList(createRequest.getContent());
-        //vos = service.doUpdateEuip(context, AdmEquipment.class, vos);
-        vos = service.doUpdate(context, AdmEquipment.class, vos);
+        //vos = service.doUpdateEuip(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
         return AdmResponse.success(vos);
     }
 
     /**
      * 查询
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
+    public AdmResponse query(@RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         request.setName(AdmEquipment.OBJ_TYPE);
-        return service.doQuery(context, request, AdmEquipment.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmEquipment.class);
     }
 
     /**
@@ -116,11 +102,9 @@ public class AdmEquipmentController {
      * @throws Exception
      */
     @GetMapping("/export")
-    public AdmResponse exportInfos(@RequestBody AdmCreateRequest<AdmEquipment> admEquipment, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse exportInfos(@RequestBody AdmCreateRequest<AdmEquipment> admEquipment) throws Exception {
         List<AdmEquipment> vos = CollUtil.newArrayList(admEquipment.getContent());
-        vos = service.doUpdate(context, AdmEquipment.class, vos);
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -132,33 +116,29 @@ public class AdmEquipmentController {
      * @throws Exception
      */
     @PostMapping("/import")
-    public AdmResponse importInfos(@RequestBody AdmCreateRequest<AdmEquipment> admEquipment, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse importInfos(@RequestBody AdmCreateRequest<AdmEquipment> admEquipment) throws Exception {
         List<AdmEquipment> vos = CollUtil.newArrayList(admEquipment.getContent());
-        vos = service.doUpdate(context, AdmEquipment.class, vos);
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
         return AdmResponse.success(vos);
     }
 
     /**
      * 根据项目id查询所有的设备和部件
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @GetMapping("/query-equip")
-    public AdmResponse queryEquip(@QueryParam("projectId") String projectId,
+    public AdmResponse queryEquip(
                                   @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         //request.setName("equipment");
         if(StrUtil.isNotEmpty(request.getFilters())){
             request.setFilters(String.join(";",request.getFilters(),"objType in ['equipment','component']"));
         }else{
             request.setFilters("objType in ['equipment','component']");
         }
-        return service.doQuery(context, request, AdmEquipment.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmEquipment.class);
     }
 
     /**
@@ -168,11 +148,9 @@ public class AdmEquipmentController {
      * @throws Exception
      */
     @PostMapping("/create-equip-pro")
-    public AdmResponse createExt(@RequestBody AdmCreateRequest<AdmEquipment> admEquipment, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse createExt(@RequestBody AdmCreateRequest<AdmEquipment> admEquipment) throws Exception {
         List<AdmEquipment> vos = CollUtil.newArrayList(admEquipment.getContent());
-        vos = service.doInsertExt(context, AdmEquipment.class, vos);
+        vos = service.doInsertExt(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
         return AdmResponse.success(vos);
     }
 

+ 22 - 39
src/main/java/com/persagy/proxy/adm/controller/AdmFloorController.java

@@ -3,7 +3,6 @@ package com.persagy.proxy.adm.controller;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.persagy.dmp.common.model.entity.BaseEntity;
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.AdmEquipment;
 import com.persagy.proxy.adm.model.AdmFloor;
 import com.persagy.proxy.adm.model.AdmISpace;
@@ -15,17 +14,15 @@ import com.persagy.proxy.adm.service.IAdmEquipmentService;
 import com.persagy.proxy.adm.service.IAdmFloorService;
 import com.persagy.proxy.adm.service.IAdmISpaceService;
 import com.persagy.proxy.adm.service.IAdmSpaceService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
 import com.persagy.proxy.common.entity.DmpResult;
-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.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.ws.rs.QueryParam;
 import java.util.List;
 import java.util.Map;
 
@@ -46,8 +43,6 @@ public class AdmFloorController {
     private IAdmISpaceService iAdmISpaceService;
     @Autowired
     private IAdmSpaceService spaceService;
-    @Value("${middleware.group.code}")
-    private String groupCode;
 
     /**
      * 创建
@@ -56,9 +51,7 @@ public class AdmFloorController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmResponse create(@RequestBody AdmCreateRequest<AdmFloor> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse create(@RequestBody AdmCreateRequest<AdmFloor> createRequest) throws Exception {
         List<AdmFloor> vos = createRequest.getContent();
         for(AdmFloor floor : vos){
             if(StrUtil.isEmpty(floor.getName())){
@@ -80,7 +73,7 @@ public class AdmFloorController {
             filters+= "]";
             admQueryCriteria.setFilters(filters);
             admQueryCriteria.setName("floor");
-            AdmResponse admResponseF = service.doQuery(context, admQueryCriteria, AdmFloor.class);
+            AdmResponse admResponseF = service.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmFloor.class);
             if(DmpResult.SUCCESS.equals(admResponseF.getResult()) && admResponseF.getTotal() > 0){
                 List<AdmFloor> vosOld = (List<AdmFloor>) admResponseF.getContent();
                 for(AdmFloor admFloorOld : vosOld){
@@ -94,7 +87,7 @@ public class AdmFloorController {
                 }
             }
         }
-        List<AdmFloor> admFloors = service.doInsert(context, AdmFloor.class, createRequest.getContent());
+        List<AdmFloor> admFloors = service.doInsert(AdmContextUtil.toDmpContext(), AdmFloor.class, createRequest.getContent());
         return AdmResponse.success(admFloors);
     }
 
@@ -105,9 +98,7 @@ public class AdmFloorController {
      * @throws Exception
      */
     @PostMapping("/delete")
-    public AdmResponse delete(@QueryParam("projectId") String projectId, @RequestBody List<AdmFloor> vos) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse delete( @RequestBody List<AdmFloor> vos) throws Exception {
         String msg = "楼层下包含其他对象实例,请解除关系后删除";
         Map<String, AdmFloor> admFloorMap = CollUtil.fieldValueMap(vos, BaseEntity.PROP_ID);
 
@@ -124,21 +115,21 @@ public class AdmFloorController {
         admQueryCriteria.setOnlyCount(true);
 
         admQueryCriteria.setName(AdmSpace.OBJ_TYPE);
-        AdmResponse admResponseSpace = spaceService.doQuery(context, admQueryCriteria, AdmSpace.class);
+        AdmResponse admResponseSpace = spaceService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmSpace.class);
         if(admResponseSpace.getResult().equals(DmpResult.SUCCESS) && CollUtil.isNotEmpty(admResponseSpace.getContent())){
             return AdmResponse.failure(msg);
         }
         admQueryCriteria.setName(AdmISpace.OBJ_TYPE);
-        AdmResponse admResponseISpace = iAdmISpaceService.doQuery(context, admQueryCriteria, AdmISpace.class);
+        AdmResponse admResponseISpace = iAdmISpaceService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmISpace.class);
         if(admResponseISpace.getResult().equals(DmpResult.SUCCESS) && CollUtil.isNotEmpty(admResponseISpace.getContent())){
             return AdmResponse.failure(msg);
         }
         admQueryCriteria.setName(AdmEquipment.OBJ_TYPE);
-        AdmResponse admResponseEuip = equipmentService.doQuery(context, admQueryCriteria, AdmEquipment.class);
+        AdmResponse admResponseEuip = equipmentService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmEquipment.class);
         if(admResponseEuip.getResult().equals(DmpResult.SUCCESS) && CollUtil.isNotEmpty(admResponseEuip.getContent())){
             return AdmResponse.failure(msg);
         }
-        service.doDelete(context, vos);
+        service.doDelete(AdmContextUtil.toDmpContext(), vos);
         return AdmResponse.success();
     }
 
@@ -149,8 +140,8 @@ public class AdmFloorController {
      * @throws Exception
      */
     @PostMapping("/single/delete")
-    public AdmResponse deleteSingle(@QueryParam("projectId") String projectId, @RequestBody List<AdmFloor> vos) throws Exception {
-       delete(projectId,vos);
+    public AdmResponse deleteSingle( @RequestBody List<AdmFloor> vos) throws Exception {
+       delete(vos);
        return AdmResponse.success();
     }
 
@@ -161,9 +152,7 @@ public class AdmFloorController {
      * @throws Exception
      */
     @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmFloor> admFloor, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmFloor> admFloor) throws Exception {
         List<AdmFloor> vos = CollUtil.newArrayList(admFloor.getContent());
         /** 遍历楼层列表 */
         Map<String, AdmFloor> admFloorBdMap = CollUtil.fieldValueMap(vos, "buildingId");
@@ -178,7 +167,7 @@ public class AdmFloorController {
             filters+= "]";
             admQueryCriteria.setFilters(filters);
             admQueryCriteria.setName("floor");
-            AdmResponse admResponseF = service.doQuery(context, admQueryCriteria, AdmFloor.class);
+            AdmResponse admResponseF = service.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmFloor.class);
             if(DmpResult.SUCCESS.equals(admResponseF.getResult()) && admResponseF.getTotal() > 0 && CollUtil.isNotEmpty(admResponseF.getContent())){
                 List<AdmFloor> vosOld = (List<AdmFloor>) admResponseF.getContent();
                 for(AdmFloor admFloorOld : vosOld){
@@ -192,7 +181,7 @@ public class AdmFloorController {
                 }
             }
         }
-        vos = service.doUpdate(context, AdmFloor.class, vos);
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmFloor.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -204,9 +193,9 @@ public class AdmFloorController {
      * @throws Exception
      */
     @PostMapping("/update-outline")
-    public AdmResponse updateOutline(@RequestBody AdmCreateRequest<AdmFloor> admFloor, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse updateOutline(@RequestBody AdmCreateRequest<AdmFloor> admFloor) throws Exception {
         // 组装上下文条件
-        AdmResponse admResponse = update(admFloor,projectId);
+        AdmResponse admResponse = update(admFloor);
         //TODO 处理关系
         /** 处理关系标记 */
        /* val listtype = ArrayList<String>()
@@ -231,35 +220,29 @@ public class AdmFloorController {
 
     /**
      * 查询
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse query(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmFloor.OBJ_TYPE);
-        return service.doQuery(context, request, AdmFloor.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmFloor.class);
     }
 
 
     /**
      * 查询
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query-outline")
-    public AdmResponse queryOutline(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse queryOutline(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmFloor.OBJ_TYPE);
-        return service.doQueryOutLine(context, request, AdmFloor.class);
+        return service.doQueryOutLine(AdmContextUtil.toDmpContext(), request, AdmFloor.class);
     }
 
 }

+ 13 - 30
src/main/java/com/persagy/proxy/adm/controller/AdmISpaceController.java

@@ -1,21 +1,18 @@
 package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.AdmISpace;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmISpaceService;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.ws.rs.QueryParam;
 import java.util.List;
 
 /**
@@ -29,24 +26,19 @@ import java.util.List;
 public class AdmISpaceController {
     @Autowired
     private IAdmISpaceService service;
-    @Value("${middleware.group.code}")
-    private String groupCode;
 
     /**
      * 统计
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse count(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmISpace.OBJ_TYPE);
         request.setOnlyCount(true);
-        return service.doQuery(context, request, AdmISpace.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmISpace.class);
     }
     /**
      * 创建
@@ -55,11 +47,9 @@ public class AdmISpaceController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmResponse create(@RequestBody AdmCreateRequest<AdmISpace> AdmISpace, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse create(@RequestBody AdmCreateRequest<AdmISpace> AdmISpace) throws Exception {
         List<AdmISpace> vos = CollUtil.newArrayList(AdmISpace.getContent());
-        vos = service.doInsert(context, AdmISpace.class, vos);
+        vos = service.doInsert(AdmContextUtil.toDmpContext(), AdmISpace.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -70,10 +60,8 @@ public class AdmISpaceController {
      * @throws Exception
      */
     @PostMapping("/delete")
-    public AdmResponse delete(@QueryParam("projectId") String projectId, @RequestBody List<AdmISpace> vos) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        service.doDelete(context, vos);
+    public AdmResponse delete( @RequestBody List<AdmISpace> vos) throws Exception {
+        service.doDelete(AdmContextUtil.toDmpContext(), vos);
         return AdmResponse.success();
     }
 
@@ -84,28 +72,23 @@ public class AdmISpaceController {
      * @throws Exception
      */
     @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmISpace> AdmISpace, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmISpace> AdmISpace) throws Exception {
         List<AdmISpace> vos = CollUtil.newArrayList(AdmISpace.getContent());
-        vos = service.doUpdate(context, AdmISpace.class, vos);
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmISpace.class, vos);
         return AdmResponse.success(vos);
     }
 
     /**
      * 查询
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse query(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmISpace.OBJ_TYPE);
-        return service.doQuery(context, request, AdmISpace.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmISpace.class);
     }
 
 }

+ 6 - 5
src/main/java/com/persagy/proxy/adm/controller/AdmLabslController.java

@@ -5,6 +5,7 @@ import com.persagy.proxy.adm.model.AdmObjectInfo;
 import com.persagy.proxy.adm.model.AdmObjectType;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmLabslService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -43,7 +44,7 @@ public class AdmLabslController {
      */
     @PostMapping("/category")
     public AdmResponse queryCategory() throws Exception {
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, AdmCommonConstant.PROJECTID, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return service.queryCategory(context, AdmObjectInfo.class);
     }
 
@@ -55,7 +56,7 @@ public class AdmLabslController {
      */
     @PostMapping("/zone/type")
     public AdmResponse queryZoneType() throws Exception {
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, AdmCommonConstant.PROJECTID, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return service.queryZoneType(context, AdmObjectInfo.class);
     }
 
@@ -66,7 +67,7 @@ public class AdmLabslController {
      */
     @PostMapping("/building/floor")
     public AdmResponse queryBuildFloor(@QueryParam("projectId") String projectId) throws Exception {
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return service.queryBuildFloor(context, AdmObjectInfo.class);
     }
 
@@ -78,7 +79,7 @@ public class AdmLabslController {
      */
     @PostMapping("/query/equip")
     public AdmResponse queryEquipType(@QueryParam("projectId") String projectId) throws Exception {
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return service.queryBuildFloor(context, AdmObjectInfo.class);
     }
 
@@ -91,7 +92,7 @@ public class AdmLabslController {
     @PostMapping("/major/category")
     public AdmResponse queryMajorCategory(@QueryParam("projectId") String projectId,
                                           @RequestBody List<String> ids) throws Exception {
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return service.queryMajorCategory(context, ids , AdmObjectType.class);
     }
 

+ 10 - 6
src/main/java/com/persagy/proxy/adm/controller/AdmLocationPointController.java

@@ -9,6 +9,7 @@ import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmLocationPointService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import lombok.extern.slf4j.Slf4j;
@@ -52,7 +53,7 @@ public class AdmLocationPointController {
     public AdmResponse count(@QueryParam("projectId") String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         request.setName("point");
         request.setOnlyCount(true);
         return service.doQuery(context, request, AdmLocationPoint.class);
@@ -69,7 +70,7 @@ public class AdmLocationPointController {
     public AdmResponse query(@QueryParam("projectId") String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         request.setName("point");
         // 查询信息点标签
         AdmResponse admResponse = service.doQuery(context, request, AdmLocationPoint.class);
@@ -87,7 +88,7 @@ public class AdmLocationPointController {
     @PostMapping("/create")
     public AdmResponse create(@RequestBody AdmCreateRequest<AdmLocationPoint> createRequest, @QueryParam("projectId") String projectId) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         List<AdmLocationPoint> vos = CollUtil.newArrayList(createRequest.getContent());
         log.info("创建条件"+vos.toString());
         vos = service.doInsert(context, AdmLocationPoint.class, vos);
@@ -104,7 +105,7 @@ public class AdmLocationPointController {
     @PostMapping("/update")
     public AdmResponse update(@RequestBody AdmCreateRequest<AdmLocationPoint> createRequest, @QueryParam("projectId") String projectId) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         List<AdmLocationPoint> vos = CollUtil.newArrayList(createRequest.getContent());
         vos = service.doUpdate(context, AdmLocationPoint.class, vos);
         return AdmResponse.success(vos);
@@ -120,7 +121,7 @@ public class AdmLocationPointController {
     @PostMapping("/delete")
     public AdmResponse delete(@QueryParam("projectId") String projectId, @RequestBody List<AdmLocationPoint> vos) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doDelete(context, vos);
         return AdmResponse.success();
     }
@@ -134,7 +135,7 @@ public class AdmLocationPointController {
     @PostMapping("/delete-image")
     public AdmResponse deleteImage(@QueryParam("projectId") String projectId, @RequestBody List<AdmPointImage> vos) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         // 删除图片参数转换
         List<AdmLocationPoint> points = deleteImageParamRevert(vos);
         service.doUpdate(context,AdmLocationPoint.class, points);
@@ -169,6 +170,9 @@ public class AdmLocationPointController {
             return;
         }
         List<AdmLocationPoint> points = (List<AdmLocationPoint>) admResponse.getContent();
+        if(CollUtil.isEmpty(points)){
+            return;
+        }
         for (AdmLocationPoint point : points) {
             ArrayList<AdmPointImage> imageList = point.getImageList();
             if(CollUtil.isEmpty(imageList)){

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

@@ -5,6 +5,7 @@ import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.*;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmPlanarService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,7 +45,7 @@ public class AdmPlanarController {
     @PostMapping("/equip")
     public AdmResponse queryPlanarEquip(@QueryParam("projectId") String projectId,
                                           @RequestBody AdmPlanarEquipRequests requests) throws Exception {
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         if(requests == null){
             throw new Exception("请求参数不能为空");
         }
@@ -59,7 +60,7 @@ public class AdmPlanarController {
     @PostMapping("/space")
     public AdmResponse queryPlanarSpace(@QueryParam("projectId") String projectId,
                                   @RequestBody AdmPlanarEquipRequests requests) throws Exception {
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         if(requests == null){
             throw new Exception("请求参数不能为空");
         }

+ 4 - 14
src/main/java/com/persagy/proxy/adm/controller/AdmProjectController.java

@@ -1,20 +1,16 @@
 package com.persagy.proxy.adm.controller;
 
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.AdmProject;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmProjectService;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.ws.rs.QueryParam;
-
 /**
  * ADM 项目 API
  * @author Charlie Yu
@@ -26,23 +22,17 @@ public class AdmProjectController {
 
     @Autowired
     private IAdmProjectService service;
-    @Value("${middleware.group.code}")
-    private String groupCode;
 
     /**
      * 查询项目信息
-     * @param projectId
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse query(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmProject.OBJ_TYPE);
-        return service.doQuery(context, request, AdmProject.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmProject.class);
     }
 
     /**
@@ -53,6 +43,6 @@ public class AdmProjectController {
      */
     @PostMapping("/query/obj")
     public AdmResponse queryObj(@RequestBody AdmQueryCriteria request) throws Exception {
-        return query(null, request);
+        return query(request);
     }
 }

+ 13 - 28
src/main/java/com/persagy/proxy/adm/controller/AdmPropertyController.java

@@ -1,15 +1,13 @@
 package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.AdmProperty;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmPropertyService;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -29,8 +27,6 @@ import java.util.List;
 public class AdmPropertyController {
     @Autowired
     private IAdmPropertyService service;
-    @Value("${middleware.group.code}")
-    private String groupCode;
 
     /**
      * 创建
@@ -39,11 +35,9 @@ public class AdmPropertyController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmResponse create(@RequestBody AdmCreateRequest<AdmProperty> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse create(@RequestBody AdmCreateRequest<AdmProperty> createRequest) throws Exception {
         List<AdmProperty> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doInsert(context, AdmProperty.class, vos);
+        vos = service.doInsert(AdmContextUtil.toDmpContext(), AdmProperty.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -54,10 +48,8 @@ public class AdmPropertyController {
      * @throws Exception
      */
     @PostMapping("/delete")
-    public AdmResponse delete(@QueryParam("projectId") String projectId, @RequestBody List<AdmProperty> vos) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        service.doDelete(context, vos);
+    public AdmResponse delete( @RequestBody List<AdmProperty> vos) throws Exception {
+        service.doDelete(AdmContextUtil.toDmpContext(), vos);
         return AdmResponse.success();
     }
 
@@ -70,45 +62,38 @@ public class AdmPropertyController {
      */
     @PostMapping("/update")
     public AdmResponse update(@RequestBody AdmCreateRequest<AdmProperty> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        
         List<AdmProperty> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doUpdate(context, AdmProperty.class, vos);
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmProperty.class, vos);
         return AdmResponse.success(vos);
     }
 
 
     /**
      * 查询
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse query(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName("equipment");
-        return service.doQuery(context, request, AdmProperty.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmProperty.class);
     }
 
 
     /**
      * 统计 已经关联岗位的资产数量("Filters": " not EquipId isNull"),未关联岗位的资产数量("Filters": " EquipId isNull")
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse count(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName("equipment");
         request.setOnlyCount(true);
-        return service.doQuery(context, request, AdmProperty.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmProperty.class);
     }
 }

+ 2 - 1
src/main/java/com/persagy/proxy/adm/controller/AdmRelationController.java

@@ -19,6 +19,7 @@ import com.persagy.proxy.adm.service.IAdmGraphicTypeService;
 import com.persagy.proxy.adm.service.IAdmRelationService;
 import com.persagy.proxy.adm.service.IAdmRelationTypeService;
 import com.persagy.proxy.adm.service.IAdmWindowService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -57,7 +58,7 @@ public class AdmRelationController {
     @PostMapping("/equip/category")
     public AdmResponse equipRel(@QueryParam("projectId") String projectId) {
         //组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         AdmResponse res = service.query(context);
         return res;
     }

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

@@ -7,6 +7,7 @@ import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmDtRelationService;
 import com.persagy.proxy.adm.service.IAdmGraphicTypeService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -40,9 +41,9 @@ public class AdmRelationObjectController {
     @PostMapping("/equip/query")
     public AdmResponse equipRel(@QueryParam("projectId") String projectId) {
         //组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         AdmQueryCriteria criteria = new AdmQueryCriteria();
-        criteria.setFilters("projectId = "+projectId);
+        criteria.setFilters("projectId = "+context.getProjectId());
         AdmResponse admResponse = service.doQuery(context, criteria, AdmDtRelation.class);
         return admResponse;
     }

+ 60 - 78
src/main/java/com/persagy/proxy/adm/controller/AdmReportEquipController.java

@@ -29,9 +29,9 @@ import com.persagy.proxy.adm.service.IAdmComponentService;
 import com.persagy.proxy.adm.service.IAdmDictService;
 import com.persagy.proxy.adm.service.IAdmEquipmentService;
 import com.persagy.proxy.adm.service.IAdmSystemService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
 import com.persagy.proxy.common.entity.DmpResult;
-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.*;
@@ -65,16 +65,13 @@ public class AdmReportEquipController {
      * 查询设备信息 关联的部件 资产信息
      * 查询设备关联资产部件数量
      *
-     * @param projectId
+     *
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/equip-components")
-    public AdmResponse getEquipAssetComponents(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse getEquipAssetComponents(@RequestBody AdmQueryCriteria request) throws Exception {
         //查询设备
         request.setName(AdmEquipment.OBJ_TYPE);
         List<AdmQueryCriteria> cascade = new ArrayList<>();
@@ -88,7 +85,7 @@ public class AdmReportEquipController {
         cascade.add(cascadeSys);
         request.setCascade(cascade);
         QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
-        List<ObjectNode> equips = DigitalObjectFacade.query(context.getGroupCode(), context.getProjectId(), context.getAppId(), null, queryCriteria);
+        List<ObjectNode> equips = DigitalObjectFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(), null, queryCriteria);
         if (CollUtil.isEmpty(equips)) {
             return AdmResponse.success();
         }
@@ -107,7 +104,7 @@ public class AdmReportEquipController {
         ObjectNode criteria = JsonNodeFactory.instance.objectNode();
         criteria.put("code", admEquipment.getClassCode());
         defineCriteria.setCriteria(criteria);
-        AdmResponse defRes = dictService.doQueryObjectType(context, queryCriteria, AdmObjectType.class);
+        AdmResponse defRes = dictService.doQueryObjectType(AdmContextUtil.toDmpContext(), queryCriteria, AdmObjectType.class);
         if (CollUtil.isNotEmpty(defRes.getContent())) {
             List<AdmObjectType> componentCategory = (List<AdmObjectType>) defRes.getContent();
             admEquipment.setComponentCategory(componentCategory);
@@ -123,10 +120,7 @@ public class AdmReportEquipController {
      * @return 查询结果
      */
     @PostMapping("/components-count")
-    public AdmResponse getEquipComponentsCount(@QueryParam("projectId") String projectId,
-                                               @RequestBody AdmQueryCriteria request){
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse getEquipComponentsCount(@RequestBody AdmQueryCriteria request){
         QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
         ObjectNode criteria = queryCriteria.getCriteria();
         if(JSONUtil.isNull(criteria)){
@@ -135,7 +129,7 @@ public class AdmReportEquipController {
         JsonNode euipId = criteria.get("id");
         RequestData requestData = new RequestData();
         requestData.setEquipmentId(String.valueOf(euipId));
-        List result = DigitalObjectSimpleFacade.queryComponentsCountByEquipId(context.getGroupCode(), context.getProjectId(), context.getAppId(),null,requestData);
+        List result = DigitalObjectSimpleFacade.queryComponentsCountByEquipId(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(),null,requestData);
         if(CollUtil.isNotEmpty(result)){
             return AdmResponse.success(result);
         }else{
@@ -152,12 +146,9 @@ public class AdmReportEquipController {
      * @return              查询结果
      */
     @PostMapping("/components-property")
-    public AdmResponse getComponentProperty(@QueryParam("projectId") String projectId,
-                                             @RequestBody AdmQueryCriteria request){
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse getComponentProperty(@RequestBody AdmQueryCriteria request){
         request.setName(AdmComponent.OBJ_TYPE);
-        return componentService.doQuery(context, request, AdmComponent.class);
+        return componentService.doQuery(AdmContextUtil.toDmpContext(), request, AdmComponent.class);
     }
 
     /**
@@ -167,10 +158,8 @@ public class AdmReportEquipController {
      * @param   category    分类
      */
     @GetMapping("/equip-compon")
-    public AdmResponse getEquipCompon(@QueryParam("projectId") String projectId, @QueryParam("id") String id, @QueryParam("category") String category){
-        //return  rEquipComponService.getEquipCompon(id,category)
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse getEquipCompon(@QueryParam("id") String id, @QueryParam("category") String category){
+        //return  rEquipComponService.getEquipCompon(id,category)        
         RequestData requestData = new RequestData();
         if(StrUtil.isNotEmpty(id)){
             requestData.setEquipmentId(id);
@@ -178,7 +167,7 @@ public class AdmReportEquipController {
         if(StrUtil.isNotEmpty(category)){
             requestData.setClassCode(category);
         }
-        List result = DigitalObjectSimpleFacade.queryEquipComponentsByProjectId(context.getGroupCode(), context.getProjectId(), context.getAppId(),null, requestData);
+        List result = DigitalObjectSimpleFacade.queryEquipComponentsByProjectId(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(),null, requestData);
         if(CollUtil.isNotEmpty(result)){
             return AdmResponse.success(result);
         }else{
@@ -204,7 +193,7 @@ public class AdmReportEquipController {
      *      "根据设备类型和建筑楼层查询(\"Filters\": \"category ='FASE';buildingId = '建筑id';floorId = '楼层id'\")"
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request) {
+    public AdmResponse count(@RequestBody AdmQueryCriteria request) {
         QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
         ObjectNode criteria = JsonNodeFactory.instance.objectNode();
         if(StrUtil.isNotEmpty(request.getFilters()) && request.getFilters().contains("category")){
@@ -213,7 +202,7 @@ public class AdmReportEquipController {
         }
         queryCriteria.setCriteria(criteria);
         queryCriteria.setOnlyCount(true);
-        List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteria);
+        List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null, queryCriteria);
         if(CollUtil.isNotEmpty(euipCom)){
             return AdmResponse.success(euipCom);
         }else{
@@ -229,7 +218,7 @@ public class AdmReportEquipController {
      *             "根据设备类型和建筑楼层查询(\"Filters\": \"category ='FASE';buildingId = '建筑id';floorId = '楼层id'\")"
      */
     @PostMapping("/pagequery")
-    public AdmResponse pageQuery(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request) {
+    public AdmResponse pageQuery(@RequestBody AdmQueryCriteria request) {
         QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
         ObjectNode criteria = JsonNodeFactory.instance.objectNode();
         queryCriteria.setCriteria(criteria);
@@ -237,7 +226,7 @@ public class AdmReportEquipController {
             criteria.put("classCode", criteria.get("category").textValue());
             criteria.remove("category");
         }
-        List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteria);
+        List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null, queryCriteria);
         if(CollUtil.isNotEmpty(euipCom)){
             return AdmResponse.success(euipCom);
         }else{
@@ -257,10 +246,10 @@ public class AdmReportEquipController {
      *             "如果是查询不属于任何业务空间的对象, 设置notInZone = true"
      */
     @PostMapping("/zone-query")
-    public AdmResponse zoneQuery(@QueryParam("projectId") String projectId, @RequestBody AdmZoneEquipQueryRequest request) {
+    public AdmResponse zoneQuery(@RequestBody AdmZoneEquipQueryRequest request) {
         request.setName(AdmEquipment.OBJ_TYPE);
         if(StrUtil.isAllEmpty(request.getZoneType(),request.getZoneId())){
-            return pageQuery(projectId, request);
+            return pageQuery(request);
         }else{
 
         }
@@ -278,10 +267,10 @@ public class AdmReportEquipController {
      *             "如果是查询不属于任何业务空间的对象, 设置notInZone = true"
      */
     @PostMapping("/zone-component-query")
-    public AdmResponse zoneComponentQuery(@QueryParam("projectId") String projectId,@RequestBody AdmZoneEquipQueryRequest request) {
+    public AdmResponse zoneComponentQuery(@RequestBody AdmZoneEquipQueryRequest request) {
         if(StrUtil.isAllEmpty(request.getZoneType(),request.getZoneId())){
             request.setName(AdmComponent.OBJ_TYPE);
-            return pageQuery(projectId, request);
+            return pageQuery(request);
         }
        return null;
     }
@@ -291,12 +280,10 @@ public class AdmReportEquipController {
      *
      */
     @PostMapping("/creat-equip-pro")
-    public AdmResponse create(@QueryParam("projectId") String projectId,@RequestBody AdmCreateRequest<AdmEquipment> createRequest){
+    public AdmResponse create(@RequestBody AdmCreateRequest<AdmEquipment> createRequest){
         //return EquipmentProSyService.createList(request)
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmEquipment> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = equipmentService.doInsertEuip(context, AdmEquipment.class, vos);
+        vos = equipmentService.doInsertEuip(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -304,7 +291,7 @@ public class AdmReportEquipController {
      * 查询不在当前系统下的设备
      */
     @PostMapping("/equip-sys")
-    public AdmResponse pageQueryEquipSys(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request,@QueryParam("sysId") String sysId){
+    public AdmResponse pageQueryEquipSys(@RequestBody AdmQueryCriteria request,@QueryParam("sysId") String sysId){
         //return EquipmentService.queryBeforeEquipSy(sysId,request)
         QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
         ObjectNode criteriaEquip = JsonNodeFactory.instance.objectNode();
@@ -317,7 +304,7 @@ public class AdmReportEquipController {
         relationTo.put("objFrom", objFrom);
         criteriaEquip.putPOJO("relationTo",relationTo);
         queryCriteria.setCriteria(criteriaEquip);
-        List<ObjectNode> equips = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteria);
+        List<ObjectNode> equips = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null,queryCriteria);
         if (CollUtil.isEmpty(equips))
             return AdmResponse.success();
         else
@@ -330,12 +317,12 @@ public class AdmReportEquipController {
      * datacenter 查询目标是SysEquip 没先查询系统,根据系统id查询系统和设备的关系,根据关系查询设备,拼接数据
      */
     @PostMapping("/sys-equip")
-    public AdmResponse pageQuerySysEquip(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request){
-        //return SysEquipService.pageQuery(request, arrayListOf(SFilter.eq("projectId", SPageContext.getHeader("projectId").toString())))
+    public AdmResponse pageQuerySysEquip(@RequestBody AdmQueryCriteria request){
+        //return SysEquipService.pageQuery(request, arrayListOf(SFilter.eq("projectId", SPageAdmContextUtil.toDmpContext().getHeader("projectId").toString())))
         request.setName(AdmSystem.OBJ_TYPE);
         QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
         queryCriteria.setSize(500l);
-        List<ObjectNode> objectNodeList = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteria);
+        List<ObjectNode> objectNodeList = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null,queryCriteria);
         if(CollUtil.isEmpty(objectNodeList)){
             return AdmResponse.success();
         }
@@ -352,7 +339,7 @@ public class AdmReportEquipController {
         admSystemMap.keySet().stream().forEach(id -> arrayNode.add(id));
         queryCriteriaRelation.setCriteria(criteria);
 
-        List<ObjectRelation> relations = DigitalRelationFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteriaRelation);
+        List<ObjectRelation> relations = DigitalRelationFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null,queryCriteriaRelation);
         if(CollUtil.isEmpty(relations)){
             AdmResponse.success();
         }
@@ -365,7 +352,7 @@ public class AdmReportEquipController {
         ArrayNode array = criteriaEquip.putObject("id").putArray("$in");
         relationMap.keySet().stream().forEach(id -> array.add(id));
         queryCriteriaEqu.setCriteria(criteriaEquip);
-        List<ObjectNode> equips = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteriaEqu);
+        List<ObjectNode> equips = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null,queryCriteriaEqu);
         List<AdmEquipment> equipsList = JSONUtil.toList(equips.toString(), AdmEquipment.class);
         Map<String, AdmEquipment> admEquipmentMap = CollUtil.fieldValueMap(equipsList, BaseEntity.PROP_ID);
 
@@ -392,14 +379,12 @@ public class AdmReportEquipController {
     @GetMapping("/equip-compon-category")
     public AdmResponse equipORComponCategory(@QueryParam("projectId") String projectId){
         //return EquipORComponCategoryService.getEquipORComponCategory()
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         RequestData requestData = new RequestData();
         if(StrUtil.isNotEmpty(projectId)){
             requestData.setProjectId(projectId);
         }
         requestData.setObjTypes(CollUtil.newHashSet(AdmEquipment.OBJ_TYPE, AdmComponent.OBJ_TYPE));
-        List<Map<String, Object>> result = DigitalObjectSimpleFacade.queryDefineInfoByObjType(context.getGroupCode(),projectId,context.getAppId(),null,requestData);
+        List<Map<String, Object>> result = DigitalObjectSimpleFacade.queryDefineInfoByObjType(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getProjectId(),AdmContextUtil.toDmpContext().getAppId(),null,requestData);
         if(CollUtil.isNotEmpty(result)){
             return AdmResponse.success(result);
         }else{
@@ -436,12 +421,12 @@ public class AdmReportEquipController {
      * }
      */
     @PostMapping("/update")
-    public AdmResponse equipUpDateEnclosure(@QueryParam("projectId") String projectId,@RequestBody ObjectNode equipUpDateEnclosureRequest) {
+    public AdmResponse equipUpDateEnclosure(@RequestBody ObjectNode equipUpDateEnclosureRequest) {
         //return EquipmentService.equipUpDateEnclosurs(equipUpDateEnclosureRequest)
         if(JSONUtil.isNull(equipUpDateEnclosureRequest)){
             return AdmResponse.failure(ResponseCode.A0400.getDesc()+",不能为空");
         }
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        
         List<EquipUpDateEnclosure> equipUpDateEnclosure = JSONUtil.toList(equipUpDateEnclosureRequest.get("content").toString(), EquipUpDateEnclosure.class);
         if(CollUtil.isNotEmpty(equipUpDateEnclosure)){
             Map<String, EquipUpDateEnclosure> equipUpDateEnclosureMap = CollUtil.fieldValueMap(equipUpDateEnclosure, BaseEntity.PROP_ID);
@@ -455,7 +440,7 @@ public class AdmReportEquipController {
             ArrayNode arrayNode = criteria.putObject("id").putArray("$in");
             equipUpDateEnclosureMap.keySet().stream().forEach(equipId -> arrayNode.add(equipId));
             queryCriteria.setCriteria(criteria);
-            AdmResponse equips = equipmentService.doQuery(context, queryCriteria, AdmEquipment.class);
+            AdmResponse equips = equipmentService.doQuery(AdmContextUtil.toDmpContext(), queryCriteria, AdmEquipment.class);
             if(CollUtil.isEmpty(equips.getContent())){
                 return AdmResponse.failure(ResponseCode.A0400.getDesc());
             }
@@ -473,7 +458,7 @@ public class AdmReportEquipController {
                     }
                 });
             });
-            List<AdmEquipment> vos = equipmentService.doUpdate(context, AdmEquipment.class, equipmentList);
+            List<AdmEquipment> vos = equipmentService.doUpdate(AdmContextUtil.toDmpContext(), AdmEquipment.class, equipmentList);
             return AdmResponse.success(vos);
         }else{
             return AdmResponse.failure(ResponseCode.A0400.getDesc());
@@ -488,7 +473,7 @@ public class AdmReportEquipController {
      * }]
      */
     @PostMapping("/equip-del-com")
-    public AdmResponse equipComDel(@QueryParam("projectId") String projectId,@RequestBody List<ObjectNode> equipComDelList){
+    public AdmResponse equipComDel(@RequestBody List<ObjectNode> equipComDelList){
         //return EquipmentService.equipComDels(equipComDelList)
         if(CollUtil.isEmpty(equipComDelList)){
             return AdmResponse.failure(ResponseCode.A0400.getCode());
@@ -504,7 +489,7 @@ public class AdmReportEquipController {
             }
         });
         queryCriteriaEuip.setCriteria(criteriaEquip);
-        List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteriaEuip);
+        List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null, queryCriteriaEuip);
         if(CollUtil.isEmpty(equipList)){
             return AdmResponse.success(equipComDelList);
         }
@@ -532,9 +517,9 @@ public class AdmReportEquipController {
      * }]
      */
     @PostMapping("/equip-supply")
-    public AdmResponse equipPropertySupply(@QueryParam("projectId") String projectId,@RequestBody List<ObjectNode> equipComDelList){
+    public AdmResponse equipPropertySupply(@RequestBody List<ObjectNode> equipComDelList){
         //return EquipmentService.equipPropertySupplys(equipComDelList)
-        //InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        //
         if(CollUtil.isEmpty(equipComDelList)){
             return AdmResponse.failure(ResponseCode.A0400.getCode());
         }
@@ -547,7 +532,7 @@ public class AdmReportEquipController {
             arrayNode.add(node.get("modelId").textValue());
         });
         queryCriteria.setCriteria(criteria);
-        List<ObjectNode> floorList = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteria);
+        List<ObjectNode> floorList = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null,queryCriteria);
         if(CollUtil.isEmpty(floorList)){
             return AdmResponse.success();
         }
@@ -573,7 +558,7 @@ public class AdmReportEquipController {
         criteriaEquip.putPOJO("modelId", modelId);
 
         queryCriteriaEuip.setCriteria(criteriaEquip);
-        List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteriaEuip);
+        List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null, queryCriteriaEuip);
         if(CollUtil.isEmpty(equipList)){
             return AdmResponse.success(equipComDelList);
         }
@@ -606,8 +591,7 @@ public class AdmReportEquipController {
      * 级联-任务(scanTaskBase)、资产(property)、设备类型(equipCategory),级联任务的时候需要设置条件(TaskState = 0 添加时间降序  取第一个值 )
      */
     @PostMapping("/equip-comm-del")
-    public AdmResponse equipCommDel(@QueryParam("projectId") String projectId,@RequestBody AdmQueryCriteria request){
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse equipCommDel(@RequestBody AdmQueryCriteria request){
         //return EquipDelService.pageQuery(sQueryRequest,withFilterList)
         //e.task_state = '-1'::integer
         //AND NOT e.model_id IS NULL
@@ -621,7 +605,7 @@ public class AdmReportEquipController {
         criteria.put("taskState","-1");
         queryCriteria.setCriteria(criteria);
 
-        AdmResponse equipRes = equipmentService.doQuery(context, queryCriteria, AdmEquipment.class);
+        AdmResponse equipRes = equipmentService.doQuery(AdmContextUtil.toDmpContext(), queryCriteria, AdmEquipment.class);
         return equipRes;
     }
 
@@ -630,8 +614,8 @@ public class AdmReportEquipController {
      * 级联-设备类型(equipFamily)
      */
     @PostMapping("/property-equip-supp")
-    public AdmResponse propertyEquip(@QueryParam("projectId") String projectId,@RequestBody AdmQueryCriteria request){
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse propertyEquip(@RequestBody AdmQueryCriteria request){
+        
         //return EquipmentService.equipPropertySupp(sQueryRequest)
         //equipment.bim_id IS NULL
         //  AND equipment.model_id IS NULL
@@ -652,7 +636,7 @@ public class AdmReportEquipController {
         criteria.putPOJO("bimLocation", bimLocation);
         queryCriteria.setCriteria(criteria);
 
-        AdmResponse equipRes = equipmentService.doQuery(context, queryCriteria, AdmEquipment.class);
+        AdmResponse equipRes = equipmentService.doQuery(AdmContextUtil.toDmpContext(), queryCriteria, AdmEquipment.class);
         if(CollUtil.isNotEmpty(equipRes.getContent())){
             List<AdmEquipment> admEquipments = JSONUtil.toList(equipRes.getContent().toString(), AdmEquipment.class);
             Map<String, AdmEquipment> admEquipmentMap = CollUtil.fieldValueMap(admEquipments, BaseEntity.PROP_ID);
@@ -676,7 +660,7 @@ public class AdmReportEquipController {
             filter =  filter + ";id in "+arrayNode.toString();
             request.setFilters(filter);
 
-           AdmResponse admResponse = equipmentService.doQuery(context, request, AdmEquipment.class);
+           AdmResponse admResponse = equipmentService.doQuery(AdmContextUtil.toDmpContext(), request, AdmEquipment.class);
            if(CollUtil.isNotEmpty(admResponse.getContent())){
                //处理数据
                List<ObjectNode> objectNodeList = (List<ObjectNode>) admResponse.getContent();
@@ -753,8 +737,8 @@ public class AdmReportEquipController {
     @PostMapping("/info-point")
     public AdmResponse infoPoint(@QueryParam("projectId") String projectId) {
         //return customSqlService.infoPoints()
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, context, false, false);
+        
+        JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, false, false);
         JSONObject infoPoint = new JSONObject();
         infoPoint.put("dynamicInfoPoint",gatherInfoPoint.getString("gatherDynamicInfoPointCounts"));
         infoPoint.put("staticInfoPoint",gatherInfoPoint.getString("gatherStaticInfoPointCounts"));
@@ -771,8 +755,8 @@ public class AdmReportEquipController {
         if(StrUtil.isEmpty(projectId)){
             return AdmResponse.failure(ResponseCode.A0400.getCode());
         }
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, context, true, true);
+        
+        JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, true, true);
         return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
     }
 
@@ -785,8 +769,8 @@ public class AdmReportEquipController {
         if(StrUtil.isEmpty(projectId)){
             return AdmResponse.failure(ResponseCode.A0400.getCode());
         }
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        JSONObject gatherInfoPoint = calInfoPointByObjType(AdmSystem.OBJ_TYPE, context, true, true);
+        
+        JSONObject gatherInfoPoint = calInfoPointByObjType(AdmSystem.OBJ_TYPE,true, true);
         return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
     }
 
@@ -802,7 +786,7 @@ public class AdmReportEquipController {
         criteria.put("objType","['equipment','component']");
         queryCriteria.setCriteria(criteria);
         queryCriteria.setOnlyCount(true);
-        List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteria);
+        List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null, queryCriteria);
         if(CollUtil.isNotEmpty(euipCom)){
            return AdmResponse.success(euipCom);
         }else{
@@ -817,14 +801,12 @@ public class AdmReportEquipController {
      */
     @PostMapping("/type")
     public AdmResponse equipType(@QueryParam("projectId") String projectId){
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         RequestData requestData = new RequestData();
         if(StrUtil.isNotEmpty(projectId)){
             requestData.setProjectId(projectId);
         }
         requestData.setObjType(AdmEquipment.OBJ_TYPE);
-        List<Map<String, Object>> result = DigitalObjectSimpleFacade.queryDefineInfoByObjType(context.getGroupCode(),projectId,context.getAppId(),null,requestData);
+        List<Map<String, Object>> result = DigitalObjectSimpleFacade.queryDefineInfoByObjType(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getProjectId(),AdmContextUtil.toDmpContext().getAppId(),null,requestData);
         if(CollUtil.isNotEmpty(result)){
             return AdmResponse.success(result);
         }else{
@@ -936,7 +918,7 @@ public class AdmReportEquipController {
         return hashMap;
     }
 
-    private JSONObject calInfoPointByObjType(String objType, InstanceUrlParam context, Boolean visible, Boolean getInfoCounts){
+    private JSONObject calInfoPointByObjType(String objType, Boolean visible, Boolean getInfoCounts){
         //1 查询项目下所有现有的系统
         AdmQueryCriteria admQueryCriteriaObj =  new AdmQueryCriteria();
         if(objType.equals(AdmEquipment.OBJ_TYPE)){
@@ -946,7 +928,7 @@ public class AdmReportEquipController {
         }
         admQueryCriteriaObj.setName(objType);
         QueryCriteria queryCriteriaSys = AdmQueryCriteriaHelper.toDmpCriteria(admQueryCriteriaObj);
-        List<ObjectNode> admObjList = DigitalObjectFacade.query(groupCode, context.getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteriaSys);
+        List<ObjectNode> admObjList = DigitalObjectFacade.query(groupCode, AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteriaSys);
 
         //2 获取动态 静态 信息点
         // 2.1 根据objType获取定义
@@ -956,7 +938,7 @@ public class AdmReportEquipController {
             ObjectNode criteria = JsonNodeFactory.instance.objectNode();
             criteria.put("objType", objType);
             queryCriteriaType.setCriteria(criteria);
-            AdmResponse admResponseType = dictService.doQueryObjectType(context, queryCriteriaType, AdmObjectType.class);
+            AdmResponse admResponseType = dictService.doQueryObjectType(AdmContextUtil.toDmpContext(), queryCriteriaType, AdmObjectType.class);
             if(CollUtil.isEmpty(admResponseType.getContent())){
                 return null;
             }
@@ -989,7 +971,7 @@ public class AdmReportEquipController {
                 criteria.put("valid","['0','1']");
                 queryCriteria.setCriteria(criteria);
                 queryCriteria.setOnlyCount(true);
-                List<ObjectInfoDefine> totalInfo = DigitalObjectInfoFacade.query(groupCode, context.getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
+                List<ObjectInfoDefine> totalInfo = DigitalObjectInfoFacade.query(groupCode, AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
                 controlInfoCounts = totalInfo.size();
                 criteria.remove("valid");
             }
@@ -1001,7 +983,7 @@ public class AdmReportEquipController {
                 criteria.put("valid","['0','1']");
             }
             queryCriteria.setCriteria(criteria);
-            List<ObjectInfoDefine> staticInfoCode = DigitalObjectInfoFacade.query(groupCode, context.getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
+            List<ObjectInfoDefine> staticInfoCode = DigitalObjectInfoFacade.query(groupCode, AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
             criteria.remove("category");
 
             //动态信息点
@@ -1009,7 +991,7 @@ public class AdmReportEquipController {
             category.put("$ne","STATIC");
             criteria.putPOJO("category", category);
             queryCriteria.setCriteria(criteria);
-            List<ObjectInfoDefine> dynamicInfoCode = DigitalObjectInfoFacade.query(groupCode, context.getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
+            List<ObjectInfoDefine> dynamicInfoCode = DigitalObjectInfoFacade.query(groupCode, AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
             //4 计算已采集的和需要采集的信息点占比
             //return customSqlService.systemInfoPoins()
             Map<String, Integer> hashMap = calculate(dynamicInfoCode, staticInfoCode, admObjList, 1);

+ 40 - 72
src/main/java/com/persagy/proxy/adm/controller/AdmShaftController.java

@@ -16,21 +16,18 @@ import com.persagy.dmp.define.entity.ObjectInfoDefine;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
 import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.*;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmBuildingService;
-import com.persagy.proxy.adm.service.IAdmDictBaseService;
 import com.persagy.proxy.adm.service.IAdmRelationService;
 import com.persagy.proxy.adm.service.IAdmShaftService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.common.entity.RelationDTO;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 
 import javax.ws.rs.QueryParam;
@@ -52,25 +49,19 @@ public class AdmShaftController {
     private IAdmRelationService relationService;
     @Autowired
     private IAdmBuildingService buildingService;
-    @Value("${middleware.group.code}")
-    private String groupCode;
-
 
     /**
      * 统计
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse count(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName("shaft");
         request.setOnlyCount(true);
-        return service.doQuery(context, request, AdmShaft.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmShaft.class);
     }
 
     /**
@@ -80,16 +71,14 @@ public class AdmShaftController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmResponse create(@RequestBody AdmCreateRequest<AdmShaft> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse create(@RequestBody AdmCreateRequest<AdmShaft> createRequest, @QueryParam("projectId") String projectId) throws Exception {       
         List<AdmShaft> vos = CollUtil.newArrayList(createRequest.getContent());
         vos.stream().forEach(admShaft -> {
             if (StrUtil.isEmpty(admShaft.getName())) {
                 admShaft.setName(ObjectNameUtil.objectName("竖井-"));
             }
         });
-        vos = service.doInsert(context, AdmShaft.class, vos);
+        vos = service.doInsert(AdmContextUtil.toDmpContext(), AdmShaft.class, vos);
 
         //TODO 创建竖井和建筑的关系
         /*if (!entity.buildingList.isNullOrEmpty()){
@@ -126,10 +115,8 @@ public class AdmShaftController {
      * @throws Exception
      */
     @PostMapping("/delete")
-    public AdmResponse delete(@QueryParam("projectId") String projectId, @RequestBody List<AdmShaft> vos) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        service.doDelete(context, vos);
+    public AdmResponse delete( @RequestBody List<AdmShaft> vos) throws Exception {       
+        service.doDelete(AdmContextUtil.toDmpContext(), vos);
         return AdmResponse.success();
     }
 
@@ -140,28 +127,23 @@ public class AdmShaftController {
      * @throws Exception
      */
     @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmShaft> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmShaft> createRequest, @QueryParam("projectId") String projectId) throws Exception {        
         List<AdmShaft> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doUpdate(context, AdmShaft.class, vos);
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmShaft.class, vos);
         return AdmResponse.success(vos);
     }
 
     /**
      * 查询
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse query(@RequestBody AdmQueryCriteria request) throws Exception {      
         request.setName("shaft");
-        return service.doQuery(context, request, AdmShaft.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmShaft.class);
     }
 
     /**
@@ -169,33 +151,27 @@ public class AdmShaftController {
      * 此方法可能会弃用
      *
      * 暂不实现
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query-with-count")
-    public AdmResponse queryWithCount(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse queryWithCount(@RequestBody AdmQueryCriteria request) throws Exception {       
         request.setName("shaft");
-        return service.doQuery(context, request, AdmShaft.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmShaft.class);
     }
 
     /**
      * 查询关联元空间
      * 可能移至关系
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/relate-space")
-    public AdmResponse queryRelateSp(@QueryParam("projectId") String projectId,
-                             @RequestBody JSONObject request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse queryRelateSp(@RequestBody JSONObject request) throws Exception {      
         //Sh2Sp
         // 先取消后重新建立
         if(JSONUtil.isNull(request)){
@@ -213,10 +189,10 @@ public class AdmShaftController {
         node.put("relCode", "Sh2Sp");
         node.put("objFrom", shaftId);
         criteria.setCriteria(node);
-        relationService.doDelete(context, criteria);
+        relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
 
         List<String> spaceIds = Arrays.asList(spaceId.split(","));
-        Set<String> existsIds = spaceExists(context, spaceIds);
+        Set<String> existsIds = spaceExists(spaceIds);
         List<String> failureList = null;
         if(CollUtil.isNotEmpty(existsIds)){
             failureList = spaceIds.stream().filter(isId -> !existsIds.contains(isId)).collect(Collectors.toList());
@@ -230,7 +206,7 @@ public class AdmShaftController {
                 relationDTOS.add(relationDTO);
             });
             List<ObjectNode> nodeList = JsonNodeUtils.toListNode(relationDTOS, null, null);
-            DigitalRelationFacade.create(context.getGroupCode(), context.getProjectId(),context.getAppId(), null, nodeList);
+            DigitalRelationFacade.create(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(),AdmContextUtil.toDmpContext().getAppId(), null, nodeList);
         }else{
             failureList = spaceIds;
         }
@@ -248,14 +224,12 @@ public class AdmShaftController {
      *     "id":"shaftFuncType",
      *     "name":"竖井功能"
      * }
-     * @param projectId
+     * 
      * @return
      * @throws Exception
      */
     @PostMapping("/query-shaft-functype")
-    public AdmResponse queryShFuncType(@QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse queryShFuncType(@QueryParam("projectId") String projectId) throws Exception {       
         if(StrUtil.isNotEmpty(projectId)){
             AdmResponse admResponse = AdmResponse.success();
             //查询参数请求查询的类型是否存在
@@ -265,14 +239,14 @@ public class AdmShaftController {
             filters.append(" classCode ='").append("shaft").append(" '");
             admQueryCriteria.setFilters(filters.toString());
             QueryCriteria dmpRequest = AdmQueryCriteriaHelper.toDmpCriteria(admQueryCriteria);
-            List<ObjectInfoDefine> defineList = DigitalObjectInfoFacade.query(context.getGroupCode(),context.getProjectId(),context.getAppId(),null,dmpRequest);
+            List<ObjectInfoDefine> defineList = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getProjectId(),AdmContextUtil.toDmpContext().getAppId(),null,dmpRequest);
             //是否有该类型的竖井信息
             if(CollUtil.isNotEmpty(defineList)){
                 //查询中台项目实际使用该信息点的竖井
                 RequestData requestData = new RequestData();
                 requestData.setObjType(AdmShaft.OBJ_TYPE);
                 requestData.setGroups(Arrays.asList("shaftFuncType"));
-                List<Map<String, Object>> listInfos = DigitalObjectSimpleFacade.queryObjectCountByObjInfos(context.getGroupCode(),context.getAppId(),null, requestData);
+                List<Map<String, Object>> listInfos = DigitalObjectSimpleFacade.queryObjectCountByObjInfos(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getAppId(),null, requestData);
 
                 if(CollUtil.isNotEmpty(listInfos)){
                     ArrayNode datasource = defineList.get(0).getDataSource();
@@ -301,19 +275,17 @@ public class AdmShaftController {
     /**
      * 查询和当前竖井有关联的业务空间
      * shaftId 为竖井id
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/shaft-zoneSpaceBaseTable")
-    public AdmResponse queryZoneSp(@QueryParam("projectId") String projectId, @RequestParam String shaftId,
+    public AdmResponse queryZoneSp(@RequestParam String shaftId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         // 组装条件
         QueryCriteria queryCriteria = new QueryCriteria();
-        if(!StrUtil.isAllNotEmpty(shaftId,projectId)) {
+        if(!StrUtil.isAllNotEmpty(shaftId,AdmContextUtil.toDmpContext().getProjectId())) {
             return AdmResponse.failure("必填项:shaftId(竖井id)、projectId(项目id)");
         }
         ObjectNode criteria = JsonNodeFactory.instance.objectNode();
@@ -324,7 +296,7 @@ public class AdmShaftController {
         criteria.put("objType", AdmSpace.OBJ_TYPE);
         queryCriteria.setCriteria(relationTO);
 
-        List<ObjectNode> spaceList = DigitalObjectFacade.query(context.getGroupCode(), context.getProjectId(), context.getAppId(), null, queryCriteria);
+        List<ObjectNode> spaceList = DigitalObjectFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(), null, queryCriteria);
         if(CollUtil.isNotEmpty(spaceList)){
             List<AdmSpace> vos = JSONUtil.toList(spaceList.toString(), AdmSpace.class);
             return AdmResponse.success(spaceList);
@@ -336,18 +308,16 @@ public class AdmShaftController {
     /**
      * 查询和当前竖井有关联的业务空间所在建筑及楼层信息
      * shaftId 为竖井id
-     * @param projectId
+     * 
      * @return
      * @throws Exception
      */
     @PostMapping("/shaft-zoneSpaceBaseTable-building")
-    public AdmResponse queryZoneSpBd(@QueryParam("projectId") String projectId, @RequestParam String shaftId,
+    public AdmResponse queryZoneSpBd( @RequestParam String shaftId,
              @RequestParam String objectType) throws Exception {
-        if(!StrUtil.isAllNotEmpty(shaftId,projectId)) {
+        if(!StrUtil.isAllNotEmpty(shaftId,AdmContextUtil.toDmpContext().getProjectId())) {
             return AdmResponse.failure("必填项:shaftId(竖井id)、projectId(项目id)");
         }
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         // 组装条件 查询竖井下的空间
         AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
         admQueryCriteria.setName(AdmSpace.OBJ_TYPE);
@@ -365,7 +335,7 @@ public class AdmShaftController {
         criteria.put("objType", AdmSpace.OBJ_TYPE);
         queryCriteria.setCriteria(criteria);
 
-        List<ObjectNode> spaceList = DigitalObjectFacade.query(context.getGroupCode(), context.getProjectId(), context.getAppId(), null, queryCriteria);
+        List<ObjectNode> spaceList = DigitalObjectFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(), null, queryCriteria);
         if(CollUtil.isNotEmpty(spaceList)){
             AdmQueryCriteria queryCriteriaBd = new AdmQueryCriteria();
             queryCriteriaBd.setName(AdmBuilding.OBJ_TYPE);
@@ -385,7 +355,7 @@ public class AdmShaftController {
             admSpaceMap.keySet().stream().forEach(spaceId -> filter.append(spaceId).append("','"));
             String filters = StrUtil.sub(filter.toString(), 0,-2)+"]";
             queryCriteriaBd.setFilters(filters);
-            AdmResponse response =  buildingService.doQuery(context, queryCriteriaBd, AdmBuilding.class);
+            AdmResponse response =  buildingService.doQuery(AdmContextUtil.toDmpContext(), queryCriteriaBd, AdmBuilding.class);
             return response;
         }else{
             return AdmResponse.success();
@@ -395,19 +365,17 @@ public class AdmShaftController {
     /**
      * 查询和当前竖井没有关联的业务空间
      * shaftId 为竖井id
-     * @param projectId
+     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/un-shaft-zoneSpaceBaseTable")
-    public AdmResponse queryUnZoneSp(@QueryParam("projectId") String projectId, @RequestParam String shaftId,
+    public AdmResponse queryUnZoneSp( @RequestParam String shaftId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         // 组装条件
         QueryCriteria queryCriteria = new QueryCriteria();
-        if(!StrUtil.isAllNotEmpty(shaftId,projectId)) {
+        if(!StrUtil.isAllNotEmpty(shaftId,AdmContextUtil.toDmpContext().getProjectId())) {
             return AdmResponse.failure("必填项:shaftId(竖井id)、projectId(项目id)");
         }
         ObjectNode criteria = JsonNodeFactory.instance.objectNode();
@@ -419,7 +387,7 @@ public class AdmShaftController {
 
         criteria.put("objType", "space");
         queryCriteria.setCriteria(relationTO);
-        List<ObjectNode> spaceList = DigitalObjectFacade.query(context.getGroupCode(), context.getProjectId(), context.getAppId(), null, queryCriteria);
+        List<ObjectNode> spaceList = DigitalObjectFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(), null, queryCriteria);
         if(CollUtil.isNotEmpty(spaceList)){
             List<AdmSpace> vos = JSONUtil.toList(spaceList.toString(), AdmSpace.class);
             return AdmResponse.success(spaceList);
@@ -434,14 +402,14 @@ public class AdmShaftController {
      * @param       spaceIds       failureList
      * @return      是否存在
      */
-    private Set<String> spaceExists(InstanceUrlParam context, List<String> spaceIds) {
+    private Set<String> spaceExists(List<String> spaceIds) {
         QueryCriteria queryCriteria = new QueryCriteria();
         ObjectNode node = JsonNodeFactory.instance.objectNode();
         ArrayNode arrayNode = node.putObject("id").putArray("$in");
         spaceIds.stream().forEach(spaceId -> arrayNode.add(spaceId));
         node.put("objType","ispace");
         queryCriteria.setCriteria(node);
-        List<ObjectNode> ispaces = DigitalObjectFacade.query(context.getGroupCode(),context.getProjectId(),context.getAppId(),context.getAppId(),queryCriteria);
+        List<ObjectNode> ispaces = DigitalObjectFacade.query(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getProjectId(),AdmContextUtil.toDmpContext().getAppId(),AdmContextUtil.toDmpContext().getAppId(),queryCriteria);
         if(CollUtil.isNotEmpty(ispaces)){
             List<AdmISpace> iSpaceList = JSONUtil.toList(JSONUtil.parseArray(ispaces.toString()), AdmISpace.class);
             Map<String, AdmISpace> admISpaceMap = CollUtil.fieldValueMap(iSpaceList, BaseEntity.PROP_ID);

+ 37 - 71
src/main/java/com/persagy/proxy/adm/controller/AdmSpaceController.java

@@ -7,7 +7,6 @@ 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.model.*;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
@@ -16,10 +15,9 @@ import com.persagy.proxy.adm.service.IAdmBuildingService;
 import com.persagy.proxy.adm.service.IAdmFloorService;
 import com.persagy.proxy.adm.service.IAdmRelationService;
 import com.persagy.proxy.adm.service.IAdmSpaceService;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.RelationDTO;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -46,24 +44,19 @@ public class AdmSpaceController {
     private IAdmRelationService relationService;
     @Autowired
     private IAdmFloorService floorService;
-    @Value("${middleware.group.code}")
-    private String groupCode;
 
     /**
      * 统计
-     * @param projectId
+     *
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse count(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName("space");
         request.setOnlyCount(true);
-        return service.doQuery(context, request, AdmSpace.class);
+        return service.doQuery( AdmContextUtil.toDmpContext(), request, AdmSpace.class);
     }
     /**
      * 创建
@@ -73,8 +66,6 @@ public class AdmSpaceController {
      */
     @PostMapping("/create")
     public AdmResponse create(@RequestBody AdmCreateRequest<AdmSpace> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmSpace> vos = CollUtil.newArrayList(createRequest.getContent());
         String msg = null;
         for (AdmSpace admSpace : vos) {
@@ -84,7 +75,7 @@ public class AdmSpaceController {
             }
         }
         if(StrUtil.isNotEmpty(msg)){
-            vos = service.doInsertExt(context, AdmSpace.class, vos);
+            vos = service.doInsertExt( AdmContextUtil.toDmpContext(), AdmSpace.class, vos);
             return AdmResponse.success(vos);
         }else{
             return AdmResponse.failure(msg);
@@ -99,15 +90,13 @@ public class AdmSpaceController {
      * @throws Exception
      */
     @PostMapping("/delete")
-    public AdmResponse delete(@QueryParam("projectId") String projectId, @RequestBody List<AdmSpace> vos) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        service.doDelete(context, vos);
+    public AdmResponse delete( @RequestBody List<AdmSpace> vos) throws Exception {
+        service.doDelete( AdmContextUtil.toDmpContext(), vos);
         QueryCriteria queryCriteria = new QueryCriteria();
         vos.forEach(vo -> {
             /** 清除空间和建筑楼层的的数据 */
-            dealRelation(vo.getId(),context,queryCriteria,"Bd2Sp");
-            dealRelation(vo.getId(),context,queryCriteria,"Fl2Sp");
+            dealRelation(vo.getId(), queryCriteria,"Bd2Sp");
+            dealRelation(vo.getId(), queryCriteria,"Fl2Sp");
         });
         return AdmResponse.success();
     }
@@ -120,41 +109,33 @@ public class AdmSpaceController {
      */
     @PostMapping("/update")
     public AdmResponse update(@RequestBody AdmCreateRequest<AdmSpace> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmSpace> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doUpdate(context, AdmSpace.class, vos);
+        vos = service.doUpdate( AdmContextUtil.toDmpContext(), AdmSpace.class, vos);
         return AdmResponse.success(vos);
     }
 
     /**
      * 查询
-     * @param projectId
+     *
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmDCSQueryRequest request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        return service.doQuerySpaces(context, request);
+    public AdmResponse query(@RequestBody AdmDCSQueryRequest request) throws Exception {
+        return service.doQuerySpaces( AdmContextUtil.toDmpContext(), request);
     }
 
     /**
      * 查询业务空间的建筑楼层,包含受影响的空间数量
-     * @param projectId
+     *
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/building-floor")
-    public AdmResponse queryBuildingFloor(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        request.setName("building");
+    public AdmResponse queryBuildingFloor(@RequestBody AdmQueryCriteria request) throws Exception {
+        request.setName(AdmBuilding.OBJ_TYPE);
         AdmQueryCriteria criteriaFloor = new AdmQueryCriteria();
         criteriaFloor.setName(AdmFloor.OBJ_TYPE);
 
@@ -164,7 +145,7 @@ public class AdmSpaceController {
 
         criteriaFloor.setCascade(CollUtil.newArrayList(criteriaSpace));
         request.setCascade(CollUtil.newArrayList(criteriaFloor));
-        AdmResponse response = buildingService.doQueryBuildingFloor(context, request);
+        AdmResponse response = buildingService.doQueryBuildingFloor( AdmContextUtil.toDmpContext(), request);
         List<AdmBuilding> buildings = (List<AdmBuilding>) response.getContent();
         buildings.stream().forEach(building -> {
             if(CollUtil.isNotEmpty(building.getFloor())){
@@ -195,8 +176,6 @@ public class AdmSpaceController {
         if(CollUtil.isEmpty(voList)){
             return AdmResponse.failure("不可以传入空数据");
         }
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         //TODO 循环删除 需要改为 批量删除
         List<RelationDTO> RSpInBd_up = new ArrayList<>();
         List<RelationDTO> RSpInFl_up = new ArrayList<>();
@@ -208,14 +187,14 @@ public class AdmSpaceController {
             String type = requestData.getType();//classCode
 
             /** 清除空间和建筑楼层的的数据 */
-            dealRelation(spaceId,context,queryCriteria,"Bd2Sp");
-            dealRelation(spaceId,context,queryCriteria,"Fl2Sp");
+            dealRelation(spaceId, queryCriteria,"Bd2Sp");
+            dealRelation(spaceId, queryCriteria,"Fl2Sp");
 
             if(StrUtil.isNotEmpty(id)){
                 if(id.startsWith("Fl") && StrUtil.isNotEmpty(spaceId)){
                     AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
                     admQueryCriteria.setName(AdmFloor.OBJ_TYPE);
-                    AdmResponse admResponseFl = floorService.doQuery(context, admQueryCriteria, AdmFloor.class);
+                    AdmResponse admResponseFl = floorService.doQuery( AdmContextUtil.toDmpContext(), admQueryCriteria, AdmFloor.class);
                     if(CollUtil.isNotEmpty(admResponseFl.getContent())){
                         AdmFloor floor = JSONUtil.toBean(admResponseFl.getContent().get(0).toString(), AdmFloor.class);
                         if (floor!=null){
@@ -263,9 +242,9 @@ public class AdmSpaceController {
                 }
             }
         });
-        service.doUpdate(context, AdmSpace.class, space_up);
-        relationService.doSave(context, RSpInBd_up);
-        relationService.doSave(context, RSpInFl_up);
+        service.doUpdate( AdmContextUtil.toDmpContext(), AdmSpace.class, space_up);
+        relationService.doSave( AdmContextUtil.toDmpContext(), RSpInBd_up);
+        relationService.doSave( AdmContextUtil.toDmpContext(), RSpInFl_up);
          return AdmResponse.success(space_up);
     }
 
@@ -277,26 +256,21 @@ public class AdmSpaceController {
      */
     @PostMapping("/update-outline")
     public AdmResponse updateOutLine(@RequestBody AdmCreateRequest<AdmSpace> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmSpace> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doUpdate(context, AdmSpace.class, vos);
+        vos = service.doUpdate( AdmContextUtil.toDmpContext(), AdmSpace.class, vos);
         //TODO 更新计算关系ZoneSpaceBaseService.upDateOutline
         return AdmResponse.success(vos);
     }
 
     /**
      * 查询空间信息-outline 级联查询:建筑(building),楼层(floor),空间类型(objectType)
-     * @param projectId
+     *
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query-outline")
-    public AdmResponse queryOutline(@QueryParam("projectId") String projectId,
-                                      @RequestBody AdmDCSQueryRequest request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse queryOutline(@RequestBody AdmDCSQueryRequest request) throws Exception {
         request.setName(AdmSpace.OBJ_TYPE);
         request.setProjection(null);
         List<String> list = new ArrayList<>();
@@ -310,61 +284,53 @@ public class AdmSpaceController {
         list.add("infos");
         list.add("properties");
         request.setProjection(list);
-        return service.doQuerySpaces(context, request);
+        return service.doQuerySpaces( AdmContextUtil.toDmpContext(), request);
     }
 
 
     /**
      * 获取项目下已有的空间类型
-     * @param projectId
+     *
      * @return
      * @throws Exception
      */
     @PostMapping("/space-type")
     public List<JSONObject> querySpaceType(@QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        return service.doQuerySpaceTypes(context);
+        return service.doQuerySpaceTypes( AdmContextUtil.toDmpContext());
     }
 
     /**
      * 查询业务空间所有类型
-     * @param projectId
+     *
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/type")
-    public AdmResponse queryType(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmDCSQueryRequest request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        return service.doQueryType(context, request);
+    public AdmResponse queryType(@RequestBody AdmDCSQueryRequest request) throws Exception {
+        return service.doQueryType( AdmContextUtil.toDmpContext(), request);
     }
 
 
     /**
      * 上传EXCEL 识别镜头信息点
-     * @param projectId
+     *
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/import")
-    public AdmResponse importExcel(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse importExcel(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmSpace.OBJ_TYPE);
-        return service.doQuery(context, request, AdmSpace.class);
+        return service.doQuery( AdmContextUtil.toDmpContext(), request, AdmSpace.class);
     }
 
 
-    private void dealRelation(String spaceId, InstanceUrlParam context, QueryCriteria queryCriteria, String relCode){
+    private void dealRelation(String spaceId, QueryCriteria queryCriteria, String relCode){
         ObjectNode rBd = JsonNodeFactory.instance.objectNode();
         rBd.put("objTo",spaceId);
         rBd.put("relCode",relCode);
         queryCriteria.setCriteria(rBd);
-        relationService.doDelete(context, queryCriteria);
+        relationService.doDelete( AdmContextUtil.toDmpContext(), queryCriteria);
     }
 }

+ 238 - 217
src/main/java/com/persagy/proxy/adm/controller/AdmSystemController.java

@@ -2,9 +2,12 @@ package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
+import com.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.dto.RequestData;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.common.model.entity.BaseEntity;
 import com.persagy.dmp.define.client.DigitalDefineFacade;
@@ -12,19 +15,20 @@ import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
 import com.persagy.dmp.digital.entity.ObjectRelation;
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
 import com.persagy.proxy.adm.model.*;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmBuildingService;
+import com.persagy.proxy.adm.service.IAdmDictService;
 import com.persagy.proxy.adm.service.IAdmFloorService;
 import com.persagy.proxy.adm.service.IAdmSystemService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.common.entity.DmpResult;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 
 import javax.json.JsonObject;
@@ -49,24 +53,21 @@ public class AdmSystemController {
     private IAdmBuildingService buildingService;
     @Autowired
     private IAdmFloorService floorService;
-    @Value("${middleware.group.code}")
-    private String groupCode;
+    @Autowired
+    private IAdmDictService dictService;
 
     /**
      * 统计
-     * @param projectId
+
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse count(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmSystem.OBJ_TYPE);
         request.setOnlyCount(true);
-        return service.doQuery(context, request, AdmSystem.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
     }
 
     /**
@@ -77,10 +78,8 @@ public class AdmSystemController {
      */
     @PostMapping("/create")
     public AdmResponse create(@RequestBody AdmCreateRequest<AdmSystem> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmSystem> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doInsert(context, AdmSystem.class, vos);
+        vos = service.doInsert(AdmContextUtil.toDmpContext(), AdmSystem.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -92,8 +91,6 @@ public class AdmSystemController {
      */
     @PostMapping("/create-bd-fl")
     public AdmResponse createBdFl(@RequestBody AdmCreateRequest<AdmSystem> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmSystem> vos = CollUtil.newArrayList(createRequest.getContent());
 
         Map<String, AdmSystem> admSystemMap = CollUtil.fieldValueMap(vos, "classCode");
@@ -103,7 +100,7 @@ public class AdmSystemController {
         ArrayNode array = criteria.putObject("code").putArray("$in");
         admSystemMap.keySet().stream().forEach(classCode -> array.add(classCode));
         defineCriteria.setCriteria(criteria);
-        List<ObjectTypeDefine> defineList = DigitalDefineFacade.queryObjectType(context.getGroupCode(),context.getProjectId(),context.getAppId(),null,defineCriteria);
+        List<ObjectTypeDefine> defineList = DigitalDefineFacade.queryObjectType(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getProjectId(),AdmContextUtil.toDmpContext().getAppId(),null,defineCriteria);
         Map<String, ObjectTypeDefine> defineMap = CollUtil.fieldValueMap(defineList, "code");
         vos.stream().forEach(admSystem -> {
             if(StrUtil.isEmpty(admSystem.getName())){
@@ -114,7 +111,7 @@ public class AdmSystemController {
                 }
             }
         });
-        vos = service.doInsert(context, AdmSystem.class, vos);
+        vos = service.doInsert(AdmContextUtil.toDmpContext(), AdmSystem.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -125,10 +122,8 @@ public class AdmSystemController {
      * @throws Exception
      */
     @PostMapping("/delete")
-    public AdmResponse delete(@QueryParam("projectId") String projectId, @RequestBody List<AdmSystem> vos) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        service.doDelete(context, vos);
+    public AdmResponse delete( @RequestBody List<AdmSystem> vos) throws Exception {
+        service.doDelete(AdmContextUtil.toDmpContext(), vos);
         return AdmResponse.success();
     }
 
@@ -140,28 +135,24 @@ public class AdmSystemController {
      */
     @PostMapping("/update")
     public AdmResponse update(@RequestBody AdmCreateRequest<AdmSystem> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmSystem> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doUpdate(context, AdmSystem.class, vos);
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmSystem.class, vos);
         return AdmResponse.success(vos);
     }
 
     /**
      * 系统绑定的动态信息点或静态信息点
      * type: static(静态),iot (动态)
-     * @param projectId
+
      * @param request
      * @return
      * @throws Exception
      */
     @GetMapping("/export")
-    public AdmResponse exportInfos(@QueryParam("projectId") String projectId,
+    public AdmResponse exportInfos(
                              @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         request.setName(AdmSystem.OBJ_TYPE);
-        return service.doQuery(context, request, AdmSystem.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
     }
 
     /**
@@ -172,8 +163,6 @@ public class AdmSystemController {
      */
     @PostMapping("/link-equip")
     public AdmResponse createRelateEquip(@RequestBody JsonObject createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         String sysId = createRequest.get("sysId").toString();
         List<String> equipIdList = (List<String>)createRequest.get("equipIdList");
         List<ObjectNode> relations = new ArrayList<>(equipIdList.size());
@@ -184,24 +173,39 @@ public class AdmSystemController {
             objectNode.put("objFrom", sysId);
             objectNode.put("objTo", euipId);
         });
-        List<ObjectRelation> list = DigitalRelationFacade.create(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, relations);
+        List<ObjectRelation> list = DigitalRelationFacade.create(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(), null, relations);
         return AdmResponse.success(list);
     }
 
     /**
      * 查询
-     * @param projectId
+
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse query(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmSystem.OBJ_TYPE);
-        return service.doQuery(context, request, AdmSystem.class);
+        AdmResponse admResponse = service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
+        List<AdmSystem> systemList = (List<AdmSystem>) admResponse.getContent();
+        if(CollUtil.isNotEmpty(systemList)){
+            AdmDict admDict = new AdmDict();
+            admDict.setType(AdmSystem.OBJ_TYPE);
+            AdmResponse admResponseDic = dictService.queryCategory(AdmContextUtil.toDmpContext(), admDict, AdmObjectType.class);
+            if(CollUtil.isNotEmpty(admResponseDic.getContent())){
+                List<AdmObjectType> admDictList = (List<AdmObjectType>) admResponseDic.getContent();
+                Map<String, AdmObjectType> admDictMap = CollUtil.fieldValueMap(admDictList, "code");
+                systemList.stream().forEach(admSystem -> {
+                    if(admDictMap.keySet().contains(admSystem.getClassCode())){
+                        AdmObjectType admDictTemp = admDictMap.get(admSystem.getClassCode());
+                        admSystem.setCategoryName(admDictTemp.getName());
+                    }
+                });
+                admResponse.setContent(systemList);
+            }
+        }
+        return admResponse;
     }
 
 
@@ -209,8 +213,10 @@ public class AdmSystemController {
      * 查询系统信息-系统建筑楼层一对多
      * MajorName 专业名称 ,级联查询 系统分类名(categoryNames),系统下的设备(equipmentList),系统下的竖井(shaftList),业务空间(zoneSpaceBaseTableList)
      *
+     * 明确建筑楼层的 adm级联 查询获取建筑楼层信息  使用正常接口 先查询楼层 再根据楼层信息拼接建筑
+     * 未明确建筑/未明确楼层 中台定制接口
+     *
      * 这个参见中心代码,
-     * @param projectId
      * @param buildingId buildingId=1,未明确建筑
      * @param floorId   floorId=1,未明确楼层
      * @param request
@@ -218,196 +224,219 @@ public class AdmSystemController {
      * @throws Exception
      */
     @PostMapping("/query-new")
-    public AdmResponse queryNew(@QueryParam("projectId") String projectId, @QueryParam("buildingId") String buildingId,
+    public AdmResponse queryNew(@QueryParam("buildingId") String buildingId,
                                 @QueryParam("floorId") String floorId, @RequestBody AdmQueryCriteria request) throws Exception {
-        if(StrUtil.isEmpty(projectId)){
-            return AdmResponse.failure("项目id为空");
-        }
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        if(StrUtil.isAllNotEmpty(buildingId, floorId) && !"1".equals(buildingId) && !"1".equals(floorId)){
-            //系统级联建筑 楼层
-            AdmResponse syses = service.doQuery(context, request, AdmSystem.class);
-            if(CollUtil.isEmpty(syses.getContent())){
-                return syses;
-            }
-            AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
-            admQueryCriteria.setName(AdmBuilding.OBJ_TYPE);
-            admQueryCriteria.setFilters("id = "+buildingId);
-            AdmResponse buildings = buildingService.doQuery(context, request, AdmBuilding.class);
-
-            admQueryCriteria = new AdmQueryCriteria();
-            admQueryCriteria.setName(AdmFloor.OBJ_TYPE);
-            admQueryCriteria.setFilters("id = "+floorId);
-            AdmResponse floors = floorService.doQuery(context, request, AdmFloor.class);
+        AdmResponse syses = new AdmResponse();
+        if(StrUtil.isAllEmpty(buildingId,floorId)){
+            //case one 查询全部系统,级联建筑,建筑级联楼层
+            AdmQueryCriteria admQueryCriteriaBd = new AdmQueryCriteria();
+            admQueryCriteriaBd.setName("buildingList");
+            List<AdmQueryCriteria> cascadeBd = new ArrayList<>(1);
+            AdmQueryCriteria admQueryCriteriaFl = new AdmQueryCriteria();
+            admQueryCriteriaFl.setName("floor");
+            cascadeBd.add(admQueryCriteriaFl);
+            admQueryCriteriaBd.setCascade(cascadeBd);
+
+            List<AdmQueryCriteria> cascade = new ArrayList<>(1);
+            cascade.add(admQueryCriteriaBd);
+            request.setCascade(cascade);
+            syses = service.doQuery(AdmContextUtil.toDmpContext(),request,AdmSystem.class);
             //处理数据 BuildingFloorInfo
-            AdmBuildingFloorInfo buildingFloorInfo = new AdmBuildingFloorInfo();
-            if(CollUtil.isNotEmpty(floors.getContent())){
-                AdmFloor floor = (AdmFloor) floors.getContent().get(0);
-                buildingFloorInfo.setFloorName(floor.getLocalName());
-                buildingFloorInfo.setFloorID(floorId);
-            }
-            if(CollUtil.isNotEmpty(buildings.getContent())){
-                AdmBuilding building = (AdmBuilding) floors.getContent().get(0);
-                buildingFloorInfo.setBuildName(building.getLocalName());
-                buildingFloorInfo.setBuildID(buildingId);
-            }
-            List<AdmSystem> admSystemList = (List<AdmSystem>) syses.getContent();
-            admSystemList.stream().forEach( admSystem -> {
-                admSystem.setBuildingFloorInfoList(CollUtil.newArrayList(buildingFloorInfo));
-            });
-            syses.setContent(admSystemList);
-            return syses;
-        }
-
-
-
-        return null;
-       /*
-        QueryCriteria queryCriteria_sysInFl = new QueryCriteria();
-        ObjectNode criteria_sysInFl = JsonNodeFactory.instance.objectNode();
-        criteria_sysInFl.put("relCode","Sy2Fl");
-        criteria_sysInFl.put("graphCode", "MechInArch");
-
-        QueryCriteria queryCriteria_sysInBd = new QueryCriteria();
-        ObjectNode criteria_sysInBd= JsonNodeFactory.instance.objectNode();
-        criteria_sysInBd.put("graphCode", "MechInArch");
-        criteria_sysInBd.put("relCode","Sy2Bd");
-
-        QueryCriteria queryCriteriaObj = AdmQueryCriteriaHelper.toDmpCriteria(request);
-        ObjectNode criteria_obj = JsonNodeFactory.instance.objectNode();
-        criteria_obj.put("objType", AdmSystem.OBJ_TYPE);
-
-        Set<String> sysIds = new HashSet<>();
-        List<ObjectRelation> relations_SysInFl = null;
-        if(StrUtil.isAllNotEmpty(buildingId,floorId)&&!floorId.equals("1")){
-            *//** 楼层id不为空且不为1,建筑id为空 ---> 系统和楼层关系表 取系统id  408 --> 明确建筑明确楼层->空间*//*
-            criteria_sysInFl.put("objTo", floorId);
-            queryCriteria_sysInFl.setCriteria(criteria_sysInFl);
-            relations_SysInFl = DigitalRelationFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteria_sysInFl);
-            if(CollUtil.isNotEmpty(relations_SysInFl)){
-                sysIds = relations_SysInFl.stream().map(ObjectRelation::getObjFrom).collect(Collectors.toSet());
+            if(CollUtil.isNotEmpty(syses.getContent())){
+                List<AdmSystem> admSystemList = (List<AdmSystem>) syses.getContent();
+                admSystemList.stream().forEach(admSystem -> {
+                    List<AdmBuildingFloorInfo> buildingFloorInfoList = new ArrayList<>();
+                    List<AdmBuilding> buildingList = admSystem.getBuildingList();
+                    if(CollUtil.isNotEmpty(buildingList)){
+                        buildingList.stream().forEach(admBuilding -> {
+                            List<AdmFloor> admFloorList = admBuilding.getFloor();
+                            if(CollUtil.isNotEmpty(admFloorList)){
+                                admFloorList.stream().forEach(floor -> {
+                                    AdmBuildingFloorInfo info = new AdmBuildingFloorInfo();
+                                    info.setBuildID(admBuilding.getId());
+                                    info.setBuildName(admBuilding.getLocalName());
+                                    info.setFloorID(floor.getId());
+                                    info.setFloorName(floor.getLocalName());
+                                    buildingFloorInfoList.add(info);
+                                });
+                            }else{
+                                AdmBuildingFloorInfo info = new AdmBuildingFloorInfo();
+                                info.setBuildID(admBuilding.getId());
+                                info.setBuildName(admBuilding.getLocalName());
+                                buildingFloorInfoList.add(info);
+                            }
+                        });
+                        admSystem.setBuildingFloorInfoList(buildingFloorInfoList);
+                        admSystem.setBuildingList(null);
+                    } else{
+                        admSystem.setBuildingFloorInfoList(buildingFloorInfoList);
+                    }
+                });
+                syses.setContent(admSystemList);
             }
-            ensureCondion(context, null, sysIds, criteria_obj,true);
-        }else if(StrUtil.isAllNotEmpty(buildingId,floorId)&&floorId.equals("1")&&!buildingId.equals("1")){
-            *//** 楼层id为空,建筑id不为空且不为1 ---> 系统和建筑关系表 取系统id  421*//*
-            // 明确建筑 未明确楼层
-            relations_SysInFl = DigitalRelationFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteria_sysInFl);
-            if(CollUtil.isNotEmpty(relations_SysInFl)){
-                List<String> sysIds_floor = relations_SysInFl.stream().map(ObjectRelation::getObjFrom).collect(Collectors.toList());
-                criteria_sysInBd.put("objTo", buildingId);
-                ArrayNode arrayNode = criteria_sysInBd.putObject("$notcontains").putArray("objFrom");
-                sysIds_floor.stream().forEach(id -> arrayNode.add(id));
-                queryCriteria_sysInBd.setCriteria(criteria_sysInBd);
-                ensureCondion(context, queryCriteria_sysInBd, sysIds, criteria_obj,true);
+        }else{
+            QueryCriteria rwdQueryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
+            ObjectNode criteria = rwdQueryCriteria.getCriteria();
+            if(JSONUtil.isNull(criteria)){
+                return AdmResponse.failure("请求参数错误");
             }
-        }else if(StrUtil.isEmpty(floorId) && StrUtil.isNotEmpty(buildingId) && buildingId.equals("1")){
-            *//** 楼层id为1,建筑id为1 ---> 系统id不在(系统和楼层关系表 取系统id  系统和建筑关系表 取系统id)之内 450*//*
-            //未明确建筑 没有Sy2Bd关系的系统
-            ensureCondion(context, queryCriteria_sysInBd, sysIds, criteria_obj,false);
-        }else if(StrUtil.isEmpty(floorId) && StrUtil.isNotEmpty(buildingId) && !buildingId.equals("1")){
-            *//** 楼层id不为空,建筑id不为空 ---> 系统和楼层关系表 取系统id  将建筑id作为条件 461*//*
-            criteria_sysInBd.put("objTo", buildingId);
-            queryCriteria_sysInBd.setCriteria(criteria_sysInBd);
-            ensureCondion(context, queryCriteria_sysInBd, sysIds, criteria_obj,true);
-        } else if(StrUtil.isAllEmpty(floorId, buildingId)){
-            *//** 楼层id为空,建筑id为空 ---> 查询所有 *//*
-        }
-        queryCriteriaObj.setCriteria(criteria_obj);
-        List<ObjectNode> systems = DigitalObjectFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteriaObj);
-        if(CollUtil.isNotEmpty(systems)){
-            List<AdmSystem> admSystemList = JSONUtil.toList(systems.toString(), AdmSystem.class);
-            if(StrUtil.isNotEmpty(buildingId)){
-                if(!buildingId.equals("1")){
-                    //处理数据 添加每个系统关联的建筑楼层信息, 查看全部信息展示所在建筑
-                    //查询关联的建筑信息
-                    QueryCriteria queryCriteriaInfo = new QueryCriteria();
-                    ObjectNode criteria = JsonNodeFactory.instance.objectNode();
-                    ArrayNode arrayNode = criteria.putObject("id").putArray("$in");
-                    arrayNode.add(buildingId);
-                    if(StrUtil.isNotEmpty(floorId)){
-                        //明确的建筑,明确的楼层  查询建筑关联的楼层信息 如果Sy2Fl -> Sy2Bd & Bd2Fl
-                        if(!floorId.equals("1")){
-                            arrayNode.add(floorId);
-                        }
-                        queryCriteriaInfo.setCriteria(criteria);
-                        List<ObjectNode> objs = DigitalObjectFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteriaInfo);
-                        if(CollUtil.isNotEmpty(objs)){
-                            List<ObjectDigital> objectDigitals = JSONUtil.toList(objs.toString(), ObjectDigital.class);
-                            AdmBuildingFloorInfo admBuildingFloorInfo =  new AdmBuildingFloorInfo();
-                            objectDigitals.forEach(objectDigital -> {
-                                if(objectDigital.getObjType().equals(AdmFloor.OBJ_TYPE)){
-                                    admBuildingFloorInfo.setFloorID(objectDigital.getId());
-                                    admBuildingFloorInfo.setFloorName(objectDigital.getLocalName());
-                                }
-                                if(objectDigital.getObjType().equals(AdmBuilding.OBJ_TYPE)){
-                                    admBuildingFloorInfo.setBuildID(objectDigital.getId());
-                                    admBuildingFloorInfo.setBuildName(objectDigital.getLocalName());
-                                }
-                            });
-                            admSystemList.stream().forEach(admSystem -> admSystem.setBuildingFloorInfoList(CollUtil.newArrayList(admBuildingFloorInfo)));
-                        }
+            criteria.put("objType", AdmSystem.OBJ_TYPE);
+            List<AdmSystem> admSystemList = null;
+            if (StrUtil.isAllNotEmpty(buildingId, floorId)) {
+                if(!"1".equals(floorId)){
+                    //case two 明确建筑、明确楼层的 系统
+                    JSONObject relationFrom = new JSONObject();
+                    relationFrom.put("relCode", "Sy2Fl");
+                    relationFrom.put("graphCode", "MechInArch");
+                    relationFrom.put("objTo", floorId);
+                    criteria.putPOJO("relationFrom",relationFrom);
+                    rwdQueryCriteria.setCriteria(criteria);
+                    syses = service.doQuery(AdmContextUtil.toDmpContext(), rwdQueryCriteria, AdmSystem.class);
+                    if (CollUtil.isNotEmpty(syses.getContent())) {
+                        admSystemList = (List<AdmSystem>) syses.getContent();
                     }
+
+                }else if("1".equals(floorId)){
+                    //case three 明确建筑 不明确楼层
+                    admSystemList = queryNotSureObj(buildingId, rwdQueryCriteria);
+                    //处理通用返回结果
+                    dealRespose(syses, request);
+                }
+                if(CollUtil.isNotEmpty(admSystemList)){
+                    //处理数据 BuildingFloorInfo
+                    admSystemList = dealBdFlInfo(floorId,buildingId,admSystemList);
+                    syses.setContent(admSystemList);
                 }
             }else{
-                //查询每个系统的建筑楼层信息
-                Map<String, AdmSystem> admSystemMap = CollUtil.fieldValueMap(admSystemList, BaseEntity.PROP_ID);
-                //查询
-                //查询楼层
+                //处理通用返回结果
+                dealRespose(syses, request);
+                if(StrUtil.isNotEmpty(buildingId) && buildingId.equals("1")){
+                    //case four 未明确建筑
+                    admSystemList = queryNotSureObj(null, rwdQueryCriteria);
+                    if(CollUtil.isNotEmpty(admSystemList)){
+                        //处理数据 BuildingFloorInfo
+                        admSystemList = dealBdFlInfo(null,null, admSystemList);
+                        syses.setContent(admSystemList);
+                    }
+                }
             }
-            return AdmResponse.success(systems);
+            if(CollUtil.isNotEmpty(admSystemList))
+                syses.setTotal(admSystemList.size()*1l);
+
+        }
+        return syses;
+    }
+
+    private void dealRespose(AdmResponse syses, AdmQueryCriteria request){
+        syses.setPageSize(request.getPageSize());
+        syses.setPageNumber(request.getPageNumber());
+        syses.setResult(DmpResult.SUCCESS);
+        syses.setTotal(0L);
+    }
+    /**
+     * 查询不确定建筑/楼层的系统
+     * @param buildingId
+     * @param rwdQueryCriteria
+     * @return
+     */
+    private List<AdmSystem> queryNotSureObj(String buildingId, QueryCriteria rwdQueryCriteria){
+        RequestData requestData = new RequestData();
+        String classCode = rwdQueryCriteria.getCriteria().get("classCode").textValue();
+        if(StrUtil.isNotEmpty(classCode)){
+            requestData.setClassCode(classCode);
+        }
+        if(StrUtil.isNotEmpty(buildingId)){
+            requestData.setBuildingId(buildingId);
+        }
+        requestData.setObjType(AdmSystem.OBJ_TYPE);
+        requestData.setPage(rwdQueryCriteria.getPage());
+        requestData.setSize(rwdQueryCriteria.getSize());
+        List result = DigitalObjectSimpleFacade.queryNotSureSystem(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(),null, requestData);
+        if(CollUtil.isNotEmpty(result)){
+           List<AdmSystem> admSystemList = JSONUtil.toList(result.toString(), AdmSystem.class);
+           return admSystemList;
         }else{
-            return AdmResponse.success();
-        }*/
+            return null;
+        }
     }
 
-    /*private void ensureCondion(InstanceUrlParam context, QueryCriteria queryCriteria_sysInBd, Set<String>sysIds, ObjectNode criteria_obj, boolean ifInCondition){
-        if(queryCriteria_sysInBd != null){
-            List<ObjectRelation> relations_SysInBd = DigitalRelationFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteria_sysInBd);
-            if(CollUtil.isNotEmpty(relations_SysInBd)){
-                sysIds = relations_SysInBd.stream().map(ObjectRelation::getObjFrom).collect(Collectors.toSet());
-            }
+    /**
+     * 处理建筑楼层信息 建筑确定,楼层可为空
+     * @param floorId
+     * @param buildingId
+     * @param admSystemList
+     * @return
+     */
+    private List<AdmSystem> dealBdFlInfo(String floorId, String buildingId, List<AdmSystem> admSystemList){
+        if(CollUtil.isEmpty(admSystemList)){
+            return null;
         }
-        if(CollUtil.isNotEmpty(sysIds)){
-            if(ifInCondition){
-                criteria_obj.put("id", sysIds.toArray().toString());
-            }else {
-                ArrayNode arrayNode = criteria_obj.putObject("$notcontains").putArray("id");
-                sysIds.stream().forEach(id -> arrayNode.add(id));
-            }
+        if(StrUtil.isEmpty(buildingId)){//处理成adm目标格式
+            List<AdmBuildingFloorInfo> nullList = new ArrayList<>(0);
+            admSystemList.stream().forEach(admSystem -> {
+                admSystem.setBuildingFloorInfoList(nullList);
+            });
+            return admSystemList;
+        }
+        AdmResponse buildings = null;
+        if(StrUtil.isNotEmpty(buildingId)){
+            AdmQueryCriteria admQueryCriteria = getAdmQueryCriteria(AdmBuilding.OBJ_TYPE, buildingId);
+            buildings = buildingService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmBuilding.class);
         }
-    }*/
+        AdmResponse floors = null;
+        if(StrUtil.isNotEmpty(floorId)){
+            AdmQueryCriteria admQueryCriteria = getAdmQueryCriteria(AdmFloor.OBJ_TYPE, floorId);
+            floors = floorService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteria, AdmFloor.class);
+        }
+        AdmBuildingFloorInfo buildingFloorInfo = new AdmBuildingFloorInfo();
+        if (CollUtil.isNotEmpty(buildings.getContent())) {
+            AdmBuilding building = (AdmBuilding) buildings.getContent().get(0);
+            buildingFloorInfo.setBuildName(building.getLocalName());
+            buildingFloorInfo.setBuildID(buildingId);
+        }
+        if (null!=floors && CollUtil.isNotEmpty(floors.getContent())) {
+            AdmFloor floor = (AdmFloor) floors.getContent().get(0);
+            buildingFloorInfo.setFloorName(floor.getLocalName());
+            buildingFloorInfo.setFloorID(floorId);
+        }
+        admSystemList.stream().forEach(admSystem -> {
+            admSystem.setBuildingFloorInfoList(CollUtil.newArrayList(buildingFloorInfo));
+        });
+        return admSystemList;
+    }
+
+    private AdmQueryCriteria getAdmQueryCriteria(String objType, String Id){
+        AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
+        admQueryCriteria.setName(objType);
+        admQueryCriteria.setFilters("id = " + Id);
+        return  admQueryCriteria;
+    }
 
     /**
      * 查询系统信息-试图级联建筑楼层 暂未使用
-     * @param projectId
+
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query-bdfl")
-    public AdmResponse queryUnBdFl(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse queryUnBdFl(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmSystem.OBJ_TYPE);
-        return service.doQuery(context, request, AdmSystem.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmSystem.class);
     }
 
     /**
      * 查询没有和当前系统关联的设备
      * id 为系统id
-     * @param projectId
+
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/un-sys-equip")
-    public AdmResponse queryUnEquip(@QueryParam("projectId") String projectId, @NotNull @QueryParam("sysId") String sysId,
+    public AdmResponse queryUnEquip( @NotNull @QueryParam("sysId") String sysId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        AdmResponse admResponse = queryObjectByType(context,sysId,request,"Sy2Eq","MechSubset", AdmEquipment.OBJ_TYPE);
+        AdmResponse admResponse = queryObjectByType(sysId,request,"Sy2Eq","MechSubset", AdmEquipment.OBJ_TYPE);
         return admResponse;
     }
 
@@ -415,17 +444,15 @@ public class AdmSystemController {
     /**
      * 查询没有和当前系统关联的竖井
      *  id 为系统id
-     * @param projectId
+
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/un-sys-shaft")
-    public AdmResponse queryUnSh(@QueryParam("projectId") String projectId, @NotNull @QueryParam("sysId") String sysId,
+    public AdmResponse queryUnSh( @NotNull @QueryParam("sysId") String sysId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        AdmResponse admResponse = queryObjectByType(context,sysId,request,"Sy2Sh",null, AdmShaft.OBJ_TYPE);
+        AdmResponse admResponse = queryObjectByType(sysId,request,"Sy2Sh",null, AdmShaft.OBJ_TYPE);
         return admResponse;
     }
 
@@ -433,17 +460,14 @@ public class AdmSystemController {
     /**
      * 查询没有和当前系统关联的业务空间
      * id 为系统id
-     * @param projectId
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/un-sys-zoneSpaceBaseTable")
-    public AdmResponse queryUnZoneSp(@QueryParam("projectId") String projectId,@NotNull @QueryParam("sysId") String sysId,
+    public AdmResponse queryUnZoneSp(@NotNull @QueryParam("sysId") String sysId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        AdmResponse admResponse = queryObjectByType(context,sysId,request,"Sy2Sp",null, AdmSpace.OBJ_TYPE);
+        AdmResponse admResponse = queryObjectByType(sysId,request,"Sy2Sp",null, AdmSpace.OBJ_TYPE);
         return admResponse;
     }
 
@@ -451,18 +475,15 @@ public class AdmSystemController {
     /**
      * 查询没有和当前空间绑定的系统
      * 例如:prijectId=Pj4201050001,type=AirConditioningZone spaceId=Sp4201050001df2091cdf719443b80bb737aeabf0525 spaceId 为当前空间id type为当前空间类型
-     * @param projectId
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/unspace-sys")
-    public AdmResponse queryUnSpSy(@QueryParam("projectId") String projectId,  @QueryParam("type") String type, @QueryParam("spaceId") String spaceId,
+    public AdmResponse queryUnSpSy(  @QueryParam("type") String type, @QueryParam("spaceId") String spaceId,
                                      @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         if(StrUtil.isNotEmpty(spaceId)){
-            AdmResponse admResponse = queryObjectByType(context, spaceId, request,"Sy2Sp",null, AdmSystem.OBJ_TYPE);
+            AdmResponse admResponse = queryObjectByType(spaceId, request,"Sy2Sp",null, AdmSystem.OBJ_TYPE);
             return admResponse;
         }else{
             if(StrUtil.isNotEmpty(type)){
@@ -470,7 +491,7 @@ public class AdmSystemController {
                 ObjectNode criteriaObj = JsonNodeFactory.instance.objectNode();
                 criteriaObj.put("objType", AdmSpace.OBJ_TYPE);
                 queryCriteriaObj.setCriteria(criteriaObj);
-                List<ObjectNode> objs = DigitalObjectFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteriaObj);
+                List<ObjectNode> objs = DigitalObjectFacade.query(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(), null, queryCriteriaObj);
 
                 QueryCriteria queryCriteriaObjSys = AdmQueryCriteriaHelper.toDmpCriteria(request);
                 ObjectNode criteriaSys = JsonNodeFactory.instance.objectNode();
@@ -482,7 +503,7 @@ public class AdmSystemController {
                     }
                 }
                 queryCriteriaObj.setCriteria(criteriaObj);
-                List<ObjectNode> syses = DigitalObjectFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteriaObjSys);
+                List<ObjectNode> syses = DigitalObjectFacade.query(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(), null, queryCriteriaObjSys);
                 return AdmResponse.success(syses);
             }
             return AdmResponse.success();
@@ -490,7 +511,7 @@ public class AdmSystemController {
     }
 
 
-    private AdmResponse queryObjectByType(InstanceUrlParam context, String sysId, AdmQueryCriteria request, String relCode, String graphCode, String objType){
+    private AdmResponse queryObjectByType(String sysId, AdmQueryCriteria request, String relCode, String graphCode, String objType){
         QueryCriteria queryCriteria = new QueryCriteria();
         ObjectNode criteria = JsonNodeFactory.instance.objectNode();
         criteria.put("objFrom", sysId);
@@ -501,7 +522,7 @@ public class AdmSystemController {
         queryCriteria.setCriteria(criteria);
         queryCriteria.setSize(request.getPageSize()*1L);
         queryCriteria.setPage(request.getPageNumber()*1L);
-        List<ObjectRelation> relations = DigitalRelationFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteria);
+        List<ObjectRelation> relations = DigitalRelationFacade.query(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(), null, queryCriteria);
 
         QueryCriteria queryCriteriaObj = AdmQueryCriteriaHelper.toDmpCriteria(request);
         ObjectNode criteriaObj = JsonNodeFactory.instance.objectNode();
@@ -512,7 +533,7 @@ public class AdmSystemController {
             objectRelationMap.keySet().stream().forEach(id -> arrayNode.add(id));
         }
         queryCriteriaObj.setCriteria(criteriaObj);
-        List<ObjectNode> obj = DigitalObjectFacade.query(context.getGroupCode(),context.getProjectId(), context.getAppId(), null, queryCriteriaObj);
+        List<ObjectNode> obj = DigitalObjectFacade.query(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(), null, queryCriteriaObj);
         return AdmResponse.success(obj);
     }
 }

+ 14 - 34
src/main/java/com/persagy/proxy/adm/controller/AdmTenantController.java

@@ -2,16 +2,14 @@ package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.AdmTenant;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmTenantService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
-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.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -31,24 +29,18 @@ import java.util.List;
 public class AdmTenantController {
     @Autowired
     private IAdmTenantService service;
-    @Value("${middleware.group.code}")
-    private String groupCode;
-
     /**
      * 统计
-     * @param projectId
+     *
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse count(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmTenant.OBJ_TYPE);
         request.setOnlyCount(true);
-        return service.doQuery(context, request, AdmTenant.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmTenant.class);
     }
 
     /**
@@ -59,15 +51,13 @@ public class AdmTenantController {
      */
     @PostMapping("/create")
     public AdmResponse create(@RequestBody AdmCreateRequest<AdmTenant> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmTenant> vos = CollUtil.newArrayList(createRequest.getContent());
         vos.stream().forEach(admTenant -> {
             if (StrUtil.isEmpty(admTenant.getName())){
                 admTenant.setName(ObjectNameUtil.objectName("租户-"));
             }
         });
-        vos = service.doInsert(context, AdmTenant.class, vos);
+        vos = service.doInsert(AdmContextUtil.toDmpContext(), AdmTenant.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -78,10 +68,8 @@ public class AdmTenantController {
      * @throws Exception
      */
     @PostMapping("/delete")
-    public AdmResponse delete(@QueryParam("projectId") String projectId, @RequestBody List<AdmTenant> vos) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        service.doDelete(context, vos);
+    public AdmResponse delete( @RequestBody List<AdmTenant> vos) throws Exception {
+        service.doDelete(AdmContextUtil.toDmpContext(), vos);
         return AdmResponse.success();
     }
 
@@ -93,44 +81,36 @@ public class AdmTenantController {
      */
     @PostMapping("/update")
     public AdmResponse update(@RequestBody AdmCreateRequest<AdmTenant> createRequest, @QueryParam("projectId") String projectId) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
         List<AdmTenant> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doUpdate(context, AdmTenant.class, vos);
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmTenant.class, vos);
         return AdmResponse.success(vos);
     }
 
     /**
      * 查询
-     * @param projectId
+     *
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse query(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmTenant.OBJ_TYPE);
-        return service.doQuery(context, request, AdmTenant.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmTenant.class);
     }
 
     /**
      * 查询租户-包含统计信息
      * 此方法可能会被废弃
-     * @param projectId
+     *
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/query-with-count")
-    public AdmResponse queryWithCount(@QueryParam("projectId") String projectId,
-                             @RequestBody AdmQueryCriteria request) throws Exception {
-        // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+    public AdmResponse queryWithCount(@RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmTenant.OBJ_TYPE);
-        return service.doQuery(context, request, AdmTenant.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmTenant.class);
     }
 
 }

+ 6 - 5
src/main/java/com/persagy/proxy/adm/controller/AdmVirtualWallController.java

@@ -7,6 +7,7 @@ import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmVirtualWallService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -41,7 +42,7 @@ public class AdmVirtualWallController {
     @PostMapping("/create")
     public AdmResponse create(@RequestBody AdmCreateRequest<AdmVirtualWall> createRequest, @QueryParam("projectId") String projectId) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         List<AdmVirtualWall> vos = CollUtil.newArrayList(createRequest.getContent());
         vos = service.doInsert(context, AdmVirtualWall.class, vos);
         return AdmResponse.success(vos);
@@ -56,7 +57,7 @@ public class AdmVirtualWallController {
     @PostMapping("/create_ignore")
     public AdmResponse createIgnore(@RequestBody AdmCreateRequest<AdmVirtualWall> createRequest, @QueryParam("projectId") String projectId) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         createRequest.getContent().forEach(it->{
             //TODO
         });
@@ -86,7 +87,7 @@ public class AdmVirtualWallController {
     @PostMapping("/update")
     public AdmResponse update(@RequestBody AdmCreateRequest<AdmVirtualWall> createRequest, @QueryParam("projectId") String projectId) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         List<AdmVirtualWall> vos = CollUtil.newArrayList(createRequest.getContent());
         vos = service.doUpdate(context, AdmVirtualWall.class, vos);
         return AdmResponse.success(vos);
@@ -103,7 +104,7 @@ public class AdmVirtualWallController {
     public AdmResponse query(@QueryParam("projectId") String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         request.setName("equipment");
         request.setFilters("classCode = 'VIRTUALWALL'");
         return service.doQuery(context, request, AdmVirtualWall.class);
@@ -120,7 +121,7 @@ public class AdmVirtualWallController {
     public AdmResponse count(@QueryParam("projectId") String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         request.setName("equipment");
         request.setOnlyCount(true);
         return service.doQuery(context, request, AdmVirtualWall.class);

+ 6 - 5
src/main/java/com/persagy/proxy/adm/controller/AdmWindowController.java

@@ -7,6 +7,7 @@ import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmWindowService;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -41,7 +42,7 @@ public class AdmWindowController {
     @PostMapping("/create")
     public AdmResponse create(@RequestBody AdmCreateRequest<AdmWindow> createRequest, @QueryParam("projectId") String projectId) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         List<AdmWindow> vos = CollUtil.newArrayList(createRequest.getContent());
         vos = service.doInsert(context, AdmWindow.class, vos);
         return AdmResponse.success(vos);
@@ -56,7 +57,7 @@ public class AdmWindowController {
     @PostMapping("/create_ignore")
     public AdmResponse createIgnore(@RequestBody AdmCreateRequest<AdmWindow> createRequest, @QueryParam("projectId") String projectId) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         createRequest.getContent().forEach(request->{
             //TODO
         });
@@ -86,7 +87,7 @@ public class AdmWindowController {
     @PostMapping("/update")
     public AdmResponse update(@RequestBody AdmCreateRequest<AdmWindow> createRequest, @QueryParam("projectId") String projectId) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         List<AdmWindow> vos = CollUtil.newArrayList(createRequest.getContent());
         vos = service.doUpdate(context, AdmWindow.class, vos);
         return AdmResponse.success(vos);
@@ -103,7 +104,7 @@ public class AdmWindowController {
     public AdmResponse query(@QueryParam("projectId") String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         request.setName("equipment");
         request.setFilters("classCode = 'CFBEWN'");
         return service.doQuery(context, request, AdmWindow.class);
@@ -120,7 +121,7 @@ public class AdmWindowController {
     public AdmResponse count(@QueryParam("projectId") String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
         request.setName("equipment");
         request.setOnlyCount(true);
         return service.doQuery(context, request, AdmWindow.class);

+ 6 - 2
src/main/java/com/persagy/proxy/adm/controller/ComponentBuildingController.java

@@ -115,8 +115,9 @@ public class ComponentBuildingController {
 			result.put("objectType", master.getObjType());
 			result.put("projectId", master.getProjectId());
 			result.put("infos", master.getInfos());
-			result.put("createTime", master.getCreationTime() == null ? null : master.getCreationTime().toString("yyyy-DD-MM 24HH:mm:ss"));
-			result.put("lastUpdate", master.getModifiedTime() == null ? null : master.getModifiedTime().toString("yyyy-DD-MM 24HH:mm:ss"));
+
+			result.put("createTime", master.getCreationTime() == null ? null : master.getCreationTime().toString("yyyy-MM-dd HH:mm:ss"));
+			result.put("lastUpdate", master.getModifiedTime() == null ? null : master.getModifiedTime().toString("yyyy-MM-dd HH:mm:ss"));
 			result.put("statistics", new JSONObject());
 			
 			List<ObjectDigital> slaveObjs = master.getRelObjs();
@@ -124,6 +125,9 @@ public class ComponentBuildingController {
 				// 遍历所有的从对象
 				for (ObjectDigital slave : slaveObjs) {
 					ObjectNode infos = slave.getInfos();
+					if(infos == null){
+						continue;
+					}
 					String outline = infos.get("outline") == null ? null : infos.get("outline").asText();
 					String modelFile = infos.get("modelFile") == null ? null : infos.get("modelFile").asText();
 					if (StrUtil.isEmpty(outline) && StrUtil.isNotBlank(modelFile)) {

+ 6 - 0
src/main/java/com/persagy/proxy/adm/model/AdmObjectType.java

@@ -56,4 +56,10 @@ public class AdmObjectType {
 
     /** 子列表 */
     private List<AdmObjectType> children;
+
+    /** 创建时间 */
+    private String createTime;
+
+    /** 更新时间 */
+    private String lastUpdate;
 }

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

@@ -27,6 +27,8 @@ public abstract class AdmSBaseEntity<T> implements Serializable, Cloneable, Comp
     private Date lastUpdate;
     /** 信息点 */
     private Map<String, Object> infos;
+    /** 集团编码 */
+    private String groupCode;
 
 
     @Override

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

@@ -36,7 +36,7 @@ public class AdmSystem extends AdmSBaseEntity<AdmSystem> {
     /** 楼层ID */
     private String floorId;
     /** 设备数量 */
-    private String count;
+    private Long count = 0L;
     /** 设备分类名 */
     private String categoryName;
     /** 设备分类名 */

+ 2 - 4
src/main/java/com/persagy/proxy/adm/model/relation/ShContainSpBaseList.java

@@ -1,9 +1,6 @@
 package com.persagy.proxy.adm.model.relation;
 
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
+import lombok.*;
 
 import java.util.List;
 
@@ -15,6 +12,7 @@ import java.util.List;
 @NoArgsConstructor
 @AllArgsConstructor
 @Data
+@EqualsAndHashCode(callSuper = true)
 public class ShContainSpBaseList extends BaseEntity{
 
     /** 竖井id */

+ 2 - 4
src/main/java/com/persagy/proxy/adm/model/relation/SiInSpBaseList.java

@@ -1,9 +1,6 @@
 package com.persagy.proxy.adm.model.relation;
 
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
+import lombok.*;
 
 import java.util.List;
 
@@ -15,6 +12,7 @@ import java.util.List;
 @NoArgsConstructor
 @AllArgsConstructor
 @Data
+@EqualsAndHashCode(callSuper = true)
 public class SiInSpBaseList extends BaseEntity{
 
     /** 元空间id列表 */

+ 2 - 4
src/main/java/com/persagy/proxy/adm/model/relation/SpForSyBaseList.java

@@ -1,9 +1,6 @@
 package com.persagy.proxy.adm.model.relation;
 
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
+import lombok.*;
 
 import java.util.List;
 
@@ -15,6 +12,7 @@ import java.util.List;
 @AllArgsConstructor
 @NoArgsConstructor
 @ToString
+@EqualsAndHashCode(callSuper = true)
 public class SpForSyBaseList extends BaseEntity{
 
     /** 业务空间id */

+ 2 - 4
src/main/java/com/persagy/proxy/adm/model/relation/SpInSyBaseList.java

@@ -1,9 +1,6 @@
 package com.persagy.proxy.adm.model.relation;
 
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
+import lombok.*;
 
 import java.util.List;
 
@@ -16,6 +13,7 @@ import java.util.List;
 @AllArgsConstructor
 @NoArgsConstructor
 @ToString
+@EqualsAndHashCode(callSuper = true)
 public class SpInSyBaseList extends BaseEntity {
 
     /**

+ 2 - 4
src/main/java/com/persagy/proxy/adm/model/relation/SyForSpBaseList.java

@@ -1,9 +1,6 @@
 package com.persagy.proxy.adm.model.relation;
 
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
+import lombok.*;
 
 import java.util.List;
 
@@ -15,6 +12,7 @@ import java.util.List;
 @AllArgsConstructor
 @NoArgsConstructor
 @ToString
+@EqualsAndHashCode(callSuper = true)
 public class SyForSpBaseList extends BaseEntity{
 
     /**

+ 2 - 4
src/main/java/com/persagy/proxy/adm/model/relation/SyInSpBaseList.java

@@ -1,10 +1,7 @@
 package com.persagy.proxy.adm.model.relation;
 
 
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
+import lombok.*;
 
 import java.util.List;
 
@@ -18,6 +15,7 @@ import java.util.List;
 @AllArgsConstructor
 @NoArgsConstructor
 @ToString
+@EqualsAndHashCode(callSuper = true)
 public class SyInSpBaseList extends BaseEntity{
     /** 系统id */
     private String sysId;

+ 2 - 1
src/main/java/com/persagy/proxy/adm/model/relation/UpDataFloorAndBuilding.java

@@ -3,8 +3,8 @@ package com.persagy.proxy.adm.model.relation;
 
 import lombok.AllArgsConstructor;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
-import lombok.ToString;
 
 /**
  * @author zhangwencheng
@@ -13,6 +13,7 @@ import lombok.ToString;
 @Data
 @AllArgsConstructor
 @NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
 public class UpDataFloorAndBuilding extends BaseEntity{
 
     /** 业务空间id */

+ 10 - 4
src/main/java/com/persagy/proxy/adm/request/AdmResponse.java

@@ -1,5 +1,6 @@
 package com.persagy.proxy.adm.request;
 
+import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.persagy.proxy.adm.utils.AdmEntityTransferUtil;
 import com.persagy.proxy.common.entity.DmpResult;
@@ -26,6 +27,7 @@ public class AdmResponse {
     private String message;
     /** 符合条件的总记录数 */
     private Long total;
+    private Long count;
     /** 页码 */
     private Integer pageNumber;
     /** 每页条数 */
@@ -34,15 +36,15 @@ public class AdmResponse {
     private List<?> content;
 
     public static AdmResponse success() {
-        return new AdmResponse(SUCCESS, null, null, null, null, null);
+        return new AdmResponse(SUCCESS, "", 0L,null, 1, 500, null);
     }
 
     public static AdmResponse failure(String message) {
-        return new AdmResponse(FAILURE, message, null, null, null, null);
+        return new AdmResponse(FAILURE, message, null, null, null, null, null);
     }
 
     public static AdmResponse success(List<?> content) {
-        return new AdmResponse(SUCCESS, null, null, null, null, content);
+        return new AdmResponse(SUCCESS, "", CollUtil.isEmpty(content) ? 0L :content.size()*1L,null, 1, 500, content);
     }
 
     /**
@@ -62,6 +64,10 @@ public class AdmResponse {
         Long total = dmpResult.getCount() == null ? null : dmpResult.getCount().longValue();
         Integer pageNo = admRequest == null ? null : admRequest.getPageNumber();
         Integer pageSize = admRequest == null ? null : admRequest.getPageSize();
-        return new AdmResponse(SUCCESS, null, total, pageNo, pageSize, admVOs);
+        if(admRequest.isOnlyCount()){
+            return new AdmResponse(SUCCESS, null, null,total, pageNo, pageSize, admVOs);
+        }else {
+            return new AdmResponse(SUCCESS, null, total,null, pageNo, pageSize, admVOs);
+        }
     }
 }

+ 8 - 3
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmBaseServiceImpl.java

@@ -59,7 +59,7 @@ public class AbstractAdmBaseServiceImpl<T> implements IAdmBaseService<T> {
         // 转换参数
         JSONObject para = null;
         try {
-            para = JsonHelper.toJSONObject(dmpRequest);
+            para = JsonHelper.toJsonObject(dmpRequest);
         } catch (IOException e) {
             log.error(e.getMessage(), e);
             return null;
@@ -72,7 +72,12 @@ public class AbstractAdmBaseServiceImpl<T> implements IAdmBaseService<T> {
         // 设置返回值
         AdmResponse response = AdmResponse.success(admVOs);
         Long total = dmpResult.getCount() == null ? null : dmpResult.getCount().longValue();
-        response.setTotal(total);
+        if(request.isOnlyCount()){
+            response.setTotal(null);
+            response.setCount(total);
+        }else {
+            response.setTotal(total);
+        }
         response.setPageNumber(request.getPageNumber());
         response.setPageSize(request.getPageSize());
         return response;
@@ -383,7 +388,7 @@ public class AbstractAdmBaseServiceImpl<T> implements IAdmBaseService<T> {
         // 转换参数
         JSONObject para = null;
         try {
-            para = JsonHelper.toJSONObject(dmpRequest);
+            para = JsonHelper.toJsonObject(dmpRequest);
         } catch (IOException e) {
             log.error(e.getMessage(), e);
             return null;

+ 101 - 6
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmDictBaseServiceImpl.java

@@ -26,7 +26,7 @@ import com.persagy.proxy.common.entity.InstanceUrlParam;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
+import org.springframework.beans.factory.annotation.Value;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -48,6 +48,9 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
     @Autowired
     private DmpDicClient dicClient;
 
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
     /**
      * 查询DMP字典数据
      * @param context
@@ -60,7 +63,7 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         // 转换参数
         JSONObject para = null;
         try {
-            para = JsonHelper.toJSONObject(dmpRequest);
+            para = JsonHelper.toJsonObject(dmpRequest);
         } catch (IOException e) {
             log.error(e.getMessage(), e);
             return null;
@@ -88,7 +91,7 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         // 转换参数
         JSONObject para = null;
         try {
-            para = JsonHelper.toJSONObject(dmpRequest);
+            para = JsonHelper.toJsonObject(dmpRequest);
         } catch (IOException e) {
             log.error(e.getMessage(), e);
             return null;
@@ -96,10 +99,12 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         // 调用中台查询
         DmpResult<JSONArray> dmpResult = rwdClient.queryObjectType(context, para);
         JSONArray data = dmpResult.getData();
-        List<T> admVOs = new ArrayList<>();
+        List<AdmObjectType> admVOs = new ArrayList<>();
         if(CollUtil.isNotEmpty(data)){
-            admVOs = data.toJavaList(clazz);
+            admVOs = data.toJavaList(AdmObjectType.class);
         }
+        //参数格式转换
+        dictDefTypeTransfer(admVOs);
         // 设置返回值
         AdmResponse response = AdmResponse.success(admVOs);
         Long total = dmpResult.getCount() == null ? null : dmpResult.getCount().longValue();
@@ -119,7 +124,7 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         // 转换参数
         JSONObject para = null;
         try {
-            para = JsonHelper.toJSONObject(dmpRequest);
+            para = JsonHelper.toJsonObject(dmpRequest);
         } catch (IOException e) {
             log.error(e.getMessage(), e);
             return null;
@@ -192,6 +197,7 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
             admVO.setSecondName(admVO.getSecondTag());
             admVO.setMultiple(admVO.getIsMultiple());
             admVO.setRegion(admVO.getIsRegion());
+            admVO.setGroupCode(groupCode);
 
             //path路径处理
             if(StringUtils.isEmpty(admVO.getFirstName()) || AdmDictConstant.FIRST_BASE_TAG.equals(admVO.getFirstName())
@@ -200,10 +206,72 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
             }else{
                 admVO.setPath(AdmDictConstant.INFOS_EX+admVO.getCode());
             }
+
+            //信息点是否可见
+            if(admVO.getVisible() == null){
+                if("localName".equals(admVO.getCode()) || "localId".equals(admVO.getCode())){
+                    admVO.setVisible(true);
+                }else{
+                    admVO.setVisible(false);
+                }
+            }
+            //信息点是否可编辑
+            if(admVO.getEditable() == null){
+                List<String> unEditableList = checkoutDefInfoUnEditable();
+                if(unEditableList.contains(admVO.getCode())){
+                    admVO.setEditable(false);
+                }else {
+                    admVO.setEditable(true);
+                }
+            }
+            //是否禁止操作
+            if(admVO.getUnDisabled() == null){
+                List<String> unDisableList = checkoutDefInfoUnDisable();
+                if(unDisableList.contains(admVO.getCode())){
+                    admVO.setUnDisabled(false);
+                }else {
+                    admVO.setUnDisabled(true);
+                }
+            }
+
         }
     }
 
     /**
+     * 校验信息点是否可编辑
+     * @return
+     */
+    public List<String> checkoutDefInfoUnEditable(){
+        List<String> list = new ArrayList<>();
+        list.add("id");
+        list.add("name");
+        list.add("qRCodePic");
+        list.add("defaultQRCode");
+        list.add("bimId");
+        list.add("bimFamilyName");
+        list.add("bimFamilySymbol");
+        return list;
+    }
+    
+    /**
+     * 校验信息点是否禁止使用
+     * @return
+     */
+    public List<String> checkoutDefInfoUnDisable(){
+        List<String> list = new ArrayList<>();
+        list.add("id");
+        list.add("name");
+        list.add("localId");
+        list.add("localName");
+        list.add("qRCodePic");
+        list.add("defaultQRCode");
+        list.add("bimId");
+        list.add("bimFamilyName");
+        list.add("bimFamilySymbol");
+        return list;
+    }
+
+    /**
      * 字典数据格式与ADM兼容
      * @param array
      */
@@ -220,6 +288,7 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
             objectType.setAliasCode(dicData.get("code").textValue());
             objectType.setAliasName(dicData.get("label").textValue());
             objectType.setObjType(dicData.get("type").textValue());
+
             result.add(objectType);
         }
         return result;
@@ -254,4 +323,30 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         return dmpCriteria;
     }
 
+
+    /**
+     * 字典类型返回结构与ADM兼容
+     * @param data
+     */
+    private List<AdmObjectType> dictDefTypeTransfer(List<AdmObjectType> data){
+        if(CollUtil.isEmpty(data)){
+            return new ArrayList<>();
+        }
+        for (AdmObjectType datum : data) {
+            String projectId = datum.getProjectId();
+            String groupCode = datum.getGroupCode();
+            if(StringUtils.isNotEmpty(groupCode) && !"0".equals(groupCode)){
+                //集团级
+                datum.setType("group");
+            }else if(StringUtils.isNotEmpty(projectId) && !"0".equals(projectId)){
+                //项目级
+                datum.setType("project");
+            }else{
+                //平台级
+                datum.setType("common");
+            }
+        }
+
+        return data;
+    }
 }

+ 7 - 1
src/main/java/com/persagy/proxy/adm/utils/AdmQueryCriteriaHelper.java

@@ -223,8 +223,14 @@ public class AdmQueryCriteriaHelper {
                 node.add(getJsonNode(criteria, split.trim()));
             }
         } else if("isnull".equals(operator)) {
+            boolean ifNot = true;
+            if(column.indexOf("not") >= 0){
+                ifNot = false;
+                column = column.split(" ")[1];
+            }
             ObjectNode node = criteria.putObject(column);
-            node.put("$null", true);
+            node.put("$null", ifNot);
+
         } else {
             ObjectNode node = criteria.putObject(column);
             node.set(OPERATOR_MAP.get(operator), getJsonNode(node, value));