Commit 6bd2c1f6 authored by 刘基明's avatar 刘基明

消息通知 fix

parent 2653c228
......@@ -23,16 +23,16 @@ public class ThemeNotifyQo {
@ApiModelProperty(value = "1:转发 2:点赞 3:评论 4:关注")
private Integer messageType;
@ApiModelProperty(value = "作者id")
@ApiModelProperty(value = "操作用户id")
public String authorId;
@ApiModelProperty(value = "用户头像")
@ApiModelProperty(value = "操作用户头像")
public String userImg;
@ApiModelProperty(value = "昵称")
@ApiModelProperty(value = "操作用户昵称")
public String nickName;
@ApiModelProperty(value = "用户简介")
@ApiModelProperty(value = "操作用户简介")
private String userIntroduction;
@ApiModelProperty(value = "当前用户是否关注该作者")
@ApiModelProperty(value = "当前用户是否关注该操作用户")
public boolean follow;
@ApiModelProperty(value = "认证机构")
private String authOrg;
......
......@@ -40,6 +40,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import static com.tanpu.community.api.constants.RedisKeyConstant.CACHE_FEIGN_USER_INFO;
......@@ -79,6 +81,7 @@ public class NotificationManager {
List<ThemeNotifyQo> themeNotifyQos = ConvertUtil.notificationEntitiy2ThemeQos(query);
UserInfoResp currentUser = redisCache.getObject(StringUtils.joinWith("_", CACHE_FEIGN_USER_INFO, userId),
60, () -> this.getUserInfo(userId), UserInfoResp.class);
Set<String> followUserIds= followRelService.queryIdolsByFansId(userId).stream().collect(Collectors.toSet());
for (ThemeNotifyQo themeNotifyQo : themeNotifyQos) {
// 用户信息
......@@ -107,10 +110,12 @@ public class NotificationManager {
}
}
}
// 话题
if (StringUtils.isNotEmpty(themeNotifyQo.getTopicId())) {
TopicEntity topicEntity = topicService.queryById(themeNotifyQo.getTopicId());
themeNotifyQo.setTopicTitle(topicEntity.getTopicTitle());
}
// 点赞聚合
if (themeNotifyQo.getLikeUserCount()!=null && themeNotifyQo.getLikeUserCount()>1) {
List<UserBriefInfoQO> likeUsers = themeNotifyQo.getLikeUsers();
for (UserBriefInfoQO likeUser : likeUsers) {
......@@ -120,6 +125,8 @@ public class NotificationManager {
likeUser.setNickName(luser.getNickName());
}
}
// 是否关注
themeNotifyQo.setFollow(followUserIds.contains(themeNotifyQo.getAuthorId()));
}
redisCache.evict(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + userId);
......
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