From 67abec4113f16e5902bcb02ece0e1074f0ba1077 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 10 May 2022 17:26:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=B8=80=E6=88=B7=E4=B8=80?= =?UTF-8?q?=E6=A1=A3=20=E6=9A=82=E5=AD=982?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/ExcelFillCellMergeStrategy.java | 4 +- .../dto/result/HouseMemberResultDTO.java | 159 +++++++++++++++- .../com/epmet/controller/HouseController.java | 42 ++++- .../epmet/service/impl/HouseServiceImpl.java | 79 +++++++- .../epmet/dto/form/RentTenantDataFormDTO.java | 5 + .../dto/result/HouseIcResiUserResultDTO.java | 175 ++++++++++++++++++ .../epmet/feign/EpmetUserOpenFeignClient.java | 6 +- .../EpmetUserOpenFeignClientFallback.java | 2 +- .../controller/IcResiUserController.java | 2 +- .../java/com/epmet/dao/IcResiUserDao.java | 8 + .../com/epmet/service/IcResiUserService.java | 2 +- .../service/impl/IcResiUserServiceImpl.java | 33 ++-- .../main/resources/mapper/IcResiUserDao.xml | 53 +++++- 13 files changed, 522 insertions(+), 48 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HouseIcResiUserResultDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ExcelFillCellMergeStrategy.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ExcelFillCellMergeStrategy.java index 54f395bbc9..4d02d241c7 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ExcelFillCellMergeStrategy.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ExcelFillCellMergeStrategy.java @@ -91,9 +91,9 @@ public class ExcelFillCellMergeStrategy implements CellWriteHandler { // 将当前单元格数据与上一个单元格数据比较 Boolean dataBool = preData.equals(curData); //此处需要注意:因为我是按照序号确定是否需要合并的,所以获取每一行第一列数据和上一行第一列数据进行比较,如果相等合并 - Boolean bool = cell.getRow().getCell(0).getStringCellValue().equals(cell.getSheet().getRow(curRowIndex - 1).getCell(0).getStringCellValue()); - if (!dataBool || !bool) { + + if (!dataBool) { return; } Sheet sheet = writeSheetHolder.getSheet(); diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseMemberResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseMemberResultDTO.java index 208353f318..615b887d03 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseMemberResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseMemberResultDTO.java @@ -1,9 +1,10 @@ package com.epmet.dto.result; -import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; -import java.util.List; +import java.io.Serializable; /** * desc:房屋和房屋成员返回结果类 @@ -13,27 +14,173 @@ import java.util.List; * @version: 1.0 */ @Data -public class HouseMemberResultDTO extends PageFormDTO { - private static final long serialVersionUID = 4574743024782401136L; +public class HouseMemberResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + @ExcelProperty(value = {"房屋信息","所属组织"},index = 1) private String agencyName; + @ExcelProperty(value = {"房屋信息","所属网格"},index = 2) private String gridName; + @ExcelIgnore + private String neighborHoodId; + @ExcelProperty(value = {"房屋信息","所属小区"},index = 3) private String neighborHoodName; + @ExcelIgnore + private String buildingId; + @ExcelIgnore + private String houseId; + @ExcelProperty(value = {"房屋信息","所属楼栋"},index = 4) private String buildingName; + @ExcelProperty(value = {"房屋信息","单元"},index = 5) private String unitName; /** * 门牌号 */ + @ExcelProperty(value = {"房屋信息","门牌号"},index = 6) private String doorName; /** * 房屋类型,1楼房,2平房,3别墅 */ + @ExcelProperty(value = {"房屋信息","房屋类型"},index = 7) private String houseType; /** - * 家庭成员 + * 房屋用途 */ - public static List memberList; + @ExcelProperty(value = {"房屋信息","房屋用途"},index = 8) + private String purpose; + /** + * 房屋状态 + */ + @ExcelProperty(value = {"房屋信息","房屋状态"},index = 9) + private String rentFlag; + + /** + * 房主姓名 + */ + @ExcelProperty(value = {"房屋信息","房主姓名"},index = 10) + private String ownerName; + /** + * 房主电话 + */ + @ExcelProperty(value = {"房屋信息","房主电话"},index = 11) + private String ownerPhone; + /** + * 房主身份证 + */ + @ExcelProperty(value = {"房屋信息","房主身份证"},index = 12) + private String ownerIdCard; + + + //居民信息/**/ + /** + * 主键 + */ + @ExcelIgnore + private String id; + + /** + * 姓名 + */ + @ExcelProperty(value = {"实际居住人息","姓名"},index = 13) + private String name; + + /** + * 性别 + */ + @ExcelProperty(value = {"实际居住人息","性别"},index = 14) + private String gender; + + /** + * 手机号 + */ + @ExcelProperty(value = {"实际居住人息","手机号"},index = 15) + private String mobile; + + /** + * 身份证号 + */ + @ExcelProperty(value = {"实际居住人息","身份证号"},index = 16) + private String idCard; + + /** + * 出生日期 + */ + @ExcelProperty(value = {"实际居住人息","出生日期"},index = 17) + private String birthday; + + /** + * 户籍所在地 + */ + @ExcelProperty(value = {"实际居住人息","户籍所在地"},index = 18) + private String hjszd; + + /** + * 与户主关系【字典表】 + */ + @ExcelProperty(value = {"实际居住人息","与户主关系"},index = 19) + private String yhzgx; + + /** + * 是否党员 + */ + @ExcelProperty(value = {"实际居住人息","是否党员"},index = 20) + private String isParty; + + /** + * 是否租户 + */ + @ExcelProperty(value = {"实际居住人息","是否租户"},index = 21) + private String isTenant; + + /** + * 是否流动人口 + */ + @ExcelProperty(value = {"实际居住人息","是否流动人口"},index = 22) + private String isFloating; + + /** + * 工作单位 + */ + @ExcelProperty(value = {"实际居住人息","工作单位"},index = 23) + private String gzdw; + + /** + * 民族【字典表】 + */ + @ExcelProperty(value = {"实际居住人息","民族"},index = 24) + private String mz; + + /** + * 籍贯 + */ + @ExcelProperty(value = {"实际居住人息","籍贯"},index = 25) + private String jg; + + /** + * 婚姻状况【字典表】 + */ + @ExcelProperty(value = {"实际居住人息","婚姻状况"},index = 26) + private String hyzk; + + /** + * 文化程度【字典表】 + */ + @ExcelProperty(value = {"实际居住人息","文化程度"},index = 27) + private String culture; + + /** + * 宗教信仰 + */ + @ExcelProperty(value = {"实际居住人息","宗教信仰"},index = 28) + private String faith; + + /** + * 备注 + */ + @ExcelProperty(value = {"实际居住人息","备注"},index = 29) + private String remarks; + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java index ae3fb5b413..438cc31abd 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java @@ -21,6 +21,9 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.excel.write.metadata.style.WriteCellStyle; +import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; +import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.MaskResponse; @@ -34,6 +37,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.poi.excel.handler.ExcelFillCellMergeStrategy; import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constants.ImportTaskConstants; @@ -45,6 +49,8 @@ import com.epmet.service.HouseService; import com.epmet.util.ExcelPoiUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.usermodel.VerticalAlignment; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -326,22 +332,42 @@ public class HouseController implements ResultDataResolver { @NoRepeatSubmit @RequestMapping(value = "/exportHouseUser") public void exportHouseUser(@LoginUser TokenDto tokenDto, @RequestBody IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception { + formDTO.setIsPage(false); + formDTO.setPageSize(NumConstant.ONE_THOUSAND); //效验数据 - LoginUserDetailsResultDTO loginUserDetail = getLoginUserDetailsResultDTO(tokenDto, "【查询房屋】查询当前staff所在组织信息失败"); - formDTO.setAgencyId(loginUserDetail.getAgencyId()); + if (StringUtils.isBlank(formDTO.getAgencyId())){ + LoginUserDetailsResultDTO loginUserDetail = getLoginUserDetailsResultDTO(tokenDto, "【查询房屋】查询当前staff所在组织信息失败"); + formDTO.setAgencyId(loginUserDetail.getAgencyId()); + } ValidatorUtils.validateEntity(formDTO); ExcelWriter excelWriter = null; try { - excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("一户一档信息.xlsx", response)) + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("一户一档信息.xlsx", response), HouseMemberResultDTO.class) .registerWriteHandler(new FreezeAndFilter()) .build(); - - WriteSheet writeSheet = EasyExcel.writerSheet().build(); + int[] mergeRowArr = new int[]{0,1,2,3,4,5,6,7,8,9,10}; + + // 头的策略 + WriteCellStyle headWriteCellStyle = new WriteCellStyle(); + // 背景设置为红色 + headWriteCellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); + WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); + contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); + FreezeAndFilter writeHandler = new FreezeAndFilter(); + ExcelFillCellMergeStrategy mergeStrategy = new ExcelFillCellMergeStrategy(2,mergeRowArr); + WriteSheet writeSheet = EasyExcel.writerSheet().registerWriteHandler(mergeStrategy) + .registerWriteHandler(horizontalCellStyleStrategy) + .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .registerWriteHandler(writeHandler) + .build(); List dataList = null; do { dataList = houseService.getHouseUser(tokenDto,formDTO); - + System.out.println("====:"+JSON.toJSONString(dataList)); + excelWriter.write(dataList,writeSheet); + formDTO.setPageSize(formDTO.getPageSize()+1); }while (dataList != null && dataList.size() == formDTO.getPageSize()); //获取导出配置 @@ -353,6 +379,10 @@ public class HouseController implements ResultDataResolver { Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg()); printWriter.write(JSON.toJSONString(result)); printWriter.close(); + }finally { + if (excelWriter != null){ + excelWriter.finish(); + } } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index b992ca9c00..e790fc07a9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -37,6 +37,8 @@ import com.epmet.service.*; import com.epmet.util.ExcelPoiUtils; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -50,6 +52,7 @@ import java.io.InputStream; import java.text.NumberFormat; import java.util.*; import java.util.concurrent.ExecutorService; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -470,16 +473,80 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { icBuildingService.update(icBuildingDTO); } } - + //Cache @Override public List getHouseUser(TokenDto tokenDto, IcHouseListFormDTO formDTO) { + RentTenantDataFormDTO resiParam = new RentTenantDataFormDTO(); + resiParam.setCustomerId(tokenDto.getCustomerId()); + resiParam.setAgencyId(formDTO.getAgencyId()); + resiParam.setGridId(formDTO.getGridId()); + resiParam.setPageSize(NumConstant.ONE_THOUSAND); + + //查询级别 默认按照小区去查 + int searchLevel = 0; + + //如果楼宇id不为空 则直接查询楼宇内的居民 + if (StringUtils.isNotEmpty(formDTO.getBuildingId())){ + searchLevel = 1; + } + //如果有具体的查询套件 则直接降级为2 按照房屋Id 来查 + if (StringUtils.isNotEmpty(formDTO.getOwnerName()) || StringUtils.isNotEmpty(formDTO.getOwnerPhone()) || StringUtils.isNotEmpty(formDTO.getRentFlag())){ + searchLevel = 2; + } + PageData houseList = this.getHouseList(formDTO); - List memberResultDTOS = ConvertUtils.sourceToTarget(houseList.getList(), HouseMemberResultDTO.class); - memberResultDTOS.parallelStream().forEach(o ->{ - RentTenantDataFormDTO userResiInfoListFormDTO = new RentTenantDataFormDTO(); - epmetUserOpenFeignClient.getHouseMemberList(userResiInfoListFormDTO); + List resultDTOS = ConvertUtils.sourceToTarget(houseList.getList(), HouseMemberResultDTO.class); + + List result = new ArrayList<>(); + int finalSearchLevel = searchLevel; + Cache> memberMap = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.SECONDS).build(); + resultDTOS.parallelStream().forEach(o ->{ + resiParam.setNeighborHoodId(o.getNeighborHoodId()); + if (finalSearchLevel == 1){ + resiParam.setBuildingId(o.getBuildingId()); + } + if (finalSearchLevel == 2){ + resiParam.setHouseId(o.getHouseId()); + } + getHouseMembers(resiParam, memberMap); + List members = memberMap.getIfPresent(o.getHouseId()); + if (members == null){ + return; + } + members.forEach(m->{ + HouseMemberResultDTO resultDTO = ConvertUtils.sourceToTarget(m, HouseMemberResultDTO.class); + resultDTO.setAgencyName(o.getAgencyName()); + resultDTO.setGridName(o.getGridName()); + resultDTO.setNeighborHoodName(o.getNeighborHoodName()); + resultDTO.setBuildingName(o.getBuildingName()); + resultDTO.setUnitName(o.getUnitName()); + resultDTO.setDoorName(o.getDoorName()); + resultDTO.setHouseType(o.getHouseType()); + resultDTO.setPurpose(o.getPurpose()); + resultDTO.setRentFlag(o.getRentFlag()); + resultDTO.setOwnerName(o.getOwnerName()); + resultDTO.setOwnerPhone(o.getOwnerPhone()); + resultDTO.setOwnerIdCard(o.getOwnerIdCard()); + result.add(resultDTO); + }); }); - return memberResultDTOS; + return result; + } + + public void getHouseMembers(RentTenantDataFormDTO resiParam, Cache> memberMap) { + List memberListTemp = null; + do { + Result> memberResult = epmetUserOpenFeignClient.getHouseMemberList(resiParam); + if (!memberResult.success()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "调用user服务失败"); + } + memberListTemp = memberResult.getData(); + if (CollectionUtils.isEmpty(memberListTemp)) { + continue; + } + resiParam.setPageSize(resiParam.getPageSize()+1); + memberListTemp.parallelStream().forEach(h -> memberMap.put(h.getHomeId(), h.getHouseMemberList())); + } while (memberListTemp != null && memberListTemp.size() == resiParam.getPageSize()); } /** diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RentTenantDataFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RentTenantDataFormDTO.java index ae6986765a..6428ab39e3 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RentTenantDataFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RentTenantDataFormDTO.java @@ -29,6 +29,11 @@ public class RentTenantDataFormDTO extends PageFormDTO { */ private String agencyId; + /** + * pids + */ + private String pids; + /** * 网格Id */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HouseIcResiUserResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HouseIcResiUserResultDTO.java new file mode 100644 index 0000000000..d640951290 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/HouseIcResiUserResultDTO.java @@ -0,0 +1,175 @@ +/** + * 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.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 房屋内居民结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-26 + */ +@Data +public class HouseIcResiUserResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 客户Id customer.id + */ + private String customerId; + + /** + * + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 所属小区ID + */ + private String villageId; + + /** + * 所属楼宇Id + */ + private String buildId; + + /** + * 单元id + */ + private String unitId; + + /** + * 所属家庭Id + */ + private String homeId; + + /** + * 屋内的居民 + */ + private List houseMemberList; + + @Data + public static class HouseMemberResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 姓名 + */ + private String name; + + /** + * 性别 + */ + private String gender; + + /** + * 手机号 + */ + private String mobile; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 出生日期 + */ + private String birthday; + + /** + * 户籍所在地 + */ + private String hjszd; + + /** + * 与户主关系【字典表】 + */ + private String yhzgx; + + /** + * 是否党员 + */ + private String isParty; + + /** + * 是否租户 + */ + private String isTenant; + + /** + * 是否流动人口 + */ + private String isFloating; + + /** + * 工作单位 + */ + private String gzdw; + + /** + * 民族【字典表】 + */ + private String mz; + + /** + * 籍贯 + */ + private String jg; + + /** + * 婚姻状况【字典表】 + */ + private String hyzk; + + /** + * 文化程度【字典表】 + */ + private String culture; + + /** + * 宗教信仰 + */ + private String faith; + + /** + * 备注 + */ + private String remarks; + + } + +} 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 1bd57957c1..3dfbe4b8fe 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 @@ -23,8 +23,8 @@ import java.util.Set; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:09 */ -// @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087") -@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class) +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087") +//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class) public interface EpmetUserOpenFeignClient { /** @@ -747,5 +747,5 @@ public interface EpmetUserOpenFeignClient { * @return */ @PostMapping("/epmetuser/icresiuser/getHouseMemberList") - Result> getHouseMemberList(@RequestBody RentTenantDataFormDTO formDTO); + Result> getHouseMemberList(@RequestBody RentTenantDataFormDTO 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 0231dce7b5..1389394e78 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 @@ -544,7 +544,7 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien } @Override - public Result> getHouseMemberList(RentTenantDataFormDTO formDTO) { + public Result> getHouseMemberList(RentTenantDataFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getHouseMemberList", 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 97b9ded9a1..121dd8c24a 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 @@ -1002,7 +1002,7 @@ public class IcResiUserController implements ResultDataResolver { return new Result().ok(r); } @PostMapping("getHouseMemberList") - Result> getHouseMemberList(@RequestBody RentTenantDataFormDTO formDTO) { + Result> getHouseMemberList(@RequestBody RentTenantDataFormDTO formDTO) { return new Result().ok(icResiUserService.getHouseMemberList(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 32878e0bde..8edf4cd3af 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 @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.tools.dto.result.OptionDataResultDTO; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.EpidemicPreventionFormDTO; +import com.epmet.dto.form.RentTenantDataFormDTO; import com.epmet.dto.form.ResiUserQueryValueDTO; import com.epmet.dto.result.*; import com.epmet.entity.IcResiUserEntity; @@ -301,4 +302,11 @@ public interface IcResiUserDao extends BaseDao { IcResiUserEntity selectResiNoDelFlag(@Param("icResiUserId") String icResiUserId); List userChart(@Param("orgId") String orgId, @Param("orgType") String orgType); + + /** + * desc:根据维度获取居民信息表的数据 + * @param formDTO + * @return + */ + List getResiUser(RentTenantDataFormDTO 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 51d71b72f0..6bbcdf1b8b 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 @@ -324,5 +324,5 @@ public interface IcResiUserService extends BaseService { * @param formDTO * @return */ - List getHouseMemberList(RentTenantDataFormDTO formDTO); + List getHouseMemberList(RentTenantDataFormDTO 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 f48398684e..4a40748907 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 @@ -1802,33 +1802,24 @@ public class IcResiUserServiceImpl extends BaseServiceImpl getHouseMemberList(RentTenantDataFormDTO formDTO) { - String pids = ""; - //根据pid 获取居民 信息 - if (StringUtils.isNotBlank(formDTO.getGridId())){ - GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getGridId()); - if (gridInfo == null){ - log.warn("getHouseMemberList gridId:{} is not exist",formDTO.getGridId()); - return null; - } - pids = gridInfo.getPids().concat(StrConstant.COLON).concat(formDTO.getGridId()); - } + public List getHouseMemberList(RentTenantDataFormDTO formDTO) { + //如果是组织 且非顶级组织 则利用pids 查询 本级及下级 if (StringUtils.isNotBlank(formDTO.getAgencyId())){ AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId()); if (agencyInfo == null){ log.warn("getHouseMemberList agencyId:{} is not exist",formDTO.getAgencyId()); return null; } - pids = agencyInfo.getPids().concat(StrConstant.COLON).concat(formDTO.getAgencyId()); - } - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(IcResiUserEntity::getCustomerId,formDTO.getCustomerId()) - .eq(StringUtils.isNotBlank(formDTO.getAgencyId()),IcResiUserEntity::getCustomerId,formDTO.getCustomerId()) - .eq(StringUtils.isNotBlank(formDTO.getCustomerId()),IcResiUserEntity::getCustomerId,formDTO.getCustomerId()) - ; - /*PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize(),formDTO.getIsPage()) - .doSelectPage(()->baseDao.getResiUser())*/ - return null; + if (!NumConstant.ZERO_STR.equals(agencyInfo.getPid())) { + String pids = agencyInfo.getPids().concat(StrConstant.COLON).concat(formDTO.getAgencyId()); + formDTO.setPids(pids); + } + } + + Page listPage = PageHelper + .startPage(formDTO.getPageNo(),formDTO.getPageSize(),formDTO.getIsPage()) + .doSelectPage(()->baseDao.getResiUser(formDTO)); + return listPage.getResult(); } } 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 8b35a19c85..4378ed3c3e 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 @@ -2,7 +2,36 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into ${tableName} ( @@ -911,5 +940,27 @@ GROUP BY is_floating +