WHMS 实现企微HR主数据镜像同步
这个提交包含在:
@@ -33,6 +33,55 @@ export type WecomDirectoryState = {
|
||||
latestSync: WecomDirectorySyncRun | null;
|
||||
};
|
||||
|
||||
export type WecomHrMasterSyncMode = "dry_run" | "apply";
|
||||
export type WecomHrMasterSyncRunStatus = "running" | "success" | "partial" | "failed" | "skipped";
|
||||
export type WecomHrMasterSyncItemStatus = "planned" | "success" | "skipped" | "conflict" | "failed";
|
||||
|
||||
export type WecomHrMasterSyncItem = {
|
||||
id: string;
|
||||
runId: string;
|
||||
employeeId: string | null;
|
||||
externalUserId: string;
|
||||
action: "create" | "update" | "noop" | "skip" | "conflict" | "failed";
|
||||
status: WecomHrMasterSyncItemStatus;
|
||||
errorCode: string | null;
|
||||
errorMessage: string | null;
|
||||
retryCount: number;
|
||||
fieldChanges: Record<string, unknown> | null;
|
||||
sourceSummary: Record<string, unknown> | null;
|
||||
createdAt: string | null;
|
||||
updatedAt: string | null;
|
||||
};
|
||||
|
||||
export type WecomHrMasterSyncRun = {
|
||||
id: string;
|
||||
mode: WecomHrMasterSyncMode;
|
||||
status: WecomHrMasterSyncRunStatus;
|
||||
tokenSource: Record<string, string> | null;
|
||||
requestedUserids: string[] | null;
|
||||
limit: number | null;
|
||||
summary: {
|
||||
total?: number;
|
||||
created?: number;
|
||||
updated?: number;
|
||||
noop?: number;
|
||||
skipped?: number;
|
||||
conflicts?: number;
|
||||
failed?: number;
|
||||
planned?: number;
|
||||
success?: number;
|
||||
} | null;
|
||||
errorCode: string | null;
|
||||
errorMessage: string | null;
|
||||
triggeredBy: string | null;
|
||||
startedAt: string | null;
|
||||
finishedAt: string | null;
|
||||
createdAt: string | null;
|
||||
updatedAt: string | null;
|
||||
itemCount?: number;
|
||||
items?: WecomHrMasterSyncItem[];
|
||||
};
|
||||
|
||||
export type EmployeeDepartmentSummary = {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -457,6 +506,27 @@ export async function retryEmployeeWecomDirectorySync(employeeId: string, operat
|
||||
});
|
||||
}
|
||||
|
||||
export async function runWecomHrMasterSync(payload: {
|
||||
mode: WecomHrMasterSyncMode;
|
||||
userids?: string[];
|
||||
limit?: number;
|
||||
}) {
|
||||
return apiRequestData<WecomHrMasterSyncRun>("/api/employees/wecom-hr-master-sync/runs", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export async function fetchWecomHrMasterSyncRuns(pageSize = 5) {
|
||||
return apiRequestData<{ items: WecomHrMasterSyncRun[] }>(
|
||||
`/api/employees/wecom-hr-master-sync/runs?pageSize=${pageSize}`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function fetchWecomHrMasterSyncRun(runId: string) {
|
||||
return apiRequestData<WecomHrMasterSyncRun>(`/api/employees/wecom-hr-master-sync/runs/${runId}`);
|
||||
}
|
||||
|
||||
export async function fetchEmployeeOrganization() {
|
||||
return apiRequestData<{ items: OrganizationDepartmentSection[] }>("/api/employees/organization");
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ const FEATURE_FLAG_DISABLED_MESSAGES: Record<string, string> = {
|
||||
attendance_unified_v1_disabled: "企微考勤统一汇总当前未启用,请联系管理员检查环境开关与功能开关配置。",
|
||||
weekly_report_v1_disabled: "周报模块当前未启用,请联系管理员检查环境开关与功能开关配置。",
|
||||
employee_lifecycle_v1_disabled: "人员生命周期模块当前未启用,请联系管理员检查环境开关与功能开关配置。",
|
||||
wecom_hr_master_sync_v1_disabled: "企微 HR 主数据镜像当前未启用,请联系管理员检查环境开关与功能开关配置。",
|
||||
todo_board_v1_disabled: "待办模块当前未启用,请联系管理员检查环境开关与功能开关配置。",
|
||||
project_domain_v1_disabled: "项目模块当前未启用,请联系管理员检查环境开关与功能开关配置。",
|
||||
project_linking_v1_disabled: "项目关联功能当前未启用,请联系管理员检查环境开关与功能开关配置。",
|
||||
|
||||
@@ -17,6 +17,8 @@ export type FeatureFlagKey =
|
||||
| "attendance_unified_v1"
|
||||
| "weekly_report_v1"
|
||||
| "employee_lifecycle_v1"
|
||||
| "hr_wecom_directory_sync_v1"
|
||||
| "wecom_hr_master_sync_v1"
|
||||
| "todo_board_v1"
|
||||
| "wecom_entry_v1"
|
||||
| "project_domain_v1"
|
||||
|
||||
在新工单中引用
屏蔽一个用户