Merge remote-tracking branch 'origin/dev/dev' into dev/dev

This commit is contained in:
shahaibo
2024-09-29 17:59:00 +08:00
4 changed files with 18 additions and 2 deletions

View File

@@ -59,7 +59,8 @@ public class CommonConstant {
public static final List<String> IS_SUBSCRIBE = Arrays.asList("yes", "no");
public static final String DEFAULT_AVATAR = "aida-users/87/avatar/default.jpg";
// public static final String DEFAULT_AVATAR = "aida-users/87/avatar/default.jpg";
public static final String DEFAULT_AVATAR = "aida-users/87/avatar/default.png";
/* 截止至2024/08/26在Code-Create DB中pmr_users表中最大的用户id */
public static final Long MAXIMUM_USER_ID = 704L;

View File

@@ -18,6 +18,8 @@ public interface MessageCenterService extends IService<Notification> {
void prePushMessage(Notification notification);
void pushMessage(String type, Long receiverId);
void cancelPushMessage(String type, Long senderId, Long receiverId, Long portfolioId, Long commentId);
Boolean setReadStatus(List<Long> notificationIdList, String type);

View File

@@ -168,6 +168,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
ArrayList<Map<String, Object>> resp = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
Long count;
Long accountId = UserContext.getUserHolder().getId();
if (!type.equals("system")) {
// 个人未读消息
count = getUnreadCountByType(type, receiverId);
@@ -175,9 +176,19 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
// 系统未读消息
count = getUnreadSystemNotification();
}
if (type.equals("follow")){
HashMap<String, Object> followee = new HashMap<>();
HashMap<String, Object> follower = new HashMap<>();
follower.put("followerCount",portfolioService.getFollowerCount(accountId));
followee.put("followeeCount",portfolioService.getFolloweeCount(accountId));
resp.add(followee);
resp.add(follower);
}
data.put(type, count);
resp.add(data);
if (count != 0){
resp.add(data);
}
String jsonString = JSON.toJSONString(resp);
log.info("消息推送 {}", jsonString);

View File

@@ -1115,6 +1115,8 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
} else {
throw new BusinessException("you.have.not.followed.the.current.user", 1);
}
// 3、更新关注人数
messageCenterService.pushMessage("follow", accountId);
}
public Long getFolloweeCount(Long accountId) {