From 62f80b2e4e2b413c444cbf413cfecb31f50a2ecf Mon Sep 17 00:00:00 2001 From: songyunpeng Date: Tue, 8 Sep 2020 17:59:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=85=E6=B0=91=E4=BF=A1=E6=81=AF=E9=87=87?= =?UTF-8?q?=E9=9B=86-bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HousingInformationController.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/HousingInformationController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/HousingInformationController.java index 29153f50..da698e67 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/HousingInformationController.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/HousingInformationController.java @@ -129,6 +129,9 @@ public class HousingInformationController { } List sysPopulationSimpleDictDTOS = listResult.getData(); for (BasePopulationInformationExportDto basePopulationInformationExportDto : basePopulationInformationExcelList) { + if(StringUtils.isBlank(basePopulationInformationExportDto.getId())){ + continue; + } String educationLevel = basePopulationInformationExportDto.getEducationLevel(); String politicsStatus = basePopulationInformationExportDto.getPoliticsStatus(); String bodyStatus = basePopulationInformationExportDto.getBodyStatus(); @@ -167,10 +170,27 @@ public class HousingInformationController { basePopulationInformationExportDto.setMotorVehicleCategory(motorVehicleCategoryEnd.substring(0,motorVehicleCategoryEnd.lastIndexOf(","))); } } + //没有户主信息的房屋,转换excel时,替换是否时会出现null,此时将对应null值替换成空字符 + basePopulationInformationExcelList.forEach(basePopulationInformationExportDto ->{ + basePopulationInformationExportDto.setResidentsSex(""); + basePopulationInformationExportDto.setMilitaryService(""); + basePopulationInformationExportDto.setReemploymentPermit(""); + basePopulationInformationExportDto.setUnemploymentRegister(""); + basePopulationInformationExportDto.setDogStatus(""); + }); //根据获取的户主ID查询居住人信息 - Map> baseMap = basePopulationInformationExcelList.stream().collect(Collectors.groupingBy(BasePopulationInformationExportDto::getId)); + List basePopulationInformationExcelListWithHouseHead = new ArrayList<>(); + basePopulationInformationExcelListWithHouseHead.addAll(basePopulationInformationExcelList); + //先去除没有户主的房屋 + for(Iterator car = basePopulationInformationExcelListWithHouseHead.iterator();car.hasNext();){ + BasePopulationInformationExportDto basePopulationInformationExportDto = car.next(); + if(StringUtils.isBlank(basePopulationInformationExportDto.getId())){ + car.remove(); + } + } + Map> baseMap = basePopulationInformationExcelListWithHouseHead.stream().collect(Collectors.groupingBy(BasePopulationInformationExportDto::getId)); //获取所有的户主ID Set houseHeadIds = baseMap.keySet(); List baseResidentInformationExportDtoList = housingInformationService.selectBaseResidentInformationExcelList(houseHeadIds);