feat(accounts): 增加账号供给画像投影

- 新增 account_supply_profiles 表与迁移
- 按租约/生命周期/价值/能力计算角色、质量分、冗余
- 新增 account_supply_profile_projection 作业,默认开启
- 账号列表展示供给画像列
- 补充画像角色/评分/游标/作业测试
This commit is contained in:
yml
2026-11-24 16:16:18 +08:00
parent ff3fbd93b3
commit f15ae99012
12 changed files with 837 additions and 0 deletions
+4
View File
@@ -453,6 +453,10 @@ export interface AccountItem {
high_value: HighValueStatus;
/** 最近一次完整一键查询时间 */
overview_queried_at: string | null;
supply_role?: string;
quality_score?: number | null;
redundancy_class?: string;
ck_remaining_hours?: number | null;
}
export interface AssignmentsSummary {
@@ -112,6 +112,12 @@ const JOB_UI: Record<string, JobUiSpec> = {
showRecheck: true,
showConcurrency: true,
},
account_supply_profile_projection: {
description: "刷新账号供给角色、质量分、能力冗余和 CK 剩余;只写派生画像表,不改选号。",
core: true,
showRecheck: false,
showConcurrency: false,
},
account_onboarding: {
description: "对没有 CK 的未登录账号执行首次真实登录;成功后写入 CK 并联动商品能力同步。默认关闭,建议先小批量。",
core: true,
@@ -14,6 +14,62 @@ import {
const { Text } = Typography;
const SUPPLY_ROLE_LABELS: Record<string, string> = {
fulfillment_protected: '履约保护',
collab_protected: '协作保护',
onboarding: '待首次登录',
repair: '待重登',
supply_high: '高价值供给',
supply_ordinary: '普通供给',
cold: '冷库存',
manual_hold: '人工',
};
const SUPPLY_ROLE_COLORS: Record<string, string> = {
fulfillment_protected: 'blue',
collab_protected: 'cyan',
onboarding: 'gold',
repair: 'orange',
supply_high: 'green',
supply_ordinary: 'default',
cold: 'default',
manual_hold: 'red',
};
const REDUNDANCY_LABELS: Record<string, string> = {
unique: '唯一',
rare: '稀有',
limited: '有限',
common: '常见',
protected: '保护中',
unknown: '未知',
};
function renderSupplyProfile(record: AccountItem) {
if (!record.supply_role) {
return <Text type="secondary">未生成</Text>;
}
return (
<Tooltip
title={
record.quality_score == null
? '画像生成中'
: `质量分 ${record.quality_score};冗余 ${REDUNDANCY_LABELS[record.redundancy_class || ''] || record.redundancy_class || '-'}`
}
>
<Space direction="vertical" size={2}>
<Tag color={SUPPLY_ROLE_COLORS[record.supply_role] || 'default'} style={{ marginInlineEnd: 0 }}>
{SUPPLY_ROLE_LABELS[record.supply_role] || record.supply_role}
</Tag>
<Text type="secondary" style={{ fontSize: 12 }}>
分 {record.quality_score ?? '-'} · {REDUNDANCY_LABELS[record.redundancy_class || ''] || record.redundancy_class || '-'}
{record.ck_remaining_hours != null ? ` · CK ${record.ck_remaining_hours}h` : ''}
</Text>
</Space>
</Tooltip>
);
}
function BindChip({ scope, status }: { scope: string; status?: string }) {
const tone =
status === 'bound'
@@ -235,6 +291,12 @@ export function buildAccountColumns({
);
},
},
{
title: '供给画像',
key: 'supply_profile',
width: 190,
render: (_: unknown, record: AccountItem) => renderSupplyProfile(record),
},
{
title: '绑定',
dataIndex: 'role_bind_status',