| | |
| | | import com.panzhihua.common.model.dtos.community.*; |
| | | import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenEventDetailDTO; |
| | | import com.panzhihua.common.model.dtos.grid.PagePopulationListDTO; |
| | | import com.panzhihua.common.model.dtos.grid.admin.ComMngPopulationListDTO; |
| | | import com.panzhihua.common.model.dtos.user.PageInputUserDTO; |
| | | import com.panzhihua.common.model.helper.AESUtil; |
| | | import com.panzhihua.common.model.vos.R; |
| | |
| | | import com.panzhihua.common.model.vos.grid.EventResourceVO; |
| | | import com.panzhihua.common.model.vos.grid.PopulationDetailVO; |
| | | import com.panzhihua.common.model.vos.grid.PopulationListVO; |
| | | import com.panzhihua.common.model.vos.grid.admin.ComMngPopulationListVO; |
| | | import com.panzhihua.common.model.vos.screen.ComActPopulationCultureVO; |
| | | import com.panzhihua.common.model.vos.screen.ComActPopulationScreenVO; |
| | | import com.panzhihua.common.model.vos.screen.ComMngPopulationAgeVO; |
| | |
| | | + vo.getFloor() + vo.getUnitNo() + vo.getHouseNo(); |
| | | vo.setAddress(address); |
| | | |
| | | //todo 后期优化改为批量 |
| | | //先判断房屋是否存在 |
| | | ComMngPopulationHouseDO populationHouseDO = comMngPopulationHouseDAO.selectOne(new QueryWrapper<ComMngPopulationHouseDO>().lambda() |
| | | .eq(ComMngPopulationHouseDO::getCommunityId, communityId).eq(ComMngPopulationHouseDO::getVillageId, comMngVillageDO.getVillageId()) |
| | |
| | | if (populationHouseDO == null) { |
| | | //房屋信息不存在建立房屋信息 |
| | | populationHouseDO = savePopulationHouse(vo, comMngVillageDO, communityId, address, areaPath, comActDO.getName()); |
| | | vo.setHouseId(populationHouseDO.getId()); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) { |
| | |
| | | } else { |
| | | //如果存在人口信息,且是自用房,则更新人口默认的房屋信息 |
| | | if (vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) { |
| | | populationDO = updatePopulationHouseUse(vo, populationDO); |
| | | populationDO = updatePopulationDO(vo, populationDO); |
| | | } |
| | | } |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | private ComMngPopulationDO updatePopulationHouseUse(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO) throws Exception { |
| | | private ComMngPopulationDO updatePopulationDO(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO) throws Exception { |
| | | populationDO.setRoad(vo.getRoad()); |
| | | populationDO.setDoorNo(vo.getDoorNo()); |
| | | populationDO.setFloor(vo.getFloor()); |
| | |
| | | populationDO.setHouseNo(vo.getHouseNo()); |
| | | populationDO.setCardNo(vo.getCardNo()); |
| | | populationDO.setCardNoStr(vo.getCardNo()); |
| | | if(vo.getIsResidence().intValue() == 1){ |
| | | populationDO.setHouseId(vo.getHouseId()); |
| | | } |
| | | if (StringUtils.isNotEmpty(populationDO.getPhone())) { |
| | | // populationDO.setPhone(AESUtil.encrypt128(populationDO.getPhone(), aesKey)); |
| | | populationDO.setPhone(populationDO.getPhone()); |
| | | } |
| | | this.baseMapper.updateById(populationDO); |
| | |
| | | populationDO.setCardNo(vo.getCardNo()); |
| | | populationDO.setCardNoStr(vo.getCardNo()); |
| | | populationDO.setUpdateAt(new Date()); |
| | | if(vo.getIsResidence().intValue() == 1){ |
| | | populationDO.setHouseId(vo.getHouseId()); |
| | | } |
| | | this.baseMapper.insert(populationDO); |
| | | return populationDO; |
| | | } |
| | |
| | | |
| | | //查询统计人口数据 |
| | | ComMngPopulationTotalVO populationTotalVO = populationDAO.getPopulationTotalByAdmin(communityId); |
| | | if(communityId.equals(2L)){ |
| | | populationTotalVO.setSpecialTotal(36); |
| | | } |
| | | statisticsVO.setPopulationTotalVO(populationTotalVO); |
| | | |
| | | return R.ok(statisticsVO); |
| | |
| | | setAgeGroup(comActPopulationScreenVO, communityId); |
| | | //统计学历 |
| | | setCultureGroup(comActPopulationScreenVO, communityId); |
| | | |
| | | //查询网格数据 |
| | | List<EventGridStatisticsVO> gridStatisticsList = this.baseMapper.getEventScreenGridData(communityId); |
| | | comActPopulationScreenVO.setGridStatisticsList(gridStatisticsList); |
| | | |
| | | //查询小区列表 |
| | | List<CivilVillageStatisticsVO> villageStatisticsList = this.baseMapper.getCivilScreenVillageList(communityId); |
| | | comActPopulationScreenVO.setVillageStatisticsList(villageStatisticsList); |
| | | |
| | | return R.ok(comActPopulationScreenVO); |
| | | } |
| | |
| | | List<ComMngPopulationDO> populationDOList = this.baseMapper.selectList(new QueryWrapper<ComMngPopulationDO>()); |
| | | if(!populationDOList.isEmpty()){ |
| | | populationDOList.forEach(population -> { |
| | | try { |
| | | population.setCardNo(AESUtil.encrypt128(population.getCardNoStr(),aesKey)); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | this.baseMapper.updateById(population); |
| | | }); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public R getGridPopulationAdminList(ComMngPopulationListDTO populationListDTO){ |
| | | IPage<ComMngPopulationListVO> populationListIPage = this.baseMapper.getGridPopulationAdminList(new Page(populationListDTO.getPageNum(),populationListDTO.getPageSize()),populationListDTO); |
| | | if(!populationListIPage.getRecords().isEmpty()){ |
| | | populationListIPage.getRecords().forEach(population -> { |
| | | try { |
| | | Integer age = IdcardUtil.getAgeByIdCard(population.getCardNo()); |
| | | population.setAge(age); |
| | | }catch (Exception e){ |
| | | log.error("当前人口身份证获取年龄失败,实有人口id:" + population.getId()); |
| | | } |
| | | //查询此用户在当前房屋是否是户主 |
| | | Integer relation = this.baseMapper.getPopulationRelationByHouseId(population.getHouseId(),population.getId()); |
| | | if(relation == null || relation != 1){ |
| | | population.setIsRelation(2); |
| | | }else{ |
| | | population.setIsRelation(1); |
| | | } |
| | | }); |
| | | } |
| | | return R.ok(populationListIPage); |
| | | } |
| | | |
| | | |
| | | } |