From 9c5b811fb700bc66e66dbf38ed8733e57a4edac6 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期三, 09 三月 2022 09:19:14 +0800
Subject: [PATCH] Merge branch 'hemenkou_dev' into dev

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java |  437 ++++++++++++++++++++++++------------------------------
 1 files changed, 196 insertions(+), 241 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java
index fca296c..becd68d 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java
@@ -14,12 +14,13 @@
 
 import javax.annotation.Resource;
 
-import com.panzhihua.common.model.vos.community.bigscreen.BigScreenResidentActStatisticsInfo;
-import com.panzhihua.common.model.vos.community.bigscreen.BigScreenVolunteerActStatisticsInfo;
-import com.panzhihua.service_community.dao.ComActActivityDAO;
-import com.panzhihua.service_community.dao.ComActCommitteeDao;
+import com.panzhihua.common.model.dtos.property.CommonPage;
+import com.panzhihua.common.model.vos.community.bigscreen.*;
+import com.panzhihua.common.utlis.DateUtils;
+import com.panzhihua.service_community.dao.*;
 import org.springframework.stereotype.Service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.panzhihua.common.model.dtos.PageBaseDTO;
 import com.panzhihua.common.model.dtos.community.convenient.PagePopularMerchantDTO;
@@ -33,12 +34,16 @@
 import com.panzhihua.common.model.vos.community.bigscreen.BigScreenMicroWishStatisticsInfo;
 import com.panzhihua.common.model.vos.community.bigscreen.BigScreenNeighborStatisticsInfo;
 import com.panzhihua.common.model.vos.community.bigscreen.BigScreenQuestionnaireStatisticsInfo;
+import com.panzhihua.common.model.vos.community.bigscreen.BigScreenResidentActStatisticsInfo;
+import com.panzhihua.common.model.vos.community.bigscreen.BigScreenVolunteerActStatisticsInfo;
 import com.panzhihua.common.model.vos.community.bigscreen.GridsGovernanceStatisticsVO;
 import com.panzhihua.common.model.vos.community.bigscreen.ResidentAutonomyStatisticsVO;
 import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
 import com.panzhihua.common.model.vos.community.screen.civil.CivilVillageStatisticsVO;
 import com.panzhihua.common.model.vos.community.screen.event.EventGridIncidentStatisticsVO;
 import com.panzhihua.common.model.vos.community.screen.event.EventGridStatisticsVO;
+import com.panzhihua.service_community.dao.ComActActivityDAO;
+import com.panzhihua.service_community.dao.ComActCommitteeDao;
 import com.panzhihua.service_community.dao.ComActDiscussDAO;
 import com.panzhihua.service_community.dao.ComActDynDAO;
 import com.panzhihua.service_community.dao.ComActEasyPhotoDAO;
@@ -102,6 +107,16 @@
     @Resource
     private ComActCommitteeDao comActCommitteeDao;
 
+    @Resource
+    private ComActSocialProjectDao comActSocialProjectDao;
+
+    @Resource
+    private ComActSocialOrgDao comActSocialOrgDao;
+
+    @Resource
+    private ComActSocialWorkerDao comActSocialWorkerDao;
+
+
     /**
      * 大数据分析平台-居民自治
      * @param communityId
@@ -113,20 +128,12 @@
         if (isNull(statisticsVO)) {
             statisticsVO = new ResidentAutonomyStatisticsVO();
         }
-        List<ComActEasyPhotoVO> easyPhotoVOList = comActEasyPhotoDAO.selectStatisticsList(communityId);
+        List<StatisticsCommVO> easyPhotoHistogram = comActEasyPhotoDAO.selectStatisticsList(communityId);
         //随手拍总数
         Integer easyPhotoTotalCount = 0;
         //随手拍柱状统计
-        List<StatisticsCommVO> easyPhotoHistogram = new ArrayList<>();
-        if (Objects.nonNull(easyPhotoVOList) && !easyPhotoVOList.isEmpty()) {
-            Map<String, List<ComActEasyPhotoVO>> easyPhotoVOMap = easyPhotoVOList.stream().collect(Collectors.groupingBy(ComActEasyPhotoVO::getClassifyName));
-            for (Map.Entry<String, List<ComActEasyPhotoVO>> entry : easyPhotoVOMap.entrySet()) {
-                StatisticsCommVO commVO = new StatisticsCommVO();
-                commVO.setFiled(entry.getKey());
-                commVO.setNum(entry.getValue().size());
-                easyPhotoHistogram.add(commVO);
-            }
-            easyPhotoTotalCount = easyPhotoVOList.size();
+        if (Objects.nonNull(easyPhotoHistogram) && !easyPhotoHistogram.isEmpty()) {
+            easyPhotoTotalCount = easyPhotoHistogram.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum();
         }
         statisticsVO.setEasyPhotoTotalCount(easyPhotoTotalCount);
         statisticsVO.setEasyPhotoHistogram(easyPhotoHistogram);
@@ -135,7 +142,7 @@
         List<StatisticsCommVO> microWishRealizePercent = comActMicroWishDAO.selectRealizePercent(communityId);
         statisticsVO.setMicroWishRealizePercent(microWishRealizePercent);
         //微心愿图片
-        List<String> microWishImages = comActMicroWishDAO.getPassedAllImages(communityId, pageSize);
+        List<String> microWishImages = comActMicroWishDAO.getPassedAllImages(communityId, 20);
         statisticsVO.setMicroWishImages(microWishImages);
 
         //议事投票类型占比
@@ -149,40 +156,19 @@
         statisticsVO.setVoteTitles(voteTitles);
 
         //邻里圈图片
-        List<String> neighborImages = comActNeighborCircleDAO.getAllImages(communityId, pageSize);
+        List<String> neighborImages = comActNeighborCircleDAO.getAllImages(communityId, 20);
         statisticsVO.setNeighborImages(neighborImages);
         //邻里圈文本内容
         List<String> neighborContents = comActNeighborCircleDAO.getContents(communityId, pageSize);
         statisticsVO.setNeighborContents(neighborContents);
 
         //报事报修新增折线数据
-        Date nowDate = new Date();
         List<StatisticsCommVO> repairAddPolylineData = comPropertyDao.getRepairPolylineDate(communityId);
-        int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate));
-        for (int i = 1; i <= currentMon; i++) {
-            String temp;
-            if (i > 9) {
-                temp = "" + i;
-            } else {
-                temp = "0" + i;
-            }
-            boolean isExist = repairAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) &&
-                    e.getFiled().endsWith(temp));
-            if (!isExist) {
-                StatisticsCommVO other = new StatisticsCommVO();
-                other.setFiled(temp);
-                other.setNum(0);
-                repairAddPolylineData.add(other);
-            }
-        }
-        repairAddPolylineData = repairAddPolylineData.stream().filter(e -> nonNull(e.getFiled()))
-                .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList());
         statisticsVO.setRepairAddPolylineData(repairAddPolylineData);
         //报事报修累计折线数据
         List<StatisticsCommVO> repairTotalPolylineData = new ArrayList<>();
-        String year = new SimpleDateFormat("yyyy").format(nowDate);
         repairAddPolylineData.forEach(e -> {
-            StatisticsCommVO temp = comPropertyDao.getRepairTotalPolylineDate(communityId, year + e.getFiled());
+            StatisticsCommVO temp = comPropertyDao.getRepairTotalPolylineDate(communityId, e.getFiled());
             temp.setFiled(e.getFiled());
             repairTotalPolylineData.add(temp);
         });
@@ -195,18 +181,20 @@
         List<String> warehouseLoveTransfer = comActWarehouseDonatesDao.getWarehouseLoveTransfer(communityId, pageSize);
         statisticsVO.setWarehouseLoveTransfer(warehouseLoveTransfer);
         //捐赠图片
-        List<String> warehouseImages = comActWarehouseDonatesDao.getWarehouseImages(communityId, pageSize);
+        List<String> warehouseImages = comActWarehouseDonatesDao.getWarehouseImages(communityId, 20);
         statisticsVO.setWarehouseImages(warehouseImages);
 
         //居民活动柱状统计
         List<StatisticsCommVO> residentActHistogram = comActActivityDAO.selectResidentActHistogramData(communityId, true);
+        //居民活动新增数据
+        List<StatisticsCommVO> actAddPolylineData = comActActivityDAO.getActAddPolylineData(communityId, true);
         //居民活动发布总数
         int residentActTotalCount = 0;
         if (!residentActHistogram.isEmpty()) {
             residentActTotalCount = residentActHistogram.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum();
         }
         statisticsVO.setResidentActTotalCount(residentActTotalCount);
-        statisticsVO.setResidentActHistogram(residentActHistogram);
+        statisticsVO.setResidentActHistogram(actAddPolylineData);
         //业主委员会党员占比
         List<StatisticsCommVO> committeePartyPercent = comActCommitteeDao.selectCommitteePartyPercent(communityId);
         statisticsVO.setCommitteePartyPercent(committeePartyPercent);
@@ -244,37 +232,13 @@
             });
         }
         statisticsVO.setVillageStatisticsList(villageStatisticsList);
-        // 查询社区事件列表
-        List<EventGridIncidentStatisticsVO> gridIncidentList = comMngPopulationDAO.getGridsGovernanceEventList(communityId);
-        statisticsVO.setGridIncidentList(gridIncidentList);
         //事件分析新增折线数据
-        Date nowDate = new Date();
         List<StatisticsCommVO> eventAddPolylineData = comPropertyDao.getEventAddPolylineData(communityId);
-        int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate));
-        for (int i = 1; i <= currentMon; i++) {
-            String temp;
-            if (i > 9) {
-                temp = "" + i;
-            } else {
-                temp = "0" + i;
-            }
-            boolean isExist = eventAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) &&
-                    e.getFiled().endsWith(temp));
-            if (!isExist) {
-                StatisticsCommVO other = new StatisticsCommVO();
-                other.setFiled(temp);
-                other.setNum(0);
-                eventAddPolylineData.add(other);
-            }
-        }
-        eventAddPolylineData = eventAddPolylineData.stream().filter(e -> nonNull(e.getFiled()))
-                .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList());
         statisticsVO.setEventAddPolylineData(eventAddPolylineData);
         //事件分析累计折线数据
         List<StatisticsCommVO> eventTotalPolylineData = new ArrayList<>();
-        String year = new SimpleDateFormat("yyyy").format(nowDate);
         eventAddPolylineData.forEach(e -> {
-            StatisticsCommVO temp = comPropertyDao.getEventTotalPolylineDate(communityId, year + e.getFiled());
+            StatisticsCommVO temp = comPropertyDao.getEventTotalPolylineDate(communityId, e.getFiled());
             temp.setFiled(e.getFiled());
             eventTotalPolylineData.add(temp);
         });
@@ -340,31 +304,11 @@
         //微心愿新增折线数据
         Date nowDate = new Date();
         List<StatisticsCommVO> microWishAddPolylineData = comActMicroWishDAO.getMicroWishAddPolylineData(communityId);
-        int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate));
-        for (int i = 1; i <= currentMon; i++) {
-            String temp;
-            if (i > 9) {
-                temp = "" + i;
-            } else {
-                temp = "0" + i;
-            }
-            boolean isExist = microWishAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) &&
-                    e.getFiled().endsWith(temp));
-            if (!isExist) {
-                StatisticsCommVO other = new StatisticsCommVO();
-                other.setFiled(temp);
-                other.setNum(0);
-                microWishAddPolylineData.add(other);
-            }
-        }
-        microWishAddPolylineData = microWishAddPolylineData.stream().filter(e -> nonNull(e.getFiled()))
-                .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList());
         statisticsInfo.setMicroWishAddPolylineData(microWishAddPolylineData);
         //微心愿累计折线数据
         List<StatisticsCommVO> microWishTotalPolylineData = new ArrayList<>();
-        String year = new SimpleDateFormat("yyyy").format(nowDate);
         microWishAddPolylineData.forEach(e -> {
-            StatisticsCommVO temp = comActMicroWishDAO.getMicroWishTotalPolylineDate(communityId, year + e.getFiled());
+            StatisticsCommVO temp = comActMicroWishDAO.getMicroWishTotalPolylineDate(communityId, e.getFiled());
             temp.setFiled(e.getFiled());
             microWishTotalPolylineData.add(temp);
         });
@@ -383,31 +327,11 @@
         //随手拍新增折线数据
         Date nowDate = new Date();
         List<StatisticsCommVO> easyPhotoAddPolylineData = comActEasyPhotoDAO.getEasyPhotoAddPolylineData(communityId);
-        int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate));
-        for (int i = 1; i <= currentMon; i++) {
-            String temp;
-            if (i > 9) {
-                temp = "" + i;
-            } else {
-                temp = "0" + i;
-            }
-            boolean isExist = easyPhotoAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) &&
-                    e.getFiled().endsWith(temp));
-            if (!isExist) {
-                StatisticsCommVO other = new StatisticsCommVO();
-                other.setFiled(temp);
-                other.setNum(0);
-                easyPhotoAddPolylineData.add(other);
-            }
-        }
-        easyPhotoAddPolylineData = easyPhotoAddPolylineData.stream().filter(e -> nonNull(e.getFiled()))
-                .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList());
         statisticsInfo.setEasyPhotoAddPolylineData(easyPhotoAddPolylineData);
         //随手拍累计折线数据
         List<StatisticsCommVO> easyPhotoTotalPolylineData = new ArrayList<>();
-        String year = new SimpleDateFormat("yyyy").format(nowDate);
         easyPhotoAddPolylineData.forEach(e -> {
-            StatisticsCommVO temp = comActEasyPhotoDAO.getEasyPhotoTotalPolylineDate(communityId, year + e.getFiled());
+            StatisticsCommVO temp = comActEasyPhotoDAO.getEasyPhotoTotalPolylineDate(communityId, e.getFiled());
             temp.setFiled(e.getFiled());
             easyPhotoTotalPolylineData.add(temp);
         });
@@ -434,33 +358,12 @@
     public R indexQuestionnaire(Long communityId) {
         BigScreenQuestionnaireStatisticsInfo statisticsInfo = comActQuestnaireDAO.getIndexQuestionnaireBaseData(communityId);
         //社区问卷新增折线数据
-        Date nowDate = new Date();
         List<StatisticsCommVO> questionnaireAddPolylineData = comActQuestnaireDAO.getQuestionnaireAddPolylineData(communityId);
-        int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate));
-        for (int i = 1; i <= currentMon; i++) {
-            String temp;
-            if (i > 9) {
-                temp = "" + i;
-            } else {
-                temp = "0" + i;
-            }
-            boolean isExist = questionnaireAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) &&
-                    e.getFiled().endsWith(temp));
-            if (!isExist) {
-                StatisticsCommVO other = new StatisticsCommVO();
-                other.setFiled(temp);
-                other.setNum(0);
-                questionnaireAddPolylineData.add(other);
-            }
-        }
-        questionnaireAddPolylineData = questionnaireAddPolylineData.stream().filter(e -> nonNull(e.getFiled()))
-                .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList());
         statisticsInfo.setQuestionnaireAddPolylineData(questionnaireAddPolylineData);
         //社区问卷累计折线数据
         List<StatisticsCommVO> questionnaireTotalPolylineData = new ArrayList<>();
-        String year = new SimpleDateFormat("yyyy").format(nowDate);
         questionnaireAddPolylineData.forEach(e -> {
-            StatisticsCommVO temp = comActQuestnaireDAO.getQuestionnaireTotalPolylineDate(communityId, year + e.getFiled());
+            StatisticsCommVO temp = comActQuestnaireDAO.getQuestionnaireTotalPolylineDate(communityId, e.getFiled());
             temp.setFiled(e.getFiled());
             questionnaireTotalPolylineData.add(temp);
         });
@@ -482,33 +385,12 @@
             statisticsInfo.setDynNum(dynCircleData.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum());
         }
         //社区动态新增折线数据
-        Date nowDate = new Date();
         List<StatisticsCommVO> dynAddPolylineData = comActDynDAO.getDynAddPolylineData(communityId);
-        int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate));
-        for (int i = 1; i <= currentMon; i++) {
-            String temp;
-            if (i > 9) {
-                temp = "" + i;
-            } else {
-                temp = "0" + i;
-            }
-            boolean isExist = dynAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) &&
-                    e.getFiled().endsWith(temp));
-            if (!isExist) {
-                StatisticsCommVO other = new StatisticsCommVO();
-                other.setFiled(temp);
-                other.setNum(0);
-                dynAddPolylineData.add(other);
-            }
-        }
-        dynAddPolylineData = dynAddPolylineData.stream().filter(e -> nonNull(e.getFiled()))
-                .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList());
         statisticsInfo.setDynAddPolylineData(dynAddPolylineData);
         //社区动态累计折线数据
         List<StatisticsCommVO> dynTotalPolylineData = new ArrayList<>();
-        String year = new SimpleDateFormat("yyyy").format(nowDate);
         dynAddPolylineData.forEach(e -> {
-            StatisticsCommVO temp = comActDynDAO.getDynTotalPolylineDate(communityId, year + e.getFiled());
+            StatisticsCommVO temp = comActDynDAO.getDynTotalPolylineDate(communityId, e.getFiled());
             temp.setFiled(e.getFiled());
             dynTotalPolylineData.add(temp);
         });
@@ -539,36 +421,15 @@
         statisticsInfo.setNeighborCircleData(neighborCircleData);
         if (!neighborCircleData.isEmpty()) {
             statisticsInfo.setPublishContentNum(neighborCircleData.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum());
-            statisticsInfo.setPublishTopicNum(neighborCircleData.size());
+            statisticsInfo.setPublishTopicNum(neighborCircleData.stream().filter(e -> !"无话题".equals(e.getFiled())).collect(Collectors.toList()).size());
         }
         //邻里圈新增折线数据
-        Date nowDate = new Date();
         List<StatisticsCommVO> neighborAddPolylineData = comActNeighborCircleDAO.getNeighborAddPolylineData(communityId);
-        int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate));
-        for (int i = 1; i <= currentMon; i++) {
-            String temp;
-            if (i > 9) {
-                temp = "" + i;
-            } else {
-                temp = "0" + i;
-            }
-            boolean isExist = neighborAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) &&
-                    e.getFiled().endsWith(temp));
-            if (!isExist) {
-                StatisticsCommVO other = new StatisticsCommVO();
-                other.setFiled(temp);
-                other.setNum(0);
-                neighborAddPolylineData.add(other);
-            }
-        }
-        neighborAddPolylineData = neighborAddPolylineData.stream().filter(e -> nonNull(e.getFiled()))
-                .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList());
         statisticsInfo.setNeighborAddPolylineData(neighborAddPolylineData);
         //邻里圈累计折线数据
         List<StatisticsCommVO> neighborTotalPolylineData = new ArrayList<>();
-        String year = new SimpleDateFormat("yyyy").format(nowDate);
         neighborAddPolylineData.forEach(e -> {
-            StatisticsCommVO temp = comActNeighborCircleDAO.getNeighborTotalPolylineDate(communityId, year + e.getFiled());
+            StatisticsCommVO temp = comActNeighborCircleDAO.getNeighborTotalPolylineDate(communityId, e.getFiled());
             temp.setFiled(e.getFiled());
             neighborTotalPolylineData.add(temp);
         });
@@ -605,33 +466,12 @@
             statisticsInfo.setServiceTypeNum(serviceTypeCircleData.size());
         }
         //服务次数(目前暂时使用浏览量)新增折线数据
-        Date nowDate = new Date();
         List<StatisticsCommVO> serviceTimesAddPolylineData = convenientMerchantDAO.getServiceTimesAddPolylineData(communityId);
-        int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate));
-        for (int i = 1; i <= currentMon; i++) {
-            String temp;
-            if (i > 9) {
-                temp = "" + i;
-            } else {
-                temp = "0" + i;
-            }
-            boolean isExist = serviceTimesAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) &&
-                    e.getFiled().endsWith(temp));
-            if (!isExist) {
-                StatisticsCommVO other = new StatisticsCommVO();
-                other.setFiled(temp);
-                other.setNum(0);
-                serviceTimesAddPolylineData.add(other);
-            }
-        }
-        serviceTimesAddPolylineData = serviceTimesAddPolylineData.stream().filter(e -> nonNull(e.getFiled()))
-                .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList());
         statisticsInfo.setServiceTimesAddPolylineData(serviceTimesAddPolylineData);
         //服务次数(目前暂时使用浏览量)累计折线数据
         List<StatisticsCommVO> serviceTimesTotalPolylineData = new ArrayList<>();
-        String year = new SimpleDateFormat("yyyy").format(nowDate);
         serviceTimesAddPolylineData.forEach(e -> {
-            StatisticsCommVO temp = convenientMerchantDAO.getServiceTimesTotalPolylineDate(communityId, year + e.getFiled());
+            StatisticsCommVO temp = convenientMerchantDAO.getServiceTimesTotalPolylineDate(communityId, e.getFiled());
             temp.setFiled(e.getFiled());
             serviceTimesTotalPolylineData.add(temp);
         });
@@ -693,33 +533,12 @@
         }
         statisticsInfo.setPublishNum(publishNum);
         //居民活动新增折线数据
-        Date nowDate = new Date();
         List<StatisticsCommVO> actAddPolylineData = comActActivityDAO.getActAddPolylineData(communityId, true);
-        int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate));
-        for (int i = 1; i <= currentMon; i++) {
-            String temp;
-            if (i > 9) {
-                temp = "" + i;
-            } else {
-                temp = "0" + i;
-            }
-            boolean isExist = actAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) &&
-                    e.getFiled().endsWith(temp));
-            if (!isExist) {
-                StatisticsCommVO other = new StatisticsCommVO();
-                other.setFiled(temp);
-                other.setNum(0);
-                actAddPolylineData.add(other);
-            }
-        }
-        actAddPolylineData = actAddPolylineData.stream().filter(e -> nonNull(e.getFiled()))
-                .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList());
         statisticsInfo.setActAddPolylineData(actAddPolylineData);
         //居民活动累计折线数据
         List<StatisticsCommVO> actTotalPolylineData = new ArrayList<>();
-        String year = new SimpleDateFormat("yyyy").format(nowDate);
         actAddPolylineData.forEach(e -> {
-            StatisticsCommVO temp = comActActivityDAO.getActTotalPolylineData(communityId, true, year + e.getFiled());
+            StatisticsCommVO temp = comActActivityDAO.getActTotalPolylineData(communityId, true, e.getFiled());
             temp.setFiled(e.getFiled());
             actTotalPolylineData.add(temp);
         });
@@ -759,33 +578,12 @@
         }
         statisticsInfo.setPublishNum(publishNum);
         //志愿者活动新增折线数据
-        Date nowDate = new Date();
         List<StatisticsCommVO> actAddPolylineData = comActActivityDAO.getActAddPolylineData(communityId, false);
-        int currentMon = Integer.parseInt(new SimpleDateFormat("MM").format(nowDate));
-        for (int i = 1; i <= currentMon; i++) {
-            String temp;
-            if (i > 9) {
-                temp = "" + i;
-            } else {
-                temp = "0" + i;
-            }
-            boolean isExist = actAddPolylineData.stream().anyMatch(e -> nonNull(e.getFiled()) &&
-                    e.getFiled().endsWith(temp));
-            if (!isExist) {
-                StatisticsCommVO other = new StatisticsCommVO();
-                other.setFiled(temp);
-                other.setNum(0);
-                actAddPolylineData.add(other);
-            }
-        }
-        actAddPolylineData = actAddPolylineData.stream().filter(e -> nonNull(e.getFiled()))
-                .sorted(Comparator.comparing(e -> e.getFiled())).collect(Collectors.toList());
         statisticsInfo.setActAddPolylineData(actAddPolylineData);
         //志愿者活动累计折线数据
         List<StatisticsCommVO> actTotalPolylineData = new ArrayList<>();
-        String year = new SimpleDateFormat("yyyy").format(nowDate);
         actAddPolylineData.forEach(e -> {
-            StatisticsCommVO temp = comActActivityDAO.getActTotalPolylineData(communityId, false, year + e.getFiled());
+            StatisticsCommVO temp = comActActivityDAO.getActTotalPolylineData(communityId, false, e.getFiled());
             temp.setFiled(e.getFiled());
             actTotalPolylineData.add(temp);
         });
@@ -804,6 +602,151 @@
         return R.ok(comActActivityDAO.indexActList(page, pageBaseDTO, false));
     }
 
+    /**
+     * 清网治格-根据事件分类获取近1月的社区事件数据
+     * @param type
+     * @param communityId
+     * @return
+     */
+    @Override
+    public R getEventList(Integer type, Long communityId) {
+        // 查询社区事件列表
+        List<EventGridIncidentStatisticsVO> gridIncidentList = comMngPopulationDAO.getGridsGovernanceEventList(communityId);
+        List<EventGridIncidentStatisticsVO> returnGridIncidentList = new ArrayList<>();
+        if (!gridIncidentList.isEmpty()) {
+            gridIncidentList.forEach(e -> {
+                if (e.getEventType().equals(2)) {
+                    String[] lngLatString = e.getLatLng().split(",");
+                    e.setLatLng(lngLatString[1] + "," + lngLatString[0]);
+                }
+            });
+            returnGridIncidentList = gridIncidentList.stream().filter(e -> type.equals(e.getType())).collect(Collectors.toList());
+        }
+        return R.ok(returnGridIncidentList);
+    }
+
+    /**
+     * 清网治格-社区事件数据分页
+     * @param pageBaseDTO
+     * @return
+     */
+    @Override
+    public R pageEventList(PageBaseDTO pageBaseDTO) {
+        Page page = retrievePage(pageBaseDTO);
+        IPage<EventGridIncidentStatisticsVO> iPage = comMngPopulationDAO.pageEventList(page, pageBaseDTO);
+        List<EventGridIncidentStatisticsVO> gridIncidentList = iPage.getRecords();
+        if (!gridIncidentList.isEmpty()) {
+            gridIncidentList.forEach(e -> {
+                if (e.getEventType().equals(2)) {
+                    String[] lngLatString = e.getLatLng().split(",");
+                    e.setLatLng(lngLatString[1] + "," + lngLatString[0]);
+                }
+            });
+        }
+        return R.ok(iPage);
+    }
+
+    @Override
+    public R hmkBaseInfo(CommonPage commonPage) {
+        BigScreenHmkBaseInfo bigScreenHmkBaseInfo=comActSocialProjectDao.selectIndexBaseInfo();
+        //项目数据
+        BigScreenHmkProjectInfo bigScreenHmkProjectInfo=comActSocialProjectDao.selectBaseInfo(commonPage.getCommunityId());
+        List<BigScreenHmkProjectTypeInfo> typeInfo=comActSocialProjectDao.selectType(null,commonPage.getCommunityId());
+        if(bigScreenHmkProjectInfo.getCount()>0){
+            typeInfo.forEach(bigScreenHmkProjectTypeInfo -> {
+                bigScreenHmkProjectTypeInfo.setPercent(bigScreenHmkProjectTypeInfo.getCount()/bigScreenHmkProjectInfo.getCount());
+            });
+        }
+        bigScreenHmkProjectInfo.setTypeInfoList(typeInfo);
+        //活动数据
+        Integer countAll=comActSocialProjectDao.selectActivity(0,commonPage.getCommunityId());
+        BigScreenHmkProjectTypeInfo jm=new BigScreenHmkProjectTypeInfo();
+        jm.setName("居民活动");
+        jm.setCount(comActSocialProjectDao.selectActivity(2,commonPage.getCommunityId()));
+        if(countAll>0){
+            jm.setPercent(jm.getCount()/countAll);
+        }
+        BigScreenHmkProjectTypeInfo zyz=new BigScreenHmkProjectTypeInfo();
+        zyz.setName("志愿者活动");
+        zyz.setCount(comActSocialProjectDao.selectActivity(1,commonPage.getCommunityId()));
+        if(countAll>0){
+            zyz.setPercent(zyz.getCount()/countAll);
+        }
+        List<BigScreenHmkProjectTypeInfo> activityList=new ArrayList<>();
+        activityList.add(jm);
+        activityList.add(zyz);
+        bigScreenHmkProjectInfo.setActivityTypeInfoList(activityList);
+        //社会组织数据
+        BigScreenHmkSocialOrgInfo bigScreenHmkSocialOrgInfo=comActSocialOrgDao.selectInfo(commonPage.getCommunityId());
+        List<BigScreenHmkProjectTypeInfo> typeInfoList= comActSocialOrgDao.selectType(commonPage.getCommunityId());
+        if(bigScreenHmkSocialOrgInfo.getCount()>0){
+            typeInfoList.forEach(bigScreenHmkProjectTypeInfo -> {
+                bigScreenHmkProjectTypeInfo.setPercent(bigScreenHmkProjectTypeInfo.getCount()/bigScreenHmkSocialOrgInfo.getCount());
+            });
+        }
+        bigScreenHmkSocialOrgInfo.setTypeInfoList(typeInfoList);
+        bigScreenHmkBaseInfo.setBigScreenHmkSocialOrgInfo(bigScreenHmkSocialOrgInfo);
+        //社工数据
+        BigScreenHmkSocialWorkerInfo bigScreenHmkSocialWorkerInfo=new BigScreenHmkSocialWorkerInfo();
+        List<BigScreenHmkProjectTypeInfo> socialWorkerList=new ArrayList<>();
+        Integer socialAll=comActSocialWorkerDao.selectType(0,commonPage.getCommunityId());
+        BigScreenHmkProjectTypeInfo ss=new BigScreenHmkProjectTypeInfo();
+        ss.setName("30岁以下");
+        ss.setCount(comActSocialWorkerDao.selectType(1,commonPage.getCommunityId()));
+        if(socialAll>0){
+            ss.setPercent(ss.getCount()/socialAll);
+        }
+        BigScreenHmkProjectTypeInfo wj=new BigScreenHmkProjectTypeInfo();
+        wj.setName("30-59岁");
+        wj.setCount(comActSocialWorkerDao.selectType(2,commonPage.getCommunityId()));
+        if(socialAll>0){
+            wj.setPercent(wj.getCount()/socialAll);
+        }
+        BigScreenHmkProjectTypeInfo ls=new BigScreenHmkProjectTypeInfo();
+        ls.setName("60岁以上");
+        ls.setCount(comActSocialWorkerDao.selectType(3,commonPage.getCommunityId()));
+        if(socialAll>0){
+            ls.setPercent(ls.getCount()/socialAll);
+        }
+        socialWorkerList.add(ss);
+        socialWorkerList.add(wj);
+        socialWorkerList.add(ls);
+        bigScreenHmkSocialWorkerInfo.setSocialWorkerAge(socialWorkerList);
+        List<BigScreenHmkProjectTypeInfo> socialWorkerSkill=comActSocialWorkerDao.selectSkillType(commonPage.getCommunityId());
+        if(socialAll>0){
+            socialWorkerSkill.forEach(bigScreenHmkProjectTypeInfo -> {
+                bigScreenHmkProjectTypeInfo.setPercent(bigScreenHmkProjectTypeInfo.getCount()/socialAll);
+            });
+        }
+        bigScreenHmkSocialWorkerInfo.setSocialWorkerSkill(socialWorkerSkill);
+        bigScreenHmkBaseInfo.setBigScreenHmkSocialWorkerInfo(bigScreenHmkSocialWorkerInfo);
+        bigScreenHmkBaseInfo.setBigScreenHmkProjectInfo(bigScreenHmkProjectInfo);
+        return R.ok(bigScreenHmkBaseInfo);
+    }
+
+    @Override
+    public R partyProjectActivityLine() {
+        List<BigScreenActivityLine> bigScreenActivityLines=this.getPastMonth();
+        bigScreenActivityLines.forEach(bigScreenActivityLine -> {
+            BigScreenActivityLine bigScreenActivityLine1=comActSocialProjectDao.selectActivityCountMonth(bigScreenActivityLine.getX(),bigScreenActivityLine.getYear());
+            bigScreenActivityLine.setY(bigScreenActivityLine1.getY());
+            bigScreenActivityLine.setCountY(bigScreenActivityLine1.getCountY());
+            bigScreenActivityLine.setX(bigScreenActivityLine.getYear().substring(2,4)+"-"+bigScreenActivityLine.getX());
+        });
+
+        return R.ok(bigScreenActivityLines);
+    }
+
+    @Override
+    public R projectActivityProject(CommonPage commonPage) {
+        return R.ok(comActActivityDAO.selectProjectActivity(new Page(commonPage.getPage(),commonPage.getSize())));
+    }
+
+    @Override
+    public R projectType(String name) {
+        return R.ok(comActSocialProjectDao.selectType(name,null));
+    }
+
     private Page retrievePage(PageBaseDTO pageBaseDTO) {
         Long pageNum = pageBaseDTO.getPageNum();
         Long size = pageBaseDTO.getPageSize();
@@ -817,4 +760,16 @@
         }
         return page;
     }
+    public List<BigScreenActivityLine> getPastMonth(){
+        List<BigScreenActivityLine> bigScreenActivityLines=new ArrayList<>();
+        for(int i=11;i>=0;i--){
+            BigScreenActivityLine bigScreenActivityLine=new BigScreenActivityLine();
+            String date=DateUtils.getDateFormatString(DateUtils.addMonth(new Date(),-i),"MM");
+            String year=DateUtils.getDateFormatString(DateUtils.addMonth(new Date(),-i),"yyyy");
+            bigScreenActivityLine.setX(date);
+            bigScreenActivityLine.setYear(year);
+            bigScreenActivityLines.add(bigScreenActivityLine);
+        }
+        return bigScreenActivityLines;
+    }
 }

--
Gitblit v1.7.1