Commit f518d744 by giaogiao

添加 未读人数, 已读为0

parent 7f50a93b
...@@ -37,6 +37,50 @@ public interface ImMessageService extends BaseService<ImMessage> { ...@@ -37,6 +37,50 @@ public interface ImMessageService extends BaseService<ImMessage> {
ApiResult<Boolean> updateMsgById(ImMsgUpdate imMsgUpdate); ApiResult<Boolean> updateMsgById(ImMsgUpdate imMsgUpdate);
/** /**
* 查询某个会话历史消息分页列表
*
* @param imHistoryMessagePageParam
* @return
* @throws Exception
*/
Paging<OfflineMsgDto> getHistoryMsgConversationId(ImHistoryMessagePageParam imHistoryMessagePageParam) throws Exception;
/**
* 查询用户所有离线消息
*
* @return
* @throws Exception
*/
List<ImMessageOfflineListVo> getOfflineList() throws Exception;
/**
* 根据客户端id与会话id 查询离线消息
*
* @param clientId
* @param conversationId
* @return
*/
List<OfflineMsgDto> getOfflineListByClientAndConversation(Long clientId, Long conversationId);
/**
* 查询会话的最后一条消息
*
* @param conversationId
* @return
*/
OfflineMsgDto getLastMsgByConversationId(Long conversationId);
/**
* 查询会话接收的最后一条消息
*
* @param clientId
* @param conversationId
* @return
*/
OfflineMsgDto getReceivedLastMsgByConversationId(Long clientId, Long conversationId);
/**
* 保存 * 保存
* *
* @param imMessage * @param imMessage
...@@ -80,53 +124,4 @@ public interface ImMessageService extends BaseService<ImMessage> { ...@@ -80,53 +124,4 @@ public interface ImMessageService extends BaseService<ImMessage> {
// * @throws Exception // * @throws Exception
// */ // */
// Paging<ImMessageQueryVo> getImMessagePageList(ImMessagePageParam imMessagePageParam) throws Exception; // Paging<ImMessageQueryVo> getImMessagePageList(ImMessagePageParam imMessagePageParam) throws Exception;
/**
* 查询某个会话历史消息分页列表
*
* @param imHistoryMessagePageParam
* @return
* @throws Exception
*/
Paging<OfflineMsgDto> getHistoryMsgConversationId(ImHistoryMessagePageParam imHistoryMessagePageParam) throws Exception;
/**
* 查询用户所有离线消息
*
* @return
* @throws Exception
*/
List<ImMessageOfflineListVo> getOfflineList() throws Exception;
/**
* 根据客户端id与会话id 查询离线消息
*
* @param clientId
* @param conversationId
* @return
*/
List<OfflineMsgDto> getOfflineListByClientAndConversation(Long clientId, Long conversationId);
/**
* 查询会话接收的最后一条消息
*
* @param clientId
* @param conversationId
* @return
*/
OfflineMsgDto getReceivedLastMsgByConversationId(Long clientId, Long conversationId);
/**
* 查询会话的最后一条消息
*
* @param conversationId
* @return
*/
OfflineMsgDto getLastMsgByConversationId(Long conversationId);
} }
...@@ -172,7 +172,7 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes ...@@ -172,7 +172,7 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
for (ImConversation imConversation : myImConversationList) { for (ImConversation imConversation : myImConversationList) {
//根据客户端id与会话id 查询离线消息 //根据客户端id与会话id 查询离线消息
List<OfflineMsgDto> offlineListByClientAndConversation = getOfflineListByClientAndConversation(client.getId(), imConversation.getId()); List<OfflineMsgDto> offlineListByClientAndConversation = this.getOfflineListByClientAndConversation(client.getId(), imConversation.getId());
ImMessageOfflineListVo imMessageOfflineListVo = new ImMessageOfflineListVo(); ImMessageOfflineListVo imMessageOfflineListVo = new ImMessageOfflineListVo();
imMessageOfflineListVo.setMsgList(offlineListByClientAndConversation); imMessageOfflineListVo.setMsgList(offlineListByClientAndConversation);
......
...@@ -42,4 +42,17 @@ public class OfflineMsgDto implements Serializable { ...@@ -42,4 +42,17 @@ public class OfflineMsgDto implements Serializable {
@ApiModelProperty("at他人,传入客户端id数组") @ApiModelProperty("at他人,传入客户端id数组")
private String at; private String at;
@ApiModelProperty("未读人数, 已读为0")
private Integer notReadCount;
// @ApiModelProperty("读取时间")
// private Date readTime;
//
// @ApiModelProperty("接收时间")
// private Date receiverTime;
// @ApiModelProperty("0未接收; 1已接收")
// private Integer receiverMsgStatus;
} }
package com.wecloud.im.ws.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class FileHelperOfflineModel implements Serializable {
private String messageId;
@ApiModelProperty(value = "消息内容")
private String content;
@ApiModelProperty(value = "消息类型 text, audio, image, file, video, location")
private String type;
@ApiModelProperty(value = "资源id")
private String sourceId;
@ApiModelProperty(value = "时长(s)")
private Integer duration;
@ApiModelProperty(value = "位置信息")
private String locationInfo;
@ApiModelProperty(value = "图片/视频尺寸相关信息")
private String measureInfo;
@ApiModelProperty(value = "消息回执id")
private String backId;
@ApiModelProperty(value = "文件名")
private String fileName;
@ApiModelProperty(value = "文件大小")
private String fileSize;
@ApiModelProperty(value = "消息渠道 singleChat, groupChat,systemNotice,syncMySend")
private String route;
@ApiModelProperty(value = "时间戳")
private Date timestamp;
}
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
FROM im_inbox FROM im_inbox
WHERE im_inbox.fk_conversation_id = imConversation.id WHERE im_inbox.fk_conversation_id = imConversation.id
AND im_inbox.receiver = #{clientId} AND im_inbox.receiver = #{clientId}
AND im_inbox.receiver_msg_status = 0) AS msg_not_read_count, AND im_inbox.read_msg_status = 0) AS msg_not_read_count,
( (
SELECT GROUP_CONCAT(im_client.client_id) SELECT GROUP_CONCAT(im_client.client_id)
FROM im_conversation_members AS im_conversation_members FROM im_conversation_members AS im_conversation_members
...@@ -79,9 +79,7 @@ ...@@ -79,9 +79,7 @@
FROM im_conversation_members FROM im_conversation_members
WHERE im_conversation_members.fk_client_id = #{clientId2}) AS im_conversation_members2 WHERE im_conversation_members.fk_client_id = #{clientId2}) AS im_conversation_members2
ON im_conversation_members.fk_conversation_id = im_conversation_members2.fk_conversation_id ON im_conversation_members.fk_conversation_id = im_conversation_members2.fk_conversation_id
INNER JOIN im_conversation ON im_conversation.id = im_conversation_members.fk_conversation_id INNER JOIN im_conversation ON im_conversation.id = im_conversation_members.fk_conversation_id
WHERE im_conversation_members.fk_client_id = #{clientId1} LIMIT 1 WHERE im_conversation_members.fk_client_id = #{clientId1} LIMIT 1
</select> </select>
......
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
im_message.system, im_message.system,
im_message.`at`, im_message.`at`,
im_message.send_status, im_message.send_status,
im_message.fk_conversation_id im_message.fk_conversation_id,
(SELECT COUNT(id) FROM im_inbox WHERE fk_msg_id = msgId AND read_msg_status = 0) AS not_read_count
FROM `im_message` FROM `im_message`
INNER JOIN `im_client` ON `im_client`.id = `im_message`.sender INNER JOIN `im_client` ON `im_client`.id = `im_message`.sender
WHERE fk_conversation_id = #{param.conversationId} WHERE fk_conversation_id = #{param.conversationId}
......
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