diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/BasePopulationInformationExcel.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/BasePopulationInformationExcel.java index 223d061d..1f88c463 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/BasePopulationInformationExcel.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/BasePopulationInformationExcel.java @@ -50,9 +50,6 @@ public class BasePopulationInformationExcel { @Excel(name = "产权人联系电话",width = 20) private String propertyOwnerMobile; - @Excel(name = "产权证") - private String propertyOwnerCard; - @Excel(name = "房屋用途",replace = {"自住_0","租赁_1","经营_2"}) private String houseUse; diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/HousingInformationServiceImpl.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/HousingInformationServiceImpl.java index c4c5a96b..57fe575e 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/HousingInformationServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/HousingInformationServiceImpl.java @@ -489,142 +489,6 @@ public class HousingInformationServiceImpl extends BaseServiceImpl savePopulationList(List basePopulationInformationExcels, ParentAndAllDeptDTO parentAndAllDeptDTO) { - //插入房屋信息 - List housingInformationEntityList = new ArrayList<>(); - - for (BasePopulationInformationExcel basePopulationInformationExcel : basePopulationInformationExcels) { - HousingInformationEntity housingInformationEntity = ConvertUtils.sourceToTarget(basePopulationInformationExcel, HousingInformationEntity.class); - housingInformationEntity.setGridId(parentAndAllDeptDTO.getGridId()); - housingInformationEntity.setParentDeptIds(parentAndAllDeptDTO.getParentDeptIds()); - housingInformationEntity.setParentDeptNames(parentAndAllDeptDTO.getParentDeptNames()); - housingInformationEntity.setAllDeptIds(parentAndAllDeptDTO.getAllDeptIds()); - housingInformationEntity.setAllDeptNames(parentAndAllDeptDTO.getAllDeptNames()); - housingInformationEntity.setBuyingTime(DateUtil.parse(basePopulationInformationExcel.getBuyingTime())); - housingInformationEntityList.add(housingInformationEntity); - } - insertBatch(housingInformationEntityList); - //组装租赁,经营,户主,房屋人员关系表信息 - List houseRentInfoEntities = new ArrayList<>(); - List houseBusinessInfoEntities = new ArrayList<>(); - //更新户主信息 - List updatePopulationInfo = new ArrayList<>(); - //插入户主信息 - List insertPopulationInfo = new ArrayList<>(); - //房屋户主信息 -- 户主更新 - List houseResidentEntityList = new ArrayList<>(); - //身份证校验 - List identifyNoValidation = new ArrayList<>(); - //存储 key:身份证 value 房子ID 身份证是可重复的 - List> HouseResidentInfos = new ArrayList<>(); - a: - for (HousingInformationEntity housingInformationEntity : housingInformationEntityList) { - for (BasePopulationInformationExcel basePopulationInformationExcel : basePopulationInformationExcels) { - //以产权证为唯一标识 - if (housingInformationEntity.getPropertyOwnerCard().equals(basePopulationInformationExcel.getPropertyOwnerCard())) { - if (HouseUseConstant.RENT.equals(housingInformationEntity.getHouseUse())) { - //房屋租赁信息 - HouseRentInfoEntity houseRentInfoEntity = ConvertUtils.sourceToTarget(basePopulationInformationExcel, HouseRentInfoEntity.class); - houseRentInfoEntity.setHouseId(housingInformationEntity.getId()); - houseRentInfoEntities.add(houseRentInfoEntity); - } else if (HouseUseConstant.BUSINESS.equals(housingInformationEntity.getHouseUse())) { - //房屋经营信息 - HouseBusinessInfoEntity houseBusinessInfoEntity = ConvertUtils.sourceToTarget(basePopulationInformationExcel, HouseBusinessInfoEntity.class); - houseBusinessInfoEntity.setHouseId(housingInformationEntity.getId()); - houseBusinessInfoEntities.add(houseBusinessInfoEntity); - } - //插入户主信息 - PopulationInformationEntity populationInformationEntity = ConvertUtils.sourceToTarget(basePopulationInformationExcel, PopulationInformationEntity.class); - PopulationInformationEntity oldPopulationInformationEntity = populationInformationService.getInfoByIdentityNo(populationInformationEntity.getResidentsIdentityNo()); - if (oldPopulationInformationEntity != null) { - //身份证在列表已存在,则更新户主信息 - populationInformationEntity.setId(oldPopulationInformationEntity.getId()); - //先检验下户主的一些信息 - validateHouseHeadInfo(populationInformationEntity, basePopulationInformationExcel); - updatePopulationInfo.add(populationInformationEntity); - //插入房屋人员关联关系表 - HouseResidentEntity houseResidentEntity = new HouseResidentEntity(); - houseResidentEntity.setHouseId(housingInformationEntity.getId()); - houseResidentEntity.setResidentId(oldPopulationInformationEntity.getId()); - houseResidentEntity.setIsHouseHead("1"); - houseResidentEntityList.add(houseResidentEntity); - } else { - //先检验下户主的一些信息 - validateHouseHeadInfo(populationInformationEntity, basePopulationInformationExcel); - - - //将新增的人员的身份证存到List,防止excel中重复的身份证增加不同的户主信息 - if (!identifyNoValidation.contains(populationInformationEntity.getResidentsIdentityNo())) { - //如果不包含,才新增进去。也就是说如果重复的身份证,只取第一条信息作为户主信息 - insertPopulationInfo.add(populationInformationEntity); - } - identifyNoValidation.add(populationInformationEntity.getResidentsIdentityNo()); - //方便下面新增房屋人员关系表,此时存储所有的户主身份证+房子ID - Map houseResidentInfo = new HashMap<>(); - houseResidentInfo.put(populationInformationEntity.getResidentsIdentityNo(), housingInformationEntity.getId()); - HouseResidentInfos.add(houseResidentInfo); - } - continue a; - } - } - } - //插入租赁信息 - if (houseRentInfoEntities.size() > 0) { - houseRentInfoService.insertBatch(houseRentInfoEntities); - } - //插入经营信息 - if (houseBusinessInfoEntities.size() > 0) { - houseBusinessInfoService.insertBatch(houseBusinessInfoEntities); - } - //如果人口信息身份证已有,则更新人口信息 - if (updatePopulationInfo.size() > 0) { - populationInformationService.updateBatchById(updatePopulationInfo); - } - //插入人口信息 - if (insertPopulationInfo.size() > 0) { - populationInformationService.insertBatch(insertPopulationInfo); - //遍历存储的身份证+房子ID对应信息,组装房屋人员关系 - for (Map houseResidentInfo : HouseResidentInfos) { - Set> set = houseResidentInfo.entrySet(); - for (Map.Entry entry : set) { - String identifyNo = entry.getKey(); - String houseId = entry.getValue(); - //根据身份证取户主ID - for (PopulationInformationEntity populationInformationEntity : insertPopulationInfo) { - if (populationInformationEntity.getResidentsIdentityNo().equals(identifyNo)) { - HouseResidentEntity houseResidentEntity = new HouseResidentEntity(); - houseResidentEntity.setHouseId(houseId); - houseResidentEntity.setResidentId(populationInformationEntity.getId()); - houseResidentEntity.setIsHouseHead("1"); - houseResidentEntityList.add(houseResidentEntity); - break; - } - } - } - - } - } - //插入房屋人员关系 - if (houseResidentEntityList.size() > 0) { - houseResidentService.insertBatch(houseResidentEntityList); - } - //组装人口身份证和ID信息 辅助添加居民信息 - insertPopulationInfo.addAll(updatePopulationInfo); - Map populationIdNoAndIdMap = new HashMap<>(); - insertPopulationInfo.forEach(i -> { - populationIdNoAndIdMap.put(i.getResidentsIdentityNo(),i.getId()); - }); - return populationIdNoAndIdMap; - } - /** @@ -637,11 +501,15 @@ public class HousingInformationServiceImpl extends BaseServiceImpl * @Description 校验居住人数据 @@ -854,6 +743,13 @@ public class HousingInformationServiceImpl extends BaseServiceImpl32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("房屋地址字数不能大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setHouseAddress(houseAddress); } if (StringUtils.isNotBlank(buyingTime)) { @@ -881,6 +777,13 @@ public class HousingInformationServiceImpl extends BaseServiceImpl32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("产权人字数不能大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setPropertyOwner(propertyOwner); } if (StringUtils.isBlank(propertyOwnerIdentityNo)) { @@ -890,6 +793,13 @@ public class HousingInformationServiceImpl extends BaseServiceImpl32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("产权人身份证号不能大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setPropertyOwnerIdentityNo(propertyOwnerIdentityNo); } if (StringUtils.isBlank(propertyOwnerMobile)) { @@ -899,6 +809,13 @@ public class HousingInformationServiceImpl extends BaseServiceImpl32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("产权人电话不能大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setPropertyOwnerMobile(propertyOwnerMobile); } if (StringUtils.isBlank(houseUse)) { @@ -925,6 +842,13 @@ public class HousingInformationServiceImpl extends BaseServiceImpl32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("承租人不能大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setTenantName(tenantName); } if (StringUtils.isBlank(tenantPhone)) { @@ -934,6 +858,13 @@ public class HousingInformationServiceImpl extends BaseServiceImpl32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("承租人电话不能大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setTenantPhone(tenantPhone); } if (StringUtils.isBlank(tenantIdentityNo)) { @@ -957,9 +888,23 @@ public class HousingInformationServiceImpl extends BaseServiceImpl128){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("企业名称不能大于128个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setEnterpriseName(enterpriseName); } if(StringUtils.isNotBlank((legalRepresentative))){ + if(legalRepresentative.length()>32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("法人代表不能大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setLegalRepresentative(legalRepresentative); } if (StringUtils.isBlank(enterprisePhone)) { @@ -969,9 +914,23 @@ public class HousingInformationServiceImpl extends BaseServiceImpl32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("企业联系电话大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setEnterprisePhone(enterprisePhone); } if(StringUtils.isNotBlank((socialUniformCode))){ + if(socialUniformCode.length()>128){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("社会统一代码不能大于128个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setSocialUniformCode(socialUniformCode); } } @@ -982,9 +941,23 @@ public class HousingInformationServiceImpl extends BaseServiceImpl32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("户主姓名不能大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setResidentsName(residentsName); } if(StringUtils.isNotBlank((residentsNation))){ + if(residentsNation.length()>32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("民族不能大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setResidentsNation(residentsNation); } if (StringUtils.isNotBlank(educationLevel)) { @@ -1049,6 +1022,13 @@ public class HousingInformationServiceImpl extends BaseServiceImpl32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("组织关系所在地不能大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setOrganizationalRelationshipLocation(organizationalRelationshipLocation); } } @@ -1080,6 +1060,13 @@ public class HousingInformationServiceImpl extends BaseServiceImpl32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("户主联系电话不能大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setResidentsPhone(residentsPhone); } if (StringUtils.isNotBlank(bodyStatus)) { @@ -1158,6 +1145,13 @@ public class HousingInformationServiceImpl extends BaseServiceImpl32){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("户籍地不能大于32个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setHouseholdRegistrationPlace(householdRegistrationPlace); } if (StringUtils.isNotBlank(employmentStatus)) { @@ -1183,9 +1177,23 @@ public class HousingInformationServiceImpl extends BaseServiceImpl128){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("现工作单位不能大于128个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setCurrentEmployer(currentEmployer); } if(StringUtils.isNotBlank((currentEmployerAddress))){ + if(currentEmployerAddress.length()>128){ + errorLineInfoDto = new EpdcPopulationErrorResultDTO(); + errorLineInfoDto.setErrorLine((i + 2) + ""); + errorLineInfoDto.setErrorInfo("现单位地址不能大于128个字符"); + errorLineInfoDto.setSheetName("房屋信息和户主信息"); + errorLineInfoList.add(errorLineInfoDto); + } basePopulationInformationExcel.setCurrentEmployerAddress(currentEmployerAddress); } } else if ("失业".equals(employmentStatus)) { diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PopulationInformationServiceImpl.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PopulationInformationServiceImpl.java index 1fc95351..962f4c3b 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PopulationInformationServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PopulationInformationServiceImpl.java @@ -157,8 +157,22 @@ public class PopulationInformationServiceImpl extends BaseServiceImpl