Commit b320cec1 authored by 刘基明's avatar 刘基明

关注话题npe

parent f09ab871
......@@ -100,9 +100,11 @@ public class TopicManager {
Map<String, TopicRankQo> topicMap = rankService.getRankTopicList(null).stream().collect(Collectors.toMap(TopicRankQo::getTopicId, o -> o, (a, b) -> a));
topicFollowQos.stream().forEach(o -> {
TopicRankQo topicRankQo = topicMap.get(o.getTopicId());
BeanUtils.copyProperties(topicRankQo, o);
o.setHasPermission(true);
if (topicMap.containsKey(o.getTopicId())) {
TopicRankQo topicRankQo = topicMap.get(o.getTopicId());
BeanUtils.copyProperties(topicRankQo, o);
o.setHasPermission(true);
}
});
......@@ -184,7 +186,7 @@ public class TopicManager {
public DiscussionAeraQo getForum(TopicDiscussionReq req) {
TopicEntity topicEntity = topicService.queryRelateTopic(req);
// 没有关联话题,或者已下线
if (topicEntity==null) return null;
if (topicEntity == null) return null;
DiscussionAeraQo result = new DiscussionAeraQo();
......@@ -192,9 +194,9 @@ public class TopicManager {
List<TopicRankQo> collect = rankTopicList.stream().filter(o -> o.getTopicId().equals(topicEntity.getTopicId())).collect(Collectors.toList());
BeanUtils.copyProperties(collect.get(0),result);
BeanUtils.copyProperties(collect.get(0), result);
if (result.getDisscussCount()!=null && result.getDisscussCount()>99){
if (result.getDisscussCount() != null && result.getDisscussCount() > 99) {
result.setFormatDisscussCount("99+");
}
......@@ -204,9 +206,9 @@ public class TopicManager {
List<String> authorIds = new ArrayList<>(themeEntities.stream().map(ThemeEntity::getAuthorId).collect(Collectors.toSet()));
List<UserInfoResp> queryUsersListNew = feignService.getUserList(authorIds);
Map<String, UserInfoResp> nameMap = queryUsersListNew.stream().collect(Collectors.toMap(UserInfoResp::getUserId, o->o));
Map<String, UserInfoResp> nameMap = queryUsersListNew.stream().collect(Collectors.toMap(UserInfoResp::getUserId, o -> o));
result.setThemes(ConvertUtil.themeEntity2Discussion(themeEntities,nameMap));
result.setThemes(ConvertUtil.themeEntity2Discussion(themeEntities, nameMap));
return result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment