From 51ee3c4db2eb49062d3236bf44f95dc22f8f6ac9 Mon Sep 17 00:00:00 2001 From: puhanshu <a9236326> Date: 星期五, 14 一月 2022 17:59:03 +0800 Subject: [PATCH] 商业街bug修改 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java | 72 ++++++++++++++++++++++++++++++++++-- 1 files changed, 68 insertions(+), 4 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 9982304..8712b7f 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,6 +2,8 @@ import static java.util.stream.Collectors.toList; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; import java.util.Comparator; import java.util.Date; @@ -11,6 +13,7 @@ import javax.annotation.Resource; +import com.panzhihua.common.model.vos.community.ComActActivityTypeVO; import com.panzhihua.service_community.dao.ComActActEvaluateDAO; import com.panzhihua.service_community.model.dos.*; import com.panzhihua.service_community.service.*; @@ -277,8 +280,8 @@ }); } comActActivityVO1.setComActActPrizeVOList(comActActPrizeVOList); - Integer participantMax = comActActivityVO1.getParticipantMax(); - if (participantMax.intValue() == 0) { + Integer volunteerMax = comActActivityVO1.getVolunteerMax(); + if (volunteerMax.intValue() != 0) { comActActivityVO1.setType(1); } else { comActActivityVO1.setType(2); @@ -361,6 +364,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){ @@ -380,6 +400,7 @@ //活动报名名单 ActivitySignVO activitySignVO = new ActivitySignVO(); activitySignVO.setActivityId(activityId); + activitySignVO.setStatus(1); R r = comActActivityService.listActivitySigns(activitySignVO); if (R.isOk(r)) { List<ActivitySignVO> activitySignVOS = @@ -1386,8 +1407,9 @@ * @return 活动列表 */ @PostMapping("listactivity") - public R listActivity(@RequestParam("userId") Long userId) { - return comActActivityService.listActivity(userId); + public R listActivity(@RequestParam("userId") Long userId, + @RequestParam(value = "status", required = false) Integer status) { + return comActActivityService.listActivity(userId, status); } /** @@ -2288,6 +2310,16 @@ } /** + * 查询西区社区列表 + * + * @return 社区列表 + */ + @GetMapping("/eventgrid/community/westList") + public R getWestCommunityLists() { + return comActService.getWestCommunityLists(); + } + + /** * 随手拍发放奖励 * * @param grantRewardDTO @@ -2477,4 +2509,36 @@ public R listRegistRecord(@RequestParam("id") Long id, @RequestParam("userId") Long userId) { return comActActivityService.listRegistRecord(id, userId); } + + /** + * 获取活动类型(目前只有志愿者活动需要获取) + * @param communityId + * @param type + * @return + */ + @GetMapping("activity/type/list") + public R listActivityType(@RequestParam("communityId") Long communityId, @RequestParam("type") Integer type) { + return comActActivityService.listActivityType(communityId, type); + } + + /** + * 添加活动类型 + * @param comActActivityTypeVO + * @return + */ + @PostMapping("activity/type/add") + public R addActivityType(@RequestBody ComActActivityTypeVO comActActivityTypeVO) { + return comActActivityService.addActivityType(comActActivityTypeVO); + } + + /** + * 我的评价 + * @param userId + * @param activityId 活动id + * @return + */ + @GetMapping("activity/my-evaluate") + public R listMyActivityEvaluate(@RequestParam("userId") Long userId, @RequestParam("activityId") Long activityId) { + return comActActEvaluateService.listMyActivityEvaluate(userId, activityId); + } } -- Gitblit v1.7.1