From da8cca4d320908b672f439369e65e9e6a95374e3 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期一, 07 三月 2022 09:46:01 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/partyBuilding_lyq' into hemenkou_dev

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java |   88 +++++++++++++++++++++++++++++++------------
 1 files changed, 63 insertions(+), 25 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
index c63f567..4941a19 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
@@ -2,16 +2,15 @@
 
 import static java.util.stream.Collectors.toList;
 
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
 
 import javax.annotation.Resource;
 
 import com.panzhihua.common.model.vos.community.ComActActivityTypeVO;
+import com.panzhihua.common.model.vos.community.volunteer.ComMngVolunteerExcelVO;
+import com.panzhihua.common.model.vos.user.SysTemplateConfigVO;
 import com.panzhihua.service_community.dao.ComActActEvaluateDAO;
 import com.panzhihua.service_community.model.dos.*;
 import com.panzhihua.service_community.service.*;
@@ -19,14 +18,7 @@
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -297,7 +289,7 @@
 
     /**
      * 社区后台分页查询社区活动
-     * 
+     *
      * @param comActActivityVO
      *            查询参数
      * @return 返回结果
@@ -364,6 +356,23 @@
         comActActivityVO.setComActActEvaluateVOList(comActActEvaluatePage.getRecords());
         //活动评价总数
         comActActivityVO.setEvaluateAmount(comActActEvaluatePage.getTotal());
+        List<ComActActEvaluateDO> comActActEvaluateList = comActActEvaluateDAO
+                .selectList(new QueryWrapper<ComActActEvaluateDO>().lambda().eq(ComActActEvaluateDO::getActivityId, id));
+        if (comActActEvaluateList != null && comActActEvaluateList.size() > 0) {
+            BigDecimal starNum = BigDecimal.ZERO;
+            //总星级
+            for (ComActActEvaluateDO evaluate:comActActEvaluateList) {
+                starNum = starNum.add(BigDecimal.valueOf(evaluate.getStarLevel()==null?0:evaluate.getStarLevel()));
+            }
+            //评分星级(如果无评分默认5分)=总星级/总评价人数
+            if(starNum.compareTo(BigDecimal.ZERO) == 0){
+                comActActivityVO.setEvaluateLevel(BigDecimal.valueOf(5));
+            }else{
+                comActActivityVO.setEvaluateLevel(starNum.divide(BigDecimal.valueOf(comActActEvaluateList.size()),2, RoundingMode.HALF_UP));
+            }
+        }else{
+            comActActivityVO.setEvaluateLevel(BigDecimal.valueOf(5));
+        }
         //当前用户对活动的评分
         ComActActEvaluateVO userActEvaluateVO = comActActEvaluateDAO.getEvaluateListByUserId(id,userId);
         if(userActEvaluateVO != null){
@@ -888,7 +897,7 @@
 
     /**
      * 查询随手拍是否有活动
-     * 
+     *
      * @return 活动详情
      */
     @PostMapping("getEasyPhotoActivity")
@@ -1179,7 +1188,7 @@
 
     /**
      * 查询所有建筑类型
-     * 
+     *
      * @return 类型列表
      */
     @PostMapping("listbuildtype")
@@ -1189,7 +1198,7 @@
 
     /**
      * 分页查询 其他建筑
-     * 
+     *
      * @param comMngStructOtherBuildVO
      *            分页查询参数
      * @return 查询结果
@@ -1201,7 +1210,7 @@
 
     /**
      * 增加志愿者
-     * 
+     *
      * @param comMngVolunteerMngVO
      *            志愿者信息
      * @return 增加结果
@@ -1213,7 +1222,7 @@
 
     /**
      * 获取志愿者详情
-     * 
+     *
      * @param id
      * @return
      */
@@ -1498,8 +1507,8 @@
      * @return 社区集合 按照创建顺序倒序排列
      */
     @PostMapping("listcommunityall")
-    public R listCommunityAll() {
-        return comActService.listCommunityAll();
+    public R listCommunityAll(@RequestParam("areaCode") String areaCode) {
+        return comActService.listCommunityAll(areaCode);
     }
 
     /**
@@ -2223,10 +2232,11 @@
                 String openid = map.get("openid");
                 try {
                     WxXCXTempSend util = new WxXCXTempSend();
+                    R<SysTemplateConfigVO> sysTemplateConfigVO=userService.selectTemplate(eldersAuthFeedbackAddDTO.getAreaCode(),5);
                     String accessToken = util.getAppAccessToken();
                     WxUtil.sendSubscribeRZSH(openid, accessToken, "高龄认证",
                         DateUtils.format(eldersAuthDO.getCreateAt(), DateUtils.ymdhms_format),
-                        eldersAuthFeedbackAddDTO.getFeedBack());
+                        eldersAuthFeedbackAddDTO.getFeedBack(),sysTemplateConfigVO.getData().getTemplateId());
                 } catch (Exception e) {
                     log.error("推送审核状态订阅消息失败,失败原因:" + e.getMessage());
                 }
@@ -2298,8 +2308,8 @@
      * @return 社区列表
      */
     @GetMapping("/eventgrid/community/westList")
-    public R getWestCommunityLists() {
-        return comActService.getWestCommunityLists();
+    public R getWestCommunityLists(@RequestParam("areaCode")String areaCode) {
+        return comActService.getWestCommunityLists(areaCode);
     }
 
     /**
@@ -2526,6 +2536,34 @@
     }
 
     /**
+     * 志愿者导入
+     *
+     * @param list        志愿者数据列表
+     * @param communityId 社区id
+     * @param userId      用户id
+     * @return 导入结果
+     */
+    @PostMapping("/volunteer/import/admin")
+    public R importVolunteerAdmin(@RequestBody List<ComMngVolunteerExcelVO> list,
+                                  @RequestParam(value = "communityId") Long communityId, @RequestParam(value = "userId") Long userId) {
+        return comMngVolunteerMngService.importVolunteerAdmin(list,communityId,userId);
+    }
+
+    /**
+     * [方法描述] 根据社区ID查询所属城市所在区区域代码,
+     *
+     * @param communityId
+     *            社区ID
+     * @return String 区域code
+     * @author manailin
+     * @date 2022/2/17 10:09
+     */
+    @GetMapping("act/getActBelongRegionCode")
+    public String getActBelongRegionCode(@RequestParam("communityId") Long communityId) {
+        return comActActivityService.getActBelongRegionCode(communityId);
+    }
+
+    /**
      * 党员活动统计
      * @param communityId
      * @param year

--
Gitblit v1.7.1