|
|
|
@ -27,6 +27,8 @@ import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.user.SecurityUser; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.*; |
|
|
|
import com.elink.esua.epdc.constant.HouseUseConstant; |
|
|
|
import com.elink.esua.epdc.constant.PopulationDictConstant; |
|
|
|
@ -100,7 +102,6 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
@Resource |
|
|
|
private EpidemicUserInfoDao epidemicUserInfoDao; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<HousingInformationDTO> page(Map<String, Object> params) { |
|
|
|
IPage<HousingInformationEntity> page = baseDao.selectPage( |
|
|
|
@ -308,6 +309,10 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
@Override |
|
|
|
public PageData<HousingInformationDTO> listOfPage(Map<String, Object> params) { |
|
|
|
IPage<HousingInformationDTO> page = getPage(params); |
|
|
|
UserDetail user = SecurityUser.getUser(); |
|
|
|
if (NumConstant.ZERO == user.getSuperAdmin() && user.getDeptId() != 1258587398679126017L) { |
|
|
|
params.put("deptIdList", user.getDeptIdList()); |
|
|
|
} |
|
|
|
List<HousingInformationDTO> list = baseDao.selectListOfHousingInformationDTO(params); |
|
|
|
return new PageData<>(list, page.getTotal()); |
|
|
|
} |
|
|
|
@ -469,21 +474,34 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
PopulationInformationEntity populationInformationEntity = ConvertUtils.sourceToTarget(baseResidentInformationExcel, PopulationInformationEntity.class); |
|
|
|
populationInformationEntity.setResidentsIdentityNo(baseResidentInformationExcel.getResidentsFamilyIdentityNo()); |
|
|
|
EpidemicUserInfoEntity epidemicUserInfoEntity = convertInformationToUserInfo(populationInformationEntity); |
|
|
|
epidemicUserInfoService.insert(epidemicUserInfoEntity); |
|
|
|
epidemicUserInfoEntity.setIdCard(baseResidentInformationExcel.getSelfIdentityNo()); |
|
|
|
EpidemicUserInfoEntity check = epidemicUserInfoService.selectInfoByIdCard(baseResidentInformationExcel.getSelfIdentityNo()); |
|
|
|
if (null == check) { |
|
|
|
epidemicUserInfoService.insert(epidemicUserInfoEntity); |
|
|
|
} |
|
|
|
//插入房屋人员关联关系表
|
|
|
|
HouseResidentEntity houseResidentEntity = ConvertUtils.sourceToTarget(baseResidentInformationExcel, HouseResidentEntity.class); |
|
|
|
houseResidentEntity.setResidentId(epidemicUserInfoEntity.getId().toString()); |
|
|
|
if (null == check) { |
|
|
|
houseResidentEntity.setResidentId(epidemicUserInfoEntity.getId().toString()); |
|
|
|
} else { |
|
|
|
houseResidentEntity.setResidentId(check.getId().toString()); |
|
|
|
} |
|
|
|
|
|
|
|
//根据身份证获取户主ID
|
|
|
|
//查找户主ID
|
|
|
|
String houseHeadId; |
|
|
|
String houseId; |
|
|
|
EpidemicUserInfoEntity infoByIdentityNo = epidemicUserInfoDao.selectInfoByIdCard(baseResidentInformationExcel.getResidentsIdentityNo()); |
|
|
|
if (infoByIdentityNo == null) { |
|
|
|
//查找不到户主则从Map中取
|
|
|
|
houseHeadId = populationIdNoAndIdMap.get(baseResidentInformationExcel.getResidentsIdentityNo()); |
|
|
|
houseId = populationIdNoAndIdMap.get(houseHeadId); |
|
|
|
} else { |
|
|
|
houseHeadId = infoByIdentityNo.getId().toString(); |
|
|
|
houseId = populationIdNoAndIdMap.get(houseHeadId); |
|
|
|
} |
|
|
|
houseResidentEntity.setHouseHeadId(houseHeadId); |
|
|
|
houseResidentEntity.setHouseId(houseId); |
|
|
|
houseResidentEntity.setIsHouseHead("0"); |
|
|
|
houseResidentEntity.setHouseHeadRelation(baseResidentInformationExcel.getHouseHeadRelation()); |
|
|
|
houseResidentDao.insert(houseResidentEntity); |
|
|
|
@ -542,6 +560,7 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
houseResidentEntity.setIsHouseHead(NumConstant.ONE_STR); |
|
|
|
houseResidentDao.insert(houseResidentEntity); |
|
|
|
populationIdNoAndIdMap.put(basePopulationInformationExcel.getResidentsIdentityNo(), epidemicUserInfoEntity.getId().toString()); |
|
|
|
populationIdNoAndIdMap.put(epidemicUserInfoEntity.getId().toString(), housingInformationEntity.getId()); |
|
|
|
} |
|
|
|
return populationIdNoAndIdMap; |
|
|
|
} |
|
|
|
@ -632,12 +651,17 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
for (int i = 0; i < basePopulationInformationExcels.size(); i++) { |
|
|
|
BaseResidentInformationExcel baseResidentInformationExcel = basePopulationInformationExcels.get(i); |
|
|
|
String residentsIdentityNo = baseResidentInformationExcel.getResidentsIdentityNo() == null ? null : baseResidentInformationExcel.getResidentsIdentityNo().trim(); |
|
|
|
String selfIdentityNo = baseResidentInformationExcel.getSelfIdentityNo() == null ? null : baseResidentInformationExcel.getSelfIdentityNo().trim(); |
|
|
|
String houseHeadRelation = baseResidentInformationExcel.getHouseHeadRelation() == null ? null : baseResidentInformationExcel.getHouseHeadRelation().trim(); |
|
|
|
String residentsName = baseResidentInformationExcel.getResidentsName() == null ? null : baseResidentInformationExcel.getResidentsName().trim(); |
|
|
|
String residentsSex = baseResidentInformationExcel.getResidentsSex() == null ? null : baseResidentInformationExcel.getResidentsSex().trim(); |
|
|
|
String residentsNation = baseResidentInformationExcel.getResidentsNation() == null ? null : baseResidentInformationExcel.getResidentsNation().trim(); |
|
|
|
String currentEmployer = baseResidentInformationExcel.getCurrentEmployer() == null ? null : baseResidentInformationExcel.getCurrentEmployer().trim(); |
|
|
|
String currentAddress = baseResidentInformationExcel.getCurrentAddress() == null ? null : baseResidentInformationExcel.getCurrentAddress().trim(); |
|
|
|
String specialCrowd = baseResidentInformationExcel.getSpecialCrowd() == null ? null : baseResidentInformationExcel.getSpecialCrowd().trim(); |
|
|
|
String peopleCategories = baseResidentInformationExcel.getPeopleCategories() == null ? null : baseResidentInformationExcel.getPeopleCategories().trim(); |
|
|
|
String politicsStatus = baseResidentInformationExcel.getPoliticsStatus() == null ? null : baseResidentInformationExcel.getPoliticsStatus().trim(); |
|
|
|
|
|
|
|
if (StringUtils.isBlank(residentsIdentityNo)) { |
|
|
|
errorLineInfoDto = new EpdcPopulationErrorResultDTO(); |
|
|
|
errorLineInfoDto.setErrorLine((i + 2) + ""); |
|
|
|
@ -657,6 +681,20 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
} |
|
|
|
baseResidentInformationExcel.setResidentsIdentityNo(residentsIdentityNo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(selfIdentityNo)) { |
|
|
|
String result = IdentityNoUtils.IdentityNoVerification(selfIdentityNo); |
|
|
|
if (result != null) { |
|
|
|
errorLineInfoDto = new EpdcPopulationErrorResultDTO(); |
|
|
|
errorLineInfoDto.setErrorLine((i + 2) + ""); |
|
|
|
errorLineInfoDto.setErrorInfo("本人身份证号码有误"); |
|
|
|
errorLineInfoDto.setSheetName("房屋信息和户主信息"); |
|
|
|
errorLineInfoList.add(errorLineInfoDto); |
|
|
|
} else { |
|
|
|
baseResidentInformationExcel.setResidentsSex(IdentityNoUtils.getSex(residentsIdentityNo)); |
|
|
|
baseResidentInformationExcel.setResidentsBirthday(DateUtil.parse(IdentityNoUtils.getBirthday(residentsIdentityNo))); |
|
|
|
} |
|
|
|
baseResidentInformationExcel.setResidentsIdentityNo(residentsIdentityNo); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(houseHeadRelation)) { |
|
|
|
errorLineInfoDto = new EpdcPopulationErrorResultDTO(); |
|
|
|
errorLineInfoDto.setErrorLine((i + 2) + ""); |
|
|
|
@ -725,7 +763,69 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
} else if (StringUtils.isNotBlank((currentAddress))) { |
|
|
|
baseResidentInformationExcel.setCurrentAddress(currentAddress); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(politicsStatus)) { |
|
|
|
boolean isMatch = false; |
|
|
|
for (SysPopulationSimpleDictDTO sysPopulationSimpleDictDTO : sysPopulationSimpleDictDTOS) { |
|
|
|
if (PopulationDictConstant.POLITICS_STATUS.equals(sysPopulationSimpleDictDTO.getDicType())) { |
|
|
|
List<SysSimpleDictDTO> sysSimpleDictList = sysPopulationSimpleDictDTO.getSysSimpleDicts(); |
|
|
|
for (SysSimpleDictDTO sysSimpleDict : sysSimpleDictList) { |
|
|
|
if (politicsStatus.equals(sysSimpleDict.getDictName())) { |
|
|
|
isMatch = true; |
|
|
|
baseResidentInformationExcel.setPoliticsStatus(sysSimpleDict.getDictValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!isMatch) { |
|
|
|
errorLineInfoDto = new EpdcPopulationErrorResultDTO(); |
|
|
|
errorLineInfoDto.setErrorLine((i + 2) + ""); |
|
|
|
errorLineInfoDto.setErrorInfo("政治面貌数据不匹配"); |
|
|
|
errorLineInfoDto.setSheetName("居住人信息"); |
|
|
|
errorLineInfoList.add(errorLineInfoDto); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(specialCrowd)) { |
|
|
|
boolean isMatch = false; |
|
|
|
for (SysPopulationSimpleDictDTO sysPopulationSimpleDictDTO : sysPopulationSimpleDictDTOS) { |
|
|
|
if (PopulationDictConstant.SPECIAL_CROWD.equals(sysPopulationSimpleDictDTO.getDicType())) { |
|
|
|
List<SysSimpleDictDTO> sysSimpleDicts = sysPopulationSimpleDictDTO.getSysSimpleDicts(); |
|
|
|
for (SysSimpleDictDTO sysSimpleDict : sysSimpleDicts) { |
|
|
|
if (specialCrowd.equals(sysSimpleDict.getDictName())) { |
|
|
|
isMatch = true; |
|
|
|
baseResidentInformationExcel.setSpecialCrowd(sysSimpleDict.getDictValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!isMatch) { |
|
|
|
errorLineInfoDto = new EpdcPopulationErrorResultDTO(); |
|
|
|
errorLineInfoDto.setErrorLine((i + 2) + ""); |
|
|
|
errorLineInfoDto.setErrorInfo("特殊人群数据不匹配"); |
|
|
|
errorLineInfoDto.setSheetName("居住人信息"); |
|
|
|
errorLineInfoList.add(errorLineInfoDto); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(peopleCategories)) { |
|
|
|
boolean isMatch = false; |
|
|
|
for (SysPopulationSimpleDictDTO sysPopulationSimpleDictDTO : sysPopulationSimpleDictDTOS) { |
|
|
|
if (PopulationDictConstant.PEOPLE_CATEGORIES.equals(sysPopulationSimpleDictDTO.getDicType())) { |
|
|
|
List<SysSimpleDictDTO> sysSimpleDicts = sysPopulationSimpleDictDTO.getSysSimpleDicts(); |
|
|
|
for (SysSimpleDictDTO sysSimpleDict : sysSimpleDicts) { |
|
|
|
if (peopleCategories.equals(sysSimpleDict.getDictName())) { |
|
|
|
isMatch = true; |
|
|
|
baseResidentInformationExcel.setPeopleCategories(sysSimpleDict.getDictValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!isMatch) { |
|
|
|
errorLineInfoDto = new EpdcPopulationErrorResultDTO(); |
|
|
|
errorLineInfoDto.setErrorLine((i + 2) + ""); |
|
|
|
errorLineInfoDto.setErrorInfo("人口类型数据不匹配"); |
|
|
|
errorLineInfoDto.setSheetName("居住人信息"); |
|
|
|
errorLineInfoList.add(errorLineInfoDto); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return errorLineInfoList; |
|
|
|
} |
|
|
|
|