Browse Source

追加字段增加业务处理

origin/epidemic_user
zhangyuan 4 years ago
parent
commit
91fadecf4c
  1. 11
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/EpidemicUserInfoService.java
  2. 11
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicUserInfoServiceImpl.java
  3. 8
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/dao/HouseResidentDao.java
  4. 2
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/excel/BasePopulationInformationExcel.java
  5. 2
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/excel/BaseResidentInformationExcel.java
  6. 208
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/service/impl/HouseResidentServiceImpl.java
  7. 54
      epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/service/impl/HousingInformationServiceImpl.java
  8. 2
      epdc-cloud-vim-yushan/src/main/resources/mapper/epidemic/EpidemicUserInfoDao.xml
  9. 25
      epdc-cloud-vim-yushan/src/main/resources/mapper/house/HouseResidentDao.xml
  10. 2
      epdc-cloud-vim-yushan/src/main/resources/mapper/house/PopulationInformationDao.xml

11
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/EpidemicUserInfoService.java

@ -14,6 +14,7 @@ import com.elink.esua.epdc.vaccine.epidemic.dto.result.VaccinationInfoResultDTO;
import com.elink.esua.epdc.vaccine.epidemic.dto.result.VaccinationInfoResultV2DTO;
import com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserInfoEntity;
import com.elink.esua.epdc.vaccine.vim.dto.VaccinationInfoDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@ -150,4 +151,14 @@ public interface EpidemicUserInfoService extends CrudService<EpidemicUserInfoEnt
*/
Result updateVaccination();
/**
* 根据身份证查找用户
*
* @param idCard
* @return com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserInfoEntity
* @author zhy
* @date 2021/9/9 13:34
*/
EpidemicUserInfoEntity selectInfoByIdCard(String idCard);
}

11
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/impl/EpidemicUserInfoServiceImpl.java

@ -1,7 +1,5 @@
package com.elink.esua.epdc.vaccine.epidemic.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -33,16 +31,12 @@ import com.elink.esua.epdc.vaccine.epidemic.entity.EpidemicUserInoutRecordEntity
import com.elink.esua.epdc.vaccine.epidemic.service.EpidemicReportUserInfoService;
import com.elink.esua.epdc.vaccine.epidemic.service.EpidemicUserInfoService;
import com.elink.esua.epdc.vaccine.epidemic.service.EpidemicUserInoutRecordService;
import com.elink.esua.epdc.vaccine.house.entity.PopulationInformationEntity;
import com.elink.esua.epdc.vaccine.vim.dao.VaccinationInfoDao;
import com.elink.esua.epdc.vaccine.vim.dto.VaccinationInfoDTO;
import com.elink.esua.epdc.vaccine.vim.dto.VaccinationInfoV2DTO;
import com.elink.esua.epdc.vaccine.vim.enums.VaccinationStateEnum;
import com.elink.esua.epdc.vaccine.vim.service.VaccinationInfoService;
import com.elink.esua.epdc.vaccine.vim.service.VaccinationUserRoleService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -587,4 +581,9 @@ public class EpidemicUserInfoServiceImpl extends CrudServiceImpl<EpidemicUserInf
return new Result<>();
}
@Override
public EpidemicUserInfoEntity selectInfoByIdCard(String idCard) {
return baseDao.selectInfoByIdCard(idCard);
}
}

8
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/dao/HouseResidentDao.java

