101captain
2021-12-08 7659a41cc50b708e89e1f8c7fcac841da816fd2b
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -7044,65 +7044,65 @@
        List<IndexSpecialStatisticsVO> specialStatisticsVOList = new ArrayList<>();
        // 查询特殊人群标签列表
        List<ComMngUserTagVO> userTagList = comMngPopulationDAO.getUserTagListByCommunityId(communityId);
        IndexSpecialStatisticsVO otherSpecialVO = new IndexSpecialStatisticsVO();
        otherSpecialVO.setTitle("其他");
        otherSpecialVO.setSum(0);
        if (!userTagList.isEmpty()) {
            userTagList.forEach(userTag -> {
                if (userTag != null) {
                    if (userTag.getSysFlag().equals(0)) {
                        Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName(),communityId);
                        otherSpecialVO.setSum(otherSpecialVO.getSum() + count);
                    } else {
                        if (StringUtils.isNotEmpty(userTag.getTagName())) {
                            if (userTag.getTagName().equals("特扶家庭")) {
                                IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO();
                                specialStatisticsVO.setTitle(userTag.getTagName());
                                specialStatisticsVO.setSum(22);
                                specialStatisticsVOList.add(specialStatisticsVO);
                            } else if (userTag.getTagName().equals("低保户")) {
                                IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO();
                                specialStatisticsVO.setTitle(userTag.getTagName());
                                specialStatisticsVO.setSum(94);
                                specialStatisticsVOList.add(specialStatisticsVO);
                            } else if (userTag.getTagName().equals("低收入人群")) {
                                IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO();
                                specialStatisticsVO.setTitle(userTag.getTagName());
                                specialStatisticsVO.setSum(2);
                                specialStatisticsVOList.add(specialStatisticsVO);
                            } else if (userTag.getTagName().equals("退役军人")) {
                                IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO();
                                specialStatisticsVO.setTitle(userTag.getTagName());
                                specialStatisticsVO.setSum(264);
                                specialStatisticsVOList.add(specialStatisticsVO);
                            } else if (userTag.getTagName().equals("高龄老人")) {
                                IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO();
                                specialStatisticsVO.setTitle(userTag.getTagName());
                                specialStatisticsVO.setSum(comMngPopulationDAO.getStatisticsCount(communityId));
                                specialStatisticsVOList.add(specialStatisticsVO);
                            } else {
                                IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO();
                                specialStatisticsVO.setTitle(userTag.getTagName());
                                Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName(),communityId);
                                specialStatisticsVO.setSum(count);
                                specialStatisticsVOList.add(specialStatisticsVO);
                            }
                        }
                    }
                }
            });
        }
        // 计算特殊人群总数
        specialStatisticsVOList.add(otherSpecialVO);
        Integer specialNum = 0;
        if (!specialStatisticsVOList.isEmpty()) {
            for (IndexSpecialStatisticsVO special : specialStatisticsVOList) {
                specialNum += special.getSum();
            }
        }
        civilStatisticsVO.setSpecialNum(specialNum);
        civilStatisticsVO.setSpecialStatisticsList(specialStatisticsVOList);
