|
@@ -14,6 +14,7 @@ import com.ruoyi.generator.mapper.community.CommunityUserBlockMapper;
|
|
|
import com.ruoyi.system.domain.CommunityChatMsg;
|
|
|
import com.ruoyi.system.domain.vo.CommunityChatMsgVo;
|
|
|
import com.ruoyi.system.domain.vo.SysUserVo;
|
|
|
+import com.ruoyi.system.mapper.CommunityChatMsgMapper;
|
|
|
import com.ruoyi.system.mapper.SysUserMapper;
|
|
|
import com.ruoyi.system.service.ICommunityChatMsgService;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -48,6 +49,8 @@ public class CommunityChatMsgController extends BaseController {
|
|
|
@Resource
|
|
|
private CommunityUserBlockMapper communityUserBlockMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private CommunityChatMsgMapper communitychatMsgMapper;
|
|
|
/**
|
|
|
* 获取当前登录用户聊天记录
|
|
|
*/
|
|
@@ -65,7 +68,8 @@ public class CommunityChatMsgController extends BaseController {
|
|
|
return AjaxResult.success("当前用户已经被拉黑");
|
|
|
}
|
|
|
}
|
|
|
- List<CommunityChatMsg> chatMsgList = communityChatMsgService.list(new QueryWrapper<CommunityChatMsg>()
|
|
|
+
|
|
|
+ /*List<CommunityChatMsg> chatMsgList = communityChatMsgService.list(new QueryWrapper<CommunityChatMsg>()
|
|
|
.and(wrapper -> wrapper.eq("sender_id", userId)
|
|
|
.eq("receiver_id", otherUserId)
|
|
|
.or()
|
|
@@ -76,7 +80,9 @@ public class CommunityChatMsgController extends BaseController {
|
|
|
wrapper.ne("is_delete", 1).or().isNull("is_delete");
|
|
|
})
|
|
|
.orderByDesc("create_time")
|
|
|
- );
|
|
|
+ );*/
|
|
|
+ List<CommunityChatMsg> chatMsgList = communitychatMsgMapper.getChatMsgRecord(userId, otherUserId, type);
|
|
|
+
|
|
|
//更新该消息标记为已读
|
|
|
List<Long> msgId = chatMsgList.stream()
|
|
|
.filter(item -> !item.isReceiverIsRead() && Objects.equals(item.getReceiverId(), SecurityUtils.getUserId()))
|
|
@@ -168,6 +174,16 @@ public class CommunityChatMsgController extends BaseController {
|
|
|
wrapper.ne("is_delete", 1).or().isNull("is_delete");
|
|
|
})
|
|
|
);
|
|
|
+ communityChatMsgService.update(
|
|
|
+ null,
|
|
|
+ new UpdateWrapper<CommunityChatMsg>()
|
|
|
+ .eq("sender_id", otherUserId )
|
|
|
+ .eq("receiver_id", userId)
|
|
|
+ .set("receiver_is_delete", true)
|
|
|
+ .and((wrapper) -> {
|
|
|
+ wrapper.ne("receiver_is_delete", 1).or().isNull("receiver_is_delete");
|
|
|
+ })
|
|
|
+ );
|
|
|
} catch (Exception e) {
|
|
|
throw new ProjectException();
|
|
|
}
|