Browse Source

注册到k8s

lixing 4 years ago
parent
commit
f33124df68

+ 3 - 3
src/main/java/com/persagy/apm/energy/report/common/service/impl/CommonServiceImpl.java

@@ -2,9 +2,9 @@ package com.persagy.apm.energy.report.common.service.impl;
 
 import com.persagy.apm.common.response.PoemsFeignResponse;
 import com.persagy.apm.energy.report.common.service.CommonService;
-import com.persagy.apm.energy.report.saasweb.client.SaasWebClient;
 import com.persagy.apm.energy.report.saasweb.model.dto.QueryProjectDTO;
 import com.persagy.apm.energy.report.saasweb.model.vo.PoemsProjectVO;
+import com.persagy.apm.energy.report.saasweb.service.impl.SaasWebClientWrapper;
 import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -18,12 +18,12 @@ import java.util.List;
 public class CommonServiceImpl implements CommonService {
 
     @Autowired
-    SaasWebClient saasWebClient;
+    SaasWebClientWrapper saasWebClientWrapper;
 
     @Override
     public List<String> getPjNameByPjId(List<String> pjIdList) {
         QueryProjectDTO queryProjectDTO = new QueryProjectDTO();
-        PoemsFeignResponse<PoemsProjectVO> projectsResponse = saasWebClient.queryProjects(queryProjectDTO);
+        PoemsFeignResponse<PoemsProjectVO> projectsResponse = saasWebClientWrapper.queryProjects(queryProjectDTO);
         List<PoemsProjectVO> projectVOList = projectsResponse.getContent();
         if (!CollectionUtils.isEmpty(projectVOList)) {
             List<String> pjNameList = new ArrayList<>();

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

@@ -9,8 +9,10 @@ import com.persagy.apm.energy.report.saasweb.model.dto.QueryByProjectIdDTO;
 import com.persagy.apm.energy.report.saasweb.model.dto.QueryPartitionDTO;
 import com.persagy.apm.energy.report.saasweb.model.dto.QueryProjectDTO;
 import com.persagy.apm.energy.report.saasweb.model.vo.*;
+import feign.Headers;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 
 /**
  * 运维平台feign客户端
@@ -31,7 +33,8 @@ public interface SaasWebClient {
      * @version V1.0 2021/5/19 2:27 下午
      */
     @PostMapping("/Spring/MVC/entrance/unifier/getProjectByIdService")
-    PoemsFeignResponse<SimpleProjectVO> getProjectById(QueryByProjectIdDTO queryByProjectIdDTO);
+    @Headers({"Content-Type: application/x-www-form-urlencoded"})
+    PoemsFeignResponse<SimpleProjectVO> getProjectById(@RequestParam("jsonString") String queryByProjectIdDTO);
 
     /**
      * 根据项目id,加载项目下的建筑信息
@@ -42,7 +45,8 @@ public interface SaasWebClient {
      * @version V1.0 2021/5/19 2:27 下午
      */
     @PostMapping("/Spring/MVC/entrance/unifier/listBuildingsByProjectIdService")
-    PoemsFeignResponse<BuildingInfoVO> listBuildingsByProjectId(QueryByProjectIdDTO queryByProjectIdDTO);
+    @Headers({"Content-Type: application/x-www-form-urlencoded"})
+    PoemsFeignResponse<BuildingInfoVO> listBuildingsByProjectId(@RequestParam("jsonString") String queryByProjectIdDTO);
 
     /**
      * 查询项目列表
@@ -53,7 +57,8 @@ public interface SaasWebClient {
      * @version V1.0 2021/5/19 2:27 下午
      */
     @PostMapping("/Spring/MVC/entrance/unifier/listProjectsService")
-    PoemsFeignResponse<PoemsProjectVO> queryProjects(QueryProjectDTO queryProjectDTO);
+    @Headers({"Content-Type: application/x-www-form-urlencoded"})
+    PoemsFeignResponse<PoemsProjectVO> queryProjects(@RequestParam("jsonString") String queryProjectDTO);
 
     /**
      * 根据id查询管理分区
@@ -64,7 +69,8 @@ public interface SaasWebClient {
      * @version V1.0 2021/5/19 2:27 下午
      */
     @PostMapping("/Spring/MVC/entrance/unifier/queryManagementPartitionsByIds")
-    PoemsFeignResponse<PoemsPartitionVO> queryPartitionsByIds(QueryPartitionDTO queryPartitionDTO);
+    @Headers({"Content-Type: application/x-www-form-urlencoded"})
+    PoemsFeignResponse<PoemsPartitionVO> queryPartitionsByIds(@RequestParam("jsonString") String queryPartitionDTO);
 
     /**
      * 获取用户信息(基本信息和关联的项目)
@@ -75,7 +81,8 @@ public interface SaasWebClient {
      * @version V1.0 2021/5/19 3:36 下午
      */
     @PostMapping("/Spring/MVC/entrance/unifier/saasGetCurrentUserService")
-    PoemsFeignResponse<UserProjectsInfoVO> getCurrentUserProjectsInfo(PoemsFeignBaseDTO poemsFeignBaseDTO);
+    @Headers({"Content-Type: application/x-www-form-urlencoded"})
+    PoemsFeignResponse<UserProjectsInfoVO> getCurrentUserProjectsInfo(@RequestParam("jsonString") String poemsFeignBaseDTO);
 
     /**
      * 获取用户信息(基本信息和关联的分区项目树)
@@ -86,7 +93,8 @@ public interface SaasWebClient {
      * @version V1.0 2021/5/19 3:36 下午
      */
     @PostMapping("/Spring/MVC/entrance/unifier/saasGetCurrentUserProjectsTreeService")
-    PoemsFeignResponse<UserPartitionProjectsInfoVO> getCurrentUserPartitionProjectsInfo(PoemsFeignBaseDTO poemsFeignBaseDTO);
+    @Headers({"Content-Type: application/x-www-form-urlencoded"})
+    PoemsFeignResponse<UserPartitionProjectsInfoVO> getCurrentUserPartitionProjectsInfo(@RequestParam("jsonString") String poemsFeignBaseDTO);
 
     /**
      * 获取所有项目功能类型
@@ -97,5 +105,6 @@ public interface SaasWebClient {
      * @version V1.0 2021/5/19 3:36 下午
      */
     @PostMapping("/Spring/MVC/entrance/unifier/listFunctionTypesService")
-    PoemsFeignResponse<FunctionTypeVO> getAllProjectFunctionTypes(PoemsFeignBaseDTO poemsFeignBaseDTO);
+    @Headers({"Content-Type: application/x-www-form-urlencoded"})
+    PoemsFeignResponse<FunctionTypeVO> getAllProjectFunctionTypes(@RequestParam("jsonString") String poemsFeignBaseDTO);
 }

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

@@ -0,0 +1,108 @@
+package com.persagy.apm.energy.report.saasweb.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.persagy.apm.common.model.dto.PoemsFeignBaseDTO;
+import com.persagy.apm.common.response.PoemsFeignResponse;
+import com.persagy.apm.energy.report.saasweb.client.SaasWebClient;
+import com.persagy.apm.energy.report.saasweb.model.dto.QueryByProjectIdDTO;
+import com.persagy.apm.energy.report.saasweb.model.dto.QueryPartitionDTO;
+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;
+
+/**
+ * 运维平台feign客户端包装类
+ *
+ * @author lixing
+ * @version V1.0 2021/3/22 2:13 下午
+ **/
+@Service
+public class SaasWebClientWrapper {
+    @Autowired
+    private SaasWebClient saasWebClient;
+
+    /**
+     * 根据项目id,获取项目信息
+     *
+     * @param queryByProjectIdDTO 查询条件
+     * @return 项目下的建筑信息
+     * @author lixing
+     * @version V1.0 2021/5/19 2:27 下午
+     */
+    public PoemsFeignResponse<SimpleProjectVO> getProjectById(QueryByProjectIdDTO queryByProjectIdDTO) {
+        return saasWebClient.getProjectById(JSON.toJSONString(queryByProjectIdDTO));
+    }
+
+    /**
+     * 根据项目id,加载项目下的建筑信息
+     *
+     * @param queryByProjectIdDTO 查询条件
+     * @return 项目下的建筑信息
+     * @author lixing
+     * @version V1.0 2021/5/19 2:27 下午
+     */
+    public PoemsFeignResponse<BuildingInfoVO> listBuildingsByProjectId(QueryByProjectIdDTO queryByProjectIdDTO){
+        return saasWebClient.listBuildingsByProjectId(JSON.toJSONString(queryByProjectIdDTO));
+    }
+
+    /**
+     * 查询项目列表
+     *
+     * @param queryProjectDTO 查询条件
+     * @return 项目列表
+     * @author lixing
+     * @version V1.0 2021/5/19 2:27 下午
+     */
+    public PoemsFeignResponse<PoemsProjectVO> queryProjects(QueryProjectDTO queryProjectDTO){
+        return saasWebClient.queryProjects(JSON.toJSONString(queryProjectDTO));
+    }
+
+    /**
+     * 根据id查询管理分区
+     *
+     * @param queryPartitionDTO 查询条件
+     * @return 项目列表
+     * @author lixing
+     * @version V1.0 2021/5/19 2:27 下午
+     */
+    public PoemsFeignResponse<PoemsPartitionVO> queryPartitionsByIds(QueryPartitionDTO queryPartitionDTO){
+        return saasWebClient.queryPartitionsByIds(JSON.toJSONString(queryPartitionDTO));
+    }
+
+    /**
+     * 获取用户信息(基本信息和关联的项目)
+     *
+     * @param poemsFeignBaseDTO 登录信息
+     * @return 用户信息
+     * @author lixing
+     * @version V1.0 2021/5/19 3:36 下午
+     */
+    public PoemsFeignResponse<UserProjectsInfoVO> getCurrentUserProjectsInfo(PoemsFeignBaseDTO poemsFeignBaseDTO){
+        return saasWebClient.getCurrentUserProjectsInfo(JSON.toJSONString(poemsFeignBaseDTO));
+    }
+
+    /**
+     * 获取用户信息(基本信息和关联的分区项目树)
+     *
+     * @param poemsFeignBaseDTO 登录信息
+     * @return 用户信息
+     * @author lixing
+     * @version V1.0 2021/5/19 3:36 下午
+     */
+    public PoemsFeignResponse<UserPartitionProjectsInfoVO> getCurrentUserPartitionProjectsInfo(PoemsFeignBaseDTO poemsFeignBaseDTO){
+        return saasWebClient.getCurrentUserPartitionProjectsInfo(JSON.toJSONString(poemsFeignBaseDTO));
+    }
+
+    /**
+     * 获取所有项目功能类型
+     *
+     * @param poemsFeignBaseDTO 登录信息
+     * @return 所有项目功能类型树
+     * @author lixing
+     * @version V1.0 2021/5/19 3:36 下午
+     */
+    public PoemsFeignResponse<FunctionTypeVO> getAllProjectFunctionTypes(PoemsFeignBaseDTO poemsFeignBaseDTO){
+        return saasWebClient.getAllProjectFunctionTypes(JSON.toJSONString(poemsFeignBaseDTO));
+    }
+}

+ 8 - 9
src/main/java/com/persagy/apm/energy/report/saasweb/service/impl/SaasWebServiceImpl.java

@@ -3,7 +3,6 @@ package com.persagy.apm.energy.report.saasweb.service.impl;
 import com.google.common.collect.Maps;
 import com.persagy.apm.common.model.dto.PoemsFeignBaseDTO;
 import com.persagy.apm.common.response.PoemsFeignResponse;
-import com.persagy.apm.energy.report.saasweb.client.SaasWebClient;
 import com.persagy.apm.energy.report.saasweb.model.ConvertSaasWebTool;
 import com.persagy.apm.energy.report.saasweb.model.dto.QueryByProjectIdDTO;
 import com.persagy.apm.energy.report.saasweb.model.dto.QueryPartitionDTO;
@@ -29,7 +28,7 @@ import java.util.stream.Collectors;
 @Service
 public class SaasWebServiceImpl implements ISaasWebService {
     @Autowired
-    SaasWebClient saasWebClient;
+    SaasWebClientWrapper saasWebClientWrapper;
 
     @Override
     public ReportProjectVO getReportProjectInfo(String projectId) {
@@ -39,7 +38,7 @@ public class SaasWebServiceImpl implements ISaasWebService {
         queryByProjectIdDTO.setProjectId(projectId);
 
         // 获取项目信息
-        PoemsFeignResponse<SimpleProjectVO> projectInfoResponse = saasWebClient.getProjectById(queryByProjectIdDTO);
+        PoemsFeignResponse<SimpleProjectVO> projectInfoResponse = saasWebClientWrapper.getProjectById(queryByProjectIdDTO);
         List<SimpleProjectVO> projectInfos = projectInfoResponse.getContent();
         if (!CollectionUtils.isEmpty(projectInfos)) {
             SimpleProjectVO simpleProjectVO = projectInfos.get(0);
@@ -70,7 +69,7 @@ public class SaasWebServiceImpl implements ISaasWebService {
         queryByProjectIdDTO.setProjectId(projectId);
 
         // 获取项目下的建筑信息
-        PoemsFeignResponse<BuildingInfoVO> buildsResponse = saasWebClient.listBuildingsByProjectId(queryByProjectIdDTO);
+        PoemsFeignResponse<BuildingInfoVO> buildsResponse = saasWebClientWrapper.listBuildingsByProjectId(queryByProjectIdDTO);
         List<BuildingInfoVO> buildingInfoVOList = buildsResponse.getContent();
         // 统计项目下建筑总的商业面积,地下停车场面积
         BigDecimal totalCommercialArea = new BigDecimal("0");
@@ -98,7 +97,7 @@ public class SaasWebServiceImpl implements ISaasWebService {
         // 查询管理分区信息
         QueryPartitionDTO queryPartitionDTO = new QueryPartitionDTO();
         queryPartitionDTO.setManagePartitionIds(Lists.newArrayList(areaCode));
-        PoemsFeignResponse<PoemsPartitionVO> partitionsResponse = saasWebClient.queryPartitionsByIds(queryPartitionDTO);
+        PoemsFeignResponse<PoemsPartitionVO> partitionsResponse = saasWebClientWrapper.queryPartitionsByIds(queryPartitionDTO);
         List<PoemsPartitionVO> partitionVOList = partitionsResponse.getContent();
         if (!CollectionUtils.isEmpty(partitionVOList)) {
             PoemsPartitionVO poemsPartitionVO = partitionVOList.get(0);
@@ -140,7 +139,7 @@ public class SaasWebServiceImpl implements ISaasWebService {
         // 获取管理分区下的项目
         QueryProjectDTO queryProjectDTO = new QueryProjectDTO();
         queryProjectDTO.setGroupManageZone(areaCode);
-        PoemsFeignResponse<PoemsProjectVO> projectsResponse = saasWebClient.queryProjects(queryProjectDTO);
+        PoemsFeignResponse<PoemsProjectVO> projectsResponse = saasWebClientWrapper.queryProjects(queryProjectDTO);
         return projectsResponse.getContent();
     }
 
@@ -175,7 +174,7 @@ public class SaasWebServiceImpl implements ISaasWebService {
         // 获取用户可选的所有项目
         PoemsFeignBaseDTO poemsFeignBaseDTO = new PoemsFeignBaseDTO();
         poemsFeignBaseDTO.setDefaultValue();
-        PoemsFeignResponse<UserProjectsInfoVO> currentUserProjectsInfosResponse = saasWebClient.getCurrentUserProjectsInfo(poemsFeignBaseDTO);
+        PoemsFeignResponse<UserProjectsInfoVO> currentUserProjectsInfosResponse = saasWebClientWrapper.getCurrentUserProjectsInfo(poemsFeignBaseDTO);
         List<UserProjectsInfoVO> currentUserProjectsInfos = currentUserProjectsInfosResponse.getContent();
         if (!CollectionUtils.isEmpty(currentUserProjectsInfos)) {
             UserProjectsInfoVO userProjectsInfoVO = currentUserProjectsInfos.get(0);
@@ -239,7 +238,7 @@ public class SaasWebServiceImpl implements ISaasWebService {
         // 获取业态下所有的子业态
         PoemsFeignBaseDTO poemsFeignBaseDTO = new PoemsFeignBaseDTO();
         poemsFeignBaseDTO.setDefaultValue();
-        PoemsFeignResponse<FunctionTypeVO> functionTypesResponse = saasWebClient.getAllProjectFunctionTypes(poemsFeignBaseDTO);
+        PoemsFeignResponse<FunctionTypeVO> functionTypesResponse = saasWebClientWrapper.getAllProjectFunctionTypes(poemsFeignBaseDTO);
         List<FunctionTypeVO> functionTypeVOList = functionTypesResponse.getContent();
         return recursiveFindSonBuildingTypes(buildingType, functionTypeVOList);
     }
@@ -334,7 +333,7 @@ public class SaasWebServiceImpl implements ISaasWebService {
         // 获取用户所有可选的分区信息
         PoemsFeignBaseDTO poemsFeignBaseDTO = new PoemsFeignBaseDTO();
         poemsFeignBaseDTO.setDefaultValue();
-        PoemsFeignResponse<UserPartitionProjectsInfoVO> partitionsResponse = saasWebClient.getCurrentUserPartitionProjectsInfo(poemsFeignBaseDTO);
+        PoemsFeignResponse<UserPartitionProjectsInfoVO> partitionsResponse = saasWebClientWrapper.getCurrentUserPartitionProjectsInfo(poemsFeignBaseDTO);
         List<UserPartitionProjectsInfoVO> userPartitionProjects = partitionsResponse.getContent();
         if (CollectionUtils.isEmpty(userPartitionProjects)) {
             return Lists.newArrayList();

+ 2 - 1
src/main/resources/bootstrap.yml

@@ -2,7 +2,8 @@ spring:
   application:
     name: energy-report
 
-EUREKA_CLIENT_DEFAULT_ZONE: http://frame:123456@192.168.64.18:9931/eureka
+EUREKA_CLIENT_DEFAULT_ZONE: http://frame:123456@develop.persagy.com/integrated-eureka/eureka/
+#EUREKA_CLIENT_DEFAULT_ZONE: http://frame:123456@192.168.64.18:9931/eureka