From 91fadecf4cf611b3446116d758c377c71832ae56 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Thu, 9 Sep 2021 13:59:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E5=AD=97=E6=AE=B5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=B8=9A=E5=8A=A1=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/EpidemicUserInfoService.java | 11 + .../impl/EpidemicUserInfoServiceImpl.java | 11 +- .../vaccine/house/dao/HouseResidentDao.java | 8 + .../excel/BasePopulationInformationExcel.java | 2 +- .../excel/BaseResidentInformationExcel.java | 2 +- .../impl/HouseResidentServiceImpl.java | 208 ++++++++++++------ .../impl/HousingInformationServiceImpl.java | 54 ++++- .../mapper/epidemic/EpidemicUserInfoDao.xml | 2 +- .../mapper/house/HouseResidentDao.xml | 25 ++- .../mapper/house/PopulationInformationDao.xml | 2 + 10 files changed, 243 insertions(+), 82 deletions(-) diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/EpidemicUserInfoService.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/EpidemicUserInfoService.java index 30ecfb9..c4844f0 100644 --- a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/epidemic/service/EpidemicUserInfoService.java +++ b/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(); } + @Override + public EpidemicUserInfoEntity selectInfoByIdCard(String idCard) { + return baseDao.selectInfoByIdCard(idCard); + } + } diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/dao/HouseResidentDao.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/dao/HouseResidentDao.java index b2a7cc8..a7c7ba3 100644 --- a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/dao/HouseResidentDao.java +++ b/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 { * @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 diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/excel/BasePopulationInformationExcel.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/excel/BasePopulationInformationExcel.java index 77b5d51..bfbf96d 100644 --- a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/excel/BasePopulationInformationExcel.java +++ b/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; } \ No newline at end of file diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/excel/BaseResidentInformationExcel.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/excel/BaseResidentInformationExcel.java index aacb5c8..fcf58d5 100644 --- a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/excel/BaseResidentInformationExcel.java +++ b/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 = "本人身份证号码") diff --git a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/service/impl/HouseResidentServiceImpl.java b/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/service/impl/HouseResidentServiceImpl.java index bdafe88..3d08e6d 100644 --- a/epdc-cloud-vim-yushan/src/main/java/com/elink/esua/epdc/vaccine/house/service/impl/HouseResidentServiceImpl.java +++ b/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 getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -90,41 +99,42 @@ public class HouseResidentServiceImpl extends BaseServiceImpl params = new HashMap<>(); - params.put("RESIDENT_ID",entity.getResidentId()); - params.put("IS_HOUSE_HEAD","0"); + Map params = new HashMap<>(); + params.put("RESIDENT_ID", entity.getResidentId()); + params.put("IS_HOUSE_HEAD", "0"); List 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 params = new HashMap<>(); + Map 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 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 oldParams = new HashMap<>(); - oldParams.put("RESIDENT_ID",entity.getResidentId()); - oldParams.put("IS_HOUSE_HEAD","0"); + Map oldParams = new HashMap<>(); + oldParams.put("RESIDENT_ID", entity.getResidentId()); + oldParams.put("IS_HOUSE_HEAD", "0"); List 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 listPage(Map params) { IPage 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 list = baseDao.selectListOfPopulationInformationDTO(params); return new PageData<>(list, page.getTotal()); } @@ -346,14 +356,19 @@ public class HouseResidentServiceImpl extends BaseServiceImpl 0) { //(1)删户主信息 - 根据人口ID删 - populationInformationService.deleteBatchIds(populationIds); + epidemicUserInfoService.deleteBatchIds(populationIds); //(3)删居住人信息 - 根据人口ID删 Map residentParams = new HashMap<>(); residentParams.put("HOUSE_HEAD_ID", populationIds.get(0)); List houseResidentEntityList = houseResidentDao.selectByMap(residentParams); if (houseResidentEntityList != null && houseResidentEntityList.size() > 0) { List 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 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> listResult = adminVimFeignClient.listPopulationSimple(sysPopulationSimpleDictFormDTO); if (listResult == null || !listResult.success()) { @@ -535,11 +535,11 @@ public class HousingInformationServiceImpl extends BaseServiceImpl 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 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))) { diff --git a/epdc-cloud-vim-yushan/src/main/resources/mapper/epidemic/EpidemicUserInfoDao.xml b/epdc-cloud-vim-yushan/src/main/resources/mapper/epidemic/EpidemicUserInfoDao.xml index d4b715d..76460c0 100644 --- a/epdc-cloud-vim-yushan/src/main/resources/mapper/epidemic/EpidemicUserInfoDao.xml +++ b/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 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} +