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

消息通知 fix

parent 94a20617
...@@ -177,7 +177,7 @@ public class CommentManager { ...@@ -177,7 +177,7 @@ public class CommentManager {
private void messageNotify(String notifyUserId,String operatorId, NotificationTypeEnum type){ private void messageNotify(String notifyUserId,String operatorId, NotificationTypeEnum type){
UserInfoResp userInfo = getUserInfo(operatorId); UserInfoResp userInfo = getUserInfo(operatorId);
redisCache.incr(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + notifyUserId); redisCache.incr(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + notifyUserId);
redisCache.put(RedisKeyConstant.MESSAGE_NOTIFY_LAST_MSG + notifyUserId, userInfo.getNickName()+type.getType()+"了你的内容", 60 * 60 * 24 * 30); redisCache.set(RedisKeyConstant.MESSAGE_NOTIFY_LAST_MSG + notifyUserId, userInfo.getNickName()+type.getType()+"了你的内容", 60 * 60 * 24 * 30);
redisCache.put(RedisKeyConstant.MESSAGE_NOTIFY_LAST_TIME + notifyUserId, TimeUtils.format(LocalDateTime.now()), 60 * 60 * 24 * 30); redisCache.set(RedisKeyConstant.MESSAGE_NOTIFY_LAST_TIME + notifyUserId, TimeUtils.format(LocalDateTime.now()), 60 * 60 * 24 * 30);
} }
} }
...@@ -249,8 +249,8 @@ public class HomePageManager { ...@@ -249,8 +249,8 @@ public class HomePageManager {
private void messageFollowNotify(String notifyUserId, String operatorId) { private void messageFollowNotify(String notifyUserId, String operatorId) {
UserInfoResp userInfo = getUserInfo(operatorId); UserInfoResp userInfo = getUserInfo(operatorId);
redisCache.incr(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + notifyUserId); redisCache.incr(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + notifyUserId);
redisCache.put(RedisKeyConstant.MESSAGE_NOTIFY_LAST_MSG + notifyUserId, userInfo.getNickName() + "关注了你", 60 * 60 * 24 * 30); redisCache.set(RedisKeyConstant.MESSAGE_NOTIFY_LAST_MSG + notifyUserId, userInfo.getNickName() + "关注了你", 60 * 60 * 24 * 30);
redisCache.put(RedisKeyConstant.MESSAGE_NOTIFY_LAST_TIME + notifyUserId, TimeUtils.format(LocalDateTime.now()), 60 * 60 * 24 * 30); redisCache.set(RedisKeyConstant.MESSAGE_NOTIFY_LAST_TIME + notifyUserId, TimeUtils.format(LocalDateTime.now()), 60 * 60 * 24 * 30);
} }
private UserInfoResp getUserInfo(String authorId) { private UserInfoResp getUserInfo(String authorId) {
......
...@@ -97,7 +97,7 @@ public class NotificationManager { ...@@ -97,7 +97,7 @@ public class NotificationManager {
ThemeEntity former = themeService.queryByThemeId(themeNotifyQo.getFormerThemeId()); ThemeEntity former = themeService.queryByThemeId(themeNotifyQo.getFormerThemeId());
if (former != null) { if (former != null) {
themeNotifyQo.setFormerUserName(currentUser.getNickName()); themeNotifyQo.setFormerUserName(currentUser.getNickName());
if (ThemeTypeEnum.DISCUSSION.getCode().equals(former.getThemeType())) { if (ThemeTypeEnum.DISCUSSION.getCode().equals(former.getThemeType()) || ThemeTypeEnum.FORWARD.getCode().equals(former.getThemeType())) {
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(former.getContent(), new TypeReference<List<ThemeContentQo>>() { List<ThemeContentQo> themeContentQos = JsonUtil.toBean(former.getContent(), new TypeReference<List<ThemeContentQo>>() {
}); });
themeNotifyQo.setFormerContent(themeContentQos.get(0).getValue()); themeNotifyQo.setFormerContent(themeContentQos.get(0).getValue());
...@@ -114,8 +114,8 @@ public class NotificationManager { ...@@ -114,8 +114,8 @@ public class NotificationManager {
if (themeNotifyQo.getLikeUserCount()!=null && themeNotifyQo.getLikeUserCount()>1) { if (themeNotifyQo.getLikeUserCount()!=null && themeNotifyQo.getLikeUserCount()>1) {
List<UserBriefInfoQO> likeUsers = themeNotifyQo.getLikeUsers(); List<UserBriefInfoQO> likeUsers = themeNotifyQo.getLikeUsers();
for (UserBriefInfoQO likeUser : likeUsers) { for (UserBriefInfoQO likeUser : likeUsers) {
UserInfoResp luser = redisCache.getObject(StringUtils.joinWith("_", CACHE_FEIGN_USER_INFO, themeNotifyQo.getAuthorId()), UserInfoResp luser = redisCache.getObject(StringUtils.joinWith("_", CACHE_FEIGN_USER_INFO, likeUser.getUserId()),
60, () -> this.getUserInfo(themeNotifyQo.getAuthorId()), UserInfoResp.class); 60, () -> this.getUserInfo(likeUser.getUserId()), UserInfoResp.class);
likeUser.setHeadImageUrl(luser.getHeadImageUrl()); likeUser.setHeadImageUrl(luser.getHeadImageUrl());
likeUser.setNickName(luser.getNickName()); likeUser.setNickName(luser.getNickName());
} }
...@@ -208,16 +208,16 @@ public class NotificationManager { ...@@ -208,16 +208,16 @@ public class NotificationManager {
private void messageNotify(String notifyUserId, String operatorId, NotificationTypeEnum type) { private void messageNotify(String notifyUserId, String operatorId, NotificationTypeEnum type) {
UserInfoResp userInfo = getUserInfo(operatorId); UserInfoResp userInfo = getUserInfo(operatorId);
redisCache.incr(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + notifyUserId); redisCache.incr(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + notifyUserId);
redisCache.put(RedisKeyConstant.MESSAGE_NOTIFY_LAST_MSG + notifyUserId, userInfo.getNickName() + type.getType() + "了你的内容", 60 * 60 * 24 * 30); redisCache.set(RedisKeyConstant.MESSAGE_NOTIFY_LAST_MSG + notifyUserId, userInfo.getNickName() + type.getType() + "了你的内容", 60 * 60 * 24 * 30);
redisCache.put(RedisKeyConstant.MESSAGE_NOTIFY_LAST_TIME + notifyUserId, TimeUtils.format(LocalDateTime.now()), 60 * 60 * 24 * 30); redisCache.set(RedisKeyConstant.MESSAGE_NOTIFY_LAST_TIME + notifyUserId, TimeUtils.format(LocalDateTime.now()), 60 * 60 * 24 * 30);
} }
// 消息通知队列缓存 // 消息通知队列缓存
private void messageNotifyFollow(String notifyUserId, String operatorId) { private void messageNotifyFollow(String notifyUserId, String operatorId) {
UserInfoResp userInfo = getUserInfo(operatorId); UserInfoResp userInfo = getUserInfo(operatorId);
redisCache.incr(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + notifyUserId); redisCache.incr(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + notifyUserId);
redisCache.put(RedisKeyConstant.MESSAGE_NOTIFY_LAST_MSG + notifyUserId, userInfo.getNickName() + "关注了你", 60 * 60 * 24 * 30); redisCache.set(RedisKeyConstant.MESSAGE_NOTIFY_LAST_MSG + notifyUserId, userInfo.getNickName() + "关注了你", 60 * 60 * 24 * 30);
redisCache.put(RedisKeyConstant.MESSAGE_NOTIFY_LAST_TIME + notifyUserId, TimeUtils.format(LocalDateTime.now()), 60 * 60 * 24 * 30); redisCache.set(RedisKeyConstant.MESSAGE_NOTIFY_LAST_TIME + notifyUserId, TimeUtils.format(LocalDateTime.now()), 60 * 60 * 24 * 30);
} }
private UserInfoResp getUserInfo(String authorId) { private UserInfoResp getUserInfo(String authorId) {
......
...@@ -931,8 +931,8 @@ public class ThemeManager { ...@@ -931,8 +931,8 @@ public class ThemeManager {
private void messageNotify(String notifyUserId,String operatorId, NotificationTypeEnum type){ private void messageNotify(String notifyUserId,String operatorId, NotificationTypeEnum type){
UserInfoResp userInfo = getUserInfo(operatorId); UserInfoResp userInfo = getUserInfo(operatorId);
redisCache.incr(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + notifyUserId); redisCache.incr(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + notifyUserId);
redisCache.put(RedisKeyConstant.MESSAGE_NOTIFY_LAST_MSG + notifyUserId, userInfo.getNickName()+type.getType()+"了你的内容", 60 * 60 * 24 * 30); redisCache.set(RedisKeyConstant.MESSAGE_NOTIFY_LAST_MSG + notifyUserId, userInfo.getNickName()+type.getType()+"了你的内容", 60 * 60 * 24 * 30);
redisCache.put(RedisKeyConstant.MESSAGE_NOTIFY_LAST_TIME + notifyUserId, TimeUtils.format(LocalDateTime.now()), 60 * 60 * 24 * 30); redisCache.set(RedisKeyConstant.MESSAGE_NOTIFY_LAST_TIME + notifyUserId, TimeUtils.format(LocalDateTime.now()), 60 * 60 * 24 * 30);
} }
} }
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