feat: add totalCommentInt & thumbupCountInt

main
wangqing 9 months ago
parent 54b731450c
commit eb6055d477

@ -152,6 +152,7 @@ public class CommentController extends BaseController {
CommentResp commentResp = new CommentResp(); CommentResp commentResp = new CommentResp();
BeanUtils.copyProperties(comment,commentResp); BeanUtils.copyProperties(comment,commentResp);
commentResp.setThumbupCountString(comment.getThumbupCount()+""); commentResp.setThumbupCountString(comment.getThumbupCount()+"");
commentResp.setThumbupCountInt(comment.getThumbupCount());
if(comment.getThumbupCount()>999) { if(comment.getThumbupCount()>999) {
commentResp.setThumbupCountString("999+"); commentResp.setThumbupCountString("999+");
} }

@ -27,6 +27,8 @@ public class CommentResp implements Serializable {
// 点赞数 // 点赞数
private String thumbupCountString; private String thumbupCountString;
private int thumbupCountInt;
// 转发数 // 转发数
// private Integer share; // private Integer share;
// 评论数量 // 评论数量

@ -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)) { if (StringUtils.isNotBlank(totalString)) {
commentDTO.setTotalCommentReply(totalString); commentDTO.setTotalCommentReply(totalString);
}else { }else {
@ -58,7 +58,8 @@ public class CommentMapper {
} }
} }
commentDTO.setTotalCommentReply(totalString); 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);
} }

@ -91,6 +91,7 @@ public class JournalMapper {
redisTemplate); redisTemplate);
journalRespDTO.setCommentList(commentDTO.getCommentList()); journalRespDTO.setCommentList(commentDTO.getCommentList());
journalRespDTO.setTotalCommentReply(commentDTO.getTotalCommentReply()); journalRespDTO.setTotalCommentReply(commentDTO.getTotalCommentReply());
journalRespDTO.setTotalCommentReplyInt(commentDTO.getTotalCommentReplyInt());
return journalRespDTO; return journalRespDTO;
} }

@ -13,4 +13,7 @@ public class CommentDTO {
@ApiModelProperty(value = "期刊总评论数,大于99显示99+") @ApiModelProperty(value = "期刊总评论数,大于99显示99+")
private String totalCommentReply; private String totalCommentReply;
@ApiModelProperty(value = "期刊总评论数int")
private int totalCommentReplyInt;
} }

@ -38,4 +38,7 @@ public class JournalRespDTO implements Serializable {
@ApiModelProperty(value = "期刊总评论数,大于99显示99+") @ApiModelProperty(value = "期刊总评论数,大于99显示99+")
private String totalCommentReply; private String totalCommentReply;
@ApiModelProperty(value = "期刊总评论数int")
private int totalCommentReplyInt;
} }

Loading…
Cancel
Save