From 7d5000fbb1b05db195bef7d4b71789dd518278c5 Mon Sep 17 00:00:00 2001
From: zxc <1272811460@qq.com>
Date: Thu, 17 Mar 2022 14:14:45 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BD=91=E6=A0=BC=E4=BF=A1?=
=?UTF-8?q?=E6=81=AFfeign=E8=B0=83=E6=88=90=E7=BB=9F=E4=B8=80=E6=96=B9?=
=?UTF-8?q?=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../tools/dto/form/CustomerGridFormDTO.java | 42 +++++++++++++++++++
.../tools/feign/CommonGovOrgFeignClient.java | 8 ++--
...ommonGovOrgFeignClientFallBackFactory.java | 5 ++-
.../tools/redis/common/CustomerOrgRedis.java | 5 ++-
4 files changed, 53 insertions(+), 7 deletions(-)
create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/CustomerGridFormDTO.java
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/CustomerGridFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/CustomerGridFormDTO.java
new file mode 100644
index 0000000000..767f03bc07
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/CustomerGridFormDTO.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.commons.tools.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+
+/**
+ * epmet-user端调用gov-org端的入参
+ * @author sun
+ */
+@Data
+public class CustomerGridFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ /**
+ * 网格Id
+ */
+ @NotBlank(message = "网格ID不能为空", groups = {Grid.class})
+ private String gridId;
+
+ public interface Grid{}
+
+}
\ No newline at end of file
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovOrgFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovOrgFeignClient.java
index 3ece646100..bb6bfe423b 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovOrgFeignClient.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonGovOrgFeignClient.java
@@ -1,13 +1,13 @@
package com.epmet.commons.tools.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
-import com.epmet.commons.tools.feign.fallback.CommonAggFeignClientFallBackFactory;
+import com.epmet.commons.tools.dto.form.CustomerGridFormDTO;
import com.epmet.commons.tools.feign.fallback.CommonGovOrgFeignClientFallBackFactory;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RequestBody;
/**
* @Author zxc
@@ -19,11 +19,11 @@ public interface CommonGovOrgFeignClient {
/**
* @Description 查询网格信息
- * @param gridId
+ * @param customerGridFormDTO
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("/gov/org/grid/getbaseinfo")
- Result getGridInfo(@RequestParam("gridId")String gridId);
+ Result getGridInfo(@RequestBody CustomerGridFormDTO customerGridFormDTO);
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java
index bcde96c380..e292d07c69 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java
@@ -1,6 +1,7 @@
package com.epmet.commons.tools.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
+import com.epmet.commons.tools.dto.form.CustomerGridFormDTO;
import com.epmet.commons.tools.feign.CommonGovOrgFeignClient;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ModuleUtils;
@@ -16,8 +17,8 @@ import org.springframework.stereotype.Component;
public class CommonGovOrgFeignClientFallBackFactory implements CommonGovOrgFeignClient {
@Override
- public Result getGridInfo(String gridId) {
- return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridInfo", gridId);
+ public Result getGridInfo(CustomerGridFormDTO customerGridFormDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridInfo", customerGridFormDTO);
}
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java
index 94c413431a..66faab24d3 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java
@@ -2,6 +2,7 @@ package com.epmet.commons.tools.redis.common;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
+import com.epmet.commons.tools.dto.form.CustomerGridFormDTO;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.CommonAggFeignClient;
import com.epmet.commons.tools.feign.CommonGovOrgFeignClient;
@@ -61,7 +62,9 @@ public class CustomerOrgRedis {
if (!CollectionUtils.isEmpty(grid)) {
return ConvertUtils.mapToEntity(grid, GridInfoCache.class);
}
- Result gridInfoResult = customerOrgRedis.govOrgFeignClient.getGridInfo(gridId);
+ CustomerGridFormDTO formDTO = new CustomerGridFormDTO();
+ formDTO.setGridId(gridId);
+ Result gridInfoResult = customerOrgRedis.govOrgFeignClient.getGridInfo(formDTO);
if (!gridInfoResult.success()){
throw new RenException("查询网格信息失败...");
}