feat: 单条评论的回复列表
This commit is contained in:
@@ -413,7 +413,7 @@ public class SchisandraOssAliController {
|
|||||||
|
|
||||||
|
|
||||||
private void parameterCheck(SchisandraOssAliDTO schisandraOssAliDTO) {
|
private void parameterCheck(SchisandraOssAliDTO schisandraOssAliDTO) {
|
||||||
Preconditions.checkNotNull(schisandraOssAliDTO.getId(), "不能为空");
|
Preconditions.checkNotNull(schisandraOssAliDTO.getId(), "ID不能为空");
|
||||||
Preconditions.checkNotNull(schisandraOssAliDTO.getEndpoint(), "OSS地址不能为空");
|
Preconditions.checkNotNull(schisandraOssAliDTO.getEndpoint(), "OSS地址不能为空");
|
||||||
Preconditions.checkNotNull(schisandraOssAliDTO.getAccessKeyId(), "AccessKey ID不能为空");
|
Preconditions.checkNotNull(schisandraOssAliDTO.getAccessKeyId(), "AccessKey ID不能为空");
|
||||||
Preconditions.checkNotNull(schisandraOssAliDTO.getAccessKeySecret(), "AccessKey Secret不能为空");
|
Preconditions.checkNotNull(schisandraOssAliDTO.getAccessKeySecret(), "AccessKey Secret不能为空");
|
||||||
|
@@ -66,7 +66,7 @@ public class SchisandraOssAliDomainServiceImpl implements SchisandraOssAliDomain
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean delete(SchisandraOssAliBO schisandraOssAliBO) {
|
public Boolean delete(SchisandraOssAliBO schisandraOssAliBO) {
|
||||||
SchisandraUserOss userOss = schisandraUserOssService.queryOSSByTypeAndUserId(schisandraOssAliBO.getUserId(), String.valueOf(OssType.ALI));
|
SchisandraUserOss userOss = schisandraUserOssService.queryOSSByTypeAndUserId(schisandraOssAliBO.getUserId(), OssType.ALI.type);
|
||||||
userOss.setConfigCount(userOss.getConfigCount()-1);
|
userOss.setConfigCount(userOss.getConfigCount()-1);
|
||||||
schisandraUserOssService.update(userOss);
|
schisandraUserOssService.update(userOss);
|
||||||
SchisandraOssAli schisandraOssAli = new SchisandraOssAli();
|
SchisandraOssAli schisandraOssAli = new SchisandraOssAli();
|
||||||
|
@@ -51,7 +51,7 @@ public class SchisandraShareCircleController {
|
|||||||
/**
|
/**
|
||||||
* 分享圈列表返回
|
* 分享圈列表返回
|
||||||
*/
|
*/
|
||||||
@Cacheable(value = "sharelist",key = "list")
|
@Cacheable(value = "sharelist",key = "sharelist")
|
||||||
@GetMapping("sharelist")
|
@GetMapping("sharelist")
|
||||||
public Result<List<SchisandraShareCircleDTO>> getShareList() {
|
public Result<List<SchisandraShareCircleDTO>> getShareList() {
|
||||||
try {
|
try {
|
||||||
|
@@ -8,6 +8,7 @@ import com.schisandra.share.common.entity.Result;
|
|||||||
import com.schisandra.share.domain.bo.SchisandraShareCommentReplyBO;
|
import com.schisandra.share.domain.bo.SchisandraShareCommentReplyBO;
|
||||||
import com.schisandra.share.domain.service.SchisandraShareCommentReplyDomainService;
|
import com.schisandra.share.domain.service.SchisandraShareCommentReplyDomainService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -27,23 +28,53 @@ public class SchisandraShareCommentReplyController {
|
|||||||
@Resource
|
@Resource
|
||||||
private SchisandraShareCommentReplyDomainService schisandraShareCommentReplyDomainService;
|
private SchisandraShareCommentReplyDomainService schisandraShareCommentReplyDomainService;
|
||||||
|
|
||||||
|
@GetMapping("addlike")
|
||||||
|
public Result addLike(String Id){
|
||||||
|
return Result.ok(schisandraShareCommentReplyDomainService.addLike(Id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询该动态下的评论
|
*
|
||||||
|
* 返回当前评论的回复
|
||||||
|
* @param commentId
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "listcommen")
|
@PostMapping(value = "listreply")
|
||||||
public Result<List<SchisandraShareCommentReplyDTO>> list(@RequestParam String detailId) {
|
public Result listReply(@RequestParam String commentId) {
|
||||||
try {
|
try {
|
||||||
List<SchisandraShareCommentReplyBO> result = schisandraShareCommentReplyDomainService.listComment(detailId);
|
List<SchisandraShareCommentReplyBO> result = schisandraShareCommentReplyDomainService.listReply(commentId);
|
||||||
if (log.isInfoEnabled()) {
|
if (log.isInfoEnabled()) {
|
||||||
log.info("获取鸡圈评论内容{}", JSON.toJSONString(result));
|
log.info("获取评论回复{}", JSON.toJSONString(result));
|
||||||
}
|
}
|
||||||
return Result.ok(SchisandraShareCommentReplyDTOConverter.INSTANCE.convertBOToDTOList(result));
|
return Result.ok(SchisandraShareCommentReplyDTOConverter.INSTANCE.convertBOToDTOList(result));
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
log.error("参数异常!错误原因{}", e.getMessage(), e);
|
log.error("参数异常!错误原因{}", e.getMessage(), e);
|
||||||
return Result.fail(e.getMessage());
|
return Result.fail(e.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取鸡圈评论内容异常!错误原因{}", e.getMessage(), e);
|
log.error("获取当前评论回复异常!错误原因{}", e.getMessage(), e);
|
||||||
return Result.fail("获取鸡圈评论内容异常!");
|
return Result.fail("获取当前评论回复异常!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询该动态下的评论
|
||||||
|
*/
|
||||||
|
@Cacheable(value = "listcommen",key = "#detailId")
|
||||||
|
@PostMapping(value = "listcommen")
|
||||||
|
public Result<List<SchisandraShareCommentReplyDTO>> listComment(@RequestParam String detailId) {
|
||||||
|
try {
|
||||||
|
List<SchisandraShareCommentReplyBO> result = schisandraShareCommentReplyDomainService.listComment(detailId);
|
||||||
|
if (log.isInfoEnabled()) {
|
||||||
|
log.info("获取当前文章评论内容{}", JSON.toJSONString(result));
|
||||||
|
}
|
||||||
|
return Result.ok(SchisandraShareCommentReplyDTOConverter.INSTANCE.convertBOToDTOList(result));
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
log.error("参数异常!错误原因{}", e.getMessage(), e);
|
||||||
|
return Result.fail(e.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取当前文章内容异常!错误原因{}", e.getMessage(), e);
|
||||||
|
return Result.fail("获取当前文章内容异常!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -107,5 +107,16 @@ public class SchisandraShareCommentReplyDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer replyCount;
|
||||||
|
|
||||||
|
private String nick;
|
||||||
|
|
||||||
|
private String nickto;
|
||||||
|
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -103,6 +103,16 @@ public class SchisandraShareCommentReplyBO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
private String nickName;
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer replyCount;
|
||||||
|
|
||||||
|
private String nick;
|
||||||
|
|
||||||
|
private String nickto;
|
||||||
|
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,4 +32,8 @@ public interface SchisandraShareCommentReplyDomainService {
|
|||||||
Boolean delete(SchisandraShareCommentReplyBO schisandraShareCommentReplyBO);
|
Boolean delete(SchisandraShareCommentReplyBO schisandraShareCommentReplyBO);
|
||||||
|
|
||||||
List<SchisandraShareCommentReplyBO> listComment(String detailId);
|
List<SchisandraShareCommentReplyBO> listComment(String detailId);
|
||||||
|
|
||||||
|
List<SchisandraShareCommentReplyBO> listReply(String commentId);
|
||||||
|
|
||||||
|
Boolean addLike(String Id);
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,7 @@ import com.schisandra.share.infra.entity.AuthUserInfoEntity;
|
|||||||
import com.schisandra.share.infra.rpc.UserRpc;
|
import com.schisandra.share.infra.rpc.UserRpc;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -44,16 +45,18 @@ public class SchisandraShareCommentReplyDomainServiceImpl implements SchisandraS
|
|||||||
schisandraShareCommentReply.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
schisandraShareCommentReply.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
||||||
schisandraShareCommentReply.setReplyType(1);
|
schisandraShareCommentReply.setReplyType(1);
|
||||||
schisandraShareCommentReply.setLikes(0L);
|
schisandraShareCommentReply.setLikes(0L);
|
||||||
if(schisandraShareCommentReply.getToId()!=null){
|
|
||||||
//查询to_user
|
Assert.notNull(schisandraShareCommentReply.getToId());
|
||||||
SchisandraShareCommentReply comment = schisandraShareCommentReplyService.queryById(schisandraShareCommentReply.getToId());
|
//查询to_user
|
||||||
schisandraShareCommentReply.setToUser(comment.getUserId());
|
SchisandraShareCommentReply comment = schisandraShareCommentReplyService.queryById(schisandraShareCommentReply.getToId());
|
||||||
}
|
int newReplyCount = comment.getReplyCount() + 1;
|
||||||
if(schisandraShareCommentReply.getReplyId()!=null){
|
comment.setReplyCount(newReplyCount);
|
||||||
//查询reply_user
|
schisandraShareCommentReplyService.update(comment);
|
||||||
SchisandraShareCommentReply reply = schisandraShareCommentReplyService.queryById(schisandraShareCommentReply.getReplyId());
|
|
||||||
schisandraShareCommentReply.setReplyUser(reply.getUserId());
|
Assert.notNull(schisandraShareCommentReply.getReplyId());
|
||||||
}
|
//查询reply_user
|
||||||
|
SchisandraShareCommentReply reply = schisandraShareCommentReplyService.queryById(schisandraShareCommentReply.getReplyId());
|
||||||
|
schisandraShareCommentReply.setReplyUser(reply.getUserId());
|
||||||
return schisandraShareCommentReplyService.insert(schisandraShareCommentReply) > 0;
|
return schisandraShareCommentReplyService.insert(schisandraShareCommentReply) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,12 +76,33 @@ public class SchisandraShareCommentReplyDomainServiceImpl implements SchisandraS
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SchisandraShareCommentReplyBO> listComment(String detailId) {
|
public List<SchisandraShareCommentReplyBO> listComment(String detailId) {
|
||||||
List<SchisandraShareCommentReply> schisandraShareCommentReplies = schisandraShareCommentReplyService.listComment(detailId);
|
List<SchisandraShareCommentReply> schisandraShareComments = schisandraShareCommentReplyService.listComment(detailId);
|
||||||
List<SchisandraShareCommentReplyBO> schisandraShareCommentReplyBOS = SchisandraShareCommentReplyBOConverter.INSTANCE.convertEntityToBOList(schisandraShareCommentReplies);
|
List<SchisandraShareCommentReplyBO> schisandraShareCommentBOS = SchisandraShareCommentReplyBOConverter.INSTANCE.convertEntityToBOList(schisandraShareComments);
|
||||||
schisandraShareCommentReplyBOS.forEach(schisandraShareCommentReplyBO -> {
|
schisandraShareCommentBOS.forEach(schisandraShareCommentReplyBO -> {
|
||||||
AuthUserInfoEntity userInfo = userRpc.getUserInfo(schisandraShareCommentReplyBO.getUserId());
|
AuthUserInfoEntity userInfo = userRpc.getUserInfo(schisandraShareCommentReplyBO.getUserId());
|
||||||
schisandraShareCommentReplyBO.setNickName(userInfo.getNickName());
|
schisandraShareCommentReplyBO.setNick(userInfo.getNickName());
|
||||||
|
schisandraShareCommentReplyBO.setAvatar(userInfo.getAvatar());
|
||||||
});
|
});
|
||||||
return schisandraShareCommentReplyBOS;
|
return schisandraShareCommentBOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraShareCommentReplyBO> listReply(String commentId) {
|
||||||
|
List<SchisandraShareCommentReply> schisandraShareReplies = schisandraShareCommentReplyService.listReply(commentId);
|
||||||
|
List<SchisandraShareCommentReplyBO> schisandraShareRepliesBO = SchisandraShareCommentReplyBOConverter.INSTANCE.convertEntityToBOList(schisandraShareReplies);
|
||||||
|
schisandraShareRepliesBO.forEach(schisandraShareReplyBO -> {
|
||||||
|
schisandraShareReplyBO.setNickto(userRpc.getUserInfo(schisandraShareReplyBO.getReplyId()).getNickName());
|
||||||
|
AuthUserInfoEntity userInfo = userRpc.getUserInfo(schisandraShareReplyBO.getUserId());
|
||||||
|
schisandraShareReplyBO.setNick(userInfo.getNickName());
|
||||||
|
schisandraShareReplyBO.setAvatar(userInfo.getAvatar());
|
||||||
|
});
|
||||||
|
return schisandraShareRepliesBO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean addLike(String Id) {
|
||||||
|
SchisandraShareCommentReply schisandraShareCommentReply = schisandraShareCommentReplyService.queryById(Id);
|
||||||
|
schisandraShareCommentReply.setLikes(schisandraShareCommentReply.getLikes()+1);
|
||||||
|
return schisandraShareCommentReplyService.update(schisandraShareCommentReply) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -127,6 +127,10 @@ public class SchisandraShareCommentReply implements Serializable {
|
|||||||
@Column("is_deleted")
|
@Column("is_deleted")
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column("reply_count")
|
||||||
|
private Integer replyCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,4 +45,5 @@ public interface SchisandraShareCommentReplyService {
|
|||||||
|
|
||||||
List<SchisandraShareCommentReply> listComment(String detailId);
|
List<SchisandraShareCommentReply> listComment(String detailId);
|
||||||
|
|
||||||
|
List<SchisandraShareCommentReply> listReply(String commentId);
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.schisandra.share.infra.basic.service.impl;
|
package com.schisandra.share.infra.basic.service.impl;
|
||||||
|
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import com.schisandra.share.common.enums.IsDeletedFlagEnum;
|
||||||
import com.schisandra.share.infra.basic.entity.SchisandraShareCommentReply;
|
import com.schisandra.share.infra.basic.entity.SchisandraShareCommentReply;
|
||||||
import com.schisandra.share.infra.basic.dao.SchisandraShareCommentReplyDao;
|
import com.schisandra.share.infra.basic.dao.SchisandraShareCommentReplyDao;
|
||||||
import com.schisandra.share.infra.basic.entity.table.SchisandraShareCommentReplyTableDef;
|
import com.schisandra.share.infra.basic.entity.table.SchisandraShareCommentReplyTableDef;
|
||||||
@@ -69,12 +70,37 @@ public class SchisandraShareCommentReplyServiceImpl implements SchisandraShareCo
|
|||||||
@Override
|
@Override
|
||||||
public List<SchisandraShareCommentReply> listComment(String detailId) {
|
public List<SchisandraShareCommentReply> listComment(String detailId) {
|
||||||
QueryWrapper wrapper = QueryWrapper.create()
|
QueryWrapper wrapper = QueryWrapper.create()
|
||||||
.select(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.ALL_COLUMNS)
|
.select(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.USER_ID,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CONTENT,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.PIC_URLS,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.LIKES,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_COUNT,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLAY_AUTHOR,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CREATED_TIME)
|
||||||
.from(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY)
|
.from(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY)
|
||||||
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.DETAIL_ID.eq(detailId))
|
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.DETAIL_ID.eq(detailId))
|
||||||
|
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_TYPE.eq(0))
|
||||||
|
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.IS_DELETED.eq(IsDeletedFlagEnum.UN_DELETED.getCode()))
|
||||||
.orderBy(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CREATED_TIME,false);
|
.orderBy(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CREATED_TIME,false);
|
||||||
return this.schisandraShareCommentReplyDao.selectListByQuery(wrapper);
|
return this.schisandraShareCommentReplyDao.selectListByQuery(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraShareCommentReply> listReply(String commentId){
|
||||||
|
QueryWrapper wrapper = QueryWrapper.create()
|
||||||
|
.select(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.USER_ID,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CONTENT,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.PIC_URLS,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.LIKES,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_COUNT,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_ID,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLAY_AUTHOR,
|
||||||
|
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CREATED_TIME)
|
||||||
|
.from(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY)
|
||||||
|
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.TO_ID.eq(commentId))
|
||||||
|
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_TYPE.eq(0))
|
||||||
|
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.IS_DELETED.eq(IsDeletedFlagEnum.UN_DELETED.getCode()))
|
||||||
|
.orderBy(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CREATED_TIME,true);
|
||||||
|
return this.schisandraShareCommentReplyDao.selectListByQuery(wrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user