|
|
@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
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.utils.*; |
|
|
@ -32,9 +33,15 @@ import com.elink.esua.epdc.constant.PopulationDictConstant; |
|
|
|
import com.elink.esua.epdc.dto.OrganizationModifyDTO; |
|
|
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|
|
|
import com.elink.esua.epdc.dto.SysSimpleDictDTO; |
|
|
|
import com.elink.esua.epdc.dto.house.*; |
|
|
|
import com.elink.esua.epdc.dto.house.BasePopulationInformationExportDto; |
|
|
|
import com.elink.esua.epdc.dto.house.BaseResidentInformationExportDto; |
|
|
|
import com.elink.esua.epdc.dto.house.HousingInformationDTO; |
|
|
|
import com.elink.esua.epdc.dto.house.SysPopulationSimpleDictDTO; |
|
|
|
import com.elink.esua.epdc.dto.house.form.SysPopulationSimpleDictFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.house.result.EpdcPopulationErrorResultDTO; |
|
|
|
import com.elink.esua.epdc.vaccine.epidemic.dao.EpidemicUserInfoDao; |
|
|
|
import com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserInfoEntity; |
|
|
|
import com.elink.esua.epdc.vaccine.epidemic.service.EpidemicUserInfoService; |
|
|
|
import com.elink.esua.epdc.vaccine.feign.VimAdminFeignClient; |
|
|
|
import com.elink.esua.epdc.vaccine.house.dao.HouseResidentDao; |
|
|
|
import com.elink.esua.epdc.vaccine.house.dao.HousingInformationDao; |
|
|
@ -42,7 +49,10 @@ import com.elink.esua.epdc.vaccine.house.entity.*; |
|
|
|
import com.elink.esua.epdc.vaccine.house.excel.BasePopulationInformationExcel; |
|
|
|
import com.elink.esua.epdc.vaccine.house.excel.BaseResidentInformationExcel; |
|
|
|
import com.elink.esua.epdc.vaccine.house.redis.HousingInformationRedis; |
|
|
|
import com.elink.esua.epdc.vaccine.house.service.*; |
|
|
|
import com.elink.esua.epdc.vaccine.house.service.HouseBusinessInfoService; |
|
|
|
import com.elink.esua.epdc.vaccine.house.service.HouseRentInfoService; |
|
|
|
import com.elink.esua.epdc.vaccine.house.service.HousingInformationService; |
|
|
|
import com.elink.esua.epdc.vaccine.house.service.PopulationInformationService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -50,6 +60,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.io.File; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
@ -75,7 +86,7 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
private HouseBusinessInfoService houseBusinessInfoService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private VimAdminFeignClient adminFeignClient; |
|
|
|
private VimAdminFeignClient adminVimFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private HouseResidentDao houseResidentDao; |
|
|
@ -83,6 +94,12 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
@Autowired |
|
|
|
private PopulationInformationService populationInformationService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpidemicUserInfoService epidemicUserInfoService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private EpidemicUserInfoDao epidemicUserInfoDao; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<HousingInformationDTO> page(Map<String, Object> params) { |
|
|
@ -172,7 +189,7 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
} |
|
|
|
|
|
|
|
private void setDept(HousingInformationEntity entity) { |
|
|
|
Result<ParentAndAllDeptDTO> parentAndAllDept = adminFeignClient.getParentAndAllDept(String.valueOf(entity.getGridId())); |
|
|
|
Result<ParentAndAllDeptDTO> parentAndAllDept = adminVimFeignClient.getParentAndAllDept(String.valueOf(entity.getGridId())); |
|
|
|
if (parentAndAllDept == null || !parentAndAllDept.success()) { |
|
|
|
throw new RenException("获取部门信息失败"); |
|
|
|
} |
|
|
@ -301,7 +318,7 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
if (StringUtils.isBlank(gridId)) { |
|
|
|
return new Result().error("归属部门不能为空"); |
|
|
|
} |
|
|
|
Result<ParentAndAllDeptDTO> parentAndAllDept = adminFeignClient.getParentAndAllDept(gridId); |
|
|
|
Result<ParentAndAllDeptDTO> parentAndAllDept = adminVimFeignClient.getParentAndAllDept(gridId); |
|
|
|
if (!parentAndAllDept.success() || parentAndAllDept.getData() == null) { |
|
|
|
return new Result().error("获取归属部门信息失败"); |
|
|
|
} |
|
|
@ -313,7 +330,7 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
, PopulationDictConstant.EMPLOYMENT_STATUS, PopulationDictConstant.FAMILY_CATEGORY, PopulationDictConstant.GENDER, PopulationDictConstant.HELP_STATUS, PopulationDictConstant.MARITAL_STATUS |
|
|
|
, PopulationDictConstant.MOTOR_VEHICLE_CATEGORY, PopulationDictConstant.POLITICS_STATUS, PopulationDictConstant.UNEMPLOYMENT_REASON); |
|
|
|
sysPopulationSimpleDictFormDTO.setDicTypes(dicTypes); |
|
|
|
Result<List<SysPopulationSimpleDictDTO>> listResult = adminFeignClient.listPopulationSimple(sysPopulationSimpleDictFormDTO); |
|
|
|
Result<List<SysPopulationSimpleDictDTO>> listResult = adminVimFeignClient.listPopulationSimple(sysPopulationSimpleDictFormDTO); |
|
|
|
if (listResult == null || !listResult.success()) { |
|
|
|
return new Result().error("获取字典信息失败"); |
|
|
|
} |
|
|
@ -451,19 +468,20 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
//插入居民信息
|
|
|
|
PopulationInformationEntity populationInformationEntity = ConvertUtils.sourceToTarget(baseResidentInformationExcel, PopulationInformationEntity.class); |
|
|
|
populationInformationEntity.setResidentsIdentityNo(baseResidentInformationExcel.getResidentsFamilyIdentityNo()); |
|
|
|
populationInformationService.insert(populationInformationEntity); |
|
|
|
EpidemicUserInfoEntity epidemicUserInfoEntity = convertInformationToUserInfo(populationInformationEntity); |
|
|
|
epidemicUserInfoService.insert(epidemicUserInfoEntity); |
|
|
|
//插入房屋人员关联关系表
|
|
|
|
HouseResidentEntity houseResidentEntity = ConvertUtils.sourceToTarget(baseResidentInformationExcel, HouseResidentEntity.class); |
|
|
|
houseResidentEntity.setResidentId(populationInformationEntity.getId()); |
|
|
|
houseResidentEntity.setResidentId(epidemicUserInfoEntity.getId().toString()); |
|
|
|
//根据身份证获取户主ID
|
|
|
|
//查找户主ID
|
|
|
|
String houseHeadId; |
|
|
|
PopulationInformationEntity infoByIdentityNo = populationInformationService.getInfoByIdentityNo(baseResidentInformationExcel.getResidentsIdentityNo()); |
|
|
|
EpidemicUserInfoEntity infoByIdentityNo = epidemicUserInfoDao.selectInfoByIdCard(baseResidentInformationExcel.getResidentsIdentityNo()); |
|
|
|
if (infoByIdentityNo == null) { |
|
|
|
//查找不到户主则从Map中取
|
|
|
|
houseHeadId = populationIdNoAndIdMap.get(baseResidentInformationExcel.getResidentsIdentityNo()); |
|
|
|
} else { |
|
|
|
houseHeadId = infoByIdentityNo.getId(); |
|
|
|
houseHeadId = infoByIdentityNo.getId().toString(); |
|
|
|
} |
|
|
|
houseResidentEntity.setHouseHeadId(houseHeadId); |
|
|
|
houseResidentEntity.setIsHouseHead("0"); |
|
|
@ -505,25 +523,25 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
} |
|
|
|
//插入户主信息
|
|
|
|
PopulationInformationEntity populationInformationEntity = ConvertUtils.sourceToTarget(basePopulationInformationExcel, PopulationInformationEntity.class); |
|
|
|
PopulationInformationEntity oldPopulationInformationEntity = populationInformationService.getInfoByIdentityNo(populationInformationEntity.getResidentsIdentityNo()); |
|
|
|
|
|
|
|
EpidemicUserInfoEntity epidemicUserInfoEntity = convertInformationToUserInfo(populationInformationEntity); |
|
|
|
EpidemicUserInfoEntity oldPopulationInformationEntity = epidemicUserInfoDao.selectInfoByIdCard(populationInformationEntity.getResidentsIdentityNo()); |
|
|
|
//校验户主信息
|
|
|
|
validateHouseHeadInfo(populationInformationEntity, basePopulationInformationExcel); |
|
|
|
if (oldPopulationInformationEntity != null) { |
|
|
|
//身份证在列表已存在,则更新户主信息,所属辖区以最后一次更新为准
|
|
|
|
populationInformationEntity.setId(oldPopulationInformationEntity.getId()); |
|
|
|
populationInformationService.updateById(populationInformationEntity); |
|
|
|
epidemicUserInfoEntity.setId(oldPopulationInformationEntity.getId()); |
|
|
|
epidemicUserInfoService.updateById(epidemicUserInfoEntity); |
|
|
|
} else { |
|
|
|
//校验户主信息
|
|
|
|
populationInformationService.insert(populationInformationEntity); |
|
|
|
epidemicUserInfoService.insert(epidemicUserInfoEntity); |
|
|
|
} |
|
|
|
//插入房屋人员关联关系表
|
|
|
|
HouseResidentEntity houseResidentEntity = new HouseResidentEntity(); |
|
|
|
houseResidentEntity.setHouseId(housingInformationEntity.getId()); |
|
|
|
houseResidentEntity.setResidentId(populationInformationEntity.getId()); |
|
|
|
houseResidentEntity.setResidentId(epidemicUserInfoEntity.getId().toString()); |
|
|
|
houseResidentEntity.setIsHouseHead("1"); |
|
|
|
houseResidentDao.insert(houseResidentEntity); |
|
|
|
populationIdNoAndIdMap.put(basePopulationInformationExcel.getResidentsIdentityNo(), populationInformationEntity.getId()); |
|
|
|
populationIdNoAndIdMap.put(basePopulationInformationExcel.getResidentsIdentityNo(), epidemicUserInfoEntity.getId().toString()); |
|
|
|
} |
|
|
|
return populationIdNoAndIdMap; |
|
|
|
} |
|
|
@ -1163,6 +1181,7 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
} |
|
|
|
} |
|
|
|
if ("在岗".equals(employmentStatus)) { |
|
|
|
basePopulationInformationExcel.setUnemploymentReason(null); |
|
|
|
if (StringUtils.isNotBlank((currentEmployer))) { |
|
|
|
if (currentEmployer.length() > 128) { |
|
|
|
errorLineInfoDto = new EpdcPopulationErrorResultDTO(); |
|
|
@ -1316,5 +1335,56 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform |
|
|
|
return errorLineInfoList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 转换新旧人员信息实体类 |
|
|
|
* |
|
|
|
* @param informationEntity |
|
|
|
* @return com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserInfoEntity |
|
|
|
* @author zhy |
|
|
|
* @date 2021/9/3 16:36 |
|
|
|
*/ |
|
|
|
private EpidemicUserInfoEntity convertInformationToUserInfo(PopulationInformationEntity informationEntity) { |
|
|
|
EpidemicUserInfoEntity entity = new EpidemicUserInfoEntity(); |
|
|
|
if (informationEntity.getId() != null) { |
|
|
|
entity.setId(Long.parseLong(informationEntity.getId())); |
|
|
|
} |
|
|
|
entity.setUserName(informationEntity.getResidentsName()); |
|
|
|
entity.setGender(informationEntity.getResidentsSex()); |
|
|
|
entity.setNation(informationEntity.getResidentsNation()); |
|
|
|
if (informationEntity.getResidentsBirthday() != null) { |
|
|
|
entity.setBirthday(DateUtils.format(informationEntity.getResidentsBirthday())); |
|
|
|
} |
|
|
|
entity.setStandardOfCulture(informationEntity.getEducationLevel()); |
|
|
|
entity.setPoliticsStatus(informationEntity.getPoliticsStatus()); |
|
|
|
entity.setJoinTime(informationEntity.getJoinTime()); |
|
|
|
entity.setOrganizationalRelationshipLocation(informationEntity.getOrganizationalRelationshipLocation()); |
|
|
|
entity.setIdCard(informationEntity.getResidentsIdentityNo()); |
|
|
|
entity.setMobile(informationEntity.getResidentsPhone()); |
|
|
|
entity.setHealth(informationEntity.getBodyStatus()); |
|
|
|
entity.setMaritalStatus(informationEntity.getMaritalStatus()); |
|
|
|
entity.setAccountType(informationEntity.getAccountType()); |
|
|
|
entity.setMilitary(informationEntity.getMilitaryService()); |
|
|
|
entity.setHouseholdRegisterDetail(informationEntity.getHouseholdRegistrationPlace()); |
|
|
|
entity.setWorkStatus(informationEntity.getEmploymentStatus()); |
|
|
|
entity.setWorkUnits(informationEntity.getCurrentEmployer()); |
|
|
|
entity.setCurrentEmployerAddress(informationEntity.getCurrentEmployerAddress()); |
|
|
|
entity.setUnemploymentReason(informationEntity.getUnemploymentReason()); |
|
|
|
entity.setReemploymentPermit(informationEntity.getReemploymentPermit()); |
|
|
|
entity.setUnemploymentRegister(informationEntity.getUnemploymentRegister()); |
|
|
|
entity.setUnemploymentRegisterTime(informationEntity.getUnemploymentRegisterTime()); |
|
|
|
entity.setSpecialCrowd(informationEntity.getSpecialCrowd()); |
|
|
|
entity.setFamilyCategory(informationEntity.getFamilyCategory()); |
|
|
|
entity.setHelpStatus(informationEntity.getHelpStatus()); |
|
|
|
entity.setMotorVehicleNum(informationEntity.getMotorVehicleNum()); |
|
|
|
entity.setMotorVehicleCategory(informationEntity.getMotorVehicleCategory()); |
|
|
|
entity.setDogStatus(informationEntity.getDogStatus()); |
|
|
|
entity.setFamilyMemberNum(informationEntity.getFamilyMemberNum()); |
|
|
|
entity.setFamilyMemberOutNum(informationEntity.getFamilyMemberOutNum()); |
|
|
|
entity.setFamilyMemberOutMonth(informationEntity.getFamilyMemberOutMonth()); |
|
|
|
entity.setFamilyMemberOutReason(informationEntity.getFamilyMemberOutReason()); |
|
|
|
entity.setRelation(NumConstant.ONE_STR); |
|
|
|
entity.setLiveAddressName(informationEntity.getCurrentAddress()); |
|
|
|
return entity; |
|
|
|
} |
|
|
|
|
|
|
|
} |