From eb6055d4776c6c8e92b0e6839f2707555e18c4c7 Mon Sep 17 00:00:00 2001 From: wangqing <408564126@qq.com> Date: Wed, 28 Feb 2024 10:38:58 +0800 Subject: [PATCH] feat: add totalCommentInt & thumbupCountInt --- .../java/com/luoo/comment/controller/CommentController.java | 1 + .../src/main/java/com/luoo/comment/pojo/CommentResp.java | 2 ++ .../main/java/com/luoo/music/dto/mapper/CommentMapper.java | 5 +++-- .../main/java/com/luoo/music/dto/mapper/JournalMapper.java | 1 + .../main/java/com/luoo/music/dto/response/CommentDTO.java | 3 +++ .../java/com/luoo/music/dto/response/JournalRespDTO.java | 3 +++ 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/luoo_comment/src/main/java/com/luoo/comment/controller/CommentController.java b/luoo_comment/src/main/java/com/luoo/comment/controller/CommentController.java index 8049685..b79a084 100644 --- a/luoo_comment/src/main/java/com/luoo/comment/controller/CommentController.java +++ b/luoo_comment/src/main/java/com/luoo/comment/controller/CommentController.java @@ -152,6 +152,7 @@ public class CommentController extends BaseController { CommentResp commentResp = new CommentResp(); BeanUtils.copyProperties(comment,commentResp); commentResp.setThumbupCountString(comment.getThumbupCount()+""); + commentResp.setThumbupCountInt(comment.getThumbupCount()); if(comment.getThumbupCount()>999) { commentResp.setThumbupCountString("999+"); } diff --git a/luoo_comment/src/main/java/com/luoo/comment/pojo/CommentResp.java b/luoo_comment/src/main/java/com/luoo/comment/pojo/CommentResp.java index 1a0036a..3e60906 100644 --- a/luoo_comment/src/main/java/com/luoo/comment/pojo/CommentResp.java +++ b/luoo_comment/src/main/java/com/luoo/comment/pojo/CommentResp.java @@ -27,6 +27,8 @@ public class CommentResp implements Serializable { // 点赞数 private String thumbupCountString; + + private int thumbupCountInt; // 转发数 // private Integer share; // 评论数量 diff --git a/luoo_music/src/main/java/com/luoo/music/dto/mapper/CommentMapper.java b/luoo_music/src/main/java/com/luoo/music/dto/mapper/CommentMapper.java index 1525108..b132324 100644 --- a/luoo_music/src/main/java/com/luoo/music/dto/mapper/CommentMapper.java +++ b/luoo_music/src/main/java/com/luoo/music/dto/mapper/CommentMapper.java @@ -34,7 +34,7 @@ public class CommentMapper { * 获取期刊总评论数 一级评论数加上父评论的总回复数 */ - String totalString = (String) redisTemplate.opsForValue().get("JOURNAL_TATAL_COMMENT_COUNT___"+journalId); + String totalString = (String) redisTemplate.opsForValue().get("JOURNAL_TATAL_COMMENT_COUNT__"+journalId); if (StringUtils.isNotBlank(totalString)) { commentDTO.setTotalCommentReply(totalString); }else { @@ -58,7 +58,8 @@ public class CommentMapper { } } commentDTO.setTotalCommentReply(totalString); - redisTemplate.opsForValue().set("JOURNAL_TATAL_COMMENT_COUNT___"+journalId,totalString,6,TimeUnit.HOURS); + commentDTO.setTotalCommentReplyInt(total); + redisTemplate.opsForValue().set("JOURNAL_TATAL_COMMENT_COUNT__"+journalId,totalString,6,TimeUnit.HOURS); } diff --git a/luoo_music/src/main/java/com/luoo/music/dto/mapper/JournalMapper.java b/luoo_music/src/main/java/com/luoo/music/dto/mapper/JournalMapper.java index bffc1b3..76ec2cd 100644 --- a/luoo_music/src/main/java/com/luoo/music/dto/mapper/JournalMapper.java +++ b/luoo_music/src/main/java/com/luoo/music/dto/mapper/JournalMapper.java @@ -91,6 +91,7 @@ public class JournalMapper { redisTemplate); journalRespDTO.setCommentList(commentDTO.getCommentList()); journalRespDTO.setTotalCommentReply(commentDTO.getTotalCommentReply()); + journalRespDTO.setTotalCommentReplyInt(commentDTO.getTotalCommentReplyInt()); return journalRespDTO; } diff --git a/luoo_music/src/main/java/com/luoo/music/dto/response/CommentDTO.java b/luoo_music/src/main/java/com/luoo/music/dto/response/CommentDTO.java index 619b4c4..488ef06 100644 --- a/luoo_music/src/main/java/com/luoo/music/dto/response/CommentDTO.java +++ b/luoo_music/src/main/java/com/luoo/music/dto/response/CommentDTO.java @@ -13,4 +13,7 @@ public class CommentDTO { @ApiModelProperty(value = "期刊总评论数,大于99,显示99+") private String totalCommentReply; + + @ApiModelProperty(value = "期刊总评论数int") + private int totalCommentReplyInt; } diff --git a/luoo_music/src/main/java/com/luoo/music/dto/response/JournalRespDTO.java b/luoo_music/src/main/java/com/luoo/music/dto/response/JournalRespDTO.java index fee0ec5..7a37da0 100644 --- a/luoo_music/src/main/java/com/luoo/music/dto/response/JournalRespDTO.java +++ b/luoo_music/src/main/java/com/luoo/music/dto/response/JournalRespDTO.java @@ -38,4 +38,7 @@ public class JournalRespDTO implements Serializable { @ApiModelProperty(value = "期刊总评论数,大于99,显示99+") private String totalCommentReply; + + @ApiModelProperty(value = "期刊总评论数int") + private int totalCommentReplyInt; }