huanghongfa
2021-06-17 884505ef2f79835c90f49cbd65e27f980b74a6af
修改bug
6个文件已修改
82 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/BigScreenStatisticsApi.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/BigScreenStatisticsApi.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -3008,4 +3008,12 @@
     */
    @PostMapping("/disable_person/batch/save")
    R saveBatchDisabledPersons(@RequestBody List<DisabledPersonsDTO> list);
    /**
     * 获取社区网格
     * @param communityId   社区id
     * @return  网格数据
     */
    @GetMapping("/screen/getScreenGirds")
    R getScreenGirds(@RequestParam("communityId")Long communityId);
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/BigScreenStatisticsApi.java
@@ -2,6 +2,7 @@
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.screen.civil.CivilStatisticsVO;
import com.panzhihua.common.model.vos.community.screen.event.EventGridStatisticsVO;
import com.panzhihua.common.model.vos.community.screen.event.EventStatisticsVO;
import com.panzhihua.common.model.vos.community.screen.index.IndexStatisticsVO;
import com.panzhihua.common.service.community.CommunityService;
@@ -56,4 +57,13 @@
        }
        return communityService.getScreenCivil(communityId);
    }
    @ApiOperation(value = "获取社区网格接口@lyq",response = EventGridStatisticsVO.class)
    @GetMapping("/event/grids/noToken")
    public R grids(@RequestParam("communityId") Long communityId) {
        if(communityId == null){
            return R.fail("参数错误");
        }
        return communityService.getScreenGirds(communityId);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/BigScreenStatisticsApi.java
@@ -48,5 +48,10 @@
        return R.ok(comMngPopulationService.getScreenCivil(communityId));
    }
    @GetMapping("/getScreenGirds")
    public R grids(@RequestParam("communityId") Long communityId) {
        return R.ok(comMngPopulationService.getScreenGirds(communityId));
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
@@ -284,7 +284,7 @@
            " egd.grid_community_id = #{communityId}  " +
            " AND e.event_deal_status IN ( 1, 4 )  " +
            "ORDER BY " +
            " e.create_at DESC  " +
            " e.happen_time DESC  " +
            " LIMIT 8")
    List<IndexEventListStatisticsVO> getScreenIndexByEventList(@Param("communityId") Long communityId);
@@ -708,4 +708,20 @@
    @Select("select count(user_id) from sys_user where community_id = #{communityId} and type = 1")
    Long countUsedCommunityPopulation(@Param("communityId")Long communityId);
    @Select(
            "SELECT " +
                    "(SELECT COUNT(aa.age) FROM " +
                    "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) as aa where aa.age<= 16) as age16," +
                    "(SELECT COUNT(aa.age) FROM " +
                    "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) AS aa WHERE aa.age > 16 and aa.age<= 27) AS age27," +
                    "(SELECT COUNT(aa.age) FROM " +
                    "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) AS aa WHERE aa.age > 27 and aa.age<= 35) AS age35," +
                    "(SELECT COUNT(aa.age) FROM " +
                    "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) AS aa WHERE aa.age > 35 and aa.age<= 45) AS age45," +
                    "(SELECT COUNT(aa.age) FROM " +
                    "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) AS aa WHERE aa.age > 45 and aa.age<= 55) AS age55," +
                    "(SELECT COUNT(aa.age) FROM " +
                    "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) AS aa WHERE aa.age > 55) AS age55over")
    Map<String, Long> indexCountByAge(@Param("communityId")Long communityId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java
@@ -203,4 +203,6 @@
     * @return
     */
    R screenStatistic(Long communityId);
    R getScreenGirds(Long communityId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -801,9 +801,7 @@
        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);
@@ -872,7 +870,8 @@
        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();
@@ -887,7 +886,7 @@
        ageStatisticsVO5.setType(5);
        ageStatisticsVO6.setType(6);
        if(populationDOList.isEmpty()){
        if(ageMap.isEmpty()){
            ageStatisticsVO1.setSum(0);
            ageStatisticsVO2.setSum(0);
            ageStatisticsVO3.setSum(0);
@@ -895,23 +894,14 @@
            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);
@@ -1059,9 +1049,6 @@
        return R.ok(civilStatisticsVO);
    }
    @Override
    public R editTagPopulationByCardNo(ComMngPopulationTagCardNoDTO comMngPopulationTagCardNoDTO)  {
@@ -1215,6 +1202,10 @@
        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));
    }