Merge remote-tracking branch 'refs/remotes/origin/dev'
This commit is contained in:
@@ -13,7 +13,6 @@ import com.schisandra.share.common.utils.CaffeineUtil;
|
||||
import com.schisandra.share.domain.bo.SchisandraShareDetailBO;
|
||||
import com.schisandra.share.domain.bo.SchisandraUserLikesDetailBO;
|
||||
import com.schisandra.share.domain.service.SchisandraShareDetailDomainService;
|
||||
import feign.form.FormData;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.rocketmq.client.producer.SendCallback;
|
||||
import org.apache.rocketmq.client.producer.SendResult;
|
||||
@@ -176,7 +175,7 @@ public class SchisandraShareDetailController {
|
||||
* 查询分享详细信息
|
||||
*/
|
||||
@Cacheable(value = "getdetail", key = "#Id")
|
||||
@PostMapping("get_detail")
|
||||
@GetMapping("get_detail")
|
||||
public Result selectDetail(@RequestParam("Id") String Id) {
|
||||
try {
|
||||
SchisandraShareDetailBO resultList = schisandraShareDetailDomainService.getDetailsById(Id);
|
||||
@@ -197,7 +196,7 @@ public class SchisandraShareDetailController {
|
||||
}
|
||||
}
|
||||
);
|
||||
return Result.ok(resultList);
|
||||
return Result.ok(SchisandraShareDetailDTOConverter.INSTANCE.convertBOToDTO(resultList));
|
||||
} catch (Exception e) {
|
||||
return Result.fail();
|
||||
}
|
||||
|
@@ -119,6 +119,12 @@ public class SchisandraShareCommentReplyDTO implements Serializable {
|
||||
|
||||
private String avatar;
|
||||
|
||||
private Boolean isLike;
|
||||
private Boolean isLike = false;
|
||||
|
||||
private String location;
|
||||
|
||||
private String browser;
|
||||
|
||||
private String browserVersion;
|
||||
}
|
||||
|
||||
|
@@ -115,6 +115,12 @@ public class SchisandraShareCommentReplyBO implements Serializable {
|
||||
|
||||
private String avatar;
|
||||
|
||||
private Boolean isLike;
|
||||
private Boolean isLike = false;
|
||||
|
||||
private String location;
|
||||
|
||||
private String browser;
|
||||
|
||||
private String browserVersion;
|
||||
}
|
||||
|
||||
|
@@ -100,11 +100,12 @@ public class SchisandraShareDetailBO implements Serializable {
|
||||
|
||||
private String avatar;
|
||||
|
||||
private Boolean isLike;
|
||||
|
||||
List<SchisandraShareTagsBO> tags;
|
||||
|
||||
List<SchisandraShareUrlBO> urls;
|
||||
|
||||
private Boolean isLike;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,5 @@
|
||||
package com.schisandra.share.domain.service.impl;
|
||||
|
||||
import com.jd.platform.async.executor.Async;
|
||||
import com.jd.platform.async.worker.WorkResult;
|
||||
import com.jd.platform.async.wrapper.WorkerWrapper;
|
||||
import com.schisandra.share.common.enums.IsDeletedFlagEnum;
|
||||
import com.schisandra.share.domain.convert.SchisandraShareCommentReplyBOConverter;
|
||||
import com.schisandra.share.domain.bo.SchisandraShareCommentReplyBO;
|
||||
@@ -11,20 +8,17 @@ import com.schisandra.share.infra.basic.entity.SchisandraShareCommentReply;
|
||||
import com.schisandra.share.infra.basic.entity.SchisandraUserLikesComment;
|
||||
import com.schisandra.share.infra.basic.service.SchisandraShareCommentReplyService;
|
||||
import com.schisandra.share.infra.basic.service.SchisandraUserLikesCommentService;
|
||||
import com.schisandra.share.infra.entity.AuthUserAddressEntity;
|
||||
import com.schisandra.share.infra.entity.AuthUserInfoEntity;
|
||||
import com.schisandra.share.infra.rpc.AddressRpc;
|
||||
import com.schisandra.share.infra.rpc.UserRpc;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/**
|
||||
* 评论回复表 领域service实现了
|
||||
@@ -41,6 +35,8 @@ public class SchisandraShareCommentReplyDomainServiceImpl implements SchisandraS
|
||||
@Resource
|
||||
UserRpc userRpc;
|
||||
@Resource
|
||||
AddressRpc addressRpc;
|
||||
@Resource
|
||||
private SchisandraUserLikesCommentService schisandraUserLikesCommentService;
|
||||
|
||||
@Override
|
||||
@@ -97,48 +93,23 @@ public class SchisandraShareCommentReplyDomainServiceImpl implements SchisandraS
|
||||
public List<SchisandraShareCommentReplyBO> listComment(String detailId, String userId) {
|
||||
List<SchisandraShareCommentReply> schisandraShareComments = schisandraShareCommentReplyService.listComment(detailId);
|
||||
List<SchisandraShareCommentReplyBO> schisandraShareCommentBOS = SchisandraShareCommentReplyBOConverter.INSTANCE.convertEntityToBOList(schisandraShareComments);
|
||||
List<WorkerWrapper> wrappers = new ArrayList<>();
|
||||
schisandraShareCommentBOS.forEach(schisandraShareCommentReplyBO -> {
|
||||
WorkerWrapper<SchisandraShareCommentReplyBO,String > workerWrapper = new WorkerWrapper.Builder<SchisandraShareCommentReplyBO,String >()
|
||||
.worker((SchisandraShareCommentReplyBO object, Map<String, WorkerWrapper> allWrappers) -> {
|
||||
SchisandraUserLikesComment schisandraUserLikesComment =
|
||||
schisandraUserLikesCommentService.queryByuserIdAndDetailId(object.getId(), userId);
|
||||
schisandraUserLikesCommentService.queryByuserIdAndCommentId(schisandraShareCommentReplyBO.getId(), userId);
|
||||
if(schisandraUserLikesComment!=null){
|
||||
object.setIsLike(true);
|
||||
schisandraShareCommentReplyBO.setIsLike(true);
|
||||
}
|
||||
AuthUserInfoEntity userInfo = userRpc.getUserInfo(object.getUserId());
|
||||
object.setNick(userInfo.getNickName());
|
||||
object.setAvatar(userInfo.getAvatar());
|
||||
return "success";
|
||||
AuthUserInfoEntity userInfo = userRpc.getUserInfo(schisandraShareCommentReplyBO.getUserId());
|
||||
schisandraShareCommentReplyBO.setNick(userInfo.getNickName());
|
||||
schisandraShareCommentReplyBO.setAvatar(userInfo.getAvatar());
|
||||
|
||||
})
|
||||
.param(schisandraShareCommentReplyBO)
|
||||
.id(schisandraShareCommentReplyBO.getId())
|
||||
.callback((boolean success, SchisandraShareCommentReplyBO param, WorkResult<String> workResult) ->
|
||||
System.out.println("该线程"+Thread.currentThread().getName()))
|
||||
.build();
|
||||
|
||||
wrappers.add(workerWrapper);
|
||||
|
||||
|
||||
//
|
||||
// SchisandraUserLikesComment schisandraUserLikesComment =
|
||||
// schisandraUserLikesCommentService.queryByuserIdAndDetailId(schisandraShareCommentReplyBO.getId(), userId);
|
||||
// if(schisandraUserLikesComment!=null){
|
||||
// schisandraShareCommentReplyBO.setIsLike(true);
|
||||
// }
|
||||
// AuthUserInfoEntity userInfo = userRpc.getUserInfo(schisandraShareCommentReplyBO.getUserId());
|
||||
// schisandraShareCommentReplyBO.setNick(userInfo.getNickName());
|
||||
// schisandraShareCommentReplyBO.setAvatar(userInfo.getAvatar());
|
||||
AuthUserAddressEntity userAddress = addressRpc.getUserAddress(schisandraShareCommentReplyBO.getUserId());
|
||||
if(userAddress!=null){
|
||||
schisandraShareCommentReplyBO.setLocation(userAddress.getLocation());
|
||||
schisandraShareCommentReplyBO.setBrowser(userAddress.getBrowser());
|
||||
schisandraShareCommentReplyBO.setBrowserVersion(userAddress.getBrowserVersion());
|
||||
}
|
||||
});
|
||||
try {
|
||||
Async.beginWork(3500L,new ThreadPoolExecutor(10, 100, 5L,
|
||||
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()), wrappers);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return schisandraShareCommentBOS;
|
||||
}
|
||||
|
||||
@@ -148,13 +119,19 @@ public class SchisandraShareCommentReplyDomainServiceImpl implements SchisandraS
|
||||
List<SchisandraShareCommentReplyBO> schisandraShareCommentBOS = SchisandraShareCommentReplyBOConverter.INSTANCE.convertEntityToBOList(schisandraShareComments);
|
||||
schisandraShareCommentBOS.forEach(schisandraShareCommentReplyBO -> {
|
||||
SchisandraUserLikesComment schisandraUserLikesComment =
|
||||
schisandraUserLikesCommentService.queryByuserIdAndDetailId(schisandraShareCommentReplyBO.getId(), userId);
|
||||
schisandraUserLikesCommentService.queryByuserIdAndCommentId(schisandraShareCommentReplyBO.getId(), userId);
|
||||
if(schisandraUserLikesComment!=null){
|
||||
schisandraShareCommentReplyBO.setIsLike(true);
|
||||
}
|
||||
AuthUserInfoEntity userInfo = userRpc.getUserInfo(schisandraShareCommentReplyBO.getUserId());
|
||||
schisandraShareCommentReplyBO.setNick(userInfo.getNickName());
|
||||
schisandraShareCommentReplyBO.setAvatar(userInfo.getAvatar());
|
||||
AuthUserAddressEntity userAddress = addressRpc.getUserAddress(schisandraShareCommentReplyBO.getUserId());
|
||||
if(userAddress!=null){
|
||||
schisandraShareCommentReplyBO.setLocation(userAddress.getLocation());
|
||||
schisandraShareCommentReplyBO.setBrowser(userAddress.getBrowser());
|
||||
schisandraShareCommentReplyBO.setBrowserVersion(userAddress.getBrowserVersion());
|
||||
}
|
||||
});
|
||||
return schisandraShareCommentBOS;
|
||||
}
|
||||
@@ -165,7 +142,7 @@ public class SchisandraShareCommentReplyDomainServiceImpl implements SchisandraS
|
||||
List<SchisandraShareCommentReplyBO> schisandraShareRepliesBO = SchisandraShareCommentReplyBOConverter.INSTANCE.convertEntityToBOList(schisandraShareReplies);
|
||||
schisandraShareRepliesBO.forEach(schisandraShareReplyBO -> {
|
||||
SchisandraUserLikesComment schisandraUserLikesComment =
|
||||
schisandraUserLikesCommentService.queryByuserIdAndDetailId(schisandraShareReplyBO.getId(), userId);
|
||||
schisandraUserLikesCommentService.queryByuserIdAndCommentId(schisandraShareReplyBO.getId(), userId);
|
||||
if(schisandraUserLikesComment!=null){
|
||||
schisandraShareReplyBO.setIsLike(true);
|
||||
}
|
||||
@@ -178,6 +155,13 @@ public class SchisandraShareCommentReplyDomainServiceImpl implements SchisandraS
|
||||
|
||||
schisandraShareReplyBO.setNick(userInfo.getNickName());
|
||||
schisandraShareReplyBO.setAvatar(userInfo.getAvatar());
|
||||
|
||||
AuthUserAddressEntity userAddress = addressRpc.getUserAddress(schisandraShareReplyBO.getUserId());
|
||||
if(userAddress!=null){
|
||||
schisandraShareReplyBO.setLocation(userAddress.getLocation());
|
||||
schisandraShareReplyBO.setBrowser(userAddress.getBrowser());
|
||||
schisandraShareReplyBO.setBrowserVersion(userAddress.getBrowserVersion());
|
||||
}
|
||||
});
|
||||
return schisandraShareRepliesBO;
|
||||
}
|
||||
|
@@ -74,7 +74,7 @@ public class SchisandraShareDetailDomainServiceImpl implements SchisandraShareDe
|
||||
AuthUserInfoEntity userInfo = userRpc.getUserInfo(shareDetailBO.getUserId());
|
||||
SchisandraShareDetailBO schisandraShareDetailBO = new SchisandraShareDetailBO();
|
||||
SchisandraUserLikesComment schisandraUserLikesComment =
|
||||
schisandraUserLikesCommentService.queryByuserIdAndDetailId(shareDetailBO.getId(), userId);
|
||||
schisandraUserLikesCommentService.queryByuserIdAndCommentId(shareDetailBO.getId(), userId);
|
||||
if(schisandraUserLikesComment!=null){
|
||||
schisandraShareDetailBO.setIsLike(true);
|
||||
}
|
||||
|
@@ -42,5 +42,5 @@ public interface SchisandraUserLikesCommentService {
|
||||
*/
|
||||
boolean deleteById(Long id);
|
||||
|
||||
SchisandraUserLikesComment queryByuserIdAndDetailId(String commentId, String userId);
|
||||
SchisandraUserLikesComment queryByuserIdAndCommentId(String commentId, String userId);
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import static com.mybatisflex.core.query.QueryMethods.count;
|
||||
import static com.mybatisflex.core.query.QueryMethods.*;
|
||||
|
||||
/**
|
||||
* 评论回复表 表服务实现类
|
||||
@@ -93,6 +93,7 @@ public class SchisandraShareCommentReplyServiceImpl implements SchisandraShareCo
|
||||
QueryWrapper wrapper = QueryWrapper.create()
|
||||
.select(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.USER_ID,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.ID,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.DETAIL_ID,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CONTENT,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.PIC_URLS,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.LIKES,
|
||||
@@ -102,33 +103,34 @@ public class SchisandraShareCommentReplyServiceImpl implements SchisandraShareCo
|
||||
.from(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY)
|
||||
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.DETAIL_ID.eq(detailId))
|
||||
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_TYPE.eq(0))
|
||||
.orderBy(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.LIKES,false)
|
||||
.orderBy(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_COUNT,false);
|
||||
return this.schisandraShareCommentReplyDao.selectListByQuery(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchisandraShareCommentReply> listCommenthot(String detailId) {
|
||||
QueryWrapper wrapper = QueryWrapper.create()
|
||||
.select(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.USER_ID,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.ID,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CONTENT,
|
||||
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)
|
||||
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.DETAIL_ID.eq(detailId))
|
||||
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_TYPE.eq(0))
|
||||
.orderBy(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CREATED_TIME,false);
|
||||
return this.schisandraShareCommentReplyDao.selectListByQuery(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchisandraShareCommentReply> listCommenthot(String detailId) {
|
||||
QueryWrapper wrapper = QueryWrapper.create()
|
||||
.select(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.USER_ID,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.ID,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.DETAIL_ID,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CONTENT,
|
||||
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)
|
||||
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.DETAIL_ID.eq(detailId))
|
||||
.where(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_TYPE.eq(0))
|
||||
.orderBy(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_COUNT.add(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.LIKES) ,false);
|
||||
return this.schisandraShareCommentReplyDao.selectListByQuery(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchisandraShareCommentReply> listReply(String commentId){
|
||||
QueryWrapper wrapper = QueryWrapper.create()
|
||||
.select(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.ID,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.USER_ID,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.DETAIL_ID,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.CONTENT,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.LIKES,
|
||||
SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_COUNT,
|
||||
@@ -139,8 +141,7 @@ public class SchisandraShareCommentReplyServiceImpl implements SchisandraShareCo
|
||||
.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(1))
|
||||
.orderBy(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.LIKES,false)
|
||||
.orderBy(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_COUNT,false);
|
||||
.orderBy(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.REPLY_COUNT.add(SchisandraShareCommentReplyTableDef.SCHISANDRA_SHARE_COMMENT_REPLY.LIKES) ,false);
|
||||
return this.schisandraShareCommentReplyDao.selectListByQuery(wrapper);
|
||||
}
|
||||
|
||||
|
@@ -66,7 +66,7 @@ public class SchisandraUserLikesCommentServiceImpl implements SchisandraUserLike
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchisandraUserLikesComment queryByuserIdAndDetailId(String commentId, String userId) {
|
||||
public SchisandraUserLikesComment queryByuserIdAndCommentId(String commentId, String userId) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||
.select(SchisandraUserLikesCommentTableDef.SCHISANDRA_USER_LIKES_COMMENT.ID)
|
||||
.where(SchisandraUserLikesCommentTableDef.SCHISANDRA_USER_LIKES_COMMENT.COMMENT_ID.eq(commentId))
|
||||
|
@@ -31,10 +31,9 @@ public class AddressRpc {
|
||||
return authUserAddressEntity;
|
||||
}
|
||||
SchisandraAuthAddressDTO data = result.getData();
|
||||
authUserAddressEntity.setId(data.getId());
|
||||
authUserAddressEntity.setUserId(data.getUserId());
|
||||
authUserAddressEntity.setLocation(data.getLocation());
|
||||
authUserAddressEntity.setBrowser(data.getBrowser());
|
||||
authUserAddressEntity.setBrowserVersion(data.getBrowserVersion());
|
||||
return authUserAddressEntity;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user