1. fix error

main
lyp 10 months ago
parent 4b62a7003d
commit febc1f7989

@ -1,8 +1,10 @@
package com.luoo.comment.config; package com.luoo.comment.config;
import org.springframework.context.ResourceLoaderAware; import org.springframework.context.ResourceLoaderAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
import util.JwtUtil;
@Configuration @Configuration
public class MyConfiguration implements ResourceLoaderAware { public class MyConfiguration implements ResourceLoaderAware {
@ -12,4 +14,10 @@ public class MyConfiguration implements ResourceLoaderAware {
public void setResourceLoader(ResourceLoader resourceLoader) { public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader; this.resourceLoader = resourceLoader;
} }
@Bean
public JwtUtil jwtUtil(){
return new JwtUtil();
}
} }

@ -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) {

Loading…
Cancel
Save