//        List<ComMngUserTagVO> userTagList = comMngPopulationDAO.getUserTagListByCommunityId(communityId);
//        IndexSpecialStatisticsVO otherSpecialVO = new IndexSpecialStatisticsVO();
//        otherSpecialVO.setTitle("其他");
//        otherSpecialVO.setSum(0);
//        if (!userTagList.isEmpty()) {
//            userTagList.forEach(userTag -> {
//                if (userTag != null) {
//                    if (userTag.getSysFlag().equals(0)) {
//                        Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName(),communityId);
//                        otherSpecialVO.setSum(otherSpecialVO.getSum() + count);
//                    } else {
//                        if (StringUtils.isNotEmpty(userTag.getTagName())) {
//                            if (userTag.getTagName().equals("特扶家庭")) {
//                                IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO();
//                                specialStatisticsVO.setTitle(userTag.getTagName());
//                                specialStatisticsVO.setSum(22);
//                                specialStatisticsVOList.add(specialStatisticsVO);
//                            } else if (userTag.getTagName().equals("低保户")) {
//                                IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO();
//                                specialStatisticsVO.setTitle(userTag.getTagName());
//                                specialStatisticsVO.setSum(94);
//                                specialStatisticsVOList.add(specialStatisticsVO);
//                            } else if (userTag.getTagName().equals("低收入人群")) {
//                                IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO();
//                                specialStatisticsVO.setTitle(userTag.getTagName());
//                                specialStatisticsVO.setSum(2);
//                                specialStatisticsVOList.add(specialStatisticsVO);
//                            } else if (userTag.getTagName().equals("退役军人")) {
//                                IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO();
//                                specialStatisticsVO.setTitle(userTag.getTagName());
//                                specialStatisticsVO.setSum(264);
//                                specialStatisticsVOList.add(specialStatisticsVO);
//                            } else if (userTag.getTagName().equals("高龄老人")) {
//                                IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO();
//                                specialStatisticsVO.setTitle(userTag.getTagName());
//                                specialStatisticsVO.setSum(comMngPopulationDAO.getStatisticsCount(communityId));
//                                specialStatisticsVOList.add(specialStatisticsVO);
//                            } else {
//                                IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO();
//                                specialStatisticsVO.setTitle(userTag.getTagName());
//                                Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName(),communityId);
//                                specialStatisticsVO.setSum(count);
//                                specialStatisticsVOList.add(specialStatisticsVO);
//                            }
//                        }
//                    }
//                }
//            });
//        }
//        // 计算特殊人群总数
//        specialStatisticsVOList.add(otherSpecialVO);
//        Integer specialNum = 0;
//        if (!specialStatisticsVOList.isEmpty()) {
//            for (IndexSpecialStatisticsVO special : specialStatisticsVOList) {
//                specialNum += special.getSum();
//            }
//        }
//        civilStatisticsVO.setSpecialNum(specialNum);
//        civilStatisticsVO.setSpecialStatisticsList(specialStatisticsVOList);
        // 计算环比上月增长率
        BigDecimal rate = BigDecimal.ZERO;
@@ -7127,6 +7127,27 @@
        // 查询小区列表
        List<CivilVillageStatisticsVO> villageStatisticsList = this.baseMapper.getCivilScreenVillageList(communityId);
        villageStatisticsList.forEach(civilVillageStatisticsVO -> {
            civilVillageStatisticsVO.setUserSum(comMngPopulationDAO.selectCount(new QueryWrapper<ComMngPopulationDO>().lambda().eq(ComMngPopulationDO::getVillageId,civilVillageStatisticsVO.getVillageId())));
            List<IndexSpecialStatisticsVO> specialStatisticsVOS = new ArrayList<>();
            IndexSpecialStatisticsVO otherSpecial = new IndexSpecialStatisticsVO();
            otherSpecial.setTitle("其他");
            otherSpecial.setSum(0);
            // 查询特殊人群标签列表
            List<ComMngUserTagVO> userTagVOS = comMngPopulationDAO.getUserTagListByCommunityId(communityId);
            userTagVOS.forEach(comMngUserTagVO -> {
              Integer count=comMngPopulationDAO.selectCountByVillageId(civilVillageStatisticsVO.getVillageId(),comMngUserTagVO.getTagName());
              IndexSpecialStatisticsVO indexSpecialStatisticsVO=new IndexSpecialStatisticsVO();
              indexSpecialStatisticsVO.setTitle(comMngUserTagVO.getTagName());
              indexSpecialStatisticsVO.setSum(count);
              otherSpecial.setSum(otherSpecial.getSum()+count);
              specialStatisticsVOS.add(indexSpecialStatisticsVO);
            });
            otherSpecial.setSum(civilVillageStatisticsVO.getUserSum()-otherSpecial.getSum());
            specialStatisticsVOS.add(otherSpecial);
            civilVillageStatisticsVO.setSpecialStatisticsList(specialStatisticsVOS);
        });
        civilStatisticsVO.setVillageStatisticsList(villageStatisticsList);
        return R.ok(civilStatisticsVO);