- 实现完整的聊天界面UI组件,支持文本、图片、视频、音频、文件等多种消息类型 - 集成IM消息收发功能,实现消息气泡显示和用户头像占位符 - 添加媒体文件选择和拍摄功能,支持相册图片、视频及相机拍照录像 - 实现语音录制和播放功能,包含按住说话交互和权限处理 - 添加群组提及功能,支持@用户和提及候选列表显示 - 实现消息回复和引用功能,支持消息长按回复操作 - 添加本地消息搜索功能,支持搜索当前会话的历史消息 - 实现文件上传下载功能,集成FileSDK进行文件传输管理 - 添加应用更新检查功能,集成UpdateSDK支持版本更新 - 实现消息状态显示,包括发送、送达、已读等状态标识 - 添加群组已读人数统计,显示消息在群聊中的阅读情况 - 实现草稿保存和恢复功能,支持断点续聊体验 - 添加连接状态横幅,实时显示IM服务连接状态 - 实现滚动加载更多历史消息,优化大量消息的性能表现 - 添加多媒体文件下载保存功能,支持保存到应用专属目录
114 行
4.0 KiB
Java
114 行
4.0 KiB
Java
package com.xuqm.im.entity;
|
|
|
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|
import com.xuqm.im.json.EpochMillisLocalDateTimeDeserializer;
|
|
import com.xuqm.im.json.EpochMillisLocalDateTimeSerializer;
|
|
import jakarta.persistence.Column;
|
|
import jakarta.persistence.Entity;
|
|
import jakarta.persistence.EnumType;
|
|
import jakarta.persistence.Enumerated;
|
|
import jakarta.persistence.Id;
|
|
import jakarta.persistence.Index;
|
|
import jakarta.persistence.Table;
|
|
import jakarta.persistence.Transient;
|
|
import java.time.LocalDateTime;
|
|
|
|
@Entity
|
|
@Table(name = "im_message", indexes = {
|
|
@Index(name = "idx_app_from", columnList = "appId,fromUserId"),
|
|
@Index(name = "idx_app_to", columnList = "appId,toId")
|
|
})
|
|
public class ImMessageEntity {
|
|
|
|
public enum ChatType { SINGLE, GROUP }
|
|
public enum MsgType {
|
|
TEXT, IMAGE, VIDEO, AUDIO, FILE, CUSTOM, LOCATION, NOTIFY,
|
|
RICH_TEXT, CALL_AUDIO, CALL_VIDEO, FORWARD, QUOTE, MERGE, REVOKED
|
|
}
|
|
public enum MsgStatus { SENT, DELIVERED, READ, REVOKED }
|
|
|
|
@Id
|
|
private String id;
|
|
|
|
@Column(nullable = false, length = 64)
|
|
private String appId;
|
|
|
|
@Column(nullable = false, length = 128)
|
|
private String fromUserId;
|
|
|
|
@Column(nullable = false, length = 128)
|
|
private String toId;
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(nullable = false, length = 16)
|
|
private ChatType chatType;
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(nullable = false, length = 16)
|
|
private MsgType msgType;
|
|
|
|
@Column(nullable = false, columnDefinition = "TEXT")
|
|
private String content;
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(nullable = false, length = 16)
|
|
private MsgStatus status;
|
|
|
|
@Column(length = 128)
|
|
private String mentionedUserIds;
|
|
|
|
@Transient
|
|
private Integer groupReadCount;
|
|
|
|
@Column
|
|
@JsonSerialize(using = EpochMillisLocalDateTimeSerializer.class)
|
|
@JsonDeserialize(using = EpochMillisLocalDateTimeDeserializer.class)
|
|
private LocalDateTime editedAt;
|
|
|
|
@Column(nullable = false)
|
|
@JsonSerialize(using = EpochMillisLocalDateTimeSerializer.class)
|
|
@JsonDeserialize(using = EpochMillisLocalDateTimeDeserializer.class)
|
|
private LocalDateTime createdAt;
|
|
|
|
public String getId() { return id; }
|
|
public void setId(String id) { this.id = id; }
|
|
|
|
public String getAppId() { return appId; }
|
|
public void setAppId(String appId) { this.appId = appId; }
|
|
|
|
public String getFromUserId() { return fromUserId; }
|
|
public void setFromUserId(String fromUserId) { this.fromUserId = fromUserId; }
|
|
|
|
public String getToId() { return toId; }
|
|
public void setToId(String toId) { this.toId = toId; }
|
|
|
|
public ChatType getChatType() { return chatType; }
|
|
public void setChatType(ChatType chatType) { this.chatType = chatType; }
|
|
|
|
public MsgType getMsgType() { return msgType; }
|
|
public void setMsgType(MsgType msgType) { this.msgType = msgType; }
|
|
|
|
public String getContent() { return content; }
|
|
public void setContent(String content) { this.content = content; }
|
|
|
|
public MsgStatus getStatus() { return status; }
|
|
public void setStatus(MsgStatus status) { this.status = status; }
|
|
|
|
public String getMentionedUserIds() { return mentionedUserIds; }
|
|
public void setMentionedUserIds(String mentionedUserIds) { this.mentionedUserIds = mentionedUserIds; }
|
|
|
|
public Integer getGroupReadCount() { return groupReadCount; }
|
|
public void setGroupReadCount(Integer groupReadCount) { this.groupReadCount = groupReadCount; }
|
|
|
|
@JsonSerialize(using = EpochMillisLocalDateTimeSerializer.class)
|
|
@JsonDeserialize(using = EpochMillisLocalDateTimeDeserializer.class)
|
|
public LocalDateTime getEditedAt() { return editedAt; }
|
|
public void setEditedAt(LocalDateTime editedAt) { this.editedAt = editedAt; }
|
|
|
|
@JsonSerialize(using = EpochMillisLocalDateTimeSerializer.class)
|
|
@JsonDeserialize(using = EpochMillisLocalDateTimeDeserializer.class)
|
|
public LocalDateTime getCreatedAt() { return createdAt; }
|
|
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
|
|
}
|