inleft
2022-03-02 e343e508ce5f2d355ad82c05a319981c66d1324b
评论页追加完成
8 files modified
92 ■■■■■ changed files
snowy-main/src/main/java/vip/xiaonuo/modular/blogStatistics/BlogStatisticsController.java 2 ●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/controller/BlogArticleCommentOutsideController.java 41 ●●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/entity/BlogCommentVo.java 4 ●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/mapper/BlogArticleCommentMapper.java 5 ●●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/mapper/mapping/BlogArticleCommentMapper.xml 25 ●●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/param/BlogCommentQueryDto.java 2 ●●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/service/BlogArticleCommentService.java 7 ●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/service/impl/BlogArticleCommentServiceImpl.java 6 ●●●●● patch | view | raw | blame | history
snowy-main/src/main/java/vip/xiaonuo/modular/blogStatistics/BlogStatisticsController.java
@@ -74,7 +74,7 @@
        String startFrom = "从这开始: 2020-05-27 ";
        String aliveDayCount = "已稳定运行:" + DateUtil.between(DateUtil.parseDate("2022-02-14"), new Date(), DateUnit.DAY) + "天";
        String lastUpdateDate = "上次更新:" + updateDate;
        String lastUpdateDate = "上次活跃于:" + updateDate;
        String visitCount = "累计访问:1010次"; //24小时ip 访问次数
        String visitorCount = "累计访客:1001名";//所有时间ip个数
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/controller/BlogArticleCommentOutsideController.java
@@ -25,6 +25,7 @@
package vip.xiaonuo.modular.blogarticlecomment.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -99,15 +100,33 @@
        List<BlogArticleComment> commentList = blogArticleCommentService.lambdaQuery()
                .eq(queryDto.getArticleId() != null, BlogArticleComment::getArticleId, queryDto.getArticleId())
                .eq(BlogArticleComment::getCommentType, queryDto.getArticleId() == null ? MyConstant.CommentType.type_1 : MyConstant.CommentType.type_2)
                .eq(BlogArticleComment::getIsCheck, MyConstant.Yes)
                .eq(BlogArticleComment::getIsEnable, MyConstant.Yes)
                .eq(BlogArticleComment::getParentId,0)
                .eq(BlogArticleComment::getParentId, 0)
                .orderByDesc(BlogArticleComment::getCreateDate)
                .page(queryPage).getRecords();
        int limitCount = 5;
        String privateComment = "******";
        List<BlogCommentVo> res = commentList.stream().map(e -> {
                    BlogCommentVo vo = new BlogCommentVo();
                    BeanUtil.copyProperties(e, vo);
                    vo.setIsHasNext(MyConstant.No);
                    List<BlogCommentVo> replyList = blogArticleCommentService.getReplyListById(e.getId(), limitCount);
                    vo.setReplyList(replyList);
                    if (e.getAuthStatus().equals(MyConstant.AuthStatus.privateCode)) {
                        vo.setCommentContent(privateComment);
                    }
                    if (CollUtil.isNotEmpty(replyList)
                            && blogArticleCommentService.lambdaQuery()
                            .eq(BlogArticleComment::getParentId, e.getId())
                            .eq(BlogArticleComment::getIsCheck, MyConstant.Yes)
                            .eq(BlogArticleComment::getIsEnable, MyConstant.Yes)
                            .count() > limitCount) {
                        vo.setIsHasNext(MyConstant.Yes);
                    }
                    return vo;
                }
        ).collect(Collectors.toList());
@@ -115,4 +134,24 @@
        queryPage.setRecords(res);
        return new SuccessResponseData(queryPage);
    }
    @GetMapping("/blogComment/queryBlogCommentSubList")
    @BusinessLog(title = "外部blog系统_blog留言/评论子列表_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData queryBlogCommentSubList(BlogCommentQueryDto queryDto) {
        if (queryDto.getArticleId() != null && blogArticleCommentService.getById(queryDto.getCommentId()) == null) {
            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);
            }
        }
        return new SuccessResponseData(replyList);
    }
}
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/entity/BlogCommentVo.java
@@ -33,4 +33,8 @@
    private List<BlogCommentVo> replyList;
    private Integer isHasNext;
    private Integer authStatus;
}
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/mapper/BlogArticleCommentMapper.java
@@ -25,7 +25,11 @@
package vip.xiaonuo.modular.blogarticlecomment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import vip.xiaonuo.modular.blogarticlecomment.entity.BlogArticleComment;
import vip.xiaonuo.modular.blogarticlecomment.entity.BlogCommentVo;
import java.util.List;
/**
 * 文章评论
@@ -34,4 +38,5 @@
 * @date 2022-03-01 14:00:53
 */
