|
|
|
@ -22,12 +22,17 @@ 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.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.DateUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.IdentityNoUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.dto.house.HouseResidentDTO; |
|
|
|
import com.elink.esua.epdc.dto.house.PopulationInformationDTO; |
|
|
|
import com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserInfoEntity; |
|
|
|
import com.elink.esua.epdc.vaccine.epidemic.service.EpidemicUserInfoService; |
|
|
|
import com.elink.esua.epdc.vaccine.house.dao.HouseResidentDao; |
|
|
|
import com.elink.esua.epdc.vaccine.house.entity.HouseResidentEntity; |
|
|
|
import com.elink.esua.epdc.vaccine.house.entity.HousingInformationEntity; |
|
|
|
@ -60,6 +65,10 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao, |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private HousingInformationService housingInformationService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpidemicUserInfoService epidemicUserInfoService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private HouseResidentDao houseResidentDao; |
|
|
|
|
|
|
|
@ -90,10 +99,12 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao, |
|
|
|
|
|
|
|
@Override |
|
|
|
public PopulationInformationDTO get(String id) { |
|
|
|
PopulationInformationDTO populationInformationDTO = baseDao.selectByHouseResidentId(id); |
|
|
|
PopulationInformationDTO populationInformationDTO = baseDao.selectByHouseResidentIdV2(id); |
|
|
|
return populationInformationDTO; |
|
|
|
} |
|
|
|
/** 居住人的新增和更新逻辑: |
|
|
|
|
|
|
|
/** |
|
|
|
* 居住人的新增和更新逻辑: |
|
|
|
* 新增:1.判断填写的身份证是否已存在 |
|
|
|
* 不存在:直接新增人口信息和关联表信息 |
|
|
|
* 存在:更新原有的人口信息和关联信息(若是有户主身份,且在此是第一次新增居住信息,则直接更新原有人口信息和新增关联信息) |
|
|
|
@ -110,8 +121,7 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao, |
|
|
|
* (1)更新原先居民关联关系为表单的身份证和表单房子关联 |
|
|
|
* (2)更新原先的人口信息 |
|
|
|
* (3)删除被更新的人口信息(非户主)和人口关系 |
|
|
|
* |
|
|
|
* */ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Result saveWithIdentifyNo(HouseResidentDTO dto) { |
|
|
|
@ -349,11 +359,16 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao, |
|
|
|
if (houseHeadInfo == null) { |
|
|
|
return new Result().error("请先填写户主信息!"); |
|
|
|
} |
|
|
|
EpidemicUserInfoEntity check = epidemicUserInfoService.selectInfoByIdCard(dto.getResidentsIdentityNo()); |
|
|
|
if (null != check && null != houseHeadInfo) { |
|
|
|
throw new RenException("身份证号已存在"); |
|
|
|
} |
|
|
|
PopulationInformationEntity populationInformationEntity = ConvertUtils.sourceToTarget(dto, PopulationInformationEntity.class); |
|
|
|
populationInformationService.insert(populationInformationEntity); |
|
|
|
EpidemicUserInfoEntity userInfoEntity = convertInformationToUserInfo(populationInformationEntity); |
|
|
|
epidemicUserInfoService.insert(userInfoEntity); |
|
|
|
HouseResidentEntity houseResidentEntity = new HouseResidentEntity(); |
|
|
|
//居住人与户主关联,与房屋不关联
|
|
|
|
houseResidentEntity.setResidentId(populationInformationEntity.getId()); |
|
|
|
houseResidentEntity.setResidentId(userInfoEntity.getId().toString()); |
|
|
|
houseResidentEntity.setHouseHeadRelation(dto.getHouseHeadRelation()); |
|
|
|
houseResidentEntity.setHouseHeadId(houseHeadInfo.getId()); |
|
|
|
houseResidentEntity.setIsHouseHead("0"); |
|
|
|
@ -363,13 +378,19 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao, |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result updateWithoutIdentifyNo(HouseResidentDTO dto) { |
|
|
|
PopulationInformationEntity populationInformationEntity = populationInformationService.selectById(dto.getResidentId()); |
|
|
|
populationInformationEntity.setResidentsName(dto.getResidentsName()); |
|
|
|
populationInformationEntity.setResidentsSex(dto.getResidentsSex()); |
|
|
|
populationInformationEntity.setResidentsNation(dto.getResidentsNation()); |
|
|
|
populationInformationEntity.setCurrentEmployer(dto.getCurrentEmployer()); |
|
|
|
populationInformationEntity.setCurrentAddress(dto.getCurrentAddress()); |
|
|
|
populationInformationService.updateById(populationInformationEntity); |
|
|
|
|
|
|
|
EpidemicUserInfoEntity epidemicUserInfoEntity = epidemicUserInfoService.selectById(dto.getResidentId()); |
|
|
|
epidemicUserInfoEntity.setUserName(dto.getResidentsName()); |
|
|
|
epidemicUserInfoEntity.setMobile(dto.getResidentsPhone()); |
|
|
|
epidemicUserInfoEntity.setPeopleCategories(dto.getPeopleCategories()); |
|
|
|
epidemicUserInfoEntity.setSpecialCrowd(dto.getSpecialCrowd()); |
|
|
|
epidemicUserInfoEntity.setPoliticsStatus(dto.getPoliticsStatus()); |
|
|
|
epidemicUserInfoEntity.setGender(dto.getResidentsSex()); |
|
|
|
epidemicUserInfoEntity.setNation(dto.getResidentsNation()); |
|
|
|
epidemicUserInfoEntity.setRelation(dto.getHouseHeadRelation()); |
|
|
|
epidemicUserInfoEntity.setWorkUnits(dto.getCurrentEmployer()); |
|
|
|
epidemicUserInfoEntity.setLiveAddressName(dto.getCurrentAddress()); |
|
|
|
epidemicUserInfoService.updateById(epidemicUserInfoEntity); |
|
|
|
HouseResidentEntity houseResidentEntity = new HouseResidentEntity(); |
|
|
|
houseResidentEntity.setHouseHeadRelation(dto.getHouseHeadRelation()); |
|
|
|
houseResidentEntity.setId(dto.getId()); |
|
|
|
@ -377,4 +398,57 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao, |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 转换新旧人员信息实体类 |
|
|
|
* |
|
|
|
* @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.setSpecialCrowd(informationEntity.getSpecialCrowd()); |
|
|
|
entity.setPeopleCategories(informationEntity.getPeopleCategories()); |
|
|
|
entity.setRelation(NumConstant.ONE_STR); |
|
|
|
entity.setLiveAddressName(informationEntity.getCurrentAddress()); |
|
|
|
return entity; |
|
|
|
} |
|
|
|
} |