@ -50,6 +50,14 @@ public interface HouseResidentDao extends BaseDao<HouseResidentEntity> {
* @return com.elink.esua.epdc.dto.PopulationInformationDTO
**/
PopulationInformationDTO selectByHouseResidentId(@Param("id") String id);
/**
* @Description 根据联系表ID查询居住人详细信息
* @Author zhangyuan
* @Date 2020/8/21
* @Param [id]
* @return com.elink.esua.epdc.dto.PopulationInformationDTO
**/
PopulationInformationDTO selectByHouseResidentIdV2(@Param("id") String id);
/**
* @Description 根据居民ID获取关联关系表ID
* @Author songyunpeng

2
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/excel/BasePopulationInformationExcel.java

@ -156,7 +156,7 @@ public class BasePopulationInformationExcel {
@Excel(name = "特殊人群")
private String specialCrowd;
@Excel(name = "人口类型", replace = {"常驻_0", "男_1"})
@Excel(name = "人口类型", replace = {"常驻_0", "流动_1", "境外_2"})
private String peopleCategories;
}

2
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/excel/BaseResidentInformationExcel.java

@ -64,7 +64,7 @@ public class BaseResidentInformationExcel {
@Excel(name = "政治面貌")
private String politicsStatus;
@Excel(name = "人口类型")
@Excel(name = "人口类型", replace = {"常驻_0", "流动_1", "境外_2"})
private String peopleCategories;
@Excel(name = "本人身份证号码")

208
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/service/impl/HouseResidentServiceImpl.java

@ -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;
@ -44,7 +49,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* 房屋人员关系表
* 房屋人员关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-08-19
@ -60,6 +65,10 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
@Autowired
private HousingInformationService housingInformationService;
@Autowired
private EpidemicUserInfoService epidemicUserInfoService;
@Autowired
private HouseResidentDao houseResidentDao;
@ -79,8 +88,8 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
return ConvertUtils.sourceToTarget(entityList, HouseResidentDTO.class);
}
private QueryWrapper<HouseResidentEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
private QueryWrapper<HouseResidentEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<HouseResidentEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -90,41 +99,42 @@ 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.判断填写的身份证是否已存在
* 不存在直接新增人口信息和关联表信息
* 存在更新原有的人口信息和关联信息若是有户主身份且在此是第一次新增居住信息则直接更新原有人口信息和新增关联信息
* 更新1.若是身份证被修改判断填写的身份证是否存在
* 不存在代表更新关联表信息和新增人口信息原先的人口信息如果只有居住人身份的话则直接删除
* ****存在只有人才才会走到这个逻辑
* 1.判断修改的身份证信息是不是在当前房屋下存在则返回错误信息
* 2.不在此房屋下
* 若是此身份证有户主身份
* 1更新原先的人口信息
* 2新增居民关联关系为表单的身份证和表单房子关联
* 3删除被更新的人口信息非户主和人口关系
* 若是此身份证有居住人身份(或者既有户主又有居民身份)
* (1)更新原先居民关联关系为表单的身份证和表单房子关联
* 2更新原先的人口信息
* 3删除被更新的人口信息非户主和人口关系
*
* */
/**
* 居住人的新增和更新逻辑
* 新增1.判断填写的身份证是否已存在
* 不存在直接新增人口信息和关联表信息
* 存在更新原有的人口信息和关联信息若是有户主身份且在此是第一次新增居住信息则直接更新原有人口信息和新增关联信息
* 更新1.若是身份证被修改判断填写的身份证是否存在
* 不存在代表更新关联表信息和新增人口信息原先的人口信息如果只有居住人身份的话则直接删除
* ****存在只有人才才会走到这个逻辑
* 1.判断修改的身份证信息是不是在当前房屋下存在则返回错误信息
* 2.不在此房屋下
* 若是此身份证有户主身份
* 1更新原先的人口信息
* 2新增居民关联关系为表单的身份证和表单房子关联
* 3删除被更新的人口信息非户主和人口关系
* 若是此身份证有居住人身份(或者既有户主又有居民身份)
* (1)更新原先居民关联关系为表单的身份证和表单房子关联
* 2更新原先的人口信息
* 3删除被更新的人口信息非户主和人口关系
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result saveWithIdentifyNo(HouseResidentDTO dto) {
//先判断身份证是否合法
String result = IdentityNoUtils.IdentityNoVerification(dto.getResidentsIdentityNo());
if(result != null){
if (result != null) {
return new Result().error(result);
}
String sex = IdentityNoUtils.getSex(dto.getResidentsIdentityNo());
String birthday = IdentityNoUtils.getBirthday(dto.getResidentsIdentityNo());
//根据身份证查询新人口信息
PopulationInformationEntity newPopulationInformationEntity = populationInformationService.getInfoByIdentityNo(dto.getResidentsIdentityNo());
if(newPopulationInformationEntity==null){
if (newPopulationInformationEntity == null) {
newPopulationInformationEntity = new PopulationInformationEntity();
newPopulationInformationEntity.setResidentsName(dto.getResidentsName());
newPopulationInformationEntity.setResidentsNation(dto.getResidentsNation());
@ -145,11 +155,11 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
entity.setResidentId(newPopulationInformationEntity.getId());
entity.setIsHouseHead("0");
insert(entity);
}else if(newPopulationInformationEntity!=null){
} else if (newPopulationInformationEntity != null) {
//人口信息不是空,则新人口信息转变为旧人口信息
//1.查询表单身份证的人口的和房子的关联关系(查询条件是非户主身份的)
HouseResidentEntity oldHouseResidentEntity = baseDao.getHouseResidentInfoByResidentId(newPopulationInformationEntity.getId());
if(oldHouseResidentEntity==null){
if (oldHouseResidentEntity == null) {
//此时说明此人有户主身份,则直接更新人口信息和新增关联信息
newPopulationInformationEntity.setResidentsName(dto.getResidentsName());
newPopulationInformationEntity.setResidentsNation(dto.getResidentsNation());
@ -173,11 +183,11 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
//2.查询表单身份证的人口的房子的信息
HousingInformationEntity oldHousingInformationEntity = housingInformationService.selectById(oldHouseResidentEntity.getHouseId());
//3.第一次修改
//比较当前房屋和表单身份证的旧房屋信息
//如果不同则提示是否要进行修改
if("0".equals(dto.getIsEditResidentInfo()) && !dto.getHouseId().equals(oldHouseResidentEntity.getHouseId())){
return new Result().ok("您在地址为"+oldHousingInformationEntity.getHouseAddress()+"房屋下已有居住信息,确认要更新吗?");
}else if("1".equals(dto.getIsEditResidentInfo())){//第二次确认修改居住信息
//比较当前房屋和表单身份证的旧房屋信息
//如果不同则提示是否要进行修改
if ("0".equals(dto.getIsEditResidentInfo()) && !dto.getHouseId().equals(oldHouseResidentEntity.getHouseId())) {
return new Result().ok("您在地址为" + oldHousingInformationEntity.getHouseAddress() + "房屋下已有居住信息,确认要更新吗?");
} else if ("1".equals(dto.getIsEditResidentInfo())) {//第二次确认修改居住信息
newPopulationInformationEntity.setResidentsName(dto.getResidentsName());
newPopulationInformationEntity.setResidentsNation(dto.getResidentsNation());
newPopulationInformationEntity.setEducationLevel(dto.getEducationLevel());
@ -194,7 +204,7 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
oldHouseResidentEntity.setHouseId(dto.getHouseId());
oldHouseResidentEntity.setHouseHeadRelation(dto.getHouseHeadRelation());
updateById(oldHouseResidentEntity);
}else if ("0".equals(dto.getIsEditResidentInfo()) && dto.getHouseId().equals(oldHouseResidentEntity.getHouseId())){
} else if ("0".equals(dto.getIsEditResidentInfo()) && dto.getHouseId().equals(oldHouseResidentEntity.getHouseId())) {
//如果相同,则表示新增时,填写的身份证在房屋居住人列表中已存在!
return new Result().error("当前房屋下已存在此人!");
} else {
@ -211,7 +221,7 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
HouseResidentEntity oldHouseResident = baseDao.selectById(dto.getId());
PopulationInformationEntity oldPopulationInformation = populationInformationService.selectById(oldHouseResident.getResidentId());
//如果身份证相同,则更新人口信息和关系表信息
if(dto.getResidentsIdentityNo().equals(oldPopulationInformation.getResidentsIdentityNo())){
if (dto.getResidentsIdentityNo().equals(oldPopulationInformation.getResidentsIdentityNo())) {
oldPopulationInformation.setResidentsName(dto.getResidentsName());
oldPopulationInformation.setResidentsNation(dto.getResidentsNation());
oldPopulationInformation.setEducationLevel(dto.getEducationLevel());
@ -227,7 +237,7 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
} else {
//先判断身份证是否合法
String result = IdentityNoUtils.IdentityNoVerification(dto.getResidentsIdentityNo());
if(result != null){
if (result != null) {
return new Result().error(result);
}
String sex = IdentityNoUtils.getSex(dto.getResidentsIdentityNo());
@ -235,7 +245,7 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
//根据身份证判断此人是否已有居住信息
//新的居住人信息
PopulationInformationEntity populationInformationEntity = populationInformationService.getInfoByIdentityNo(dto.getResidentsIdentityNo());
if(populationInformationEntity==null){
if (populationInformationEntity == null) {
//新的居住人信息是空,代表添加新的人口信息到表中。并且由于此处是更新,则当前选择的被更新人的数据要从人口信息表中删除,且之前的关联关系也得更新
populationInformationEntity = new PopulationInformationEntity();
populationInformationEntity.setResidentsName(dto.getResidentsName());
@ -251,11 +261,11 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
//获取原先关联表信息
HouseResidentEntity entity = selectById(dto.getId());
//查询原先绑定的居住人的信息,如果此居住人只有居住人身份则删除此人人口信息
Map<String,Object> params = new HashMap<>();
params.put("RESIDENT_ID",entity.getResidentId());
params.put("IS_HOUSE_HEAD","0");
Map<String, Object> params = new HashMap<>();
params.put("RESIDENT_ID", entity.getResidentId());
params.put("IS_HOUSE_HEAD", "0");
List<HouseResidentEntity> houseResidentEntities = baseDao.selectByMap(params);
if(houseResidentEntities!=null && houseResidentEntities.size()>0){
if (houseResidentEntities != null && houseResidentEntities.size() > 0) {
//没有户主身份,删除人口信息
populationInformationService.deleteById(entity.getResidentId());
}
@ -265,16 +275,16 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
entity.setResidentId(populationInformationEntity.getId());
//更新关联表信息
updateById(entity);
}else if(populationInformationEntity!=null){
} else if (populationInformationEntity != null) {
//1.判断查出的表单身份证的这个人是不是已经在这个房屋下了
Map<String,Object> params = new HashMap<>();
Map<String, Object> params = new HashMap<>();
//当前表单身份证对应的人口ID
params.put("RESIDENT_ID",populationInformationEntity.getId());
params.put("RESIDENT_ID", populationInformationEntity.getId());
//当前表单房屋ID
params.put("HOUSE_ID",dto.getHouseId());
params.put("IS_HOUSE_HEAD","0");
params.put("HOUSE_ID", dto.getHouseId());
params.put("IS_HOUSE_HEAD", "0");
List<HouseResidentEntity> houseResidentEntities = houseResidentDao.selectByMap(params);
if(houseResidentEntities!=null && houseResidentEntities.size()>0){
if (houseResidentEntities != null && houseResidentEntities.size() > 0) {
return new Result().error("当前房屋下已存在此人!");
}
//2.此人不在此屋子下
@ -290,30 +300,30 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
//获取原先关联表信息
HouseResidentEntity entity = selectById(dto.getId());
//查询原先绑定的居住人的信息,如果此居住人只有居住人身份则删除此人人口信息
Map<String,Object> oldParams = new HashMap<>();
oldParams.put("RESIDENT_ID",entity.getResidentId());
oldParams.put("IS_HOUSE_HEAD","0");
Map<String, Object> oldParams = new HashMap<>();
oldParams.put("RESIDENT_ID", entity.getResidentId());
oldParams.put("IS_HOUSE_HEAD", "0");
List<HouseResidentEntity> oldHouseResidentEntities = baseDao.selectByMap(oldParams);
//(3)更新表单身份证与房屋关联关系为当前房屋(若是表单身份证存在户主身份,且第一次添加居住人,则新增关联关系)
//获取表单身份证之前的居住地关联关系表的信息
HouseResidentEntity newHouseResidentEntity = houseResidentDao.getHouseResidentInfoByResidentId(populationInformationEntity.getId());
if(newHouseResidentEntity==null){
if (newHouseResidentEntity == null) {
//此处判断代表此人有户主身份,且第一次更新为居民身份,此时新增关联关系
newHouseResidentEntity.setHouseId(dto.getHouseId());
newHouseResidentEntity.setHouseHeadRelation(dto.getHouseHeadRelation());
newHouseResidentEntity.setResidentId(populationInformationEntity.getId());
houseResidentDao.insert(newHouseResidentEntity);
}else {
} else {
houseResidentDao.updateById(newHouseResidentEntity);
}
baseDao.deleteById(entity.getId());
if(oldHouseResidentEntities!=null && oldHouseResidentEntities.size()>0){
if (oldHouseResidentEntities != null && oldHouseResidentEntities.size() > 0) {
//没有户主身份,删除人口信息
populationInformationService.deleteById(entity.getResidentId());
}
populationInformationService.updateById(populationInformationEntity);
}else {
} else {
return new Result().error("参数传递出错");
}
}
@ -334,10 +344,10 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
public PageData<PopulationInformationDTO> listPage(Map<String, Object> params) {
IPage<PopulationInformationDTO> page = getPage(params);
PopulationInformationDTO populationInformationDTO = populationInformationService.getHouseHeadInfo(params.get("houseId") + "");
if(populationInformationDTO==null){
if (populationInformationDTO == null) {
return new PageData<>(new ArrayList<>(), page.getTotal());
}
params.put("houseHeadId",populationInformationDTO.getId());
params.put("houseHeadId", populationInformationDTO.getId());
List<PopulationInformationDTO> list = baseDao.selectListOfPopulationInformationDTO(params);
return new PageData<>(list, page.getTotal());
}
@ -346,14 +356,19 @@ public class HouseResidentServiceImpl extends BaseServiceImpl<HouseResidentDao,
public Result saveWithoutIdentifyNo(HouseResidentDTO dto) {
//先取房屋的户主ID
PopulationInformationDTO houseHeadInfo = populationInformationService.getHouseHeadInfo(dto.getHouseId());
if(houseHeadInfo==null){
return new Result().error("请先填写户主信息!");
if (houseHeadInfo == null) {
return new Result().error("请先填写户主信息!");
}
PopulationInformationEntity populationInformationEntity = ConvertUtils.sourceToTarget(dto,PopulationInformationEntity.class);
populationInformationService.insert(populationInformationEntity);
EpidemicUserInfoEntity check = epidemicUserInfoService.selectInfoByIdCard(dto.getResidentsIdentityNo());
if (null != check && null != houseHeadInfo) {
throw new RenException("身份证号已存在");
}
PopulationInformationEntity populationInformationEntity = ConvertUtils.sourceToTarget(dto, PopulationInformationEntity.class);
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;
}
}

54
epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/service/impl/HousingInformationServiceImpl.java

@ -286,14 +286,14 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform
//删除人口信息 -- 删户主信息,居住人信息,户主房屋关联信息,居住人户主关联信息
if (populationIds.size() > 0) {
//(1)删户主信息 - 根据人口ID删
populationInformationService.deleteBatchIds(populationIds);
epidemicUserInfoService.deleteBatchIds(populationIds);
//(3)删居住人信息 - 根据人口ID删
Map<String, Object> residentParams = new HashMap<>();
residentParams.put("HOUSE_HEAD_ID", populationIds.get(0));
List<HouseResidentEntity> houseResidentEntityList = houseResidentDao.selectByMap(residentParams);
if (houseResidentEntityList != null && houseResidentEntityList.size() > 0) {
List<String> residentIds = houseResidentEntityList.stream().map(HouseResidentEntity::getResidentId).collect(Collectors.toList());
populationInformationService.deleteBatchIds(residentIds);
epidemicUserInfoService.deleteBatchIds(residentIds);
//(4)删居住人关联信息 - 根据户主ID删
houseResidentDao.deleteByMap(residentParams);
}
@ -328,7 +328,7 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform
List<String> dicTypes = new ArrayList<>();
Collections.addAll(dicTypes, PopulationDictConstant.ACCOUNT_TYPE, PopulationDictConstant.BODY_STATUS, PopulationDictConstant.EDUCATION_LEVEL
, PopulationDictConstant.EMPLOYMENT_STATUS, PopulationDictConstant.FAMILY_CATEGORY, PopulationDictConstant.GENDER, PopulationDictConstant.HELP_STATUS, PopulationDictConstant.MARITAL_STATUS
, PopulationDictConstant.MOTOR_VEHICLE_CATEGORY, PopulationDictConstant.POLITICS_STATUS, PopulationDictConstant.UNEMPLOYMENT_REASON);
, PopulationDictConstant.MOTOR_VEHICLE_CATEGORY, PopulationDictConstant.POLITICS_STATUS, PopulationDictConstant.UNEMPLOYMENT_REASON, PopulationDictConstant.SPECIAL_CROWD, PopulationDictConstant.PEOPLE_CATEGORIES);
sysPopulationSimpleDictFormDTO.setDicTypes(dicTypes);
Result<List<SysPopulationSimpleDictDTO>> listResult = adminVimFeignClient.listPopulationSimple(sysPopulationSimpleDictFormDTO);
if (listResult == null || !listResult.success()) {
@ -535,11 +535,11 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform
//校验户主信息
epidemicUserInfoService.insert(epidemicUserInfoEntity);
}
//插入房屋人员关联关系表
//插入房屋人员关联关系表(户主信息)
HouseResidentEntity houseResidentEntity = new HouseResidentEntity();
houseResidentEntity.setHouseId(housingInformationEntity.getId());
houseResidentEntity.setResidentId(epidemicUserInfoEntity.getId().toString());
houseResidentEntity.setIsHouseHead("1");
houseResidentEntity.setIsHouseHead(NumConstant.ONE_STR);
houseResidentDao.insert(houseResidentEntity);
populationIdNoAndIdMap.put(basePopulationInformationExcel.getResidentsIdentityNo(), epidemicUserInfoEntity.getId().toString());
}
@ -780,6 +780,8 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform
String unemploymentRegisterTime = basePopulationInformationExcel.getUnemploymentRegisterTime() == null ? null : basePopulationInformationExcel.getUnemploymentRegisterTime().trim();
String familyCategory = basePopulationInformationExcel.getFamilyCategory() == null ? null : basePopulationInformationExcel.getFamilyCategory().trim();
String helpStatus = basePopulationInformationExcel.getHelpStatus() == null ? null : basePopulationInformationExcel.getHelpStatus().trim();
String specialCrowd = basePopulationInformationExcel.getSpecialCrowd() == null ? null : basePopulationInformationExcel.getSpecialCrowd().trim();
String peopleCategories = basePopulationInformationExcel.getPeopleCategories() == null ? null : basePopulationInformationExcel.getPeopleCategories().trim();
Integer motorVehicleNum = basePopulationInformationExcel.getMotorVehicleNum();
String motorVehicleCategory = basePopulationInformationExcel.getMotorVehicleCategory() == null ? null : basePopulationInformationExcel.getMotorVehicleCategory().trim();
String dogStatus = basePopulationInformationExcel.getDogStatus() == null ? null : basePopulationInformationExcel.getDogStatus().trim();
@ -1180,6 +1182,48 @@ public class HousingInformationServiceImpl extends BaseServiceImpl<HousingInform
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;
basePopulationInformationExcel.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;
basePopulationInformationExcel.setPeopleCategories(sysSimpleDict.getDictValue());
}
}
}
}
if (!isMatch) {
errorLineInfoDto = new EpdcPopulationErrorResultDTO();
errorLineInfoDto.setErrorLine((i + 2) + "");
errorLineInfoDto.setErrorInfo("人口类型数据不匹配");
errorLineInfoDto.setSheetName("房屋信息和户主信息");
errorLineInfoList.add(errorLineInfoDto);
}
}
if ("在岗".equals(employmentStatus)) {
basePopulationInformationExcel.setUnemploymentReason(null);
if (StringUtils.isNotBlank((currentEmployer))) {

2
epdc-cloud-vim-yushan/src/main/resources/mapper/epidemic/EpidemicUserInfoDao.xml

@ -356,7 +356,7 @@
select *
from epidemic_user_info
where ID_CARD = #{idCard}
and del_flag = '0'
and del_flag = '0' limit 1
</select>
<select id="getEpidemicPageV2"

25
epdc-cloud-vim-yushan/src/main/resources/mapper/house/HouseResidentDao.xml

@ -18,7 +18,7 @@
</resultMap>
<select id="selectListOfPopulationInformationDTO"
resultType="com.elink.esua.epdc.dto.house.PopulationInformationDTO">
select t.ID,
select t1.ID,
t.USER_NAME as RESIDENTS_NAME,
t.GENDER as RESIDENTS_SEX,
t.NATION as RESIDENTS_NATION,
@ -56,6 +56,29 @@
from epdc_population_information t left join epdc_house_resident t1 on t1.RESIDENT_ID = t.ID
where t.DEL_FLAG ='0' and t1.DEL_FLAG ='0' and t1.IS_HOUSE_HEAD = '0' and t1.ID = #{id}
</select>
<select id="selectByHouseResidentIdV2" resultType="com.elink.esua.epdc.dto.house.PopulationInformationDTO">
select t.ID,
t.USER_NAME as RESIDENTS_NAME,
t.GENDER as RESIDENTS_SEX,
t.NATION as RESIDENTS_NATION,
t.BIRTHDAY as RESIDENTS_BIRTHDAY,
t.STANDARD_OF_CULTURE as EDUCATION_LEVEL,
t.POLITICS_STATUS,
t.JOIN_TIME,
t.ORGANIZATIONAL_RELATIONSHIP_LOCATION,
t.ID_CARD as RESIDENTS_IDENTITY_NO,
t.MOBILE as RESIDENTS_PHONE,
t.WORK_UNITS as CURRENT_EMPLOYER,
t.LIVE_ADDRESS_NAME as CURRENT_ADDRESS,
t1.HOUSE_ID as houseId,
t.RELATION as HOUSE_HEAD_RELATION,
t.ID as residentId,
t.PEOPLE_CATEGORIES,
t.SPECIAL_CROWD,
t1.HOUSE_HEAD_ID
from epidemic_user_info t left join epdc_house_resident t1 on t1.RESIDENT_ID = t.ID
where t.DEL_FLAG ='0' and t1.DEL_FLAG ='0' and t1.IS_HOUSE_HEAD = '0' and t1.ID = #{id}
</select>
<select id="getHouseResidentInfoByResidentId"
resultType="com.elink.esua.epdc.vaccine.house.entity.HouseResidentEntity">
select * from epdc_house_resident where RESIDENT_ID = #{residentId} and DEL_FLAG ='0'

2
epdc-cloud-vim-yushan/src/main/resources/mapper/house/PopulationInformationDao.xml

@ -127,6 +127,8 @@
t.MOTOR_VEHICLE_NUM,
t.MOTOR_VEHICLE_CATEGORY,
t.DOG_STATUS,
t.PEOPLE_CATEGORIES,
t.SPECIAL_CROWD,
t.LIVE_ADDRESS_NAME as CURRENT_ADDRESS,
t1.HOUSE_ID as houseId
from epidemic_user_info t

Loading…
Cancel
Save