From b03d6975514e07ab91b2b033098a0d65ded19b15 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期四, 17 二月 2022 17:45:45 +0800
Subject: [PATCH] 三社功能提交

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenStatisticsServiceImpl.java |   68 +++++++++++++++++++++++++++-------
 1 files changed, 54 insertions(+), 14 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 d080650..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,7 +14,9 @@
 
 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;
 
@@ -83,6 +85,9 @@
 
     @Resource
     private ComActSocialWorkerDao comActSocialWorkerDao;
+
+    @Resource
+    private ComActActivityDAO comActActivityDAO;
 
     /**
      * 大数据分析平台-居民自治
@@ -642,11 +647,11 @@
     }
 
     @Override
-    public R hmkBaseInfo() {
+    public R hmkBaseInfo(CommonPage commonPage) {
         BigScreenHmkBaseInfo bigScreenHmkBaseInfo=comActSocialProjectDao.selectIndexBaseInfo();
         //项目数据
-        BigScreenHmkProjectInfo bigScreenHmkProjectInfo=comActSocialProjectDao.selectBaseInfo();
-        List<BigScreenHmkProjectTypeInfo> typeInfo=comActSocialProjectDao.selectType();
+        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());
@@ -654,16 +659,16 @@
         }
         bigScreenHmkProjectInfo.setTypeInfoList(typeInfo);
         //活动数据
-        Integer countAll=comActSocialProjectDao.selectActivity(0);
+        Integer countAll=comActSocialProjectDao.selectActivity(0,commonPage.getCommunityId());
         BigScreenHmkProjectTypeInfo jm=new BigScreenHmkProjectTypeInfo();
         jm.setName("居民活动");
-        jm.setCount(comActSocialProjectDao.selectActivity(2));
+        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));
+        zyz.setCount(comActSocialProjectDao.selectActivity(1,commonPage.getCommunityId()));
         if(countAll>0){
             zyz.setPercent(zyz.getCount()/countAll);
         }
@@ -672,8 +677,8 @@
         activityList.add(zyz);
         bigScreenHmkProjectInfo.setActivityTypeInfoList(activityList);
         //社会组织数据
-        BigScreenHmkSocialOrgInfo bigScreenHmkSocialOrgInfo=comActSocialOrgDao.selectInfo();
-        List<BigScreenHmkProjectTypeInfo> typeInfoList= comActSocialOrgDao.selectType();
+        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());
@@ -684,22 +689,22 @@
         //社工数据
         BigScreenHmkSocialWorkerInfo bigScreenHmkSocialWorkerInfo=new BigScreenHmkSocialWorkerInfo();
         List<BigScreenHmkProjectTypeInfo> socialWorkerList=new ArrayList<>();
-        Integer socialAll=comActSocialWorkerDao.selectType(0);
+        Integer socialAll=comActSocialWorkerDao.selectType(0,commonPage.getCommunityId());
         BigScreenHmkProjectTypeInfo ss=new BigScreenHmkProjectTypeInfo();
         ss.setName("30岁以下");
-        ss.setCount(comActSocialWorkerDao.selectType(1));
+        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));
+        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(2));
+        ls.setCount(comActSocialWorkerDao.selectType(3,commonPage.getCommunityId()));
         if(socialAll>0){
             ls.setPercent(ls.getCount()/socialAll);
         }
@@ -707,7 +712,7 @@
         socialWorkerList.add(wj);
         socialWorkerList.add(ls);
         bigScreenHmkSocialWorkerInfo.setSocialWorkerAge(socialWorkerList);
-        List<BigScreenHmkProjectTypeInfo> socialWorkerSkill=comActSocialWorkerDao.selectSkillType();
+        List<BigScreenHmkProjectTypeInfo> socialWorkerSkill=comActSocialWorkerDao.selectSkillType(commonPage.getCommunityId());
         if(socialAll>0){
             socialWorkerSkill.forEach(bigScreenHmkProjectTypeInfo -> {
                 bigScreenHmkProjectTypeInfo.setPercent(bigScreenHmkProjectTypeInfo.getCount()/socialAll);
@@ -715,8 +720,31 @@
         }
         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) {
@@ -732,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