|
|
@ -329,12 +329,18 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
try { |
|
|
|
//获取多个sheet页
|
|
|
|
Workbook workBook = ExcelUtils.getWorkBook(file); |
|
|
|
//
|
|
|
|
//户主身份证和插入的ID,便于保存居住人信息时匹配户主信息
|
|
|
|
Map<String, String> populationIdNoAndIdMap = new HashMap<>(); |
|
|
|
//户主导入数据
|
|
|
|
List<BasePopulationInformationExcel> basePopulationInformationExcels = null; |
|
|
|
//户主导入数据异常提示
|
|
|
|
List<EpdcPopulationErrorResultDTO> epdcHouseAndHouseHeadErrorResultDTOS = null; |
|
|
|
//居民导入数据
|
|
|
|
List<BaseResidentInformationExcel> baseResidentInformationExcels = null; |
|
|
|
//居民导入数据异常提示
|
|
|
|
List<EpdcPopulationErrorResultDTO> epdcResidentErrorResultDTOS = null; |
|
|
|
//户主身份证列表,便于校验居住人页填写的身份证信息是否正确
|
|
|
|
Set<String> residentIdentifyNo = new HashSet<>(); |
|
|
|
for (int numSheet = 0; numSheet < workBook.getNumberOfSheets(); numSheet++) { |
|
|
|
//第几个sheet
|
|
|
|
importParams.setStartSheetIndex(numSheet); |
|
|
@ -343,11 +349,13 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
basePopulationInformationExcels = ExcelImportUtil.importExcel(f, BasePopulationInformationExcel.class, importParams); |
|
|
|
// 校验数据
|
|
|
|
epdcHouseAndHouseHeadErrorResultDTOS = this.checkPopulationExcel(basePopulationInformationExcels, sysPopulationSimpleDictDTOS); |
|
|
|
|
|
|
|
basePopulationInformationExcels.forEach(basePopulationInformationExcel -> |
|
|
|
residentIdentifyNo.add(basePopulationInformationExcel.getResidentsIdentityNo()) |
|
|
|
); |
|
|
|
} else if (numSheet == 1) {//检验和新增居住人信息
|
|
|
|
baseResidentInformationExcels = ExcelImportUtil.importExcel(f, BaseResidentInformationExcel.class, importParams); |
|
|
|
// 校验数据
|
|
|
|
epdcResidentErrorResultDTOS = this.checkResidentsExcel(baseResidentInformationExcels, sysPopulationSimpleDictDTOS); |
|
|
|
epdcResidentErrorResultDTOS = this.checkResidentsExcel(baseResidentInformationExcels, sysPopulationSimpleDictDTOS,residentIdentifyNo); |
|
|
|
} |
|
|
|
} |
|
|
|
if (epdcHouseAndHouseHeadErrorResultDTOS!=null && epdcHouseAndHouseHeadErrorResultDTOS.size() > 0) { |
|
|
@ -610,7 +618,7 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
* @Date 2020/8/31 |
|
|
|
* @Param [basePopulationInformationExcels, basePopulationInformationExcels1] |
|
|
|
**/ |
|
|
|
private List<EpdcPopulationErrorResultDTO> checkResidentsExcel(List<BaseResidentInformationExcel> basePopulationInformationExcels, List<SysPopulationSimpleDictDTO> sysPopulationSimpleDictDTOS) { |
|
|
|
private List<EpdcPopulationErrorResultDTO> checkResidentsExcel(List<BaseResidentInformationExcel> basePopulationInformationExcels, List<SysPopulationSimpleDictDTO> sysPopulationSimpleDictDTOS, Set<String> residentIdentifyNo) { |
|
|
|
// 不匹配信息
|
|
|
|
List<EpdcPopulationErrorResultDTO> errorLineInfoList = new ArrayList<>(); |
|
|
|
EpdcPopulationErrorResultDTO errorLineInfoDto; |
|
|
@ -630,6 +638,16 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
errorLineInfoDto.setSheetName("居住人信息"); |
|
|
|
errorLineInfoList.add(errorLineInfoDto); |
|
|
|
}else if(StringUtils.isNotBlank((residentsIdentityNo))){ |
|
|
|
//根据身份证获取户主信息
|
|
|
|
PopulationInformationEntity infoByIdentityNo = populationInformationService.getInfoByIdentityNo(residentsIdentityNo); |
|
|
|
//校验是否有此户主 excel中没有 且库中没有则提示信息
|
|
|
|
if(!residentIdentifyNo.contains(residentsIdentityNo) && infoByIdentityNo==null){ |
|
|
|
errorLineInfoDto = new EpdcPopulationErrorResultDTO(); |
|
|
|
errorLineInfoDto.setErrorLine((i + 2) + ""); |
|
|
|
errorLineInfoDto.setErrorInfo("未查询到此户主信息"); |
|
|
|
errorLineInfoDto.setSheetName("居住人信息"); |
|
|
|
errorLineInfoList.add(errorLineInfoDto); |
|
|
|
} |
|
|
|
baseResidentInformationExcel.setResidentsIdentityNo(residentsIdentityNo); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(houseHeadRelation)) { |
|
|
|