|
|
@ -21,16 +21,30 @@ 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.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.IdentityNoUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.constant.HouseHeadRelationConstant; |
|
|
|
import com.elink.esua.epdc.constant.HouseUseConstant; |
|
|
|
import com.elink.esua.epdc.constant.PopulationIdentify; |
|
|
|
import com.elink.esua.epdc.dao.HouseResidentDao; |
|
|
|
import com.elink.esua.epdc.dao.PopulationInformationDao; |
|
|
|
import com.elink.esua.epdc.dto.BaseResidentInformationExportDto; |
|
|
|
import com.elink.esua.epdc.dto.HousingInformationDTO; |
|
|
|
import com.elink.esua.epdc.dto.PopulationInfoOverviewDTO; |
|
|
|
import com.elink.esua.epdc.dto.PopulationInformationDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.form.EpdcScreenSelectPeopleDetailFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.form.EpdcScreenSelectPeopleFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.result.EpdcScreenSelectPeopleDetailResultDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.result.EpdcScreenSelectPeopleResultDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.result.FamilyMember; |
|
|
|
import com.elink.esua.epdc.dto.epdc.result.HousingInfo; |
|
|
|
import com.elink.esua.epdc.entity.HouseResidentEntity; |
|
|
|
import com.elink.esua.epdc.entity.HousingInformationEntity; |
|
|
|
import com.elink.esua.epdc.entity.PopulationInformationEntity; |
|
|
|
import com.elink.esua.epdc.feign.AdminFeignClient; |
|
|
|
import com.elink.esua.epdc.redis.PopulationInformationRedis; |
|
|
|
import com.elink.esua.epdc.service.HouseResidentService; |
|
|
|
import com.elink.esua.epdc.service.HousingInformationService; |
|
|
@ -40,10 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* 人口信息表 |
|
|
@ -63,6 +74,9 @@ public class PopulationInformationServiceImpl extends BaseServiceImpl<Population |
|
|
|
private HouseResidentDao houseResidentDao; |
|
|
|
@Autowired |
|
|
|
private HousingInformationService housingInformationService; |
|
|
|
@Autowired |
|
|
|
private AdminFeignClient adminFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<PopulationInformationDTO> page(Map<String, Object> params) { |
|
|
@ -285,4 +299,130 @@ public class PopulationInformationServiceImpl extends BaseServiceImpl<Population |
|
|
|
baseDao.setUnemploymentRegisterTimeToNull(id); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<List<EpdcScreenSelectPeopleResultDTO>> selectPeople(EpdcScreenSelectPeopleFormDTO dto) { |
|
|
|
int pageIndex = (dto.getPageIndex() - NumConstant.ONE) * dto.getPageSize(); |
|
|
|
dto.setPageIndex(pageIndex); |
|
|
|
List<EpdcScreenSelectPeopleResultDTO> data = baseDao.selectListPeople(dto); |
|
|
|
return new Result().ok(data); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<EpdcScreenSelectPeopleDetailResultDTO> selectPeopleDetail(EpdcScreenSelectPeopleDetailFormDTO dto) { |
|
|
|
EpdcScreenSelectPeopleDetailResultDTO epdcScreenSelectPeopleDetailResultDTO = new EpdcScreenSelectPeopleDetailResultDTO(); |
|
|
|
//根据身份标识寻找对应人员信息
|
|
|
|
if(PopulationIdentify.PROPERTY_OWNER.equals(dto.getIdentifyFlag())){ |
|
|
|
if(StringUtils.isBlank(dto.getHouseId())){ |
|
|
|
return new Result<EpdcScreenSelectPeopleDetailResultDTO>().error("查询产权人信息失败:房屋ID为空"); |
|
|
|
} |
|
|
|
//如果是产权人,人口信息从房屋信息表拿
|
|
|
|
HousingInformationEntity housingInformationEntity = housingInformationService.selectById(dto.getHouseId()); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setName(housingInformationEntity.getPropertyOwner()); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setSex(""); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setAge(""); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setPhone(housingInformationEntity.getPropertyOwnerMobile()); |
|
|
|
//房屋信息
|
|
|
|
List<HousingInfo> housingInfoList = new ArrayList<>(); |
|
|
|
HousingInfo housingInfo = new HousingInfo(); |
|
|
|
housingInfo.setHouseAddress(housingInformationEntity.getHouseAddress()); |
|
|
|
housingInfo.setHouseArea(housingInformationEntity.getHouseArea()); |
|
|
|
setHouseUse(housingInformationEntity.getHouseUse(),housingInfo); |
|
|
|
housingInfoList.add(housingInfo); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setHousingInfo(housingInfoList); |
|
|
|
return new Result<EpdcScreenSelectPeopleDetailResultDTO>().ok(epdcScreenSelectPeopleDetailResultDTO); |
|
|
|
} else if(PopulationIdentify.HOUSE_HEAD.equals(dto.getIdentifyFlag())) { |
|
|
|
if(StringUtils.isBlank(dto.getPopulationId())){ |
|
|
|
return new Result<EpdcScreenSelectPeopleDetailResultDTO>().error("查询产权人信息失败:人口ID为空"); |
|
|
|
} |
|
|
|
//如果是户主,人口信息从人口表拿
|
|
|
|
PopulationInformationEntity populationInformationEntity = this.selectById(dto.getPopulationId()); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setName(populationInformationEntity.getResidentsName()); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setSex("0".equals(populationInformationEntity.getResidentsSex())?"女":"男"); |
|
|
|
if(IdentityNoUtils.IdentityNoVerification(populationInformationEntity.getResidentsIdentityNo())==null){ |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setAge(IdentityNoUtils.getAge(populationInformationEntity.getResidentsIdentityNo())+""); |
|
|
|
}else { |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setAge(""); |
|
|
|
} |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setPhone(populationInformationEntity.getResidentsPhone()); |
|
|
|
//房屋信息
|
|
|
|
List<HousingInformationDTO> housingInformationDTOList = housingInformationService.getHouseInfoByHouseHeadID(dto.getPopulationId()); |
|
|
|
List<HousingInfo> housingInfoList = ConvertUtils.sourceToTarget(housingInformationDTOList, HousingInfo.class); |
|
|
|
housingInfoList.forEach(housingInfo -> { |
|
|
|
setHouseUse(housingInfo.getHouseUse(),housingInfo); |
|
|
|
}); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setHousingInfo(housingInfoList); |
|
|
|
//居住人信息
|
|
|
|
List<FamilyMember> familyMemberList = new ArrayList<>(); |
|
|
|
Set<String> houseHeadIds = new HashSet<>(1); |
|
|
|
houseHeadIds.add(dto.getPopulationId()); |
|
|
|
List<BaseResidentInformationExportDto> baseResidentInformationExportDtos = housingInformationService.selectBaseResidentInformationExcelList(houseHeadIds); |
|
|
|
FamilyMember familyMember = new FamilyMember(); |
|
|
|
baseResidentInformationExportDtos.forEach(a -> { |
|
|
|
familyMember.setName(a.getResidentsName()); |
|
|
|
familyMember.setPhone(""); |
|
|
|
switch (a.getHouseHeadRelation()){ |
|
|
|
case HouseHeadRelationConstant.CHILDREN : |
|
|
|
familyMember.setRelation("子女"); |
|
|
|
break; |
|
|
|
case HouseHeadRelationConstant.HUSBAND_AND_WIFE : |
|
|
|
familyMember.setRelation("夫妻"); |
|
|
|
break; |
|
|
|
case HouseHeadRelationConstant.PARENT : |
|
|
|
familyMember.setRelation("父母"); |
|
|
|
break; |
|
|
|
case HouseHeadRelationConstant.OTHER : |
|
|
|
familyMember.setRelation("其他"); |
|
|
|
break; |
|
|
|
default: |
|
|
|
familyMember.setRelation(""); |
|
|
|
break; |
|
|
|
} |
|
|
|
familyMemberList.add(familyMember); |
|
|
|
}); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setFamilyMember(familyMemberList); |
|
|
|
return new Result<EpdcScreenSelectPeopleDetailResultDTO>().ok(epdcScreenSelectPeopleDetailResultDTO); |
|
|
|
} else if(PopulationIdentify.HOUSE_RESIDENT.equals(dto.getIdentifyFlag())) { |
|
|
|
if(StringUtils.isBlank(dto.getPopulationId())){ |
|
|
|
return new Result<EpdcScreenSelectPeopleDetailResultDTO>().error("查询产权人信息失败:人口ID为空"); |
|
|
|
} |
|
|
|
//居住人,人口信息从人口表拿
|
|
|
|
PopulationInformationEntity populationInformationEntity = this.selectById(dto.getPopulationId()); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setName(populationInformationEntity.getResidentsName()); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setSex("0".equals(populationInformationEntity.getResidentsSex())?"女":"男"); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setAge(""); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setPhone(""); |
|
|
|
//房屋信息 - 继承户主的房屋信息
|
|
|
|
//查询该居住人的户主ID
|
|
|
|
Map<String,Object> params = new HashMap<>(); |
|
|
|
params.put("RESIDENT_ID",dto.getPopulationId()); |
|
|
|
params.put("IS_HOUSE_HEAD","0"); |
|
|
|
List<HouseResidentEntity> houseResidentEntityList = houseResidentDao.selectByMap(params); |
|
|
|
String houseHeadId = houseResidentEntityList.get(0).getHouseHeadId(); |
|
|
|
//房屋信息
|
|
|
|
List<HousingInformationDTO> housingInformationDTOList = housingInformationService.getHouseInfoByHouseHeadID(houseHeadId); |
|
|
|
List<HousingInfo> housingInfoList = ConvertUtils.sourceToTarget(housingInformationDTOList, HousingInfo.class); |
|
|
|
housingInfoList.forEach(housingInfo -> { |
|
|
|
setHouseUse(housingInfo.getHouseUse(),housingInfo); |
|
|
|
}); |
|
|
|
epdcScreenSelectPeopleDetailResultDTO.setHousingInfo(housingInfoList); |
|
|
|
return new Result<EpdcScreenSelectPeopleDetailResultDTO>().ok(epdcScreenSelectPeopleDetailResultDTO); |
|
|
|
} |
|
|
|
return new Result<EpdcScreenSelectPeopleDetailResultDTO>().error("查询错误:身份标识参数无法匹配"); |
|
|
|
} |
|
|
|
private void setHouseUse(String houseUse,HousingInfo housingInfo){ |
|
|
|
switch (houseUse){ |
|
|
|
case HouseUseConstant.RENT : |
|
|
|
housingInfo.setHouseUse("租赁"); |
|
|
|
break; |
|
|
|
case HouseUseConstant.SINCE_THE_LIVING : |
|
|
|
housingInfo.setHouseUse("自住"); |
|
|
|
break; |
|
|
|
case HouseUseConstant.BUSINESS : |
|
|
|
housingInfo.setHouseUse("经营"); |
|
|
|
break; |
|
|
|
default: |
|
|
|
housingInfo.setHouseUse(""); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |