From 51ee3c4db2eb49062d3236bf44f95dc22f8f6ac9 Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期五, 14 一月 2022 17:59:03 +0800
Subject: [PATCH] 商业街bug修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java |  182 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 179 insertions(+), 3 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 19b1e58..3886633 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,6 +14,10 @@
 
 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 org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -92,6 +96,12 @@
     @Resource
     private ComActDynDAO comActDynDAO;
 
+    @Resource
+    private ComActActivityDAO comActActivityDAO;
+
+    @Resource
+    private ComActCommitteeDao comActCommitteeDao;
+
     /**
      * 大数据分析平台-居民自治
      * @param communityId
@@ -125,7 +135,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);
 
         //议事投票类型占比
@@ -139,7 +149,7 @@
         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);
@@ -185,8 +195,42 @@
         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);
+        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());
+        //居民活动发布总数
+        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);
         return R.ok(statisticsVO);
     }
 
@@ -649,6 +693,138 @@
         return R.ok(comActQuestnaireDAO.selectQuestionnaireDisplayList(page, pageBaseDTO));
     }
 
+    /**
+     * 首页二级页面-居民活动
+     * @param communityId
+     * @return
+     */
+    @Override
+    public R indexResidentAct(Long communityId) {
+        BigScreenResidentActStatisticsInfo statisticsInfo = new BigScreenResidentActStatisticsInfo();
+        List<StatisticsCommVO> actCircleData = comActActivityDAO.getIndexResidentActBaseData(communityId, true);
+        statisticsInfo.setActCircleData(actCircleData);
+        if (!actCircleData.isEmpty()) {
+            statisticsInfo.setJoinNum(actCircleData.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum());
+        }
+        List<StatisticsCommVO> residentActHistogram = comActActivityDAO.selectResidentActHistogramData(communityId, true);
+        //居民活动发布总数
+        int publishNum = 0;
+        if (!residentActHistogram.isEmpty()) {
+            publishNum = residentActHistogram.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum();
+        }
+        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());
+            temp.setFiled(e.getFiled());
+            actTotalPolylineData.add(temp);
+        });
+        statisticsInfo.setActTotalPolylineData(actTotalPolylineData);
+        return R.ok(statisticsInfo);
+    }
+
+    /**
+     * 首页二级页面-居民活动展示列表
+     * @param pageBaseDTO
+     * @return
+     */
+    @Override
+    public R indexResidentActList(PageBaseDTO pageBaseDTO) {
+        Page page = retrievePage(pageBaseDTO);
+        return R.ok(comActActivityDAO.indexActList(page, pageBaseDTO, true));
+    }
+
+    /**
+     * 首页二级页面-志愿者活动
+     * @param communityId
+     * @return
+     */
+    @Override
+    public R indexVolunteerAct(Long communityId) {
+        BigScreenVolunteerActStatisticsInfo statisticsInfo = new BigScreenVolunteerActStatisticsInfo();
+        List<StatisticsCommVO> actCircleData = comActActivityDAO.getIndexResidentActBaseData(communityId, false);
+        statisticsInfo.setActCircleData(actCircleData);
+        if (!actCircleData.isEmpty()) {
+            statisticsInfo.setJoinNum(actCircleData.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum());
+        }
+        List<StatisticsCommVO> volunteerActHistogram = comActActivityDAO.selectResidentActHistogramData(communityId, false);
+        //志愿者活动发布总数
+        int publishNum = 0;
+        if (!volunteerActHistogram.isEmpty()) {
+            publishNum = volunteerActHistogram.stream().map(StatisticsCommVO::getNum).mapToInt(Integer::intValue).sum();
+        }
+        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());
+            temp.setFiled(e.getFiled());
+            actTotalPolylineData.add(temp);
+        });
+        statisticsInfo.setActTotalPolylineData(actTotalPolylineData);
+        return R.ok(statisticsInfo);
+    }
+
+    /**
+     * 首页二级页面-志愿者活动展示列表
+     * @param pageBaseDTO
+     * @return
+     */
+    @Override
+    public R indexVolunteerActList(PageBaseDTO pageBaseDTO) {
+        Page page = retrievePage(pageBaseDTO);
+        return R.ok(comActActivityDAO.indexActList(page, pageBaseDTO, false));
+    }
+
     private Page retrievePage(PageBaseDTO pageBaseDTO) {
         Long pageNum = pageBaseDTO.getPageNum();
         Long size = pageBaseDTO.getPageSize();

--
Gitblit v1.7.1