From f7b14aa7b17d465f82d8213d0c9949ffdeae4533 Mon Sep 17 00:00:00 2001
From: luoxinwu <934743099@qq.com>
Date: 星期二, 05 三月 2024 09:40:07 +0800
Subject: [PATCH] 双争双评积分

---
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/PartyMemberAnalysisVO.java                           |   12 ++
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/ExcelDO.java                                                 |    6 
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/PartyExcelDO.java                                            |   22 ++-
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java                                 |   14 ++
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/EasyExcel.java                                                    |   84 ++++++++++++++++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActNeighborCircleDOMapper.xml                                      |    8 
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ActivityAnalysisVO.java                              |    5 
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActNeighborCircleService.java          |    8 +
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java |   95 ++++++++++++++++++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/NeighborApi.java                              |   21 +++-
 springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java                 |   20 +++
 11 files changed, 260 insertions(+), 35 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ExcelDO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/ExcelDO.java
similarity index 89%
rename from springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ExcelDO.java
rename to springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/ExcelDO.java
index 699680a..39c3e43 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ExcelDO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/ExcelDO.java
@@ -1,11 +1,13 @@
-package com.panzhihua.service_community.model.dos;
+package com.panzhihua.common.model.dtos;
 
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import lombok.Data;
 
+import java.io.Serializable;
+
 @Data
