From e23107ef049fefa00cd54a4a2271513da81644f7 Mon Sep 17 00:00:00 2001 From: 罗元桥 <2376770955@qq.com> Date: 星期一, 13 九月 2021 20:23:29 +0800 Subject: [PATCH] Merge branch 'test' into 'test_bak' --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java | 35 ++++++++++++++--------------------- 1 files changed, 14 insertions(+), 21 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 7e2c566..4cff40f 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 @@ -11,6 +11,7 @@ import javax.annotation.Resource; +import com.panzhihua.service_community.dao.ComActActEvaluateDAO; import com.panzhihua.service_community.model.dos.*; import com.panzhihua.service_community.service.*; import org.springframework.beans.BeanUtils; @@ -149,6 +150,8 @@ private ComEldersAuthElderlyService comEldersAuthElderlyService; @Resource private ComActMicroWishOperationRecordService wishOperationRecordService; + @Resource + private ComActActEvaluateDAO comActActEvaluateDAO; /** * 新增社区活动 @@ -334,7 +337,9 @@ */ @PostMapping("detailactivity") public R detailActivity(@RequestParam("id") Long id, - @RequestParam(value = "userId", required = false) Long userId) { + @RequestParam(value = "userId", required = false) Long userId, + @RequestParam(value = "pageNum",defaultValue = "1", required = false) Long pageNum, + @RequestParam(value = "pageSize",defaultValue = "10", required = false) Long pageSize) { ComActActivityVO comActActivityVO = comActActivityService.inforActivity(id, userId); if (ObjectUtils.isEmpty(comActActivityVO)) { return R.fail("活动不存在"); @@ -352,26 +357,14 @@ comActActivityVO.setComActActPrizeVOList(comActActPrizeVOS); } //活动评价 - List<ComActActEvaluateDO> comActActEvaluateDOList = comActActEvaluateService - .list(new QueryWrapper<ComActActEvaluateDO>().lambda().eq(ComActActEvaluateDO::getActivityId, id)); - if (!ObjectUtils.isEmpty(comActActEvaluateDOList)) { - List<ComActActEvaluateVO> comActActEvaluateVOList = new ArrayList<>(); - comActActEvaluateDOList.forEach(comActActEvaluateDO -> { - ComActActEvaluateVO comActActEvaluateVO = new ComActActEvaluateVO(); - BeanUtils.copyProperties(comActActEvaluateDO, comActActEvaluateVO); - comActActEvaluateVOList.add(comActActEvaluateVO); - }); - comActActivityVO.setComActActEvaluateVOList(comActActEvaluateVOList); - //活动评价总数 - comActActivityVO.setEvaluateAmount(comActActEvaluateDOList.size()); - //当前用户对活动的评分 - Optional.ofNullable(userId).ifPresent(currentUserId -> { - Optional<ComActActEvaluateDO> optional = comActActEvaluateDOList.stream() - .filter(comActActEvaluateDO -> comActActEvaluateDO.getUserId().equals(currentUserId)).findFirst(); - if (optional.isPresent()) { - comActActivityVO.setMyRating(optional.get().getStarLevel()); - } - }); + IPage<ComActActEvaluateVO> comActActEvaluatePage = comActActEvaluateDAO.getEvaluateListPage(new Page(pageNum,pageSize),id); + comActActivityVO.setComActActEvaluateVOList(comActActEvaluatePage.getRecords()); + //活动评价总数 + comActActivityVO.setEvaluateAmount(comActActEvaluatePage.getTotal()); + //当前用户对活动的评分 + ComActActEvaluateVO userActEvaluateVO = comActActEvaluateDAO.getEvaluateListByUserId(id,userId); + if(userActEvaluateVO != null){ + comActActivityVO.setMyRating(userActEvaluateVO.getStarLevel()); } fillActivitySignList(id, comActActivityVO); comActActivityVO.setIntegral(0); -- Gitblit v1.7.1