| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotEmpty; |
| | | |
| | | import com.panzhihua.common.model.dtos.community.ComActDiscussVoteOptionDTO; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | 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 cn.hutool.core.util.StrUtil; |
| | | import com.panzhihua.applets.weixin.CheckService; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.community.ComActDiscussCommentDTO; |
| | | import com.panzhihua.common.model.dtos.community.ComActDiscussCommentUserDTO; |
| | | import com.panzhihua.common.model.dtos.community.ComActDiscussDTO; |
| | | import com.panzhihua.common.model.dtos.community.ComActDiscussOptionDTO; |
| | | import com.panzhihua.common.model.dtos.community.ComActDiscussOptionUserDTO; |
| | | import com.panzhihua.common.model.dtos.community.ComActDiscussUserDTO; |
| | | import com.panzhihua.common.model.dtos.community.DiscussVoteOptionDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageComActDiscussCommentDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageComActDiscussDTO; |
| | | import com.panzhihua.common.model.dtos.community.*; |
| | | import com.panzhihua.common.model.dtos.community.integral.admin.AddComActIntegralUserDTO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | |
| | | import com.panzhihua.common.utlis.DateUtils; |
| | | import com.panzhihua.common.validated.AddGroup; |
| | | import com.panzhihua.common.validated.PutGroup; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | |
| | | @ApiOperation(value = "一起议-新增") |
| | | @PostMapping("discuss") |
| | | public R addDiscuss(@RequestBody @Validated(AddGroup.class) ComActDiscussDTO comActDiscussDTO) { |
| | | String openid = this.getLoginUserInfo().getOpenid(); |
| | | String appId = this.getAppId(); |
| | | // 微信内容审核 |
| | | String discussSubject = comActDiscussDTO.getDiscussSubject(); |
| | | if (!checkService.checkMessage(discussSubject)) { |
| | | return R.fail("内容违规"); |
| | | if (StrUtil.isNotBlank(discussSubject)) { |
| | | String result = checkService.checkMessageBy(discussSubject, openid, appId); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | return R.fail("填写内容存在 " + result + " 违规信息"); |
| | | } |
| | | } |
| | | |
| | | //微信图片审核 |
| | | String photoPah = comActDiscussDTO.getPhotoPah(); |
| | | if (StrUtil.isNotBlank(photoPah)) { |
| | | if (!checkService.checkImageBy(photoPah, appId)) { |
| | | return R.fail("上传图片存在违规信息"); |
| | | } |
| | | } |
| | | |
| | | Integer type = comActDiscussDTO.getType(); |
| | | String voteTitle = comActDiscussDTO.getVoteTitle(); |
| | | List<ComActDiscussOptionDTO> discussOptions = comActDiscussDTO.getDiscussOptions(); |
| | |
| | | if (null == discussId || 0 == discussId) { |
| | | return R.fail("一起议主键不能为空"); |
| | | } |
| | | String result = checkService.checkMessageBy(comment, this.getLoginUserInfo().getOpenid(), this.getAppId()); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | return R.fail("填写内容存在 " + result + " 违规信息"); |
| | | } |
| | | comActDiscussCommentDTO.setUserId(this.getUserId()); |
| | | // 议事投票计算积分 |
| | | AddComActIntegralUserDTO integralUserDTO = new AddComActIntegralUserDTO(discussId, |
| | | AddComActIntegralUserDTO.integralType.cyystp, this.getCommunityId(), this.getUserId()); |
| | | AddComActIntegralUserDTO.integralType.cyystp, this.getCommunityId(), this.getUserId()); |
| | | integralUserDTO.setIsComment(1); |
| | | communityService.addIntegralTradeAdmin(integralUserDTO); |
| | | return communityService.addDiscussComment(comActDiscussCommentDTO); |
| | |
| | | if (null == id || 0 == id) { |
| | | return R.fail("评论主键不能为空"); |
| | | } |
| | | String result = checkService.checkMessageBy(comment, this.getLoginUserInfo().getOpenid(), this.getAppId()); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | return R.fail("填写内容存在 " + result + " 违规信息"); |
| | | } |
| | | comActDiscussCommentDTO.setUserId(this.getUserId()); |
| | | return communityService.addDiscussCommentBack(comActDiscussCommentDTO); |
| | | } |
| | |
| | | @ApiOperation(value = "一起议-增加浏览量") |
| | | @PostMapping("discuss/increase-view-num") |
| | | public void increaseViewNum(@RequestParam("discussId") |
| | | @ApiParam(value = "一起议主键id", required = true) |
| | | Long discussId) { |
| | | @ApiParam(value = "一起议主键id", required = true) |
| | | Long discussId) { |
| | | communityService.increaseViewNum(discussId); |
| | | } |
| | | |