|
@@ -130,6 +130,26 @@ public class CommunityChatMsgController extends BaseController {
|
|
|
return AjaxResult.success(sysUserChatVos);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 我的私信是否有未读
|
|
|
+ */
|
|
|
+ @ApiOperation("我的私信消息提示")
|
|
|
+ @GetMapping("/messageAlert")
|
|
|
+ public AjaxResult messageAlert(String type) {
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
+ List<SysUserVo> sysUserChatVos = null;
|
|
|
+ boolean hasUnreadMessages = false;
|
|
|
+ try {
|
|
|
+ sysUserChatVos = communityChatMsgService.getChatListWithLatestMessage(userId, type);
|
|
|
+ // 判断是否有未读消息
|
|
|
+ hasUnreadMessages = sysUserChatVos.stream()
|
|
|
+ .anyMatch(vo -> Objects.equals(vo.getReceiverId(), userId) && !vo.isReceiverIsRead());
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ProjectException();
|
|
|
+ }
|
|
|
+ return AjaxResult.success(hasUnreadMessages);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 清空聊天记录
|
|
|
*/
|