| | |
| | | List<IndexPopulationSexStatisticsVO> sexPopulationList = comMngPopulationDAO.getScreenIndexByPopulationSex(communityId); |
| | | populationStatisticsVO.setSexPopulationList(sexPopulationList); |
| | | //查询实有人口年龄统计 |
| | | List<ComMngPopulationDO> populationDOList = comMngPopulationDAO.selectList(new QueryWrapper<ComMngPopulationDO>().lambda() |
| | | .eq(ComMngPopulationDO::getActId,communityId)); |
| | | List<IndexPopulationAgeStatisticsVO> agePopulationList = statisticsAge(populationDOList); |
| | | List<IndexPopulationAgeStatisticsVO> agePopulationList = statisticsAge(communityId); |
| | | populationStatisticsVO.setAgePopulationList(agePopulationList); |
| | | statisticsVO.setPopulationStatisticsVO(populationStatisticsVO); |
| | | |
| | |
| | | return R.ok(statisticsVO); |
| | | } |
| | | |
| | | private List<IndexPopulationAgeStatisticsVO> statisticsAge(List<ComMngPopulationDO> populationDOList){ |
| | | private List<IndexPopulationAgeStatisticsVO> statisticsAge(Long communityId){ |
| | | Map<String,Long> ageMap = populationDAO.indexCountByAge(communityId); |
| | | List<IndexPopulationAgeStatisticsVO> agePopulationList = new ArrayList<>(); |
| | | IndexPopulationAgeStatisticsVO ageStatisticsVO1 = new IndexPopulationAgeStatisticsVO(); |
| | | IndexPopulationAgeStatisticsVO ageStatisticsVO2 = new IndexPopulationAgeStatisticsVO(); |
| | |
| | | ageStatisticsVO5.setType(5); |
| | | ageStatisticsVO6.setType(6); |
| | | |
| | | if(populationDOList.isEmpty()){ |
| | | if(ageMap.isEmpty()){ |
| | | ageStatisticsVO1.setSum(0); |
| | | ageStatisticsVO2.setSum(0); |
| | | ageStatisticsVO3.setSum(0); |
| | |
| | | ageStatisticsVO5.setSum(0); |
| | | ageStatisticsVO6.setSum(0); |
| | | }else{ |
| | | populationDOList.forEach(population -> { |
| | | Integer age = IdcardUtil.getAgeByIdCard(population.getCardNoStr()); |
| | | if(age >= 0 && age < 16){ |
| | | ageStatisticsVO1.setSum(ageStatisticsVO1.getSum() + 1); |
| | | }else if(age >= 16 && age < 27){ |
| | | ageStatisticsVO2.setSum(ageStatisticsVO2.getSum() + 1); |
| | | }else if(age >= 27 && age < 35){ |
| | | ageStatisticsVO3.setSum(ageStatisticsVO3.getSum() + 1); |
| | | }else if(age >= 35 && age < 45){ |
| | | ageStatisticsVO4.setSum(ageStatisticsVO4.getSum() + 1); |
| | | }else if(age >= 45 && age < 55){ |
| | | ageStatisticsVO5.setSum(ageStatisticsVO5.getSum() + 1); |
| | | }else if(age >= 55){ |
| | | ageStatisticsVO6.setSum(ageStatisticsVO6.getSum() + 1); |
| | | ageStatisticsVO1.setSum(ageMap.get("age16").intValue()); |
| | | ageStatisticsVO2.setSum(ageMap.get("age27").intValue()); |
| | | ageStatisticsVO3.setSum(ageMap.get("age35").intValue()); |
| | | ageStatisticsVO4.setSum(ageMap.get("age45").intValue()); |
| | | ageStatisticsVO5.setSum(ageMap.get("age55").intValue()); |
| | | ageStatisticsVO6.setSum(ageMap.get("age55over").intValue()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | agePopulationList.add(ageStatisticsVO1); |
| | | agePopulationList.add(ageStatisticsVO2); |
| | | agePopulationList.add(ageStatisticsVO3); |
| | |
| | | return R.ok(civilStatisticsVO); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public R editTagPopulationByCardNo(ComMngPopulationTagCardNoDTO comMngPopulationTagCardNoDTO) { |
| | | ComMngPopulationDO comMngPopulationDO = getPopulationByCardNo(comMngPopulationTagCardNoDTO.getCardNo()); |
| | |
| | | //查询网格数据 |
| | | List<EventGridStatisticsVO> gridStatisticsList = this.baseMapper.getEventScreenGridData(communityId); |
| | | comActPopulationScreenVO.setGridStatisticsList(gridStatisticsList); |
| | | |
| | | //查询小区列表 |
| | | List<CivilVillageStatisticsVO> villageStatisticsList = this.baseMapper.getCivilScreenVillageList(communityId); |
| | | comActPopulationScreenVO.setVillageStatisticsList(villageStatisticsList); |
| | | |
| | | return R.ok(comActPopulationScreenVO); |
| | | } |
| | |
| | | comActPopulationScreenVO.setAgeGroup(ageList); |
| | | } |
| | | |
| | | public R getScreenGirds(Long communityId){ |
| | | return R.ok(this.baseMapper.getEventScreenGridData(communityId)); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // List<ComMngPopulationHouseUserDO> distinctClass = populationHouseUserDOList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getPopulId() + ";" + o.getHouseId() + ";" + o.getId() + ";" + o.getRelation()))), ArrayList::new)); |
| | | } |