浏览代码

从body里获取用户信息

lixing 3 年之前
父节点
当前提交
bfd078013b

+ 3 - 3
src/main/java/com/persagy/apm/energy/report/saasweb/client/SaasWebClient.java

@@ -63,14 +63,14 @@ public interface SaasWebClient {
     /**
      * 根据id查询管理分区
      *
-     * @param queryPartitionDTO 查询条件
+     * @param poemsFeignBaseDTO 查询条件
      * @return 项目列表
      * @author lixing
      * @version V1.0 2021/5/19 2:27 下午
      */
-    @PostMapping("/Spring/MVC/entrance/unifier/queryManagementPartitionsByIds")
+    @PostMapping("/Spring/MVC/entrance/unifier/queryAllManagementPartitionsService")
     @Headers({"Content-Type: application/x-www-form-urlencoded"})
-    PoemsFeignResponse<PoemsPartitionVO> queryPartitionsByIds(@RequestParam("jsonString") String queryPartitionDTO);
+    PoemsFeignResponse<PoemsPartitionVO> queryAllPartitions(@RequestParam("jsonString") String poemsFeignBaseDTO);
 
     /**
      * 获取用户信息(基本信息和关联的项目)

+ 25 - 7
src/main/java/com/persagy/apm/energy/report/saasweb/service/impl/SaasWebClientWrapper.java

@@ -10,6 +10,11 @@ import com.persagy.apm.energy.report.saasweb.model.dto.QueryProjectDTO;
 import com.persagy.apm.energy.report.saasweb.model.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 运维平台feign客户端包装类
@@ -42,7 +47,7 @@ public class SaasWebClientWrapper {
      * @author lixing
      * @version V1.0 2021/5/19 2:27 下午
      */
-    public PoemsFeignResponse<BuildingInfoVO> listBuildingsByProjectId(QueryByProjectIdDTO queryByProjectIdDTO){
+    public PoemsFeignResponse<BuildingInfoVO> listBuildingsByProjectId(QueryByProjectIdDTO queryByProjectIdDTO) {
         return saasWebClient.listBuildingsByProjectId(JSON.toJSONString(queryByProjectIdDTO));
     }
 
@@ -54,7 +59,7 @@ public class SaasWebClientWrapper {
      * @author lixing
      * @version V1.0 2021/5/19 2:27 下午
      */
-    public PoemsFeignResponse<PoemsProjectVO> queryProjects(QueryProjectDTO queryProjectDTO){
+    public PoemsFeignResponse<PoemsProjectVO> queryProjects(QueryProjectDTO queryProjectDTO) {
         return saasWebClient.queryProjects(JSON.toJSONString(queryProjectDTO));
     }
 
@@ -66,8 +71,21 @@ public class SaasWebClientWrapper {
      * @author lixing
      * @version V1.0 2021/5/19 2:27 下午
      */
-    public PoemsFeignResponse<PoemsPartitionVO> queryPartitionsByIds(QueryPartitionDTO queryPartitionDTO){
-        return saasWebClient.queryPartitionsByIds(JSON.toJSONString(queryPartitionDTO));
+    public PoemsFeignResponse<PoemsPartitionVO> queryPartitionsByIds(QueryPartitionDTO queryPartitionDTO) {
+        PoemsFeignBaseDTO poemsFeignBaseDTO = new PoemsFeignBaseDTO();
+        poemsFeignBaseDTO.setPuser(queryPartitionDTO.getPuser());
+
+        PoemsFeignResponse<PoemsPartitionVO> partitionsResponse = saasWebClient.queryAllPartitions(
+                JSON.toJSONString(poemsFeignBaseDTO));
+        List<PoemsPartitionVO> filteredContents = new ArrayList<>();
+        List<PoemsPartitionVO> partitionVOList = partitionsResponse.getContent();
+        if (!CollectionUtils.isEmpty(partitionVOList)) {
+            filteredContents = partitionVOList.stream().filter(
+                    poemsPartitionVO -> queryPartitionDTO.getManagePartitionIds().contains(poemsPartitionVO.getManagePartitionId())
+            ).collect(Collectors.toList());
+        }
+        partitionsResponse.setContent(filteredContents);
+        return partitionsResponse;
     }
 
     /**
@@ -78,7 +96,7 @@ public class SaasWebClientWrapper {
      * @author lixing
      * @version V1.0 2021/5/19 3:36 下午
      */
-    public PoemsFeignResponse<UserProjectsInfoVO> getCurrentUserProjectsInfo(PoemsFeignBaseDTO poemsFeignBaseDTO){
+    public PoemsFeignResponse<UserProjectsInfoVO> getCurrentUserProjectsInfo(PoemsFeignBaseDTO poemsFeignBaseDTO) {
         return saasWebClient.getCurrentUserProjectsInfo(JSON.toJSONString(poemsFeignBaseDTO));
     }
 
@@ -90,7 +108,7 @@ public class SaasWebClientWrapper {
      * @author lixing
      * @version V1.0 2021/5/19 3:36 下午
      */
-    public PoemsFeignResponse<UserPartitionProjectsInfoVO> getCurrentUserPartitionProjectsInfo(PoemsFeignBaseDTO poemsFeignBaseDTO){
+    public PoemsFeignResponse<UserPartitionProjectsInfoVO> getCurrentUserPartitionProjectsInfo(PoemsFeignBaseDTO poemsFeignBaseDTO) {
         return saasWebClient.getCurrentUserPartitionProjectsInfo(JSON.toJSONString(poemsFeignBaseDTO));
     }
 
@@ -102,7 +120,7 @@ public class SaasWebClientWrapper {
      * @author lixing
      * @version V1.0 2021/5/19 3:36 下午
      */
-    public PoemsFeignResponse<FunctionTypeVO> getAllProjectFunctionTypes(PoemsFeignBaseDTO poemsFeignBaseDTO){
+    public PoemsFeignResponse<FunctionTypeVO> getAllProjectFunctionTypes(PoemsFeignBaseDTO poemsFeignBaseDTO) {
         return saasWebClient.getAllProjectFunctionTypes(JSON.toJSONString(poemsFeignBaseDTO));
     }
 }