public interface BlogArticleCommentMapper extends BaseMapper<BlogArticleComment> {
    List<BlogCommentVo> getReplyListById(@Param("id") Long id, @Param("limitCount") Integer limitCount);
}
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/mapper/mapping/BlogArticleCommentMapper.xml
@@ -2,4 +2,29 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="vip.xiaonuo.modular.blogarticlecomment.mapper.BlogArticleCommentMapper">
    <select id="getReplyListById" resultType="vip.xiaonuo.modular.blogarticlecomment.entity.BlogCommentVo">
        SELECT
        b.id AS id,
        b.parent_id AS parentId,
        b.reply_id AS replyId,
        b.visitor_id AS visitorId,
        b.visitor_nick_name AS visitorNickName,
        b.visitor_home_page AS visitorHomePage,
        b.comment_content AS commentContent,
        b.create_date AS createDate,
        b.auth_status AS authStatus,
        a.visitor_nick_name AS replyUserName,
        a.visitor_home_page AS replyUserHomePage
        FROM
        `blog_article_comment` a
        INNER JOIN `blog_article_comment` b ON a.id = b.reply_id
        AND b.parent_id = #{id}
        AND b.is_enable=1
        AND b.is_check=1
        ORDER BY
        a.create_date ASC
        <if test="limitCount != null">
            LIMIT #{limitCount};
        </if>
    </select>
</mapper>
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/param/BlogCommentQueryDto.java
@@ -19,4 +19,6 @@
    private Long articleId;
    private Long commentId;
}
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/service/BlogArticleCommentService.java
@@ -27,7 +27,9 @@
import com.baomidou.mybatisplus.extension.service.IService;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.modular.blogarticlecomment.entity.BlogArticleComment;
import vip.xiaonuo.modular.blogarticlecomment.entity.BlogCommentVo;
import vip.xiaonuo.modular.blogarticlecomment.param.BlogArticleCommentParam;
import java.util.List;
/**
@@ -84,7 +86,7 @@
     * @author inleft
     * @date 2022-03-01 14:00:53
     */
     BlogArticleComment detail(BlogArticleCommentParam blogArticleCommentParam);
    BlogArticleComment detail(BlogArticleCommentParam blogArticleCommentParam);
    /**
     * 导出文章评论
@@ -92,6 +94,7 @@
     * @author inleft
     * @date 2022-03-01 14:00:53
     */
     void export(BlogArticleCommentParam blogArticleCommentParam);
    void export(BlogArticleCommentParam blogArticleCommentParam);
    List<BlogCommentVo> getReplyListById(Long id, Integer limitCount);
}
snowy-main/src/main/java/vip/xiaonuo/modular/blogarticlecomment/service/impl/BlogArticleCommentServiceImpl.java
@@ -33,6 +33,7 @@
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.core.util.PoiUtil;
import vip.xiaonuo.modular.blogarticlecomment.entity.BlogArticleComment;
import vip.xiaonuo.modular.blogarticlecomment.entity.BlogCommentVo;
import vip.xiaonuo.modular.blogarticlecomment.enums.BlogArticleCommentExceptionEnum;
import vip.xiaonuo.modular.blogarticlecomment.mapper.BlogArticleCommentMapper;
import vip.xiaonuo.modular.blogarticlecomment.param.BlogArticleCommentParam;
@@ -153,4 +154,9 @@
        PoiUtil.exportExcelWithStream("SnowyBlogArticleComment.xls", BlogArticleComment.class, list);
    }
    @Override
    public List<BlogCommentVo> getReplyListById(Long id, Integer limitCount) {
        return this.baseMapper.getReplyListById(id, limitCount);
    }
}