diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/BehaviorEnum.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/BehaviorEnum.java index c047767b..c4e80bc8 100644 --- a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/BehaviorEnum.java +++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/BehaviorEnum.java @@ -298,7 +298,7 @@ public enum BehaviorEnum { NOTICE_COMMENT_SUBMIT("notice_comment_submit"), /** - * 回复内容的评论 + * 内容评论的回复 */ NOTICE_COMMENT_REPLY_SUBMIT("notice_comment_reply_submit"), diff --git a/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/NoticeShieldCommentsFormDTO.java b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/NoticeShieldCommentsFormDTO.java new file mode 100644 index 00000000..fc23840c --- /dev/null +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/NoticeShieldCommentsFormDTO.java @@ -0,0 +1,16 @@ +package com.elink.esua.epdc.dto.epdc.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author:liuchuang + * @Date:2019/11/12 11:06 + */ +@Data +public class NoticeShieldCommentsFormDTO implements Serializable { + private static final long serialVersionUID = -8359841146893592752L; + + private String[] commentIds; +} diff --git a/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/NoticeCommentListDTO.java b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/NoticeCommentListDTO.java new file mode 100644 index 00000000..98bc16b9 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/NoticeCommentListDTO.java @@ -0,0 +1,60 @@ +package com.elink.esua.epdc.dto.epdc.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author:liuchuang + * @Date:2019/11/12 10:55 + */ +@Data +public class NoticeCommentListDTO implements Serializable { + private static final long serialVersionUID = 1678760230045285655L; + + /** + * 评论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-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/ReplyCommentDto.java b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/ReplyCommentDto.java new file mode 100644 index 00000000..a6ea0bd8 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/ReplyCommentDto.java @@ -0,0 +1,24 @@ +package com.elink.esua.epdc.dto.epdc.result; + +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-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/UserBaseInfoDto.java b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/UserBaseInfoDto.java new file mode 100644 index 00000000..355bc923 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/UserBaseInfoDto.java @@ -0,0 +1,33 @@ +package com.elink.esua.epdc.dto.epdc.result; + +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; + + /** + * 党员标识是否是党员(0-否,1-是) + */ + private String partyFlag; +} diff --git a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/NoticeCommentController.java b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/NoticeCommentController.java index 379d0f59..5498cec0 100644 --- a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/NoticeCommentController.java +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/NoticeCommentController.java @@ -26,6 +26,8 @@ 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.NoticeCommentDTO; +import com.elink.esua.epdc.dto.epdc.form.NoticeShieldCommentsFormDTO; +import com.elink.esua.epdc.dto.epdc.result.NoticeCommentListDTO; import com.elink.esua.epdc.service.NoticeCommentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -84,4 +86,31 @@ public class NoticeCommentController { return new Result(); } + /** + * 评论列表 + * + * @param params + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author Liuchuang + * @since 2021/3/16 16:12 + */ + @GetMapping("comments") + public Result> commentsList(@RequestParam Map params) { + PageData page = noticeCommentService.listComments(params); + return new Result>().ok(page); + } + + /** + * 屏蔽评论 + * + * @param formDto + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author Liuchuang + * @since 2021/3/16 16:14 + */ + @PostMapping("shieldComment") + public Result shieldComment(@RequestBody NoticeShieldCommentsFormDTO formDto) { + return noticeCommentService.modifyCommentById(formDto.getCommentIds()); + } + } diff --git a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeCommentDao.java b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeCommentDao.java index a92b7a70..8ee0f2d6 100644 --- a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeCommentDao.java +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeCommentDao.java @@ -20,10 +20,13 @@ package com.elink.esua.epdc.dao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentListFormDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO; +import com.elink.esua.epdc.dto.epdc.result.NoticeCommentListDTO; import com.elink.esua.epdc.entity.NoticeCommentEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * 内容评论表 @@ -104,4 +107,24 @@ public interface NoticeCommentDao extends BaseDao { */ List selectListNoticeComments(EpdcNoticeCommentListFormDTO formDto); + /** + * 评论列表 + * + * @param params + * @return java.util.List + * @author Liuchuang + * @since 2021/3/16 16:17 + */ + List selectListOfCommentsByNoticeId(Map params); + + /** + * 屏蔽评论 + * + * @param commentIds + * @return void + * @author Liuchuang + * @since 2021/3/16 16:17 + */ + void updateCommentShieldFlag(@Param("commentIds") String[] commentIds); + } diff --git a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/NoticeCommentService.java b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/NoticeCommentService.java index c8be9b65..0ddfc0ee 100644 --- a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/NoticeCommentService.java +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/NoticeCommentService.java @@ -25,6 +25,7 @@ import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentListFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentStatementFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentSubmitFormDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO; +import com.elink.esua.epdc.dto.epdc.result.NoticeCommentListDTO; import com.elink.esua.epdc.entity.NoticeCommentEntity; import java.util.List; @@ -167,4 +168,24 @@ public interface NoticeCommentService extends BaseService { * @since 2021/3/16 14:59 */ void updateNoticeCommentOpposeNumSubtract(String commentId); + + /** + * 评论列表 + * + * @param params + * @return com.elink.esua.epdc.commons.tools.page.PageData + * @author Liuchuang + * @since 2021/3/16 16:15 + */ + PageData listComments(Map params); + + /** + * 屏蔽评论 + * + * @param commentIds + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author Liuchuang + * @since 2021/3/16 16:15 + */ + Result modifyCommentById(String[] commentIds); } diff --git a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeCommentServiceImpl.java b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeCommentServiceImpl.java index 6e69490e..c5af138d 100644 --- a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeCommentServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeCommentServiceImpl.java @@ -33,6 +33,7 @@ import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentStatementFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentSubmitFormDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO; +import com.elink.esua.epdc.dto.epdc.result.NoticeCommentListDTO; import com.elink.esua.epdc.entity.NoticeCommentEntity; import com.elink.esua.epdc.entity.NoticeCommentUserAttitudeEntity; import com.elink.esua.epdc.service.NoticeCommentService; @@ -198,4 +199,18 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl listComments(Map params) { + IPage page = getPage(params); + List list = baseDao.selectListOfCommentsByNoticeId(params); + return new PageData<>(list, page.getTotal()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result modifyCommentById(String[] commentIds) { + baseDao.updateCommentShieldFlag(commentIds); + return new Result(); + } + } diff --git a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeCommentDao.xml b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeCommentDao.xml index 467372d4..38a1ced2 100644 --- a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeCommentDao.xml +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeCommentDao.xml @@ -121,4 +121,60 @@ t2.CREATED_TIME DESC + + + + + + + + + + + + + + + UPDATE epdc_notice_comment SET SHIELD_FLAG = '1' WHERE ID IN + + #{commentId} + + +