|
|
@ -4,7 +4,6 @@ package com.luoo.comment.service.impl;
|
|
|
|
import api.Result;
|
|
|
|
import api.Result;
|
|
|
|
import client.vo.SimpleUser;
|
|
|
|
import client.vo.SimpleUser;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import com.luoo.comment.client.UserClient;
|
|
|
|
|
|
|
|
import com.luoo.comment.dao.CommentDao;
|
|
|
|
import com.luoo.comment.dao.CommentDao;
|
|
|
|
import com.luoo.comment.enums.CommentStatusEnum;
|
|
|
|
import com.luoo.comment.enums.CommentStatusEnum;
|
|
|
|
import com.luoo.comment.pojo.Comment;
|
|
|
|
import com.luoo.comment.pojo.Comment;
|
|
|
@ -32,8 +31,8 @@ import java.util.stream.Collectors;
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public class CommentServiceImpl implements CommentService {
|
|
|
|
public class CommentServiceImpl implements CommentService {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
// @Autowired
|
|
|
|
private UserClient userClient;
|
|
|
|
// private UserClient userClient;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private CommentDao commentDao;
|
|
|
|
private CommentDao commentDao;
|
|
|
@ -109,7 +108,8 @@ public class CommentServiceImpl implements CommentService {
|
|
|
|
|
|
|
|
|
|
|
|
List<String> userIds = comments.stream().map(Comment::getUserId).collect(Collectors.toList());
|
|
|
|
List<String> userIds = comments.stream().map(Comment::getUserId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
Result<List<SimpleUser>> userByIds = userClient.findUserByIds(userIds);
|
|
|
|
// Result<List<SimpleUser>> userByIds = userClient.findUserByIds(userIds);
|
|
|
|
|
|
|
|
Result<List<SimpleUser>> userByIds = Result.success(null);
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, SimpleUser> userIdAndInfoMap = userByIds.getData().stream().collect(Collectors.toMap(SimpleUser::getUserId, Function.identity()));
|
|
|
|
Map<String, SimpleUser> userIdAndInfoMap = userByIds.getData().stream().collect(Collectors.toMap(SimpleUser::getUserId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
|
@ -161,8 +161,8 @@ public class CommentServiceImpl implements CommentService {
|
|
|
|
List<CommentVo> commentVos = byArticleId.stream().map(Comment::convertVo).collect(Collectors.toList());
|
|
|
|
List<CommentVo> commentVos = byArticleId.stream().map(Comment::convertVo).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
List<String> userIds = byArticleId.stream().map(Comment::getUserId).collect(Collectors.toList());
|
|
|
|
List<String> userIds = byArticleId.stream().map(Comment::getUserId).collect(Collectors.toList());
|
|
|
|
Result<List<SimpleUser>> userByIds = userClient.findUserByIds(userIds);
|
|
|
|
// Result<List<SimpleUser>> userByIds = userClient.findUserByIds(userIds);
|
|
|
|
|
|
|
|
Result<List<SimpleUser>> userByIds = Result.success(null);
|
|
|
|
Map<String, SimpleUser> userIdAndInfoMap = userByIds.getData().stream().collect(Collectors.toMap(SimpleUser::getUserId, Function.identity()));
|
|
|
|
Map<String, SimpleUser> userIdAndInfoMap = userByIds.getData().stream().collect(Collectors.toMap(SimpleUser::getUserId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
|
|
for (CommentVo commentVo : commentVos) {
|
|
|
|
for (CommentVo commentVo : commentVos) {
|
|
|
|