From d01be9f1ec9a393818ea64deca3cbe7fa9372e08 Mon Sep 17 00:00:00 2001
From: xyh <18782104331@139.com>
Date: 星期三, 23 六月 2021 18:21:21 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/test' into test

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java |  131 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 128 insertions(+), 3 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
index 90cf3a8..e6e05d1 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -1,5 +1,6 @@
 package com.panzhihua.service_community.service.impl;
 
+import cn.hutool.core.util.IdcardUtil;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -14,6 +15,7 @@
 import com.panzhihua.common.exceptions.ServiceException;
 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.user.PageInputUserDTO;
 import com.panzhihua.common.model.helper.AESUtil;
 import com.panzhihua.common.model.vos.R;
@@ -27,6 +29,7 @@
 import com.panzhihua.common.model.vos.community.screen.index.*;
 import com.panzhihua.common.model.vos.grid.EventGridDataVO;
 import com.panzhihua.common.model.vos.grid.EventResourceVO;
+import com.panzhihua.common.model.vos.grid.PopulationListVO;
 import com.panzhihua.common.model.vos.screen.ComActPopulationCultureVO;
 import com.panzhihua.common.model.vos.screen.ComActPopulationScreenVO;
 import com.panzhihua.common.model.vos.screen.ComMngPopulationAgeVO;
@@ -924,7 +927,12 @@
                                 specialStatisticsVO.setTitle(userTag.getTagName());
                                 specialStatisticsVO.setSum(264);
                                 specialStatisticsVOList.add(specialStatisticsVO);
-                            } else {
+                            }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());
@@ -1040,6 +1048,10 @@
             newStatisticsVO.setAudios(audioList);
             newStatisticsVO.setPics(picList);
             newStatisticsVO.setVideos(videoList);
+
+            //查询事件流转记录
+            List<EventTransferRecordVO> transferRecordList = this.baseMapper.getEventScreenEventTransList(newStatisticsVO.getId());
+            newStatisticsVO.setTransferRecordList(transferRecordList);
         }
         statisticsVO.setNewStatisticsVO(newStatisticsVO);
 
@@ -1050,6 +1062,22 @@
         //查询社区事件列表
         List<EventGridIncidentStatisticsVO> gridIncidentList = this.baseMapper.getEventScreenEventList(communityId);
         statisticsVO.setGridIncidentList(gridIncidentList);
+
+        //查询小区列表
+        List<CivilVillageStatisticsVO> villageStatisticsList = this.baseMapper.getCivilScreenVillageList(communityId);
+        if(!villageStatisticsList.isEmpty()){
+            villageStatisticsList.forEach(village -> {
+                CivilVillageStatisticsVO villageStatisticsVO = this.baseMapper.getCivilScreenVillageStatistics(village.getVillageId());
+                if(villageStatisticsVO != null){
+                    BeanUtils.copyProperties(villageStatisticsVO,village);
+                }
+            });
+        }
+        statisticsVO.setVillageStatisticsList(villageStatisticsList);
+
+        //查询统计人口数据
+        ComMngPopulationTotalVO populationTotalVO = populationDAO.getPopulationTotalByAdmin(communityId);
+        statisticsVO.setPopulationTotalVO(populationTotalVO);
 
         return R.ok(statisticsVO);
     }
@@ -1101,7 +1129,12 @@
                                 specialStatisticsVO.setTitle(userTag.getTagName());
                                 specialStatisticsVO.setSum(264);
                                 specialStatisticsVOList.add(specialStatisticsVO);
-                            } else {
+                            }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());
@@ -1154,7 +1187,69 @@
         comActPopulationScreenVO.setTotalNum(vo.getPopulationTotal() == null ? 0 : vo.getPopulationTotal());
         comActPopulationScreenVO.setLocalNum(vo.getLocalTotal() == null ? 0 : vo.getLocalTotal().longValue());
         comActPopulationScreenVO.setOutNum(vo.getOutTotal() == null ? 0 : vo.getOutTotal().longValue());
-        comActPopulationScreenVO.setSpecialNum(vo.getSpecialTotal() == null ? 0 : vo.getSpecialTotal().longValue());
+
+        //查询特殊人群统计
+        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());
+                        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());
+                                specialStatisticsVO.setSum(count);
+                                specialStatisticsVOList.add(specialStatisticsVO);
+                            }
+                        }
+                    }
+                }
+            });
+        }
+        //计算特殊人群总数
+        specialStatisticsVOList.add(otherSpecialVO);
+        Integer specialNum = 0;
+        if(!specialStatisticsVOList.isEmpty()){
+            for (IndexSpecialStatisticsVO special:specialStatisticsVOList) {
+                specialNum += special.getSum();
+            }
+        }
+        comActPopulationScreenVO.setSpecialNum(specialNum.longValue());
         //统计已使用社区通人数
         Long count = populationDAO.countUsedCommunityPopulation(communityId);
         comActPopulationScreenVO.setUsedCommunityNum(count == null ? 0 : count);
@@ -1321,10 +1416,40 @@
                 statisticsVO.setAudios(audioList);
                 statisticsVO.setPics(picList);
                 statisticsVO.setVideos(videoList);
+
+                //查询事件流转记录
+                List<EventTransferRecordVO> transferRecordList = this.baseMapper.getEventScreenEventTransList(eventDetailDTO.getEventId());
+                if(!transferRecordList.isEmpty()){
+                    transferRecordList.forEach(transfer -> {
+                        if(transfer.getFromType().equals(EventTransferRecordVO.fromType.wgy)){
+                            //查询上级网格信息
+                            EventTransferRecordDetailVO transferRecordDetailVO = this.baseMapper.getEventScreenEventTransDetail(transfer.getEventId());
+                            transfer.setSuperiorRelationship(transferRecordDetailVO.getStreetName() + "-"
+                                    + transferRecordDetailVO.getCommunityName() + "-" + transferRecordDetailVO.getGridName());
+                        }else if(transfer.getFromType().equals(EventTransferRecordVO.fromType.sq)){
+                            //查询上级社区信息
+                            EventTransferRecordDetailVO transferRecordDetailVO = this.baseMapper.getEventScreenEventTransDetailByCommunityId(transfer.getFromId());
+                            transfer.setSuperiorRelationship(transferRecordDetailVO.getStreetName() + "-"
+                                    + transferRecordDetailVO.getCommunityName());
+                        }
+                    });
+                }
+                statisticsVO.setTransferRecordList(transferRecordList);
             }
         }
         return R.ok(statisticsVO);
     }
 
+    @Override
+    public R pagePopulationListApp(PagePopulationListDTO populationListDTO){
+        IPage<PopulationListVO> pagePopulationList = this.baseMapper.pagePopulationListApp(new Page(populationListDTO.getPageNum(),populationListDTO.getPageSize()),populationListDTO);
+        if(!pagePopulationList.getRecords().isEmpty()){
+            pagePopulationList.getRecords().forEach(population -> {
+                population.setAge(IdcardUtil.getAgeByIdCard(population.getCardNo()));
+            });
+        }
+        return R.ok(pagePopulationList);
+    }
+
 
 }
\ No newline at end of file

--
Gitblit v1.7.1