| | |
| | | import com.panzhihua.service_community.service.ComMngPopulationService; |
| | | import com.panzhihua.service_community.service.ComMngVillageService; |
| | | import com.panzhihua.service_community.service.EventResourceService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | /** |
| | | * 实有人口Service实现类 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ComMngPopulationServiceImpl extends ServiceImpl<ComMngPopulationDAO, ComMngPopulationDO> implements ComMngPopulationService { |
| | | @Resource |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R listSavePopulation(List<ComMngPopulationServeExcelVO> list, Long communityId) throws Exception { |
| | | List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>(); |
| | | List<ComMngPopulationMistakeExcelVO> mistakes = new ArrayList<>(); |
| | | // List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>(); |
| | | //查询该社区 |
| | | ComActDO comActDO = comActDAO.selectById(communityId); |
| | | //查询该社区的省市区地址 |
| | |
| | | //查询小区街路巷是否存在 |
| | | ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>().eq("alley", vo.getRoad()).eq("house_num", vo.getDoorNo()).eq("community_id", communityId)); |
| | | if (comMngVillageDO == null) { |
| | | ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | importErrorVO.setErrorMsg("街路巷或小区号不存在"); |
| | | importErrorVO.setErrorPosition("街路巷:" + vo.getRoad() + ",小区号:" + vo.getDoorNo()); |
| | | populationImportErrorVOList.add(importErrorVO); |
| | | // ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO(); |
| | | // importErrorVO.setErrorMsg("街路巷或小区号不存在,请先在“小区管理”中添加该小区"); |
| | | // importErrorVO.setErrorPosition("街路巷:" + vo.getRoad() + ",小区号:" + vo.getDoorNo()); |
| | | // populationImportErrorVOList.add(importErrorVO); |
| | | // index++; |
| | | ComMngPopulationMistakeExcelVO mistake = new ComMngPopulationMistakeExcelVO(); |
| | | BeanUtils.copyProperties(vo,mistake); |
| | | setMistake(mistake, vo); |
| | | mistake.setMistake("街路巷或小区号不存在,请先在“小区管理”中添加该小区:街路巷:"+ vo.getRoad() +",小区号:" + vo.getDoorNo()); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | |
| | |
| | | } |
| | | String cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey); |
| | | //判断实有人口是否已存在 |
| | | ComMngPopulationDO populationDO = this.baseMapper.selectOne(new QueryWrapper<ComMngPopulationDO>().lambda() |
| | | .eq(ComMngPopulationDO::getCardNo, cardNoAES)); |
| | | if (populationDO == null) { |
| | | List<ComMngPopulationDO> populationDOList = this.baseMapper.selectList(new QueryWrapper<ComMngPopulationDO>().lambda() |
| | | .eq(ComMngPopulationDO::getCardNo, cardNoAES).eq(ComMngPopulationDO::getActId,communityId)); |
| | | ComMngPopulationDO populationDO = null; |
| | | if (populationDOList.isEmpty()) { |
| | | //不存在实有人口,则新增 |
| | | populationDO = savePopulationDO(vo, comActDO, comMngVillageDO); |
| | | // ComMngPopulationHouseUserDO comMngPopulationHouseUserDO = savePopulationHouseUser(vo, populationDO, populationHouseDO); |
| | |
| | | // if (vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) { |
| | | // populationDO = updatePopulationDO(vo, populationDO); |
| | | // } |
| | | populationDO = updatePopulationDO(vo, comActDO, populationDO); |
| | | populationDO = updatePopulationDO(vo, comActDO, populationDOList.get(0)); |
| | | } |
| | | |
| | | //处理实有人口房屋居住信息 |
| | |
| | | populationHouseUserDO.setPopulId(populationDO.getId()); |
| | | populationHouseUserDO.setRelation(vo.getRelation()); |
| | | populationHouseUserDO.setRelationId(vo.getIsRent()); |
| | | populationHouseUserDO.setResidence(vo.getResidence()); |
| | | comMngPopulationHouseUserDAO.insert(populationHouseUserDO); |
| | | } |
| | | } |
| | |
| | | } |
| | | this.saveBatch(populationDOList);*/ |
| | | |
| | | if (!populationImportErrorVOList.isEmpty()) { |
| | | return R.fail(JSON.toJSONString(populationImportErrorVOList)); |
| | | if (!mistakes.isEmpty()) { |
| | | return R.fail(mistakes); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | populationHouseUserDO.setRelation(houseEditDto.getRelation()); |
| | | if (houseEditDto.getIsResidence().equals(ComMngPopulationHouseEditDTO.isResidence.yes)) { |
| | | houseId = houseEditDto.getId();//居住地 |
| | | populationHouseUserDO.setResidence(ComMngPopulationHouseEditDTO.isResidence.yes); |
| | | }else { |
| | | populationHouseUserDO.setResidence(ComMngPopulationHouseEditDTO.isResidence.no); |
| | | } |
| | | populationHouseUserDOList.add(populationHouseUserDO); |
| | | |
| | |
| | | villageStatisticsList.forEach(village -> { |
| | | CivilVillageStatisticsVO villageStatisticsVO = this.baseMapper.getCivilScreenVillageStatistics(village.getVillageId()); |
| | | if(villageStatisticsVO != null){ |
| | | BeanUtils.copyProperties(villageStatisticsVO,village); |
| | | village.setPeopleNum(villageStatisticsVO.getPeopleNum()); |
| | | village.setHouseNum(villageStatisticsVO.getHouseNum()); |
| | | village.setRegisterNum(villageStatisticsVO.getRegisterNum()); |
| | | village.setFlowNum(villageStatisticsVO.getFlowNum()); |
| | | // BeanUtils.copyProperties(villageStatisticsVO,village); |
| | | } |
| | | }); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public R getGridPopulationAdminList(ComMngPopulationListDTO populationListDTO){ |
| | | if(StringUtils.isNotEmpty(populationListDTO.getKeyWord())){ |
| | | try { |
| | | populationListDTO.setCardNo(AESUtil.encrypt128(populationListDTO.getKeyWord(),aesKey)); |
| | | }catch (Exception e){ |
| | | log.error("转换身份证号码失败"); |
| | | } |
| | | } |
| | | |
| | | IPage<ComMngPopulationListVO> populationListIPage = this.baseMapper.getGridPopulationAdminList(new Page(populationListDTO.getPageNum(),populationListDTO.getPageSize()),populationListDTO); |
| | | if(!populationListIPage.getRecords().isEmpty()){ |
| | | populationListIPage.getRecords().forEach(population -> { |
| | |
| | | return R.ok(this.baseMapper.getVillagePopulationAdmin(new Page(villagePopulationDTO.getPageNum(),villagePopulationDTO.getPageSize()),villagePopulationDTO)); |
| | | } |
| | | |
| | | private void setMistake(ComMngPopulationMistakeExcelVO mvo, ComMngPopulationServeExcelVO vo){ |
| | | mvo.setPoliticalOutlook(PopulPoliticalOutlookEnum.getCnDescByName(vo.getPoliticalOutlook())); |
| | | mvo.setIsRent(PopulHouseUseEnum.getCnDescByName(vo.getIsRent())); |
| | | mvo.setRelation(PopulRelationEnum.getCnDescByName(vo.getRelation())); |
| | | mvo.setHouseStatus(PopulHouseStatusEnum.getCnDescByName(vo.getHouseStatus())); |
| | | mvo.setHousePurpose(PopulHousePurposeEnum.getCnDescByName(vo.getHousePurpose())); |
| | | mvo.setControlStatus(PopulHouseControlStatusEnum.getCnDescByName(vo.getControlStatus())); |
| | | mvo.setCultureLevel(PopulCultureLevelEnum.getCnDescByName(vo.getCultureLevel())); |
| | | mvo.setMarriage(PopulMarriageEnum.getCnDescByName(vo.getMarriage())); |
| | | mvo.setOutOrLocal(PopulOutOrLocalEnum.getCnDescByName(vo.getOutOrLocal())); |
| | | mvo.setResidence(PopulRelationEnum.getCnDescByName(vo.getResidence())); |
| | | mvo.setPersonType(PopulPersonTypeEnum.getCnDescByName(vo.getPersonType())); |
| | | mvo.setDeath(PopulOutOrLocalEnum.getCnDescByName(vo.getDeath())); |
| | | } |
| | | |
| | | } |