Commit 2a4bd0ec authored by 刘基明's avatar 刘基明

消息通知初始化

parent 0112d403
......@@ -58,10 +58,8 @@ public class ThemeNotifyQo {
public String formerUserName;
// 点赞聚合
@ApiModelProperty(value = "用户头像")
public List<String> likeUserIds;
@ApiModelProperty(value = "用户头像")
public List<String> likeUserImgs;
@ApiModelProperty(value = "用户id")
public List<UserBriefInfoQO> likeUsers;
@ApiModelProperty(value = "点赞人数")
public Integer likeUserCount;
......
package com.tanpu.community.api.beans.qo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class UserBriefInfoQO {
@ApiModelProperty("用户id")
private String userId;//用户id
@ApiModelProperty("昵称")
private String nickName;//昵称
@ApiModelProperty("头像")
private String headImageUrl;//头像
}
......@@ -9,6 +9,7 @@ import com.tanpu.community.api.beans.qo.NotificationQo;
import com.tanpu.community.api.beans.qo.ThemeContentQo;
import com.tanpu.community.api.beans.qo.ThemeNotifyQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.qo.UserBriefInfoQO;
import com.tanpu.community.api.beans.req.notification.NotifyQueryReq;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp;
import com.tanpu.community.api.constants.RedisKeyConstant;
......@@ -107,6 +108,15 @@ public class NotificationManager {
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) {
UserInfoResp luser = redisCache.getObject(StringUtils.joinWith("_", CACHE_FEIGN_USER_INFO, themeNotifyQo.getAuthorId()),
60, () -> this.getUserInfo(themeNotifyQo.getAuthorId()), UserInfoResp.class);
likeUser.setHeadImageUrl(luser.getHeadImageUrl());
likeUser.setNickName(luser.getNickName());
}
}
}
redisCache.evict(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + userId);
......
......@@ -273,7 +273,9 @@ public class ConvertUtil {
try {
NotificationLikeDO notificationLikeDO = JsonUtil.toBean(entity.getContent(), NotificationLikeDO.class);
themeNotifyQo.setLikeUserCount(notificationLikeDO.getCount());
themeNotifyQo.setLikeUserIds(new ArrayList<>(notificationLikeDO.getSet()));
ArrayList<UserBriefInfoQO> likeUsers = new ArrayList<>();
notificationLikeDO.getSet().stream().forEach(o->likeUsers.add(UserBriefInfoQO.builder().userId(o).build()));
themeNotifyQo.setLikeUsers(likeUsers);
}catch (Exception e){
throw new BizException("消息通知-点赞类型-反序列化异常:"+ entity.getContent());
}
......
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