From 3eb2d28cc1c13a0da1b360236bb30a83cab24627 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Mon, 8 Nov 2021 11:07:13 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E3=80=91=E6=90=9C=E7=B4=A2=E4=BA=BA=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/feign/GovOrgOpenFeignClient.java | 3 +++ .../GovOrgOpenFeignClientFallback.java | 5 ++++ .../controller/IcNeighborHoodController.java | 12 +++++++++ .../epmet/service/IcNeighborHoodService.java | 9 +++++++ .../impl/IcNeighborHoodServiceImpl.java | 19 ++++++++++++++ .../service/impl/IcResiUserServiceImpl.java | 26 +++++++++++++++++-- 6 files changed, 72 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 08cee7d65d..4525030489 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -522,4 +522,7 @@ public interface GovOrgOpenFeignClient { @PostMapping("/gov/org/building/buildinglistbyids") Result> buildingListByIds(@RequestBody List buildingIdList); + + @PostMapping("/gov/org/icneighborhood/getlistbyids") + Result> getListByIds(@RequestBody List ids); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 7734d66901..5a5bc80ed5 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -320,6 +320,11 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "buildingListByIds", buildingIdList); } + @Override + public Result> getListByIds(List ids) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getListByIds", ids); + } + @Override public Result selectPidsByGridId(String gridId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectPidsByGridId", gridId); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java index 8af8c48978..48137bf4cb 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java @@ -95,4 +95,16 @@ public class IcNeighborHoodController { return new Result>().ok(icNeighborHoodService.getNeighborHoodOptions(dto.getAgencyId(), dto.getGridId())); } + /** + * @Description 通过ID查询小区信息 + * @Param ids + * @Return {@link Result< List< IcNeighborHoodDTO>>} + * @Author zhaoqifeng + * @Date 2021/11/8 10:46 + */ + @PostMapping("getlistbyids") + public Result> getListByIds(@RequestBody List ids) { + return new Result>().ok(icNeighborHoodService.getListByIds(ids)); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java index d069185056..cc8fd47ad1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java @@ -103,4 +103,13 @@ public interface IcNeighborHoodService extends BaseService * @Date 2021/10/26 14:32 */ List getNeighborHoodOptions(String agencyId, String gridId); + + /** + * @Description 通过ID查询小区信息 + * @Param ids + * @Return {@link List< IcNeighborHoodDTO>} + * @Author zhaoqifeng + * @Date 2021/11/8 10:45 + */ + List getListByIds(List ids); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java index ceea51f13d..db000d1208 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java @@ -134,4 +134,23 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl} + * @Author zhaoqifeng + * @Date 2021/11/8 10:45 + */ + @Override + public List getListByIds(List ids) { + if (CollectionUtils.isEmpty(ids)) { + return Collections.emptyList(); + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(IcNeighborHoodEntity::getId, ids); + List list = baseDao.selectList(wrapper); + return ConvertUtils.sourceToTarget(list, IcNeighborHoodDTO.class); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index ab211a7e29..59fe112b31 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -43,6 +43,7 @@ import com.epmet.dao.IcResiUserDao; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.IcHouseDTO; +import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.IcResiUserEntity; @@ -545,11 +546,32 @@ public class IcResiUserServiceImpl extends BaseServiceImpl pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.searchByName(formDTO.getName(), staffInfo.getAgencyId(), no)); List result = pageInfo.getList(); - // 查询小区,楼号,网格 - // TODO if (CollectionUtils.isEmpty(result)){ return new ArrayList<>(); } + // 查询小区,楼号,网格 + Result> gridResult = govOrgOpenFeignClient.getGridListByGridIds(result.stream().map(SearchByNameResultDTO::getGridId).collect(Collectors.toList())); + if (!gridResult.success()) { + throw new RenException(gridResult.getCode(),gridResult.getMsg()); + } + Map gridMap = gridResult.getData().stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName)); + Result> neighborHoodResult = govOrgOpenFeignClient.getListByIds(result.stream().map(SearchByNameResultDTO::getNeighborHoodId).collect(Collectors.toList())); + if (!neighborHoodResult.success()) { + throw new RenException(neighborHoodResult.getCode(),neighborHoodResult.getMsg()); + } + Map neighborHoodMap = neighborHoodResult.getData().stream().collect(Collectors.toMap(IcNeighborHoodDTO::getId, IcNeighborHoodDTO::getNeighborHoodName)); + Result> buildResult = govOrgOpenFeignClient.buildingListByIds(result.stream().map(SearchByNameResultDTO::getBuildId).collect(Collectors.toList())); + if (!buildResult.success()) { + throw new RenException(buildResult.getCode(),buildResult.getMsg()); + } + Map buildMap = buildResult.getData().stream().collect(Collectors.toMap(BuildingResultDTO::getBuildingId, BuildingResultDTO::getBuildingName)); + + result.forEach(item -> { + item.setGridName(gridMap.get(item.getGridId())); + item.setNeighborHoodName(neighborHoodMap.get(item.getNeighborHoodId())); + item.setBuildNum(buildMap.get(item.getBuildId())); + }); + return result; }