-public class ExcelDO {
+public class ExcelDO implements Serializable {
 
     @ColumnWidth(10) // 定义列宽
     @ExcelProperty(value = {"单位归属"}, index = 0)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ExcelDO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/PartyExcelDO.java
similarity index 60%
copy from springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ExcelDO.java
copy to springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/PartyExcelDO.java
index 699680a..c584c56 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ExcelDO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/PartyExcelDO.java
@@ -1,11 +1,11 @@
-package com.panzhihua.service_community.model.dos;
+package com.panzhihua.common.model.dtos;
 
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import lombok.Data;
 
 @Data
-public class ExcelDO {
+public class PartyExcelDO {
 
     @ColumnWidth(10) // 定义列宽
     @ExcelProperty(value = {"单位归属"}, index = 0)
@@ -19,19 +19,23 @@
     @ExcelProperty(value = {"单位名称"}, index = 2)
     private String unitName;
 
-    @ColumnWidth(20) // 定义列宽
-    @ExcelProperty(value = {"报道社区名称"}, index = 3)
-    private String communityName;
+    @ColumnWidth(26) // 定义列宽
+    @ExcelProperty(value = {"姓名"}, index = 3)
+    private String memberName;
 
     @ColumnWidth(20) // 定义列宽
-    @ExcelProperty(value = {"服务次数"}, index = 4)
+    @ExcelProperty(value = {"报道社区名称"}, index = 4)
+    private String belongCommunity;
+
+    @ColumnWidth(20) // 定义列宽
+    @ExcelProperty(value = {"服务次数"}, index = 5)
     private Integer serviceTimes;
 
     @ColumnWidth(20) // 定义列宽
-    @ExcelProperty(value = {"服务时长"}, index = 5)
+    @ExcelProperty(value = {"服务时长"}, index = 6)
     private Integer serviceTime;
 
     @ColumnWidth(20) // 定义列宽
-    @ExcelProperty(value = {"累计积分"}, index = 6)
-    private Long awardSum;
+    @ExcelProperty(value = {"累计积分"}, index = 7)
+    private Long partyCount;
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ActivityAnalysisVO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ActivityAnalysisVO.java
index 4b24265..19d35bb 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ActivityAnalysisVO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ActivityAnalysisVO.java
@@ -32,6 +32,9 @@
     @ApiModelProperty("党员服务总时长")
     private Integer partyMemberServiceTotalTime;
 
-    @ApiModelProperty("累计总积分")
+    @ApiModelProperty("报道单位累计总积分")
     private Long awardSumCount;
+
+    @ApiModelProperty("报道党员累计总积分")
+    private Long partySumCount;
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/PartyMemberAnalysisVO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/PartyMemberAnalysisVO.java
index 1d9dbbe..49666d0 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/PartyMemberAnalysisVO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/PartyMemberAnalysisVO.java
@@ -19,6 +19,15 @@
     @ApiModelProperty("所属社区")
     private String belongCommunity;
 
+    @ApiModelProperty("单位归属")
+    private String belongTo;
+
+    @ApiModelProperty("所属党组织")
+    private String orgName;
+
+    @ApiModelProperty("单位名称")
+    private String unitName;
+
     @ApiModelProperty("服务次数")
     private Integer serviceTimes;
 
@@ -28,4 +37,7 @@
     @ApiModelProperty("党员id")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long memberId;
+
+    @ApiModelProperty("党员积分")
+    private Long partyCount;
 }
\ No newline at end of file
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
index f35e876..67a4801 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -3,7 +3,7 @@
 import java.util.Date;
 import java.util.List;
 
-import com.panzhihua.common.model.dtos.PageBaseDTO;
+import com.panzhihua.common.model.dtos.*;
 import com.panzhihua.common.model.dtos.community.*;
 import com.panzhihua.common.model.dtos.community.acid.*;
 import com.panzhihua.common.model.dtos.community.building.BuildingDto;
@@ -52,8 +52,6 @@
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 
-import com.panzhihua.common.model.dtos.AppletesBackstageConfigDTO;
-import com.panzhihua.common.model.dtos.PageDTO;
 import com.panzhihua.common.model.dtos.advertisement.ComOpsAdvDTO;
 import com.panzhihua.common.model.dtos.advertisement.PageComOpsAdvDTO;
 import com.panzhihua.common.model.dtos.civil.ComActSocialWorkerAddDTO;
@@ -9962,7 +9960,15 @@
                                        @RequestParam(value = "unitId",required = false) Long unitId,@RequestParam(value = "loginAccount",required = false) String loginAccount);
 
     @GetMapping("/neighbor/export")
-    public R export(@RequestParam("year") Integer year, @RequestParam("belongTo") String belongTo, @RequestParam("communityId") Long communityId, HttpServletResponse response);
+    public List<ExcelDO> export(@RequestParam(value = "year",required = false) Integer year,
+                                @RequestParam(value = "belongTo",required = false) String belongTo,
+                                @RequestParam(value = "communityId",required = false) Long communityId);
+
+    @GetMapping("/neighbor/partyExcel")
+    public List<PartyExcelDO> partyExcel(@RequestParam(value = "year",required = false) Integer year,
+                                         @RequestParam(value = "belongTo",required = false) String belongTo,
+                                         @RequestParam(value = "communityId",required = false) Long communityId,
+                                         @RequestParam(value = "unitId",required = false) Long unitId);
 
     /**
      * 批量删除活动
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/EasyExcel.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/EasyExcel.java
new file mode 100644
index 0000000..d21efdc
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/EasyExcel.java
@@ -0,0 +1,84 @@
+package com.panzhihua.common.utlis;
+
+import com.alibaba.excel.support.ExcelTypeEnum;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.IOUtils;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.List;
+
+@Slf4j
+public class EasyExcel {
+
+    /**
+     * 导出Excel(07版.xlsx)到指定路径下
+     *
+     * @param path      路径
+     * @param excelName Excel名称
+     * @param sheetName sheet页名称
+     * @param clazz     Excel要转换的类型
+     * @param data      要导出的数据
+     */
+    public static void export2File(String path, String excelName, String sheetName, Class clazz, List data) {
+        String fileName = path.concat(excelName).concat(ExcelTypeEnum.XLSX.getValue());
+        com.alibaba.excel.EasyExcel.write(fileName, clazz).sheet(sheetName).doWrite(data);
+    }
+
+    /**
+     * 导出Excel(07版.xlsx)到web
+     *
+     * @param response  响应
+     * @param excelName Excel名称
+     * @param sheetName sheet页名称
+     * @param clazz     Excel要转换的类型
+     * @param data      要导出的数据
+     * @throws Exception
+     */
+    public static void export2Web(HttpServletResponse response, String excelName, String sheetName, Class clazz, List data) throws Exception {
+        response.setContentType("application/vnd.ms-excel");
+        response.setCharacterEncoding("utf-8");
+        // 这里URLEncoder.encode可以防止中文乱码
+        excelName = URLEncoder.encode(excelName, "UTF-8");
+        response.setHeader("Content-disposition", "attachment;filename=" + excelName + ExcelTypeEnum.XLSX.getValue());
+        com.alibaba.excel.EasyExcel.write(response.getOutputStream(), clazz).sheet(sheetName).doWrite(data);
+    }
+
+    /**
+     * 将指定位置指定名称的Excel导出到web
+     *
+     * @param response  响应
+     * @param path      文件路径
+     * @param excelName 文件名称
+     * @return
+     * @throws UnsupportedEncodingException
+     */
+    public static String export2Web4File(HttpServletResponse response, String path, String excelName) throws UnsupportedEncodingException {
+        File file = new File(path.concat(excelName).concat(ExcelTypeEnum.XLSX.getValue()));
+        if (!file.exists()) {
+            return "文件不存在!";
+        }
+
+        response.setContentType("application/vnd.ms-excel");
+        response.setCharacterEncoding("utf-8");
+        // 这里URLEncoder.encode可以防止中文乱码
+        excelName = URLEncoder.encode(excelName, "UTF-8");
+        response.setHeader("Content-disposition", "attachment;filename=" + excelName + ExcelTypeEnum.XLSX.getValue());
+
+        try (
+                FileInputStream in = new FileInputStream(file);
+                ServletOutputStream out = response.getOutputStream();
+        ) {
+            IOUtils.copy(in, out);
+            return "导出成功!";
+        } catch (Exception e) {
+            log.error("导出文件异常:", e);
+        }
+
+        return "导出失败!";
+    }
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java b/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java
index a823566..5114ea7 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java
@@ -20,6 +20,8 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
+import com.panzhihua.common.model.dtos.ExcelDO;
+import com.panzhihua.common.model.dtos.PartyExcelDO;
 import com.panzhihua.common.model.dtos.partybuilding.NewFightIntegral;
 import com.panzhihua.common.model.dtos.property.CommonPage;
 import com.panzhihua.common.model.vos.community.*;
@@ -1383,12 +1385,22 @@
     }
 
     @GetMapping("/exportExcel")
-    public R exportExcel(@RequestParam(value = "year",required = false) Integer year,
+    public void exportExcel(@RequestParam(value = "year",required = false) Integer year,
                          @RequestParam(value = "type",required = false) Integer type,
                          @RequestParam(value = "communityId",required = false) Long communityId,
                          @RequestParam(value = "belongTo",required = false) String  belongTo,
-                         HttpServletResponse response){
-        communityService.export(year,belongTo,communityId,response);
-        return R.ok();
+                         HttpServletResponse response) throws Exception {
+        List<ExcelDO> excelDOList = communityService.export(year, belongTo, communityId);
+        com.panzhihua.common.utlis.EasyExcel.export2Web(response,"报道单位","sheet",ExcelDO.class,excelDOList);
+    }
+
+    @GetMapping("/partyExcel")
+    public void partyExcel(@RequestParam(value = "year",required = false) Integer year,
+                           @RequestParam(value = "belongTo",required = false) String belongTo,
+                           @RequestParam(value = "communityId",required = false) Long communityId,
+                           @RequestParam(value = "unitId",required = false) Long unitId,
+                           HttpServletResponse response) throws Exception {
+        List<PartyExcelDO> list = communityService.partyExcel(year, belongTo, communityId, unitId);
+        com.panzhihua.common.utlis.EasyExcel.export2Web(response,"报道党员","sheet", PartyExcelDO.class,list);
     }
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/NeighborApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/NeighborApi.java
index a48cf4a..502b592 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/NeighborApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/NeighborApi.java
@@ -1,10 +1,9 @@
 package com.panzhihua.service_community.api;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
 
-import com.panzhihua.service_community.model.dos.ComActNeighborCircleDO;
-import org.springframework.beans.BeanUtils;
+import com.panzhihua.common.model.dtos.ExcelDO;
+import com.panzhihua.common.model.dtos.PartyExcelDO;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
@@ -18,6 +17,8 @@
 import com.panzhihua.service_community.service.ComActNeighborCircleTopicService;
 
 import lombok.extern.slf4j.Slf4j;
+
+import java.util.List;
 
 @Slf4j
 @RestController
@@ -433,8 +434,18 @@
      * 导出
      */
     @GetMapping("/export")
-    public R export(@RequestParam("year") Integer year, @RequestParam("belongTo") String belongTo, @RequestParam("communityId") Long communityId, HttpServletResponse response) throws Exception {
-        return this.comActNeighborCircleService.export(year,belongTo,communityId,response);
+    public List<ExcelDO> export(@RequestParam(value = "year",required = false) Integer year,
+                                @RequestParam(value = "belongTo",required = false) String belongTo,
+                                @RequestParam(value = "communityId",required = false) Long communityId) throws Exception {
+        return this.comActNeighborCircleService.export(year,belongTo,communityId);
+    }
+
+    @GetMapping("/partyExcel")
+    public List<PartyExcelDO> partyExcel(@RequestParam(value = "year",required = false) Integer year,
+                                         @RequestParam(value = "belongTo",required = false) String belongTo,
+                                         @RequestParam(value = "communityId",required = false) Long communityId,
+                                         @RequestParam(value = "unitId",required = false) Long unitId){
+        return this.comActNeighborCircleService.partyExcel(year,belongTo,communityId,unitId);
     }
 
     /**
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActNeighborCircleService.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActNeighborCircleService.java
index 5d86cde..f9769cc 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActNeighborCircleService.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActNeighborCircleService.java
@@ -1,6 +1,8 @@
 package com.panzhihua.service_community.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.panzhihua.common.model.dtos.ExcelDO;
+import com.panzhihua.common.model.dtos.PartyExcelDO;
 import com.panzhihua.common.model.dtos.neighbor.*;
 import com.panzhihua.common.model.vos.R;
 import com.panzhihua.common.model.vos.neighbor.AddNeighborCircleAdminVO;
@@ -10,7 +12,7 @@
 import com.panzhihua.service_community.model.dos.ComActNeighborCircleDO;
 import org.springframework.web.bind.annotation.RequestParam;
 
-import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * @auther lyq
@@ -261,7 +263,9 @@
     /**
      * 导出
      */
-    R export(Integer year,String belongTo,Long communityId, HttpServletResponse response) throws Exception;
+    List<ExcelDO> export(Integer year, String belongTo, Long communityId) throws Exception;
+
+    List<PartyExcelDO> partyExcel(Integer year, String belongTo, Long communityId, Long unitId);
 
     /**
      * 后台服务统计
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
index 7bc5d52..efb913b 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
@@ -9,6 +9,8 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.panzhihua.common.constants.NeighborCircleConstants;
+import com.panzhihua.common.model.dtos.ExcelDO;
+import com.panzhihua.common.model.dtos.PartyExcelDO;
 import com.panzhihua.common.model.dtos.neighbor.*;
 import com.panzhihua.common.model.vos.PageVO;
 import com.panzhihua.common.model.vos.R;
@@ -1229,7 +1231,7 @@
                 }
             }
         }
-        //统计积分
+        //报道单位统计积分
         List<NewFightNeedProblemInventory> allList = newFightNeedProblemInventoryMapper.selectAll();
         Map<Long, String> awardMap = allList.stream().filter(Objects::nonNull).collect(Collectors.toMap(NewFightNeedProblemInventory::getId, NewFightNeedProblemInventory::getAward));
         for (UnitActivityAnalysisVO unitVO : unitActivityAnalysisVOS) {
@@ -1254,12 +1256,29 @@
             unitVO.setAwardSum(sum);
         }
 
+        //报道党员统计积分
+        for (PartyMemberAnalysisVO memberAnalysisVO : partyMemberAnalysisVOS) {
+            Long userId = memberAnalysisVO.getMemberId();
+            LambdaQueryWrapper<NewFightNeedProblemClaim> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(NewFightNeedProblemClaim::getUserId,userId);
+            List<NewFightNeedProblemClaim> newFightNeedProblemInventories = newFightNeedProblemClaimMapper.selectList(wrapper);
+            long sumAward = 0L;
+            for (NewFightNeedProblemClaim inventory : newFightNeedProblemInventories) {
+                String taskId = inventory.getTaskId();
+                NewFightNeedProblemInventory newFightNeedProblemInventory = newFightNeedProblemInventoryMapper.selectById(taskId);
+                String award = newFightNeedProblemInventory.getAward();
+                sumAward = Long.parseLong(award) + sumAward;
+            }
+            memberAnalysisVO.setPartyCount(sumAward);
+        }
+
         //统计总时长和总次数
         Integer unitServiceCount=0;
         Integer unitServiceTotalTime=0;
         Integer memberServiceCount=0;
         Integer memberServiceTotalTome=0;
         long awardSumCount=0L;
+        long partySumCount=0L;
         for (UnitActivityAnalysisVO vo : unitActivityAnalysisVOS) {
             //避免空指针
             if (ObjectUtils.isNotEmpty(vo)){
@@ -1289,7 +1308,15 @@
                 }
             }
         }
+        for (PartyMemberAnalysisVO memberAnalysisVO : partyMemberAnalysisVOS) {
+            if(ObjectUtils.isNotEmpty(memberAnalysisVO)){
+                if(ObjectUtils.isNotEmpty(memberAnalysisVO.getPartyCount())){
+                    partySumCount += memberAnalysisVO.getPartyCount();
+                }
+            }
+        }
         activityVO.setAwardSumCount(awardSumCount);
+        activityVO.setPartySumCount(partySumCount);
         activityVO.setUnitServiceTotalCount(unitServiceCount);
         activityVO.setUnitServiceTotalTime(unitServiceTotalTime);
         activityVO.setPartyMemberServiceTotalCount(memberServiceCount);
@@ -1336,7 +1363,7 @@
     }
 
     @Override
-    public R export(Integer year,String belongTo,Long communityId, HttpServletResponse response) throws Exception {
+    public List<ExcelDO> export(Integer year, String belongTo, Long communityId) throws Exception {
         List<ExcelDO> excelDOList = new ArrayList<>();
         String beginTime=null;
         String endTime=null;
@@ -1426,8 +1453,68 @@
             excelDO.setAwardSum(vo.getAwardSum());
             excelDOList.add(excelDO);
         }
-        ExcelUtils.export2Web(response,"双争双评","sheet",ExcelDO.class,excelDOList);
-        return R.ok();
+        return excelDOList;
+    }
+
+    @Override
+    public List<PartyExcelDO> partyExcel(Integer year, String belongTo, Long communityId,Long unitId) {
+        String beginTime=null;
+        String endTime=null;
+        if (null != year){
+            //设置开始,截止时间
+            beginTime=year.toString().concat("-01-01");
+            endTime=year.toString().concat("-12-31");
+        }
+        //获取党员活动统计数据
+        List<PartyMemberAnalysisVO> partyMemberAnalysisVOS = comActNeighborCircleDAO.institutionalPartyMemberServiceAnalysis(beginTime, endTime, belongTo,communityId,unitId);
+        List<PartyMemberAnalysisVO> partyMemberAnalysisVOS1 = comActNeighborCircleDAO.institutionalPartyMemberActAnalysis(beginTime, endTime, belongTo,communityId,unitId);
+        if (partyMemberAnalysisVOS1.size()>0){
+            for (PartyMemberAnalysisVO vo : partyMemberAnalysisVOS1) {
+                if (ObjectUtils.isNotEmpty(vo)){
+                    if (ObjectUtils.isNotEmpty(vo.getMemberId())){
+                        Map<String, Integer> param = memberAlreadyAnalysis(vo.getMemberId(), partyMemberAnalysisVOS);
+                        if (param.get("flag")==1){
+                            Integer serviceTime = vo.getServiceTime();
+                            Integer serviceTimes = vo.getServiceTimes();
+                            partyMemberAnalysisVOS.get(param.get("index")).setServiceTime(partyMemberAnalysisVOS.get(param.get("index")).getServiceTime()+serviceTime);
+                            partyMemberAnalysisVOS.get(param.get("index")).setServiceTimes(partyMemberAnalysisVOS.get(param.get("index")).getServiceTimes()+serviceTimes);
+                        }else{
+                            partyMemberAnalysisVOS.add(vo);
+                        }
+                    }
+                }
+            }
+        }
+
+        //报道党员统计积分
+        for (PartyMemberAnalysisVO memberAnalysisVO : partyMemberAnalysisVOS) {
+            Long userId = memberAnalysisVO.getMemberId();
+            LambdaQueryWrapper<NewFightNeedProblemClaim> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(NewFightNeedProblemClaim::getUserId,userId);
+            List<NewFightNeedProblemClaim> newFightNeedProblemInventories = newFightNeedProblemClaimMapper.selectList(wrapper);
+            long sumAward = 0L;
+            for (NewFightNeedProblemClaim inventory : newFightNeedProblemInventories) {
+                String taskId = inventory.getTaskId();
+                NewFightNeedProblemInventory newFightNeedProblemInventory = newFightNeedProblemInventoryMapper.selectById(taskId);
+                String award = newFightNeedProblemInventory.getAward();
+                sumAward = Long.parseLong(award) + sumAward;
+            }
+            memberAnalysisVO.setPartyCount(sumAward);
+        }
+        List<PartyExcelDO> list = new ArrayList<>();
+        for (PartyMemberAnalysisVO memberAnalysisVO : partyMemberAnalysisVOS) {
+            PartyExcelDO partyExcelDO = new PartyExcelDO();
+            partyExcelDO.setBelongTo(memberAnalysisVO.getBelongTo());
+            partyExcelDO.setOrgName(memberAnalysisVO.getOrgName());
+            partyExcelDO.setUnitName(memberAnalysisVO.getUnitName());
+            partyExcelDO.setMemberName(memberAnalysisVO.getMemberName());
+            partyExcelDO.setBelongCommunity(memberAnalysisVO.getBelongCommunity());
+            partyExcelDO.setServiceTimes(memberAnalysisVO.getServiceTimes());
+            partyExcelDO.setServiceTime(memberAnalysisVO.getServiceTime());
+            partyExcelDO.setPartyCount(memberAnalysisVO.getPartyCount());
+            list.add(partyExcelDO);
+        }
+        return list;
     }
 
 
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActNeighborCircleDOMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActNeighborCircleDOMapper.xml
index e8c8c2f..89422c8 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActNeighborCircleDOMapper.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActNeighborCircleDOMapper.xml
@@ -641,10 +641,10 @@
     </select>
     <select id="institutionalPartyMemberServiceAnalysis"
             resultType="com.panzhihua.common.model.vos.neighbor.PartyMemberAnalysisVO">
-        SELECT count(id) as serviceTimes, sum(duration) as serviceTime, unitId,
-        communityId, memberId, memberName, belongUnit, belongCommunity, belong_to FROM (
-            SELECT caa.id, caa.duration, cpcu.id as unitId, cpcu.community_id as communityId, su.user_id as
-            memberId, su.name as memberName, su.relation_name as belongUnit, ca.name as belongCommunity, cpcu.belong_to
+        SELECT count(id) as serviceTimes, sum(duration) as serviceTime, unitId,unitName,orgName,
+        communityId, memberId, memberName, belongUnit, belongCommunity, belongTo FROM (
+            SELECT caa.id, caa.duration, cpcu.id as unitId,cpcu.name as unitName,cpcu.org_name as orgName, cpcu.community_id as communityId, su.user_id as
+            memberId, su.name as memberName, su.relation_name as belongUnit, ca.name as belongCommunity, cpcu.belong_to belongTo
             FROM `com_act_activity` as caa
             left join com_act_act_regist as caar on caa.id=caar.activity_id
             left join sys_user as su on caar.user_id=su.user_id

--
Gitblit v1.7.1