Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package com.schisandra.share.domain.service.impl;
|
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.jd.platform.async.wrapper.WorkerWrapper;
|
||||||
import com.schisandra.share.common.enums.IsDeletedFlagEnum;
|
import com.schisandra.share.common.enums.IsDeletedFlagEnum;
|
||||||
import com.schisandra.share.domain.convert.SchisandraShareCommentReplyBOConverter;
|
import com.schisandra.share.domain.convert.SchisandraShareCommentReplyBOConverter;
|
||||||
@@ -18,6 +20,11 @@ import org.springframework.util.Assert;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
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实现了
|
* 评论回复表 领域service实现了
|
||||||
@@ -90,16 +97,48 @@ public class SchisandraShareCommentReplyDomainServiceImpl implements SchisandraS
|
|||||||
public List<SchisandraShareCommentReplyBO> listComment(String detailId, String userId) {
|
public List<SchisandraShareCommentReplyBO> listComment(String detailId, String userId) {
|
||||||
List<SchisandraShareCommentReply> schisandraShareComments = schisandraShareCommentReplyService.listComment(detailId);
|
List<SchisandraShareCommentReply> schisandraShareComments = schisandraShareCommentReplyService.listComment(detailId);
|
||||||
List<SchisandraShareCommentReplyBO> schisandraShareCommentBOS = SchisandraShareCommentReplyBOConverter.INSTANCE.convertEntityToBOList(schisandraShareComments);
|
List<SchisandraShareCommentReplyBO> schisandraShareCommentBOS = SchisandraShareCommentReplyBOConverter.INSTANCE.convertEntityToBOList(schisandraShareComments);
|
||||||
|
List<WorkerWrapper> wrappers = new ArrayList<>();
|
||||||
schisandraShareCommentBOS.forEach(schisandraShareCommentReplyBO -> {
|
schisandraShareCommentBOS.forEach(schisandraShareCommentReplyBO -> {
|
||||||
SchisandraUserLikesComment schisandraUserLikesComment =
|
WorkerWrapper<SchisandraShareCommentReplyBO,String > workerWrapper = new WorkerWrapper.Builder<SchisandraShareCommentReplyBO,String >()
|
||||||
schisandraUserLikesCommentService.queryByuserIdAndDetailId(schisandraShareCommentReplyBO.getId(), userId);
|
.worker((SchisandraShareCommentReplyBO object, Map<String, WorkerWrapper> allWrappers) -> {
|
||||||
if(schisandraUserLikesComment!=null){
|
SchisandraUserLikesComment schisandraUserLikesComment =
|
||||||
schisandraShareCommentReplyBO.setIsLike(true);
|
schisandraUserLikesCommentService.queryByuserIdAndDetailId(object.getId(), userId);
|
||||||
}
|
if(schisandraUserLikesComment!=null){
|
||||||
AuthUserInfoEntity userInfo = userRpc.getUserInfo(schisandraShareCommentReplyBO.getUserId());
|
object.setIsLike(true);
|
||||||
schisandraShareCommentReplyBO.setNick(userInfo.getNickName());
|
}
|
||||||
schisandraShareCommentReplyBO.setAvatar(userInfo.getAvatar());
|
AuthUserInfoEntity userInfo = userRpc.getUserInfo(object.getUserId());
|
||||||
|
object.setNick(userInfo.getNickName());
|
||||||
|
object.setAvatar(userInfo.getAvatar());
|
||||||
|
return "success";
|
||||||
|
|
||||||
|
})
|
||||||
|
.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());
|
||||||
});
|
});
|
||||||
|
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;
|
return schisandraShareCommentBOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user