feat: 添加分享圈列表返回缓存。新增评论和回复,评论列表返回
This commit is contained in:
@@ -8,6 +8,7 @@ import com.schisandra.share.common.entity.Result;
|
|||||||
import com.schisandra.share.domain.bo.SchisandraShareCircleBO;
|
import com.schisandra.share.domain.bo.SchisandraShareCircleBO;
|
||||||
import com.schisandra.share.domain.service.SchisandraShareCircleDomainService;
|
import com.schisandra.share.domain.service.SchisandraShareCircleDomainService;
|
||||||
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;
|
||||||
@@ -50,6 +51,7 @@ public class SchisandraShareCircleController {
|
|||||||
/**
|
/**
|
||||||
* 分享圈列表返回
|
* 分享圈列表返回
|
||||||
*/
|
*/
|
||||||
|
@Cacheable(value = "sharelist",key = "list")
|
||||||
@GetMapping("sharelist")
|
@GetMapping("sharelist")
|
||||||
public Result<List<SchisandraShareCircleDTO>> getShareList() {
|
public Result<List<SchisandraShareCircleDTO>> getShareList() {
|
||||||
try {
|
try {
|
||||||
|
@@ -8,11 +8,10 @@ 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.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 评论回复表 controller
|
* 评论回复表 controller
|
||||||
@@ -29,37 +28,88 @@ public class SchisandraShareCommentReplyController {
|
|||||||
private SchisandraShareCommentReplyDomainService schisandraShareCommentReplyDomainService;
|
private SchisandraShareCommentReplyDomainService schisandraShareCommentReplyDomainService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增评论回复表
|
* 查询该动态下的评论
|
||||||
*/
|
*/
|
||||||
@RequestMapping("add")
|
@PostMapping(value = "listcommen")
|
||||||
public Result<Boolean> add(@RequestBody SchisandraShareCommentReplyDTO schisandraShareCommentReplyDTO) {
|
public Result<List<SchisandraShareCommentReplyDTO>> list(@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("获取鸡圈评论内容异常!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("addreply")
|
||||||
|
public Result<Boolean> addReply(@RequestBody SchisandraShareCommentReplyDTO schisandraShareCommentReplyDTO) {
|
||||||
|
try {
|
||||||
|
if (log.isInfoEnabled()) {
|
||||||
|
log.info("SchisandraShareCommentReplyController.addComment.dto:{}", JSON.toJSONString(schisandraShareCommentReplyDTO));
|
||||||
|
}
|
||||||
|
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getContent(), "内容不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getDetailId(), "分享文章id不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getUserId(), "发布人id不能为空");
|
||||||
|
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getToId(), "评论目标id不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getReplyType(), "回复类型 0评论 1回复不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getToUser(), "评论人不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getReplayAuthor(), "回复人是否作者 1=是 0=否不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getPicUrls(), "图片内容不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getLikes(), "点赞数不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getExtJson(), "预留字段不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getCreatedBy(), "创建人不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getCreatedTime(), "创建时间不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getUpdateBy(), "更新人不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getUpdateTime(), "更新时间不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getIsDeleted(), "不能为空");
|
||||||
|
SchisandraShareCommentReplyBO SchisandraShareCommentReplyBO = SchisandraShareCommentReplyDTOConverter.INSTANCE.convertDTOToBO(schisandraShareCommentReplyDTO);
|
||||||
|
return Result.ok(schisandraShareCommentReplyDomainService.addReply(SchisandraShareCommentReplyBO));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("SchisandraShareCommentReplyController.register.error:{}", e.getMessage(), e);
|
||||||
|
return Result.fail("新增评论失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增评论
|
||||||
|
*/
|
||||||
|
@PostMapping("addcomment")
|
||||||
|
public Result<Boolean> addComment(@RequestBody SchisandraShareCommentReplyDTO schisandraShareCommentReplyDTO) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (log.isInfoEnabled()) {
|
if (log.isInfoEnabled()) {
|
||||||
log.info("SchisandraShareCommentReplyController.add.dto:{}", JSON.toJSONString(schisandraShareCommentReplyDTO));
|
log.info("SchisandraShareCommentReplyController.addComment.dto:{}", JSON.toJSONString(schisandraShareCommentReplyDTO));
|
||||||
}
|
}
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getId(), "评论ID不能为空");
|
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getDetailId(), "分享文章id不能为空");
|
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getReplyType(), "回复类型 0评论 1回复不能为空");
|
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getToId(), "评论目标id不能为空");
|
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getToUser(), "评论人不能为空");
|
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getReplyId(), "回复目标id不能为空");
|
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getReplyUser(), "回复人不能为空");
|
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getReplayAuthor(), "回复人是否作者 1=是 0=否不能为空");
|
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getContent(), "内容不能为空");
|
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getContent(), "内容不能为空");
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getPicUrls(), "图片内容不能为空");
|
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getDetailId(), "分享文章id不能为空");
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getLikes(), "点赞数不能为空");
|
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getUserId(), "发布人id不能为空");
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getExtJson(), "预留字段不能为空");
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getReplyType(), "回复类型 0评论 1回复不能为空");
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getCreatedBy(), "创建人不能为空");
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getToId(), "评论目标id不能为空");
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getCreatedTime(), "创建时间不能为空");
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getToUser(), "评论人不能为空");
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getUpdateBy(), "更新人不能为空");
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getReplyId(), "回复目标id不能为空");
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getUpdateTime(), "更新时间不能为空");
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getReplyUser(), "回复人不能为空");
|
||||||
Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getIsDeleted(), "不能为空");
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getReplayAuthor(), "回复人是否作者 1=是 0=否不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getPicUrls(), "图片内容不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getLikes(), "点赞数不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getExtJson(), "预留字段不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getCreatedBy(), "创建人不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getCreatedTime(), "创建时间不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getUpdateBy(), "更新人不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getUpdateTime(), "更新时间不能为空");
|
||||||
|
// Preconditions.checkNotNull(schisandraShareCommentReplyDTO.getIsDeleted(), "不能为空");
|
||||||
SchisandraShareCommentReplyBO SchisandraShareCommentReplyBO = SchisandraShareCommentReplyDTOConverter.INSTANCE.convertDTOToBO(schisandraShareCommentReplyDTO);
|
SchisandraShareCommentReplyBO SchisandraShareCommentReplyBO = SchisandraShareCommentReplyDTOConverter.INSTANCE.convertDTOToBO(schisandraShareCommentReplyDTO);
|
||||||
return Result.ok(schisandraShareCommentReplyDomainService.add(SchisandraShareCommentReplyBO));
|
return Result.ok(schisandraShareCommentReplyDomainService.addComment(SchisandraShareCommentReplyBO));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("SchisandraShareCommentReplyController.register.error:{}", e.getMessage(), e);
|
log.error("SchisandraShareCommentReplyController.register.error:{}", e.getMessage(), e);
|
||||||
return Result.fail("新增评论回复表失败");
|
return Result.fail("新增评论失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@ import com.schisandra.share.common.entity.Result;
|
|||||||
import com.schisandra.share.domain.bo.SchisandraShareDetailBO;
|
import com.schisandra.share.domain.bo.SchisandraShareDetailBO;
|
||||||
import com.schisandra.share.domain.service.SchisandraShareDetailDomainService;
|
import com.schisandra.share.domain.service.SchisandraShareDetailDomainService;
|
||||||
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;
|
||||||
@@ -46,10 +47,15 @@ public class SchisandraShareDetailController {
|
|||||||
/**
|
/**
|
||||||
* 查询分享详细信息
|
* 查询分享详细信息
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@PostMapping("get_detail")
|
@PostMapping("get_detail")
|
||||||
public Result selectDetail(@RequestParam("Id") String Id){
|
public Result selectDetail(@RequestParam("Id") String Id){
|
||||||
SchisandraShareDetailBO resultList = schisandraShareDetailDomainService.getDetailsById(Id);
|
try{
|
||||||
return Result.ok(resultList);
|
SchisandraShareDetailBO resultList = schisandraShareDetailDomainService.getDetailsById(Id);
|
||||||
|
return Result.ok(resultList);
|
||||||
|
}catch (Exception e){
|
||||||
|
return Result.fail();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -60,6 +66,7 @@ public class SchisandraShareDetailController {
|
|||||||
* @author: landaiqing
|
* @author: landaiqing
|
||||||
* @date: 2024/7/15 下午7:09
|
* @date: 2024/7/15 下午7:09
|
||||||
*/
|
*/
|
||||||
|
@Cacheable(value = "detaillist",key = "#circleId")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public Result<List<SchisandraShareDetailDTO>> selectCircleList(@RequestParam("circleId") String circleId) {
|
public Result<List<SchisandraShareDetailDTO>> selectCircleList(@RequestParam("circleId") String circleId) {
|
||||||
List<SchisandraShareDetailBO> resultList = schisandraShareDetailDomainService.list(circleId);
|
List<SchisandraShareDetailBO> resultList = schisandraShareDetailDomainService.list(circleId);
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.schisandra.share.application.dto;
|
package com.schisandra.share.application.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -19,6 +20,11 @@ public class SchisandraShareCommentReplyDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布者id
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分享文章id
|
* 分享文章id
|
||||||
*/
|
*/
|
||||||
@@ -82,6 +88,7 @@ public class SchisandraShareCommentReplyDTO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
|
||||||
private Date createdTime;
|
private Date createdTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,6 +99,7 @@ public class SchisandraShareCommentReplyDTO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -64,5 +64,6 @@ public class SchisandraShareTagsDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
private String color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -77,5 +77,6 @@ public class SchisandraShareUrlDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
private String typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,6 +18,11 @@ public class SchisandraShareCommentReplyBO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布者id
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分享文章id
|
* 分享文章id
|
||||||
*/
|
*/
|
||||||
@@ -98,5 +103,6 @@ public class SchisandraShareCommentReplyBO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
private String nickName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -58,5 +58,6 @@ public class SchisandraShareTagsBO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
private String color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -73,5 +73,6 @@ public class SchisandraShareUrlBO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
private String typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@ import com.schisandra.share.domain.bo.SchisandraShareCommentReplyBO;
|
|||||||
import com.schisandra.share.infra.basic.entity.SchisandraShareCommentReply;
|
import com.schisandra.share.infra.basic.entity.SchisandraShareCommentReply;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 评论回复表 bo转换器
|
* 评论回复表 bo转换器
|
||||||
@@ -19,4 +20,5 @@ public interface SchisandraShareCommentReplyBOConverter {
|
|||||||
SchisandraShareCommentReply convertBOToEntity(SchisandraShareCommentReplyBO schisandraShareCommentReplyBO);
|
SchisandraShareCommentReply convertBOToEntity(SchisandraShareCommentReplyBO schisandraShareCommentReplyBO);
|
||||||
SchisandraShareCommentReplyBO convertEntityToBO(SchisandraShareCommentReply schisandraShareCommentReply);
|
SchisandraShareCommentReplyBO convertEntityToBO(SchisandraShareCommentReply schisandraShareCommentReply);
|
||||||
|
|
||||||
|
List<SchisandraShareCommentReplyBO> convertEntityToBOList(List<SchisandraShareCommentReply> schisandraShareCommentReplies);
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.schisandra.share.domain.service;
|
package com.schisandra.share.domain.service;
|
||||||
|
|
||||||
import com.schisandra.share.domain.bo.SchisandraShareCommentReplyBO;
|
import com.schisandra.share.domain.bo.SchisandraShareCommentReplyBO;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 评论回复表 领域service
|
* 评论回复表 领域service
|
||||||
@@ -11,9 +12,14 @@ import com.schisandra.share.domain.bo.SchisandraShareCommentReplyBO;
|
|||||||
public interface SchisandraShareCommentReplyDomainService {
|
public interface SchisandraShareCommentReplyDomainService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加 评论回复表 信息
|
* 添加 评论 信息
|
||||||
*/
|
*/
|
||||||
Boolean add(SchisandraShareCommentReplyBO schisandraShareCommentReplyBO);
|
Boolean addComment(SchisandraShareCommentReplyBO schisandraShareCommentReplyBO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加 回复 信息
|
||||||
|
*/
|
||||||
|
Boolean addReply(SchisandraShareCommentReplyBO schisandraShareCommentReplyBO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新 评论回复表 信息
|
* 更新 评论回复表 信息
|
||||||
@@ -25,4 +31,5 @@ public interface SchisandraShareCommentReplyDomainService {
|
|||||||
*/
|
*/
|
||||||
Boolean delete(SchisandraShareCommentReplyBO schisandraShareCommentReplyBO);
|
Boolean delete(SchisandraShareCommentReplyBO schisandraShareCommentReplyBO);
|
||||||
|
|
||||||
|
List<SchisandraShareCommentReplyBO> listComment(String detailId);
|
||||||
}
|
}
|
||||||
|
@@ -6,10 +6,13 @@ import com.schisandra.share.domain.bo.SchisandraShareCommentReplyBO;
|
|||||||
import com.schisandra.share.domain.service.SchisandraShareCommentReplyDomainService;
|
import com.schisandra.share.domain.service.SchisandraShareCommentReplyDomainService;
|
||||||
import com.schisandra.share.infra.basic.entity.SchisandraShareCommentReply;
|
import com.schisandra.share.infra.basic.entity.SchisandraShareCommentReply;
|
||||||
import com.schisandra.share.infra.basic.service.SchisandraShareCommentReplyService;
|
import com.schisandra.share.infra.basic.service.SchisandraShareCommentReplyService;
|
||||||
|
import com.schisandra.share.infra.entity.AuthUserInfoEntity;
|
||||||
|
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 javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 评论回复表 领域service实现了
|
* 评论回复表 领域service实现了
|
||||||
@@ -23,11 +26,34 @@ public class SchisandraShareCommentReplyDomainServiceImpl implements SchisandraS
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SchisandraShareCommentReplyService schisandraShareCommentReplyService;
|
private SchisandraShareCommentReplyService schisandraShareCommentReplyService;
|
||||||
|
@Resource
|
||||||
|
UserRpc userRpc;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean add(SchisandraShareCommentReplyBO schisandraShareCommentReplyBO) {
|
public Boolean addComment(SchisandraShareCommentReplyBO schisandraShareCommentReplyBO) {
|
||||||
SchisandraShareCommentReply schisandraShareCommentReply = SchisandraShareCommentReplyBOConverter.INSTANCE.convertBOToEntity(schisandraShareCommentReplyBO);
|
SchisandraShareCommentReply schisandraShareCommentReply = SchisandraShareCommentReplyBOConverter.INSTANCE.convertBOToEntity(schisandraShareCommentReplyBO);
|
||||||
schisandraShareCommentReply.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
schisandraShareCommentReply.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
||||||
|
schisandraShareCommentReply.setReplyType(0);
|
||||||
|
schisandraShareCommentReply.setLikes(0L);
|
||||||
|
return schisandraShareCommentReplyService.insert(schisandraShareCommentReply) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean addReply(SchisandraShareCommentReplyBO schisandraShareCommentReplyBO) {
|
||||||
|
SchisandraShareCommentReply schisandraShareCommentReply = SchisandraShareCommentReplyBOConverter.INSTANCE.convertBOToEntity(schisandraShareCommentReplyBO);
|
||||||
|
schisandraShareCommentReply.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
||||||
|
schisandraShareCommentReply.setReplyType(1);
|
||||||
|
schisandraShareCommentReply.setLikes(0L);
|
||||||
|
if(schisandraShareCommentReply.getToId()!=null){
|
||||||
|
//查询to_user
|
||||||
|
SchisandraShareCommentReply comment = schisandraShareCommentReplyService.queryById(schisandraShareCommentReply.getToId());
|
||||||
|
schisandraShareCommentReply.setToUser(comment.getUserId());
|
||||||
|
}
|
||||||
|
if(schisandraShareCommentReply.getReplyId()!=null){
|
||||||
|
//查询reply_user
|
||||||
|
SchisandraShareCommentReply reply = schisandraShareCommentReplyService.queryById(schisandraShareCommentReply.getReplyId());
|
||||||
|
schisandraShareCommentReply.setReplyUser(reply.getUserId());
|
||||||
|
}
|
||||||
return schisandraShareCommentReplyService.insert(schisandraShareCommentReply) > 0;
|
return schisandraShareCommentReplyService.insert(schisandraShareCommentReply) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,4 +71,14 @@ public class SchisandraShareCommentReplyDomainServiceImpl implements SchisandraS
|
|||||||
return schisandraShareCommentReplyService.update(schisandraShareCommentReply) > 0;
|
return schisandraShareCommentReplyService.update(schisandraShareCommentReply) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraShareCommentReplyBO> listComment(String detailId) {
|
||||||
|
List<SchisandraShareCommentReply> schisandraShareCommentReplies = schisandraShareCommentReplyService.listComment(detailId);
|
||||||
|
List<SchisandraShareCommentReplyBO> schisandraShareCommentReplyBOS = SchisandraShareCommentReplyBOConverter.INSTANCE.convertEntityToBOList(schisandraShareCommentReplies);
|
||||||
|
schisandraShareCommentReplyBOS.forEach(schisandraShareCommentReplyBO -> {
|
||||||
|
AuthUserInfoEntity userInfo = userRpc.getUserInfo(schisandraShareCommentReplyBO.getUserId());
|
||||||
|
schisandraShareCommentReplyBO.setNickName(userInfo.getNickName());
|
||||||
|
});
|
||||||
|
return schisandraShareCommentReplyBOS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,10 +11,9 @@ 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.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.print.DocFlavor;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -106,6 +105,7 @@ public class SchisandraShareDetailDomainServiceImpl implements SchisandraShareDe
|
|||||||
|
|
||||||
List<SchisandraShareUrlDetail> schisandraShareUrlDetailS = schisandraShareUrlDetailService.queryByDetailId(Id);
|
List<SchisandraShareUrlDetail> schisandraShareUrlDetailS = schisandraShareUrlDetailService.queryByDetailId(Id);
|
||||||
List<SchisandraShareUrlDetailBO> schisandraShareUrlDetailBOS = SchisandraShareUrlDetailBOConverter.INSTANCE.convertEntityToBOList(schisandraShareUrlDetailS);
|
List<SchisandraShareUrlDetailBO> schisandraShareUrlDetailBOS = SchisandraShareUrlDetailBOConverter.INSTANCE.convertEntityToBOList(schisandraShareUrlDetailS);
|
||||||
|
Assert.notNull(schisandraShareUrlDetailBOS.stream().map(SchisandraShareUrlDetailBO::getUrlId).collect(Collectors.toList()),"分享链接为空");
|
||||||
List<String> urlIds = schisandraShareUrlDetailBOS.stream().map(SchisandraShareUrlDetailBO::getUrlId).collect(Collectors.toList());
|
List<String> urlIds = schisandraShareUrlDetailBOS.stream().map(SchisandraShareUrlDetailBO::getUrlId).collect(Collectors.toList());
|
||||||
|
|
||||||
List<SchisandraShareUrl> schisandraShareUrlS = schisandraShareUrlService.queryByIds(urlIds);
|
List<SchisandraShareUrl> schisandraShareUrlS = schisandraShareUrlService.queryByIds(urlIds);
|
||||||
|
@@ -26,6 +26,11 @@ public class SchisandraShareCommentReply implements Serializable {
|
|||||||
@Id(keyType=KeyType.Generator, value= KeyGenerators.flexId)
|
@Id(keyType=KeyType.Generator, value= KeyGenerators.flexId)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布者id
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分享文章id
|
* 分享文章id
|
||||||
*/
|
*/
|
||||||
@@ -122,5 +127,6 @@ public class SchisandraShareCommentReply implements Serializable {
|
|||||||
@Column("is_deleted")
|
@Column("is_deleted")
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -74,5 +74,7 @@ public class SchisandraShareTags implements Serializable {
|
|||||||
@Column("is_deleted")
|
@Column("is_deleted")
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
@Column("color")
|
||||||
|
private String color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -92,5 +92,7 @@ public class SchisandraShareUrl implements Serializable {
|
|||||||
@Column("is_deleted")
|
@Column("is_deleted")
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
@Column("type_name")
|
||||||
|
private String typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ package com.schisandra.share.infra.basic.service;
|
|||||||
|
|
||||||
import com.schisandra.share.infra.basic.entity.SchisandraShareCommentReply;
|
import com.schisandra.share.infra.basic.entity.SchisandraShareCommentReply;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 评论回复表 表服务接口
|
* 评论回复表 表服务接口
|
||||||
*
|
*
|
||||||
@@ -42,5 +43,6 @@ public interface SchisandraShareCommentReplyService {
|
|||||||
*/
|
*/
|
||||||
boolean deleteById(String id);
|
boolean deleteById(String id);
|
||||||
|
|
||||||
|
List<SchisandraShareCommentReply> listComment(String detailId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,14 @@
|
|||||||
package com.schisandra.share.infra.basic.service.impl;
|
package com.schisandra.share.infra.basic.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
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.service.SchisandraShareCommentReplyService;
|
import com.schisandra.share.infra.basic.service.SchisandraShareCommentReplyService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 评论回复表 表服务实现类
|
* 评论回复表 表服务实现类
|
||||||
@@ -63,5 +66,15 @@ public class SchisandraShareCommentReplyServiceImpl implements SchisandraShareCo
|
|||||||
return this.schisandraShareCommentReplyDao.deleteById(id) > 0;
|
return this.schisandraShareCommentReplyDao.deleteById(id) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SchisandraShareCommentReply> listComment(String detailId) {
|
||||||
|
QueryWrapper wrapper = QueryWrapper.create()
|
||||||
|
.select(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.ALL_COLUMNS)
|
||||||
|
.from(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY)
|
||||||
|
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.DETAIL_ID.eq(detailId))
|
||||||
|
.orderBy(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CREATED_TIME,false);
|
||||||
|
return this.schisandraShareCommentReplyDao.selectListByQuery(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@ package com.schisandra.share;
|
|||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
@@ -18,6 +19,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||||||
@MapperScan("com.schisandra.**.dao")
|
@MapperScan("com.schisandra.**.dao")
|
||||||
@EnableFeignClients(basePackages = "com.schisandra")
|
@EnableFeignClients(basePackages = "com.schisandra")
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
|
@EnableCaching
|
||||||
public class ShareApplication {
|
public class ShareApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(ShareApplication.class);
|
SpringApplication.run(ShareApplication.class);
|
||||||
|
Reference in New Issue
Block a user