From ab33210e842a04c23b7d9a4424c22850371b68fd Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 30 Jun 2022 10:31:30 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8F=8C=E5=AE=9E=E5=BD=95=E5=85=A5?= =?UTF-8?q?=E3=80=91=E7=BB=9F=E8=AE=A1=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/BuildingCountResultDTO.java | 12 +- .../dto/result/BuildingListResultDTO.java | 14 +- .../dto/result/CommunityCountResultDTO.java | 12 +- .../dto/result/GridCountListResultDTO.java | 18 +- .../epmet/dto/result/HomeListResultDTO.java | 2 +- .../epmet/dto/result/UnitCountResultDTO.java | 4 +- .../epmet/dto/result/UnitListResultDTO.java | 6 +- .../impl/HouseInformationServiceImpl.java | 198 ++++++++++++++++-- .../resources/mapper/IcNeighborHoodDao.xml | 8 +- .../epmet/dto/form/IcUserCountFormDTO.java | 24 +++ .../dto/result/IcUserCountResultDTO.java | 17 ++ .../epmet/feign/EpmetUserOpenFeignClient.java | 11 + .../EpmetUserOpenFeignClientFallback.java | 14 ++ .../controller/IcResiUserController.java | 13 ++ .../java/com/epmet/dao/IcResiUserDao.java | 15 +- .../com/epmet/service/IcResiUserService.java | 10 + .../service/impl/IcResiUserServiceImpl.java | 18 ++ .../main/resources/mapper/IcResiUserDao.xml | 64 ++++++ 18 files changed, 400 insertions(+), 60 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUserCountFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcUserCountResultDTO.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingCountResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingCountResultDTO.java index c37e19702d..c6a09dd2ab 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingCountResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingCountResultDTO.java @@ -14,10 +14,10 @@ public class BuildingCountResultDTO { private String buildingId; private String buildingName; private String buildingType; - private Integer unitCount; - private Integer houseCount; - private Integer personCount; - private Integer unitRealCount; - private Integer houseRealCount; - private Integer personRealCount; + private Integer unitCount = 0; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer unitRealCount = 0; + private Integer houseRealCount = 0; + private Integer personRealCount = 0; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingListResultDTO.java index e0f6c7e038..67b4642640 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingListResultDTO.java @@ -16,11 +16,11 @@ public class BuildingListResultDTO implements Serializable { private static final long serialVersionUID = -1423424057500044373L; private String id; private String name; - private Integer unitCount; - private Integer houseCount; - private Integer personCount; - private Integer differHouseCount; - private Integer differPersonCount; - private Integer houseRealCount; - private Integer personRealCount; + private Integer unitCoun = 0; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer differHouseCount = 0; + private Integer differPersonCount = 0; + private Integer houseRealCount = 0; + private Integer personRealCount = 0; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityCountResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityCountResultDTO.java index 50961f3a9f..393d6d5b2e 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityCountResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityCountResultDTO.java @@ -16,10 +16,10 @@ public class CommunityCountResultDTO implements Serializable { private static final long serialVersionUID = -1677303397440121269L; private String id; private String name; - private Integer buildingCount; - private Integer houseCount; - private Integer personCount; - private Integer buildingRealCount; - private Integer houseRealCount; - private Integer personRealCount; + private Integer buildingCount = 0; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer buildingRealCount = 0; + private Integer houseRealCount = 0; + private Integer personRealCount = 0; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridCountListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridCountListResultDTO.java index 99318e3bc5..6863f4cf49 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridCountListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridCountListResultDTO.java @@ -16,13 +16,13 @@ public class GridCountListResultDTO implements Serializable { private static final long serialVersionUID = -7938740461257344347L; private String id; private String name; - private Integer buildingCount; - private Integer houseCount; - private Integer personCount; - private Integer differBuildingCount; - private Integer differHouseCount; - private Integer differPersonCount; - private Integer buildingRealCount; - private Integer houseRealCount; - private Integer personRealCount; + private Integer buildingCount = 0; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer differBuildingCount = 0; + private Integer differHouseCount = 0; + private Integer differPersonCount = 0; + private Integer buildingRealCount = 0; + private Integer houseRealCount = 0; + private Integer personRealCount = 0; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HomeListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HomeListResultDTO.java index be5a99c195..9dbf8bfcac 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HomeListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HomeListResultDTO.java @@ -16,7 +16,7 @@ public class HomeListResultDTO implements Serializable { private static final long serialVersionUID = -1098032063828430218L; private String id; private String name; - private Double personCount; + private Integer personCount = 0; private String houseType; private String houseCode; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitCountResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitCountResultDTO.java index ac8d1d8d03..f9a634f59d 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitCountResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitCountResultDTO.java @@ -13,6 +13,6 @@ import lombok.NoArgsConstructor; public class UnitCountResultDTO { private String unitId; private String unitName; - private Integer houseCount; - private Integer personCount; + private Integer houseCount = 0; + private Integer personCount = 0; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitListResultDTO.java index 3d6256a399..4deeb9dd66 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/UnitListResultDTO.java @@ -16,7 +16,7 @@ public class UnitListResultDTO implements Serializable { private static final long serialVersionUID = -8750897881106004416L; private String id; private String name; - private Double houseCount; - private Double personCount; - private Double differHouseCount; + private Integer houseCount = 0; + private Integer personCount = 0; + private Integer differHouseCount = 0; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseInformationServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseInformationServiceImpl.java index 66aae8029b..ddd609fd47 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseInformationServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseInformationServiceImpl.java @@ -6,12 +6,15 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.CustomerAgencyDao; import com.epmet.dao.IcNeighborHoodDao; import com.epmet.dto.form.HouseInformationFormDTO; +import com.epmet.dto.form.IcUserCountFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; import com.epmet.enums.HouseRentFlagEnums; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.HouseInformationService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -21,7 +24,11 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Collections; +import java.util.Comparator; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * @Description @@ -36,6 +43,8 @@ public class HouseInformationServiceImpl implements HouseInformationService { private IcNeighborHoodDao icNeighborHoodDao; @Resource private CustomerAgencyDao customerAgencyDao; + @Resource + private EpmetUserOpenFeignClient userOpenFeignClient; /** * 【双实录入】社区录入数据统计 @@ -71,7 +80,15 @@ public class HouseInformationServiceImpl implements HouseInformationService { CommunityCountResultDTO result = icNeighborHoodDao.getCommunityCount(formDTO); result.setId(agency.getId()); result.setName(orgName); - //TODO 获取录入人口数 + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.ZERO_STR); + countFormDTO.setOrgId(formDTO.getCommunityId()); + countFormDTO.setType(NumConstant.ZERO_STR); + Map map = getMapResult(countFormDTO); + if (map.containsKey(formDTO.getCommunityId())) { + result.setPersonCount(map.get(formDTO.getCommunityId())); + } return result; } @@ -89,7 +106,22 @@ public class HouseInformationServiceImpl implements HouseInformationService { PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); List list = icNeighborHoodDao.getGridList(formDTO); PageInfo pageInfo = new PageInfo<>(list); - //TODO 获取录入人口数 + if (CollectionUtils.isNotEmpty(list)) { + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.ZERO_STR); + countFormDTO.setOrgId(formDTO.getCommunityId()); + countFormDTO.setType(NumConstant.ONE_STR); + Map map = getMapResult(countFormDTO); + + list.forEach(item -> { + if (map.containsKey(item.getId())) { + item.setPersonCount(map.get(item.getId())); + } + item.setDifferPersonCount(item.getPersonRealCount() - item.getPersonCount()); + }); + + } return new PageData<>(list, pageInfo.getTotal()); } @@ -105,7 +137,15 @@ public class HouseInformationServiceImpl implements HouseInformationService { @Override public GridStatisticsResultDTO getGridCount(HouseInformationFormDTO formDTO) { GridStatisticsResultDTO result = icNeighborHoodDao.getGridCount(formDTO); - //TODO 获取录入人口数 + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.ONE_STR); + countFormDTO.setOrgId(formDTO.getGridId()); + countFormDTO.setType(NumConstant.ZERO_STR); + Map map = getMapResult(countFormDTO); + if (map.containsKey(formDTO.getGridId())) { + result.setPersonCount(map.get(formDTO.getGridId())); + } return result; } @@ -123,7 +163,20 @@ public class HouseInformationServiceImpl implements HouseInformationService { PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); List list = icNeighborHoodDao.getNeighborHoodList(formDTO); PageInfo pageInfo = new PageInfo<>(list); - //TODO 获取录入人口数 + if (CollectionUtils.isNotEmpty(list)) { + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.ONE_STR); + countFormDTO.setOrgId(formDTO.getGridId()); + countFormDTO.setType(NumConstant.ONE_STR); + Map map = getMapResult(countFormDTO); + list.forEach(item -> { + if (map.containsKey(item.getId())) { + item.setPersonCount(map.get(item.getId())); + } + item.setDifferPersonCount(item.getPersonRealCount() - item.getPersonCount()); + }); + } return new PageData<>(list, pageInfo.getTotal()); } @@ -139,7 +192,15 @@ public class HouseInformationServiceImpl implements HouseInformationService { @Override public NeighborHoodCountResultDTO getNeighborHoodCount(HouseInformationFormDTO formDTO) { NeighborHoodCountResultDTO result = icNeighborHoodDao.getNeighborHoodCount(formDTO); - //TODO 获取录入人口数 + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.TWO_STR); + countFormDTO.setOrgId(formDTO.getNeighborHoodId()); + countFormDTO.setType(NumConstant.ZERO_STR); + Map map = getMapResult(countFormDTO); + if (map.containsKey(formDTO.getNeighborHoodId())) { + result.setPersonCount(map.get(formDTO.getNeighborHoodId())); + } return result; } @@ -156,17 +217,47 @@ public class HouseInformationServiceImpl implements HouseInformationService { public PageData getBuildingList(HouseInformationFormDTO formDTO) { List list; long total = 0; - //TODO 获取录入人口数 - if (NumConstant.FIVE_STR.equals(formDTO.getSort())) { + + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.TWO_STR); + countFormDTO.setOrgId(formDTO.getNeighborHoodId()); + countFormDTO.setType(NumConstant.ONE_STR); + Map map = getMapResult(countFormDTO); + + if (!NumConstant.FIVE_STR.equals(formDTO.getSort())) { PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); list = icNeighborHoodDao.getBuildingList(formDTO); PageInfo pageInfo = new PageInfo<>(list); total = pageInfo.getTotal(); + + if (CollectionUtils.isNotEmpty(list)) { + list.forEach(item -> { + if (map.containsKey(item.getId())) { + item.setPersonCount(map.get(item.getId())); + } + item.setDifferPersonCount(item.getPersonRealCount() - item.getPersonCount()); + }); + } } else { list = icNeighborHoodDao.getBuildingList(formDTO); - total = list.size(); + if (CollectionUtils.isNotEmpty(list)) { + total = list.size(); + list.forEach(item -> { + if (map.containsKey(item.getId())) { + item.setPersonCount(map.get(item.getId())); + } + item.setDifferPersonCount(item.getPersonRealCount() - item.getPersonCount()); + }); + + //排序 + list = list.stream().sorted(Comparator.comparing(BuildingListResultDTO::getDifferPersonCount).reversed()).collect(Collectors.toList()); + //分页 + list = list.stream().skip((long)(formDTO.getPageNo() - 1) * formDTO.getPageSize()).limit(formDTO.getPageSize()).collect(Collectors.toList()); + } } + return new PageData<>(list, total); } @@ -182,7 +273,15 @@ public class HouseInformationServiceImpl implements HouseInformationService { @Override public BuildingCountResultDTO getBuildingCount(HouseInformationFormDTO formDTO) { BuildingCountResultDTO result = icNeighborHoodDao.getBuildingCount(formDTO); - //TODO 获取录入人口数 + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.THREE_STR); + countFormDTO.setOrgId(formDTO.getBuildingId()); + countFormDTO.setType(NumConstant.ZERO_STR); + Map map = getMapResult(countFormDTO); + if (map.containsKey(formDTO.getBuildingId())) { + result.setPersonCount(map.get(formDTO.getBuildingId())); + } return result; } @@ -200,7 +299,19 @@ public class HouseInformationServiceImpl implements HouseInformationService { PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); List list = icNeighborHoodDao.getUnitList(formDTO); PageInfo pageInfo = new PageInfo<>(list); - //TODO 获取录入人口数 + if (CollectionUtils.isNotEmpty(list)) { + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.THREE_STR); + countFormDTO.setOrgId(formDTO.getBuildingId()); + countFormDTO.setType(NumConstant.ONE_STR); + Map map = getMapResult(countFormDTO); + list.forEach(item -> { + if (map.containsKey(item.getId())) { + item.setPersonCount(map.get(item.getId())); + } + }); + } return new PageData<>(list, pageInfo.getTotal()); } @@ -216,7 +327,15 @@ public class HouseInformationServiceImpl implements HouseInformationService { @Override public UnitCountResultDTO getUnitCount(HouseInformationFormDTO formDTO) { UnitCountResultDTO result = icNeighborHoodDao.getUnitCount(formDTO); - //TODO 获取录入人口数 + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.FOUR_STR); + countFormDTO.setOrgId(formDTO.getUnitId()); + countFormDTO.setType(NumConstant.ZERO_STR); + Map map = getMapResult(countFormDTO); + if (map.containsKey(formDTO.getUnitId())) { + result.setPersonCount(map.get(formDTO.getUnitId())); + } return result; } @@ -231,15 +350,54 @@ public class HouseInformationServiceImpl implements HouseInformationService { */ @Override public PageData getHouseList(HouseInformationFormDTO formDTO) { - PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); - List list = icNeighborHoodDao.getHouseList(formDTO); - PageInfo pageInfo = new PageInfo<>(list); - //TODO 获取录入人口数 - if (CollectionUtils.isNotEmpty(list)) { - list.forEach(item -> { - item.setHouseType(HouseRentFlagEnums.getTypeValue(item.getHouseType())); - }); + List list = null; + long total = 0; + //获取录入人口数 + IcUserCountFormDTO countFormDTO = new IcUserCountFormDTO(); + countFormDTO.setOrgType(NumConstant.FOUR_STR); + countFormDTO.setOrgId(formDTO.getUnitId()); + countFormDTO.setType(NumConstant.ONE_STR); + Map map = getMapResult(countFormDTO); + + if (!NumConstant.TWO_STR.equals(formDTO.getSort())) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + list = icNeighborHoodDao.getHouseList(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + total = pageInfo.getTotal(); + if (CollectionUtils.isNotEmpty(list)) { + list.forEach(item -> { + if (map.containsKey(item.getId())) { + item.setHouseType(HouseRentFlagEnums.getTypeValue(item.getHouseType())); + item.setPersonCount(map.get(item.getId())); + } + }); + } + } else { + list = icNeighborHoodDao.getHouseList(formDTO); + if (CollectionUtils.isNotEmpty(list)) { + total = list.size(); + list.forEach(item -> { + if (map.containsKey(item.getId())) { + item.setHouseType(HouseRentFlagEnums.getTypeValue(item.getHouseType())); + item.setPersonCount(map.get(item.getId())); + } + }); + //排序 + list = list.stream().sorted(Comparator.comparing(HomeListResultDTO::getPersonCount).reversed()).collect(Collectors.toList()); + //分页 + list = list.stream().skip((long)(formDTO.getPageNo() - 1) * formDTO.getPageSize()).limit(formDTO.getPageSize()).collect(Collectors.toList()); + } } - return new PageData<>(list, pageInfo.getTotal()); + + return new PageData<>(list, total); + } + + private Map getMapResult(IcUserCountFormDTO countFormDTO) { + Result> result = userOpenFeignClient.getIcUserCount(countFormDTO); + if (!result.success()) { + log.warn("查询录入人数失败"); + return Collections.emptyMap(); + } + return result.getData(); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml index 2ac839f1ce..fefb061e7d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml @@ -381,7 +381,9 @@ SUM(IFNULL( houseRealCount, 0 )) AS houseRealCount, SUM(IFNULL( personRealCount, 0 )) AS personRealCount, SUM(IFNULL( buildingCount, 0 )) AS buildingCount, - SUM(IFNULL( houseCount, 0 )) AS houseCount + SUM(IFNULL( houseCount, 0 )) AS houseCount, + SUM(IFNULL( buildingRealCount, 0 )) - SUM(IFNULL( buildingCount, 0 )) AS differBuildingCount, + SUM(IFNULL( houseRealCount, 0 )) - SUM(IFNULL( houseCount, 0 )) AS differHouseCount FROM customer_grid grid LEFT JOIN ( @@ -472,7 +474,9 @@ SUM( IFNULL( b.TOTAL_HOUSE_NUM, 0 ) ) AS houseRealCount, SUM( IFNULL( b.REAL_PERSON, 0 ) ) AS personRealCount, COUNT( DISTINCT b.ID ) AS buildingCount, - IFNULL(c.houseCount, 0) AS houseCount + IFNULL(c.houseCount, 0) AS houseCount, + IFNULL( a.REAL_BUILDING, 0 ) - COUNT( DISTINCT b.ID ) AS differBuildingCount, + SUM( IFNULL( b.TOTAL_HOUSE_NUM, 0 ) ) - IFNULL(c.houseCount, 0) AS differHouseCount FROM ic_neighbor_hood a LEFT JOIN ic_building b ON a.ID = b.NEIGHBOR_HOOD_ID diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUserCountFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUserCountFormDTO.java new file mode 100644 index 0000000000..675109ce0c --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcUserCountFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/29 17:27 + */ +@Data +public class IcUserCountFormDTO implements Serializable { + private static final long serialVersionUID = 1303693003176367290L; + private String orgId; + /** + * 0 组织,1 网格,2 小区,3 楼栋,4 单元,5 房屋 + */ + private String orgType; + /** + * 0 本级,1 下级 + */ + private String type; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcUserCountResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcUserCountResultDTO.java new file mode 100644 index 0000000000..a1e6e6a482 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcUserCountResultDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/6/29 17:50 + */ +@Data +public class IcUserCountResultDTO implements Serializable { + private static final long serialVersionUID = 2875016989035736971L; + private String id; + private Integer count; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 90b0359881..196debd91f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -816,4 +816,15 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/icresiuser/getUserId/{icUserId}") Result> getUserId(@PathVariable("icUserId") String icUserId); + + /** + * 获取录入居民的数量 + * + * @Param formDTO + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/6/30 9:35 + */ + @PostMapping("/epmetuser/icresiuser/getIcUserCount") + Result> getIcUserCount(IcUserCountFormDTO formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 55083de3a2..be1b2903c2 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -611,4 +611,18 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserId", icUserId); } + /** + * 获取录入居民的数量 + * + * @param formDTO + * @Param formDTO + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/6/30 9:35 + */ + @Override + public Result> getIcUserCount(IcUserCountFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getIcUserCount", formDTO); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 8e9e6a41c7..3541d2f4ad 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -1188,4 +1188,17 @@ public class IcResiUserController implements ResultDataResolver { public Result> getUserId(@PathVariable("icUserId") String icUserId) { return new Result>().ok(icResiUserService.getUserId(icUserId)); } + + /** + * 获取录入居民的数量 + * + * @Param formDTO + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2022/6/30 9:35 + */ + @PostMapping("getIcUserCount") + public Result> getIcUserCount(IcUserCountFormDTO formDTO) { + return new Result>().ok(icResiUserService.getIcUserCount(formDTO)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index f145fadd97..712537df0c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -22,10 +22,7 @@ import com.epmet.commons.tools.dto.result.OptionDataResultDTO; import com.epmet.dto.IcResiUserConfirmDTO; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.IcVolunteerPolyDTO; -import com.epmet.dto.form.EpidemicPreventionFormDTO; -import com.epmet.dto.form.MoveOutMemberFormDTO; -import com.epmet.dto.form.RentTenantDataFormDTO; -import com.epmet.dto.form.ResiUserQueryValueDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.IcResiUserEntity; import org.apache.ibatis.annotations.MapKey; @@ -370,4 +367,14 @@ public interface IcResiUserDao extends BaseDao { * @return com.epmet.entity.IcResiUserEntity */ IcResiUserEntity selectResiUserEntityByIdCard(@Param("idCard") String idCard,@Param("customerId") String customerId); + + /** + * 获取录入居民的数量 + * + * @Param formDTO + * @Return {@link Map} + * @Author zhaoqifeng + * @Date 2022/6/29 17:37 + */ + List getIcUserCount(IcUserCountFormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index 1abd65036f..31091ff3a6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -436,4 +436,14 @@ public interface IcResiUserService extends BaseService { * @Date 2022/6/16 15:30 */ List getUserId(String icResiUserId); + + /** + * 获取录入居民的数量 + * + * @Param formDTO + * @Return {@link Map} + * @Author zhaoqifeng + * @Date 2022/6/29 17:32 + */ + Map getIcUserCount(IcUserCountFormDTO formDTO); } 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 981abb643a..bfbc25808f 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 @@ -2572,6 +2572,24 @@ public class IcResiUserServiceImpl extends BaseServiceImpl} + * @Author zhaoqifeng + * @Date 2022/6/29 17:32 + */ + @Override + public Map getIcUserCount(IcUserCountFormDTO formDTO) { + List list = baseDao.getIcUserCount(formDTO); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyMap(); + } + return list.stream().collect(Collectors.toMap(IcUserCountResultDTO::getId, IcUserCountResultDTO::getCount, (key1 , key2)-> key2))); + } + /** * 根据身份证获取居民角色(目前只有是否是志愿者) * diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 57f23f9898..6fb49d35c0 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -1133,4 +1133,68 @@ AND customer_id = #{customerId} AND DEL_FLAG = '0' +