From f372e6282a957dbbc529c432f3e19a4028d7aee8 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期二, 04 一月 2022 14:15:38 +0800
Subject: [PATCH] 1.4   折线图时间处理

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenServiceImpl.java |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenServiceImpl.java
index d513916..9c63b80 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/BigScreenServiceImpl.java
@@ -1,10 +1,12 @@
 package com.panzhihua.service_community.service.impl;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 import javax.annotation.Resource;
 
+import com.panzhihua.common.utlis.DateUtils;
 import com.panzhihua.common.utlis.SensitiveUtil;
 import com.panzhihua.common.utlis.StringUtils;
 import com.panzhihua.service_community.dao.ComPbMemberDAO;
@@ -116,9 +118,9 @@
 
     @Override
     public R partyActivityLine(Long communityId) {
-        List<BigScreenActivityLine> bigScreenActivityLines=this.getPoints();
+        List<BigScreenActivityLine> bigScreenActivityLines=this.getPastMonth();
         bigScreenActivityLines.forEach(bigScreenActivityLine -> {
-           BigScreenActivityLine bigScreenActivityLine1=comPbMemberDAO.selectActivityCountMonth(communityId,bigScreenActivityLine.getX());
+           BigScreenActivityLine bigScreenActivityLine1=comPbMemberDAO.selectActivityCountMonth(communityId,bigScreenActivityLine.getX(),bigScreenActivityLine.getYear());
            bigScreenActivityLine.setY(bigScreenActivityLine1.getY());
            bigScreenActivityLine.setCountY(bigScreenActivityLine1.getCountY());
         });
@@ -157,4 +159,17 @@
         return bigScreenActivityLines;
     }
 
+    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