主体(T17 数据同步,/admin/sync 三个独立按钮): - 同步群组:get_appid_group_list 全量 Next 分页 + 逐群 get_group_info → group_mapping - 同步群成员(→用户):遍历该租户群取 MemberList → user_mapping(腾讯无全量用户API,靠群成员反推) - 同步群消息:遍历该租户群 getGroupMsg + IsFinished 滚动全量 → im_message(source=SYNC) - DB: group_mapping 加 name/owner_account/member_count/last_synced_at;user_mapping 加 nick/last_synced_at (init.sql 建表 + ADD COLUMN IF NOT EXISTS 老库升级补丁,幂等) - TencentImClient: 新增 getAppidGroupList(limit,next[,sdkAppId,secretKey]) - 已知限制:C2C单聊无全量会话API;超大群成员需换 get_group_member_info 分页 附带收尾此前未提交的改动: - 回调字段名修正(FromAccount→From_Account 等腾讯标准字段) + pickMsgRandom/Time/Type 兼容字段差异 - 租户识别重构:前缀经 TenantService.getByPrefixCode 反查 tenantId(主键雪花化与前缀解耦) - FreeMarker java.time ?string 坑修复(usage/queue Controller 预格式化) + 消息记录"全部"状态修复 - 新增项目 CLAUDE.md + .claude/memory 基建(gitignore 含密钥记忆,不进 git) Co-Authored-By: Claude <noreply@anthropic.com>
51 lines
1.2 KiB
Java
51 lines
1.2 KiB
Java
package com.imutil.entity;
|
|
|
|
import com.baomidou.mybatisplus.annotation.IdType;
|
|
import com.baomidou.mybatisplus.annotation.TableId;
|
|
import com.baomidou.mybatisplus.annotation.TableName;
|
|
import lombok.Data;
|
|
|
|
import java.time.OffsetDateTime;
|
|
|
|
/**
|
|
* 用户映射实体(业务用户 ↔ IM 用户)
|
|
* <p>
|
|
* im_user_id = prefix_code + '_' + biz_user_id,前缀法保证跨租户不撞号。
|
|
* is_default 标记默认账户(admin/客服等),is_global 标记跨租户通行账户。
|
|
*
|
|
* @author imutil
|
|
*/
|
|
@Data
|
|
@TableName("user_mapping")
|
|
public class UserMapping {
|
|
|
|
@TableId(type = IdType.ASSIGN_ID)
|
|
private Long id;
|
|
|
|
/** 租户ID */
|
|
private String tenantId;
|
|
|
|
/** 业务系统用户ID */
|
|
private String bizUserId;
|
|
|
|
/** IM 用户ID(带前缀) */
|
|
private String imUserId;
|
|
|
|
/** 是否默认账户 */
|
|
private Boolean isDefault;
|
|
|
|
/** 是否全局跨租户账户 */
|
|
private Boolean isGlobal;
|
|
|
|
/** 状态:1=正常 0=封禁 */
|
|
private Integer status;
|
|
|
|
/** 用户昵称(同步拉取自腾讯群成员资料) */
|
|
private String nick;
|
|
|
|
/** 最近一次同步时间(数据同步功能刷新) */
|
|
private OffsetDateTime lastSyncedAt;
|
|
|
|
private OffsetDateTime createdAt;
|
|
}
|