|
@@ -51,13 +51,16 @@ public class KfRoomMsgServiceImpl extends ServiceImpl<KfRoomMsgMapper, KfRoomMsg
|
|
|
//构造消息列表
|
|
|
List<KfWebSocketMsgDTO.RoomMsgBean> roomMsgBeanList = kfRoomMsgPage.getRecords().stream()
|
|
|
.map(roomMsgBean -> this.transform(roomMsgBean, kfUserNameMap)).collect(Collectors.toList());
|
|
|
- //消息列表不为空
|
|
|
- if (CollectionUtils.isNotEmpty(roomMsgBeanList)) {
|
|
|
- //更新消息已读状态
|
|
|
- List<String> msgIdList = roomMsgBeanList.stream()
|
|
|
- .filter(msg -> Objects.equals(msg.getReadStatus(), Boolean.FALSE))
|
|
|
- .map(KfWebSocketMsgDTO.RoomMsgBean::getMsgId)
|
|
|
- .collect(Collectors.toList());
|
|
|
+ //没有查到数据
|
|
|
+ if (CollectionUtils.isEmpty(roomMsgBeanList)) {
|
|
|
+ return Tuples.of(KfWebSocketMsgDTO.defaultPage(pageBean.getPageNum(), pageBean.getPageSize()), Collections.emptyList());
|
|
|
+ }
|
|
|
+ //更新消息已读状态
|
|
|
+ List<String> msgIdList = roomMsgBeanList.stream()
|
|
|
+ .filter(msg -> Objects.equals(msg.getReadStatus(), Boolean.FALSE))
|
|
|
+ .map(KfWebSocketMsgDTO.RoomMsgBean::getMsgId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(msgIdList)) {
|
|
|
super.update(new LambdaUpdateWrapper<KfRoomMsg>()
|
|
|
.set(KfRoomMsg::getReadStatus, Boolean.TRUE)
|
|
|
.set(KfRoomMsg::getUpdateTime, LocalDateTime.now())
|