| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import com.panzhihua.applets.config.WxMaConfiguration; |
| | | import com.panzhihua.applets.weixin.CheckService; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.community.*; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | |
| | | public class DiscussApi extends BaseController { |
| | | @Resource |
| | | private CommunityService communityService; |
| | | @Resource |
| | | private CheckService checkService; |
| | | |
| | | |
| | | @ApiOperation(value = "一起议-新增") |
| | | @PostMapping("discuss") |
| | | public R addDiscuss(@RequestBody @Validated(AddGroup.class) ComActDiscussDTO comActDiscussDTO) { |
| | | // 微信内容审核 |
| | | String discussSubject = comActDiscussDTO.getDiscussSubject(); |
| | | if (!checkService.checkMessage(discussSubject)) { |
| | | return R.fail("内容违规"); |
| | | } |
| | | Integer type = comActDiscussDTO.getType(); |
| | | String voteTitle = comActDiscussDTO.getVoteTitle(); |
| | | List<String> discussOptions = comActDiscussDTO.getDiscussOptions(); |
| | |
| | | String address = comActDiscussDTO.getAddress(); |
| | | if (ObjectUtils.isEmpty(address)) { |
| | | return R.fail("地址不能为空"); |
| | | }else if(address.contains("null")){ |
| | | comActDiscussDTO.setAddress(null); |
| | | } |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | |
| | | return communityService.putDiscussUser(comActDiscussUserDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "一起议-评论-点赞、取消点赞") |
| | | @PutMapping("discusscommentuser") |
| | | public R putDiscussCommentUser(@RequestBody @Validated ComActDiscussCommentUserDTO comActDiscussUserDTO) { |
| | | comActDiscussUserDTO.setUserId(this.getUserId()); |
| | | return communityService.putDiscussCommentUser(comActDiscussUserDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "一起议-详情",response = ComActDiscussVO.class) |
| | | @GetMapping("discuss") |
| | | @ApiImplicitParam(name = "id",value = "一起议主键",required = true) |
| | | public R detailDiscuss(@RequestParam("id") Long id) { |
| | | return communityService.detailDiscussApplets(id); |
| | | Long userId = this.getUserId(); |
| | | return communityService.detailDiscussApplets(id,userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "一起议-评论-分页查询",response = ComActDiscussCommentVO.class) |
| | |
| | | if (null==id||0==id) { |
| | | return R.fail("一起议主键不能为空"); |
| | | } |
| | | pageComActDiscussCommentDTO.setLoginUserId(this.getUserId()); |
| | | return communityService.pageDiscussCommentApplets(pageComActDiscussCommentDTO); |
| | | } |
| | | |