From d224a412800a481471149db823ab296b51f0427f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=87=91=E9=B9=8F?= Date: Thu, 24 Oct 2019 14:08:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E7=BE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ApiTopicCommentController.java | 50 +++++ .../epdc/feign/TopicCommentFeignClient.java | 35 ++++ .../TopicCommentFeignClientFallback.java | 32 +++ .../epdc/service/TopicCommentService.java | 34 ++++ .../service/impl/TopicCommentServiceImpl.java | 62 ++++++ .../controller/AppEventCommentController.java | 2 +- .../modules/events/dao/EpdcEventsDao.java | 2 +- .../dto/comment/TopicCommentDTO.java | 141 +++++++++++++ .../dto/comment/TopicCommentFormDTO.java | 48 +++++ .../comment/TopicCommentStatementFormDTO.java | 47 +++++ .../comment/TopicCommentUserAttitudeDTO.java | 86 ++++++++ .../dto/comment/TopicCommentsFormDTO.java | 45 +++++ .../dto/comment/TopicCommentsResultDTO.java | 27 +++ .../dto/constant/TopicNoticeConstant.java | 54 +++++ .../dto/topic/ReplyCommentDto.java | 24 +++ .../dto/topic/TopicCommentsDTO.java | 63 ++++++ .../dto/topic/UserBaseInfoDto.java | 28 +++ .../controller/AppTopicCommentController.java | 61 ++++++ .../controller/TopicCommentController.java | 94 +++++++++ .../TopicCommentUserAttitudeController.java | 94 +++++++++ .../modules/comment/dao/TopicCommentDao.java | 35 ++++ .../dao/TopicCommentUserAttitudeDao.java | 33 +++ .../comment/entity/TopicCommentEntity.java | 111 +++++++++++ .../TopicCommentUserAttitudeEntity.java | 56 ++++++ .../comment/excel/TopicCommentExcel.java | 98 +++++++++ .../excel/TopicCommentUserAttitudeExcel.java | 65 ++++++ .../comment/redis/TopicCommentRedis.java | 47 +++++ .../redis/TopicCommentUserAttitudeRedis.java | 47 +++++ .../comment/service/TopicCommentService.java | 110 ++++++++++ .../TopicCommentUserAttitudeService.java | 95 +++++++++ .../service/impl/TopicCommentServiceImpl.java | 188 ++++++++++++++++++ .../TopicCommentUserAttitudeServiceImpl.java | 104 ++++++++++ .../modules/topic/dao/TopicDao.java | 9 +- .../modules/topic/service/TopicService.java | 8 +- .../topic/service/impl/TopicServiceImpl.java | 7 +- .../mapper/comment/TopicCommentDao.xml | 37 ++++ .../comment/TopicCommentUserAttitudeDao.xml | 20 ++ .../main/resources/mapper/topic/TopicDao.xml | 9 +- 38 files changed, 2100 insertions(+), 8 deletions(-) create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiTopicCommentController.java create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/TopicCommentFeignClient.java create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/TopicCommentFeignClientFallback.java create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/TopicCommentService.java create mode 100644 esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/TopicCommentServiceImpl.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentDTO.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentFormDTO.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentStatementFormDTO.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentUserAttitudeDTO.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentsFormDTO.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentsResultDTO.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/constant/TopicNoticeConstant.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/ReplyCommentDto.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/TopicCommentsDTO.java create mode 100644 esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/UserBaseInfoDto.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/controller/AppTopicCommentController.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/controller/TopicCommentController.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/controller/TopicCommentUserAttitudeController.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/dao/TopicCommentDao.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/dao/TopicCommentUserAttitudeDao.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/entity/TopicCommentEntity.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/entity/TopicCommentUserAttitudeEntity.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/excel/TopicCommentExcel.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/excel/TopicCommentUserAttitudeExcel.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/redis/TopicCommentRedis.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/redis/TopicCommentUserAttitudeRedis.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/TopicCommentService.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/TopicCommentUserAttitudeService.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/impl/TopicCommentServiceImpl.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/impl/TopicCommentUserAttitudeServiceImpl.java create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/comment/TopicCommentDao.xml create mode 100755 esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/comment/TopicCommentUserAttitudeDao.xml diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiTopicCommentController.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiTopicCommentController.java new file mode 100644 index 000000000..a325ea0a7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiTopicCommentController.java @@ -0,0 +1,50 @@ +package com.elink.esua.epdc.controller; + +import com.elink.esua.epdc.common.token.dto.TokenDto; +import com.elink.esua.epdc.commons.tools.annotation.LoginUser; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; +import com.elink.esua.epdc.dto.comment.result.EventCommentsResultDTO; +import com.elink.esua.epdc.service.TopicCommentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 移动端接口-评论模块 + * @Author WJP + * @Date 2019/9/9 09:45 + */ +@RestController +@RequestMapping("group/comment") +public class ApiTopicCommentController { + + @Autowired + private TopicCommentService topicCommentService; + + /** + * 提交评论或回复接口 + */ + @PostMapping("submit") + public Result submit(@LoginUser TokenDto userDetail, @RequestBody TopicCommentFormDTO topicCommentFormDTO) { + return topicCommentService.submit(userDetail,topicCommentFormDTO); + } + + /** + * 评论(赞/踩) + */ + @PostMapping("statement") + public Result statement(@LoginUser TokenDto userDetail, @RequestBody TopicCommentStatementFormDTO topicCommentStatementFormDTO) { + return topicCommentService.statement(userDetail,topicCommentStatementFormDTO); + } + + /** + * 评论列表 + */ + @GetMapping("list") + public Result listOfComments(@LoginUser TokenDto userDetail, TopicCommentsFormDTO topicCommentsFormDTO) { + return topicCommentService.listOfComments(userDetail,topicCommentsFormDTO); + } + +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/TopicCommentFeignClient.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/TopicCommentFeignClient.java new file mode 100644 index 000000000..0540257eb --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/TopicCommentFeignClient.java @@ -0,0 +1,35 @@ +package com.elink.esua.epdc.feign; + +import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; +import com.elink.esua.epdc.dto.comment.result.EventCommentsResultDTO; +import com.elink.esua.epdc.feign.fallback.TopicCommentFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; + +/** + * 评论模块调用 + * @Author LC + * @Date 2019/9/7 11:34 + */ +@FeignClient(name = ServiceConstant.EPDC_GROUP_SERVER, fallback = TopicCommentFeignClientFallback.class) +public interface TopicCommentFeignClient { + + + @PostMapping(value = "group/epdc-app/comment/submit", consumes = MediaType.APPLICATION_JSON_VALUE) + Result submit(TopicCommentFormDTO commentFormDTO); + + @PostMapping(value = "group/epdc-app/comment/statement", consumes = MediaType.APPLICATION_JSON_VALUE) + Result statement(TopicCommentStatementFormDTO commentStatementFormDTO); + + @GetMapping(value = "group/epdc-app/comment/list", consumes = MediaType.APPLICATION_JSON_VALUE) + Result listOfComments(TopicCommentsFormDTO formDto); + + + +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/TopicCommentFeignClientFallback.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/TopicCommentFeignClientFallback.java new file mode 100644 index 000000000..f97e4efaf --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/TopicCommentFeignClientFallback.java @@ -0,0 +1,32 @@ +package com.elink.esua.epdc.feign.fallback; + +import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; +import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; +import com.elink.esua.epdc.dto.comment.result.EventCommentsResultDTO; +import com.elink.esua.epdc.feign.TopicCommentFeignClient; +import org.springframework.stereotype.Component; + + +@Component +public class TopicCommentFeignClientFallback implements TopicCommentFeignClient { + + @Override + public Result submit(TopicCommentFormDTO commentFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_GROUP_SERVER, "submit", commentFormDTO); + } + + @Override + public Result statement(TopicCommentStatementFormDTO commentStatementFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_GROUP_SERVER, "statement", commentStatementFormDTO); + } + + @Override + public Result listOfComments(TopicCommentsFormDTO formDto) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_GROUP_SERVER, "listOfComments", formDto); + } + +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/TopicCommentService.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/TopicCommentService.java new file mode 100644 index 000000000..54802b4ae --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/TopicCommentService.java @@ -0,0 +1,34 @@ +package com.elink.esua.epdc.service; + +import com.elink.esua.epdc.common.token.dto.TokenDto; +import com.elink.esua.epdc.commons.tools.annotation.LoginUser; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.comment.*; +import com.elink.esua.epdc.dto.comment.form.CommentFormDTO; +import com.elink.esua.epdc.dto.comment.form.EventCommentsFormDTO; +import com.elink.esua.epdc.dto.comment.result.EventCommentsResultDTO; + + +/** + * 移动端接口-评论模块 + * @Author WJP + * @Date 2019/9/9 09:45 + */ +public interface TopicCommentService { + + /** + * 提交评论或回复接口 + */ + Result submit(@LoginUser TokenDto userDetail, TopicCommentFormDTO topicCommentFormDTO); + + /** + * 评论(赞/踩) + */ + Result statement(@LoginUser TokenDto userDetail, TopicCommentStatementFormDTO topicCommentStatementFormDTO); + + + /** + * 评论列表 + */ + Result listOfComments(TokenDto userDetail, TopicCommentsFormDTO topicCommentsFormDTO); +} diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/TopicCommentServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/TopicCommentServiceImpl.java new file mode 100644 index 000000000..c878f58c5 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/TopicCommentServiceImpl.java @@ -0,0 +1,62 @@ +package com.elink.esua.epdc.service.impl; + + +import com.elink.esua.epdc.async.WxMaSecCheckTask; +import com.elink.esua.epdc.common.token.dto.TokenDto; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; +import com.elink.esua.epdc.dto.comment.result.EventCommentsResultDTO; +import com.elink.esua.epdc.feign.TopicCommentFeignClient; +import com.elink.esua.epdc.service.TopicCommentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.listener.Topic; +import org.springframework.stereotype.Service; + +/** + * 移动端接口-评论模块 + * @Author WJP + * @Date 2019/9/9 09:45 + */ +@Service +public class TopicCommentServiceImpl implements TopicCommentService { + + @Autowired + private TopicCommentFeignClient topicCommentFeignClient; + + @Autowired + private WxMaSecCheckTask wxMaSecCheckTask; + + @Override + public Result submit(TokenDto userDetail, TopicCommentFormDTO topicCommentFormDTO) { + if (null == userDetail) { + return new Result().error("获取用户信息失败"); + } + // 上传内容安全检查 + wxMaSecCheckTask.checkMessage(topicCommentFormDTO.getContent()); + topicCommentFormDTO.setUserId(userDetail.getUserId()); + topicCommentFormDTO.setUserName(userDetail.getNickname()); + topicCommentFormDTO.setUserFace(userDetail.getFaceImg()); + return topicCommentFeignClient.submit(topicCommentFormDTO); + } + + @Override + public Result statement(TokenDto userDetail, TopicCommentStatementFormDTO topicCommentStatementFormDTO) { + if (null == userDetail) { + return new Result().error("获取用户信息失败"); + } + topicCommentStatementFormDTO.setUseId(userDetail.getUserId()); + topicCommentStatementFormDTO.setUserName(userDetail.getNickname()); + return topicCommentFeignClient.statement(topicCommentStatementFormDTO); + } + + @Override + public Result listOfComments(TokenDto userDetail, TopicCommentsFormDTO topicCommentsFormDTO) { + if (null == userDetail) { + return new Result().error("获取用户信息失败"); + } + topicCommentsFormDTO.setUserId(userDetail.getUserId()); + return topicCommentFeignClient.listOfComments(topicCommentsFormDTO); + } +} diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/comment/controller/AppEventCommentController.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/comment/controller/AppEventCommentController.java index d960b1330..cc13e34c0 100755 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/comment/controller/AppEventCommentController.java +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/comment/controller/AppEventCommentController.java @@ -40,7 +40,7 @@ public class AppEventCommentController { @Autowired private EventCommentUserAttitudeService eventCommentUserAttitudeService; - /** + /**AppTopicCommentController * 提交评论或回复接口 * @param commentFormDTO * @return diff --git a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/EpdcEventsDao.java b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/EpdcEventsDao.java index c50228021..054d166c5 100644 --- a/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/EpdcEventsDao.java +++ b/esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/EpdcEventsDao.java @@ -77,7 +77,7 @@ public interface EpdcEventsDao extends BaseDao { List selectListOfCommentsByEventId(Map params); /** - * 修改评论数+1 + * 评论数+1 */ void updateCommentNum(String id); diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentDTO.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentDTO.java new file mode 100755 index 000000000..3b284fcd5 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentDTO.java @@ -0,0 +1,141 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dto.comment; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 话题评论表 话题评论表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@Data +public class TopicCommentDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 话题ID + */ + private String topicId; + + /** + * 评论人ID + */ + private String userId; + + /** + * 评论人昵称 + */ + private String username; + + /** + * 评论人头像 + */ + private String userFace; + + /** + * 评论内容 + */ + private String content; + + /** + * 评论类型 0:评论,1:回复,2:回复的回复 + */ + private String commentType; + + /** + * 回复的评论ID + */ + private String commentId; + + /** + * 被回复数 + */ + private Integer replyCount; + + /** + * 被回复人ID + */ + private String replyUserId; + + /** + * 被回复人名称 + */ + private String replyUsername; + + /** + * 被回复人头像 + */ + private String replyUserFace; + + /** + * 点赞数 + */ + private Integer likeCount; + + /** + * 点踩数 + */ + private Integer unLikeCount; + + /** + * 屏蔽标识 0:未屏蔽,1:已屏蔽 + */ + private String shieldFlag; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentFormDTO.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentFormDTO.java new file mode 100644 index 000000000..d968ed85f --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentFormDTO.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.elink.esua.epdc.dto.comment; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +/** + * 评论议题、提交评论 + * + */ +@Data +public class TopicCommentFormDTO { + + private static final long serialVersionUID = 1L; + + private String topicId; + + private String faCommentId; + + @Size(min = 1, max = 500, message = "评论内容不能超过500字") + private String content; + + /** + * 评论人ID + */ + @NotBlank(message = "评论人ID不能为空") + private String userId; + + /** + * 评论人昵称 + */ + private String userName; + + /** + * 评论人头像 + */ + private String userFace; + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentStatementFormDTO.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentStatementFormDTO.java new file mode 100755 index 000000000..0dba41f08 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentStatementFormDTO.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dto.comment; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +@Data +public class TopicCommentStatementFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 表态 0赞;1踩;2取消点赞;3取消点踩 + */ + private String attitude; + + /** + * 评论ID + */ + private String commentId; + + private String useId; + + private String userName; + + private String topicId; + + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentUserAttitudeDTO.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentUserAttitudeDTO.java new file mode 100755 index 000000000..00b52b119 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentUserAttitudeDTO.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 话题评论用户表态表 话题评论用户表态表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@Data +public class TopicCommentUserAttitudeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 评论ID + */ + private String commentId; + + /** + * 用户ID + */ + private String userId; + + /** + * 表态标识 0:点赞,1:点踩 + */ + private String attitudeFlag; + + /** + * 删除标记 0:未删除,1:删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentsFormDTO.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentsFormDTO.java new file mode 100644 index 000000000..6e1c02a5a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentsFormDTO.java @@ -0,0 +1,45 @@ +package com.elink.esua.epdc.dto.comment; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * 移动端评论表单DTO + * @Author LC + * @Date 2019/9/9 15:09 + */ +@Data +public class TopicCommentsFormDTO implements Serializable { + private static final long serialVersionUID = -3804142943077174555L; + + /** + * 页码 + */ + @NotNull(message = "页码不能为空") + private Integer pageIndex; + /** + * 页容量 + */ + @NotNull(message = "分页数量不能为空") + private Integer pageSize; + /** + * 时间戳(yyyy-MM-dd HH:mm:ss) + */ + private String timestamp; + /** + * 列表类型 0最新;1最热 + */ + @NotBlank(message = "列表类型不能为空") + private String orderType; + /** + * 项目ID + */ + private String topicId; + /** + * 用户ID + */ + private String userId; +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentsResultDTO.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentsResultDTO.java new file mode 100644 index 000000000..3b4f3eb1a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/comment/TopicCommentsResultDTO.java @@ -0,0 +1,27 @@ +package com.elink.esua.epdc.dto.comment; + +import com.elink.esua.epdc.dto.topic.TopicCommentsDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 移动端评论列表DTO + * @Author LC + * @Date 2019/9/9 14:46 + */ +@Data +public class TopicCommentsResultDTO implements Serializable { + private static final long serialVersionUID = -5087234859322214256L; + + /** + * 表态数 + */ + private long statementNum; + + /** + * 评论 + */ + List commentsList; +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/constant/TopicNoticeConstant.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/constant/TopicNoticeConstant.java new file mode 100644 index 000000000..5a53e5d20 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/constant/TopicNoticeConstant.java @@ -0,0 +1,54 @@ +package com.elink.esua.epdc.dto.constant; + +/** + * 发送消息常量 + * @Author LC + * @Date 2019/9/18 17:26 + */ +public interface TopicNoticeConstant { + /** + * 话题被评论 + */ + String NOTICE_TOPIC_COMMENT = "你的话题【有新评论】"; + /** + * 评论被回复 + */ + String NOTICE_TOPIC_COMMENT_REPLY = "你的评论【有新回复】"; + + /** + * 话题支持 + */ + String NOTICE_TOPIC_APPROVE = "你的话题【有新的支持】"; + /** + * 话题反对 + */ + String NOTICE_TOPIC_OPPOSE = "你的话题【有新的反对】"; + /** + * 评论支持 + */ + String NOTICE_COMMENT_APPROVE = "你的评论【有新的支持】"; + /** + * 评论反对 + */ + String NOTICE_COMMENT_OPPOSE = "你的评论【有新的反对】"; + + + + /** + * 我的消息类型:1互动通知 + */ + String NOTICE_TYPE_INTERACTIVE_NOTICE = "1"; + + + /** + * 消息所属业务类型:话题评论 + */ + String NOTICE_BUSINESS_TYPE_TOPIC_COMMENT = "topicComment"; + /** + * 消息所属业务类型:话题评论回复 + */ + String NOTICE_BUSINESS_TYPE_TOPIC_COMMENT_REPLY = "topicCommentReply"; + + + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/ReplyCommentDto.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/ReplyCommentDto.java new file mode 100644 index 000000000..ca6289bcf --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/ReplyCommentDto.java @@ -0,0 +1,24 @@ +package com.elink.esua.epdc.dto.events; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 被回复的评论 + * @Author LC + * @Date 2019/9/6 17:25 + */ +@Data +public class ReplyCommentDto implements Serializable { + private static final long serialVersionUID = 3501567846629315395L; + + /** + * 用户名 + */ + private String userName; + /** + * 内容 + */ + private String content; +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/TopicCommentsDTO.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/TopicCommentsDTO.java new file mode 100644 index 000000000..23ad2c0b6 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/TopicCommentsDTO.java @@ -0,0 +1,63 @@ +package com.elink.esua.epdc.dto.topic; + +import com.elink.esua.epdc.dto.events.ReplyCommentDto; +import com.elink.esua.epdc.dto.events.UserBaseInfoDto; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 事件评论DTO + * @Author LC + * @Date 2019/9/6 17:20 + */ +@Data +public class TopicCommentsDTO implements Serializable { + private static final long serialVersionUID = 2112619345374657409L; + + /** + * 评论ID + */ + private String commentId; + /** + * 内容 + */ + private String content; + /** + * 用户是否赞过,false未赞 + */ + private boolean userLike; + /** + * 用户是否踩过,true踩 + */ + private boolean userDislike; + /** + * 评论时间 + */ + private Date commentTime; + /** + * 赞数 + */ + private Integer approveNum; + /** + * 踩数 + */ + private Integer opposeNum; + /** + * 表态次数 + */ + private Integer attitudeNum; + /** + * 用户信息 + */ + private UserBaseInfoDto user; + /** + * 屏蔽标识 0:未屏蔽,1:已屏蔽 + */ + private String shieldFlag; + /** + * 回复评论信息 + */ + private ReplyCommentDto replyComment; +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/UserBaseInfoDto.java b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/UserBaseInfoDto.java new file mode 100644 index 000000000..298bd7127 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-client/src/main/java/com.elink.esua.epdc/dto/topic/UserBaseInfoDto.java @@ -0,0 +1,28 @@ +package com.elink.esua.epdc.dto.events; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 用户基础信息DTO + * @Author LC + * @Date 2019/9/6 17:23 + */ +@Data +public class UserBaseInfoDto implements Serializable { + private static final long serialVersionUID = -6564298463849924671L; + + /** + * 用户ID + */ + private String userId; + /** + * 用户名 + */ + private String userName; + /** + * 用户头像 + */ + private String userFace; +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/controller/AppTopicCommentController.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/controller/AppTopicCommentController.java new file mode 100755 index 000000000..489c1e77b --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/controller/AppTopicCommentController.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.controller; + +import com.elink.esua.epdc.commons.tools.constant.Constant; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentsResultDTO; +import com.elink.esua.epdc.modules.comment.service.TopicCommentService; +import com.elink.esua.epdc.modules.comment.service.TopicCommentUserAttitudeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +@RestController +@RequestMapping(Constant.EPDC_APP + "comment") +public class AppTopicCommentController { + + @Autowired + private TopicCommentService topicCommentService; + + @Autowired + private TopicCommentUserAttitudeService topicCommentUserAttitudeService; + + /** + * 提交评论或回复接口 + */ + @PostMapping("submit") + public Result submit(@RequestBody TopicCommentFormDTO commentFormDTO){ + ValidatorUtils.validateEntity(commentFormDTO); + return topicCommentService.submit(commentFormDTO); + } + + /** + * 评论列表 + */ + @GetMapping("list") + public Result listOfComments(@RequestBody TopicCommentsFormDTO formDto) { + return topicCommentService.listOfComments(formDto); + } + + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/controller/TopicCommentController.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/controller/TopicCommentController.java new file mode 100755 index 000000000..d601d9d8a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/controller/TopicCommentController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.AssertUtils; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.dto.comment.TopicCommentDTO; +import com.elink.esua.epdc.modules.comment.excel.TopicCommentExcel; +import com.elink.esua.epdc.modules.comment.service.TopicCommentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 话题评论表 话题评论表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@RestController +@RequestMapping("topiccomment") +public class TopicCommentController { + + @Autowired + private TopicCommentService topicCommentService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = topicCommentService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + TopicCommentDTO data = topicCommentService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody TopicCommentDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + topicCommentService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody TopicCommentDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + topicCommentService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + topicCommentService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = topicCommentService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, TopicCommentExcel.class); + } + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/controller/TopicCommentUserAttitudeController.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/controller/TopicCommentUserAttitudeController.java new file mode 100755 index 000000000..a76be530d --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/controller/TopicCommentUserAttitudeController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.controller; + +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.commons.tools.validator.AssertUtils; +import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; +import com.elink.esua.epdc.dto.TopicCommentUserAttitudeDTO; +import com.elink.esua.epdc.modules.comment.excel.TopicCommentUserAttitudeExcel; +import com.elink.esua.epdc.modules.comment.service.TopicCommentUserAttitudeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 话题评论用户表态表 话题评论用户表态表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@RestController +@RequestMapping("topiccommentuserattitude") +public class TopicCommentUserAttitudeController { + + @Autowired + private TopicCommentUserAttitudeService topicCommentUserAttitudeService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = topicCommentUserAttitudeService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + TopicCommentUserAttitudeDTO data = topicCommentUserAttitudeService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody TopicCommentUserAttitudeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + topicCommentUserAttitudeService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody TopicCommentUserAttitudeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + topicCommentUserAttitudeService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + topicCommentUserAttitudeService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = topicCommentUserAttitudeService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, TopicCommentUserAttitudeExcel.class); + } + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/dao/TopicCommentDao.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/dao/TopicCommentDao.java new file mode 100755 index 000000000..f483add1a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/dao/TopicCommentDao.java @@ -0,0 +1,35 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.modules.comment.entity.TopicCommentEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 话题评论表 话题评论表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@Mapper +public interface TopicCommentDao extends BaseDao { + + void updateReplyCount(String commentId); + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/dao/TopicCommentUserAttitudeDao.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/dao/TopicCommentUserAttitudeDao.java new file mode 100755 index 000000000..31618083e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/dao/TopicCommentUserAttitudeDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.modules.comment.entity.TopicCommentUserAttitudeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 话题评论用户表态表 话题评论用户表态表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@Mapper +public interface TopicCommentUserAttitudeDao extends BaseDao { + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/entity/TopicCommentEntity.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/entity/TopicCommentEntity.java new file mode 100755 index 000000000..ee4068dd8 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/entity/TopicCommentEntity.java @@ -0,0 +1,111 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 话题评论表 话题评论表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_topic_comment") +public class TopicCommentEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 话题ID + */ + private String topicId; + + /** + * 评论人ID + */ + private String userId; + + /** + * 评论人昵称 + */ + private String username; + + /** + * 评论人头像 + */ + private String userFace; + + /** + * 评论内容 + */ + private String content; + + /** + * 评论类型 0:评论,1:回复,2:回复的回复 + */ + private String commentType; + + /** + * 回复的评论ID + */ + private String commentId; + + /** + * 被回复数 + */ + private Integer replyCount; + + /** + * 被回复人ID + */ + private String replyUserId; + + /** + * 被回复人名称 + */ + private String replyUsername; + + /** + * 被回复人头像 + */ + private String replyUserFace; + + /** + * 点赞数 + */ + private Integer likeCount; + + /** + * 点踩数 + */ + private Integer unLikeCount; + + /** + * 屏蔽标识 0:未屏蔽,1:已屏蔽 + */ + private String shieldFlag; + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/entity/TopicCommentUserAttitudeEntity.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/entity/TopicCommentUserAttitudeEntity.java new file mode 100755 index 000000000..3d1359e97 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/entity/TopicCommentUserAttitudeEntity.java @@ -0,0 +1,56 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 话题评论用户表态表 话题评论用户表态表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_topic_comment_user_attitude") +public class TopicCommentUserAttitudeEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 评论ID + */ + private String commentId; + + /** + * 用户ID + */ + private String userId; + + /** + * 表态标识 0:点赞,1:点踩 + */ + private String attitudeFlag; + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/excel/TopicCommentExcel.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/excel/TopicCommentExcel.java new file mode 100755 index 000000000..005adc83e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/excel/TopicCommentExcel.java @@ -0,0 +1,98 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 话题评论表 话题评论表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@Data +public class TopicCommentExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "话题ID") + private String topicId; + + @Excel(name = "评论人ID") + private String userId; + + @Excel(name = "评论人昵称") + private String username; + + @Excel(name = "评论人头像") + private String userFace; + + @Excel(name = "评论内容") + private String content; + + @Excel(name = "评论类型 0:评论,1:回复,2:回复的回复") + private String commentType; + + @Excel(name = "回复的评论ID") + private String commentId; + + @Excel(name = "被回复数") + private Integer replyCount; + + @Excel(name = "被回复人ID") + private String replyUserId; + + @Excel(name = "被回复人名称") + private String replyUsername; + + @Excel(name = "被回复人头像") + private String replyUserFace; + + @Excel(name = "点赞数") + private Integer likeCount; + + @Excel(name = "点踩数") + private Integer unLikeCount; + + @Excel(name = "屏蔽标识 0:未屏蔽,1:已屏蔽") + private String shieldFlag; + + @Excel(name = "删除标记 0:未删除,1:已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/excel/TopicCommentUserAttitudeExcel.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/excel/TopicCommentUserAttitudeExcel.java new file mode 100755 index 000000000..3f2b8930c --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/excel/TopicCommentUserAttitudeExcel.java @@ -0,0 +1,65 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 话题评论用户表态表 话题评论用户表态表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@Data +public class TopicCommentUserAttitudeExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "评论ID") + private String commentId; + + @Excel(name = "用户ID") + private String userId; + + @Excel(name = "表态标识 0:点赞,1:点踩") + private String attitudeFlag; + + @Excel(name = "删除标记 0:未删除,1:删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/redis/TopicCommentRedis.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/redis/TopicCommentRedis.java new file mode 100755 index 000000000..b5f48c502 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/redis/TopicCommentRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 话题评论表 话题评论表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@Component +public class TopicCommentRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/redis/TopicCommentUserAttitudeRedis.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/redis/TopicCommentUserAttitudeRedis.java new file mode 100755 index 000000000..b21c40035 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/redis/TopicCommentUserAttitudeRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 话题评论用户表态表 话题评论用户表态表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@Component +public class TopicCommentUserAttitudeRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/TopicCommentService.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/TopicCommentService.java new file mode 100755 index 000000000..e512616de --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/TopicCommentService.java @@ -0,0 +1,110 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.comment.TopicCommentDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentsResultDTO; +import com.elink.esua.epdc.modules.comment.entity.TopicCommentEntity; + +import java.util.List; +import java.util.Map; + +/** + * 话题评论表 话题评论表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +public interface TopicCommentService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2019-10-23 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2019-10-23 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return TopicCommentDTO + * @author generator + * @date 2019-10-23 + */ + TopicCommentDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2019-10-23 + */ + void save(TopicCommentDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2019-10-23 + */ + void update(TopicCommentDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2019-10-23 + */ + void delete(String[] ids); + + /** + * 提交评论或回复接口 + * @param commentFormDTO + */ + Result submit(TopicCommentFormDTO commentFormDTO); + + /** + * 移动端评论列表 + */ + Result listOfComments(TopicCommentsFormDTO formDto); +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/TopicCommentUserAttitudeService.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/TopicCommentUserAttitudeService.java new file mode 100755 index 000000000..a75d25453 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/TopicCommentUserAttitudeService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.TopicCommentUserAttitudeDTO; +import com.elink.esua.epdc.modules.comment.entity.TopicCommentUserAttitudeEntity; + +import java.util.List; +import java.util.Map; + +/** + * 话题评论用户表态表 话题评论用户表态表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +public interface TopicCommentUserAttitudeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2019-10-23 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2019-10-23 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return TopicCommentUserAttitudeDTO + * @author generator + * @date 2019-10-23 + */ + TopicCommentUserAttitudeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2019-10-23 + */ + void save(TopicCommentUserAttitudeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2019-10-23 + */ + void update(TopicCommentUserAttitudeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2019-10-23 + */ + void delete(String[] ids); +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/impl/TopicCommentServiceImpl.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/impl/TopicCommentServiceImpl.java new file mode 100755 index 000000000..a3ee66683 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/impl/TopicCommentServiceImpl.java @@ -0,0 +1,188 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.constant.NumConstant; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.dto.comment.TopicCommentDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; +import com.elink.esua.epdc.dto.comment.TopicCommentsResultDTO; +import com.elink.esua.epdc.dto.constant.TopicNoticeConstant; +import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO; +import com.elink.esua.epdc.modules.async.NewsTask; +import com.elink.esua.epdc.modules.comment.dao.TopicCommentDao; +import com.elink.esua.epdc.modules.comment.entity.TopicCommentEntity; +import com.elink.esua.epdc.modules.comment.redis.TopicCommentRedis; +import com.elink.esua.epdc.modules.comment.service.TopicCommentService; +import com.elink.esua.epdc.modules.topic.service.TopicService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 话题评论表 话题评论表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@Service +public class TopicCommentServiceImpl extends BaseServiceImpl implements TopicCommentService { + + @Autowired + private TopicCommentRedis topicCommentRedis; + + @Autowired + private TopicService topicService; + + @Autowired + private NewsTask newsTask; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, TopicCommentDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, TopicCommentDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public TopicCommentDTO get(String id) { + TopicCommentEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, TopicCommentDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(TopicCommentDTO dto) { + TopicCommentEntity entity = ConvertUtils.sourceToTarget(dto, TopicCommentEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TopicCommentDTO dto) { + TopicCommentEntity entity = ConvertUtils.sourceToTarget(dto, TopicCommentEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Result submit(TopicCommentFormDTO commentFormDTO) { + + TopicCommentEntity commentEntity = new TopicCommentEntity(); + commentEntity.setContent(commentFormDTO.getContent()); + commentEntity.setUserId(commentFormDTO.getUserId()); + commentEntity.setUsername(commentFormDTO.getUserName()); + commentEntity.setUserFace(commentFormDTO.getUserFace()); + + boolean isComment = true; + + // 评论类型 0-评论 + String commentType = NumConstant.ZERO_STR; + // 父评论:用户回复的那条评论 + TopicCommentEntity parentComment = null; + if (!StringUtils.isEmpty(commentFormDTO.getFaCommentId())) { + parentComment = this.selectById(commentFormDTO.getFaCommentId()); + if (null == parentComment || null == parentComment.getId()) { + return new Result().error("您要回复的评论不存在"); + } + isComment = false; + commentType = NumConstant.ONE_STR; + commentEntity.setCommentId(commentFormDTO.getFaCommentId()); + commentEntity.setReplyUserId(parentComment.getUserId()); + commentEntity.setReplyUsername(parentComment.getUsername()); + commentEntity.setReplyUserFace(parentComment.getUserFace()); + } + commentEntity.setCommentType(commentType); + if (NumConstant.ONE != baseDao.insert(commentEntity)) { + return new Result().error("评论失败"); + } + // 回复加1 + if (NumConstant.ONE_STR.equals(commentType)) { + baseDao.updateReplyCount(commentFormDTO.getFaCommentId()); + } + // 评论数加1 + topicService.updateCommentNum(commentEntity.getTopicId()); + + // 组装发送消息内容 + EpdcInformationFormDTO informationFormDTO = new EpdcInformationFormDTO(); + informationFormDTO.setType(TopicNoticeConstant.NOTICE_TYPE_INTERACTIVE_NOTICE); + if (isComment) { + // 评论 + informationFormDTO.setUserId(commentEntity.getUserId()); + informationFormDTO.setContent(commentEntity.getContent()); + informationFormDTO.setTitle(TopicNoticeConstant.NOTICE_TOPIC_COMMENT); + informationFormDTO.setBusinessType(TopicNoticeConstant.NOTICE_BUSINESS_TYPE_TOPIC_COMMENT); + informationFormDTO.setBusinessId(commentEntity.getId()); + informationFormDTO.setRelBusinessContent(commentFormDTO.getUserName()+":"+commentFormDTO.getContent()); + } else { + // 回复 + informationFormDTO.setUserId(parentComment.getUserId()); + informationFormDTO.setContent(commentFormDTO.getUserName()+":"+commentFormDTO.getContent()); + informationFormDTO.setTitle(TopicNoticeConstant.NOTICE_TOPIC_COMMENT_REPLY); + informationFormDTO.setBusinessType(TopicNoticeConstant.NOTICE_BUSINESS_TYPE_TOPIC_COMMENT_REPLY); + informationFormDTO.setBusinessId(commentEntity.getId()); + informationFormDTO.setRelBusinessContent(parentComment.getContent()); + } + // 发送消息 + newsTask.insertUserInformation(informationFormDTO); + + return new Result(); + } + + + @Override + public Result listOfComments(TopicCommentsFormDTO formDto) { + return null; + } +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/impl/TopicCommentUserAttitudeServiceImpl.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/impl/TopicCommentUserAttitudeServiceImpl.java new file mode 100755 index 000000000..caf12eb65 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/impl/TopicCommentUserAttitudeServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.modules.comment.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.dto.TopicCommentUserAttitudeDTO; +import com.elink.esua.epdc.modules.comment.dao.TopicCommentUserAttitudeDao; +import com.elink.esua.epdc.modules.comment.entity.TopicCommentUserAttitudeEntity; +import com.elink.esua.epdc.modules.comment.redis.TopicCommentUserAttitudeRedis; +import com.elink.esua.epdc.modules.comment.service.TopicCommentUserAttitudeService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 话题评论用户表态表 话题评论用户表态表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-10-23 + */ +@Service +public class TopicCommentUserAttitudeServiceImpl extends BaseServiceImpl implements TopicCommentUserAttitudeService { + + @Autowired + private TopicCommentUserAttitudeRedis topicCommentUserAttitudeRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, TopicCommentUserAttitudeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, TopicCommentUserAttitudeDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public TopicCommentUserAttitudeDTO get(String id) { + TopicCommentUserAttitudeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, TopicCommentUserAttitudeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(TopicCommentUserAttitudeDTO dto) { + TopicCommentUserAttitudeEntity entity = ConvertUtils.sourceToTarget(dto, TopicCommentUserAttitudeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TopicCommentUserAttitudeDTO dto) { + TopicCommentUserAttitudeEntity entity = ConvertUtils.sourceToTarget(dto, TopicCommentUserAttitudeEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/TopicDao.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/TopicDao.java index e6d7e9c43..86adc36fb 100644 --- a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/TopicDao.java +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/TopicDao.java @@ -29,5 +29,10 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface TopicDao extends BaseDao { - -} \ No newline at end of file + + /** + * 评论数+1 + */ + void updateCommentNum(String id); + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/TopicService.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/TopicService.java index 6e63b7df8..c725fa991 100644 --- a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/TopicService.java +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/TopicService.java @@ -92,4 +92,10 @@ public interface TopicService extends BaseService { * @date 2019-10-10 */ void delete(String[] ids); -} \ No newline at end of file + + + /** + * 评论数+1 + */ + void updateCommentNum(String id); +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java index 388b99d45..432d0a81a 100644 --- a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java @@ -101,4 +101,9 @@ public class TopicServiceImpl extends BaseServiceImpl imp baseDao.deleteBatchIds(Arrays.asList(ids)); } -} \ No newline at end of file + @Override + public void updateCommentNum(String id) { + baseDao.updateCommentNum(id); + } + +} diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/comment/TopicCommentDao.xml b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/comment/TopicCommentDao.xml new file mode 100755 index 000000000..db7cb2a55 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/comment/TopicCommentDao.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE epdc_topic_comment + SET REPLY_COUNT = REPLY_COUNT + 1 + WHERE ID = #{commentId} + + + diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/comment/TopicCommentUserAttitudeDao.xml b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/comment/TopicCommentUserAttitudeDao.xml new file mode 100755 index 000000000..2d6d40d28 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/comment/TopicCommentUserAttitudeDao.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicDao.xml b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicDao.xml index a5b72af95..57b2b51ee 100644 --- a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicDao.xml +++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicDao.xml @@ -1,7 +1,12 @@ - + - \ No newline at end of file + + UPDATE epdc_topic SET COMMENT_NUM = COMMENT_NUM + 1 WHERE ID = #{id} + + + +