snowy-base/snowy-core/src/main/java/vip/xiaonuo/core/consts/MyConstant.java
@@ -4,6 +4,10 @@ Integer No = 0; Integer Yes = 1; String privateComment = "(悄悄话已隐藏)******"; String checkComment = "(未审核消息)******"; interface AuthStatus { int publicCode = 1; int privateCode = 2; snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/entity/BlogArticle.java
@@ -124,6 +124,10 @@ @Excel(name = "编辑状态 0:草稿 1:发布") private Integer editorStatus; @Excel(name = "是否允许评论 0:否 1:是") private Integer isAllowedComment; /** * 归档年份(以初次发布时间为准) */ snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/entity/BlogArticleVo.java
@@ -89,7 +89,7 @@ /** * 发布时间 */ @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") private Date publishDate; /** @@ -103,10 +103,10 @@ */ private Integer authStatus; /** * 创建时间 * 是否允许评论 0:否 1:是 */ private Date createDate; private Integer isAllowedComment; } snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/mapper/mapping/BlogArticleMapper.xml
@@ -23,6 +23,7 @@ a.publish_date, a.is_top, a.editor_status, a.is_allowed_comment, a.create_date </sql> snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/param/BlogArticleParam.java
@@ -115,6 +115,11 @@ private Integer editorStatus; /** * 是否允许评论 */ private Integer isAllowedComment; /** * 归档年份 */ private Integer separateYear; snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/controller/BlogArticleCommentOutsideController.java
@@ -35,6 +35,7 @@ import vip.xiaonuo.core.exception.BlogException; import vip.xiaonuo.core.pojo.response.ResponseData; import vip.xiaonuo.core.pojo.response.SuccessResponseData; import vip.xiaonuo.modular.blogarticle.entity.BlogArticle; import vip.xiaonuo.modular.blogarticle.service.BlogArticleService; import vip.xiaonuo.modular.blogarticlecomment.entity.BlogArticleComment; import vip.xiaonuo.modular.blogarticlecomment.entity.BlogCommentVo; @@ -71,13 +72,18 @@ if (addDto.getArticleId() == null) { throw new BlogException("评论类型为日志评论,日志id不能为空"); } if (blogArticleService.getById(addDto.getId()) == null) { BlogArticle checkArticle = blogArticleService.getById(addDto.getId()); if (checkArticle == null) { throw new BlogException("查询不到相关日志"); } if (checkArticle.getIsAllowedComment().equals(MyConstant.No)) { throw new BlogException("该日志评论已经关闭.."); } } BlogArticleComment insert = new BlogArticleComment(); BeanUtil.copyProperties(addDto, insert); insert.setIsCheck(MyConstant.No); insert.setIsCheck(MyConstant.Yes); insert.setIsEnable(MyConstant.Yes); insert.setIsReceiveCallback(addDto.getIsReceiveMail()); @@ -106,8 +112,7 @@ .orderByDesc(BlogArticleComment::getCreateDate) .page(queryPage).getRecords(); int limitCount = 5; String privateComment = "******"; int limitCount = 3; List<BlogCommentVo> res = commentList.stream().map(e -> { BlogCommentVo vo = new BlogCommentVo(); BeanUtil.copyProperties(e, vo); @@ -116,7 +121,7 @@ vo.setReplyList(replyList); if (e.getAuthStatus().equals(MyConstant.AuthStatus.privateCode)) { vo.setCommentContent(privateComment); vo.setCommentContent(MyConstant.privateComment); } if (CollUtil.isNotEmpty(replyList) @@ -142,13 +147,12 @@ throw new BlogException("查询不到相关评论"); } String privateComment = "(悄悄话已隐藏)******"; List<BlogCommentVo> replyList = blogArticleCommentService.getReplyListById(queryDto.getCommentId(), null); for (BlogCommentVo vo : replyList) { vo.setIsHasNext(MyConstant.No); if (vo.getAuthStatus().equals(MyConstant.AuthStatus.privateCode)) { vo.setCommentContent(privateComment); vo.setCommentContent(MyConstant.privateComment); } } snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/entity/BlogCommentVo.java
@@ -28,7 +28,7 @@ private String replyUserHomePage; @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm") private Date createDate; private List<BlogCommentVo> replyList;