From e7fbb69f132d0b040e329f8cf212de5d9ce5f3b3 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期一, 21 二月 2022 13:59:12 +0800
Subject: [PATCH] 抽奖活动代码提交

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java |  148 +++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 129 insertions(+), 19 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 7ab345f..841ef39 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.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.extension.plugins.pagination.Page;
@@ -22,29 +26,10 @@
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO;
 import com.panzhihua.common.model.vos.community.StatisticsCommVO;
-import com.panzhihua.common.model.vos.community.bigscreen.BigScreenCommunityStatisticsVO;
-import com.panzhihua.common.model.vos.community.bigscreen.BigScreenDynStatisticsInfo;
-import com.panzhihua.common.model.vos.community.bigscreen.BigScreenEasyPhotoStatisticsInfo;
-import com.panzhihua.common.model.vos.community.bigscreen.BigScreenMerchantStatisticsInfo;
-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.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.ComActDiscussDAO;
-import com.panzhihua.service_community.dao.ComActDynDAO;
-import com.panzhihua.service_community.dao.ComActEasyPhotoDAO;
-import com.panzhihua.service_community.dao.ComActMicroWishDAO;
-import com.panzhihua.service_community.dao.ComActNeighborCircleDAO;
-import com.panzhihua.service_community.dao.ComActQuestnaireDAO;
-import com.panzhihua.service_community.dao.ComActWarehouseDonatesDao;
-import com.panzhihua.service_community.dao.ComMngPopulationDAO;
-import com.panzhihua.service_community.dao.ComPropertyDao;
-import com.panzhihua.service_community.dao.ConvenientMerchantDAO;
 import com.panzhihua.service_community.service.BigScreenStatisticsService;
 
 import lombok.extern.slf4j.Slf4j;
@@ -91,6 +76,18 @@
 
     @Resource
     private ComActDynDAO comActDynDAO;
+
+    @Resource
+    private ComActSocialProjectDao comActSocialProjectDao;
+
+    @Resource
+    private ComActSocialOrgDao comActSocialOrgDao;
+
+    @Resource
+    private ComActSocialWorkerDao comActSocialWorkerDao;
+
+    @Resource
+    private ComActActivityDAO comActActivityDAO;
 
     /**
      * 大数据分析平台-居民自治
@@ -649,6 +646,107 @@
         return R.ok(comActQuestnaireDAO.selectQuestionnaireDisplayList(page, pageBaseDTO));
     }
 
+    @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();
@@ -662,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