| | |
| | | |
| | | 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; |
| | |
| | | private ComEldersAuthElderlyService comEldersAuthElderlyService; |
| | | @Resource |
| | | private ComActMicroWishOperationRecordService wishOperationRecordService; |
| | | @Resource |
| | | private ComActActEvaluateDAO comActActEvaluateDAO; |
| | | |
| | | /** |
| | | * 新增社区活动 |
| | |
| | | */ |
| | | @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("活动不存在"); |
| | |
| | | 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); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询西区社区列表 |
| | | * |
| | | * @return 社区列表 |
| | | */ |
| | | @GetMapping("/eventgrid/community/westList") |
| | | public R getWestCommunityLists() { |
| | | return comActService.getWestCommunityLists(); |
| | | } |
| | | |
| | | /** |
| | | * 随手拍发放奖励 |
| | | * |
| | | * @param grantRewardDTO |
| | |
| | | public R easyPhotoNoHandleList(@RequestParam("communityId") Long communityId) { |
| | | return comActEasyPhotoService.easyPhotoNoHandleList(communityId); |
| | | } |
| | | |
| | | /** |
| | | * 微心愿处理人列表 |
| | | * @param communityId 社区id |
| | | * @param type 处理人类型(1.后台用户 2.党员 3.志愿者) |
| | | * @return 处理人列表 |
| | | */ |
| | | @GetMapping("wish/handle/list/admin") |
| | | public R wishHandleListAdmin(@RequestParam(value = "communityId") Long communityId,@RequestParam("type") Integer type){ |
| | | return R.ok(comActMicroWishService.wishHandleListAdmin(communityId,type)); |
| | | } |
| | | |
| | | /** |
| | | * 社区后台分页查询微心愿 |
| | | * @param comActMicroWishVO 请求参数 |
| | | * @return 微心愿列表 |
| | | */ |
| | | @PostMapping("pagemicrowishAdmin") |
| | | public R pageMicroWishAdmin(@RequestBody ComActMicroWishVO comActMicroWishVO) { |
| | | return comActMicroWishService.pageMicroWishAdmin(comActMicroWishVO); |
| | | } |
| | | } |