feat(admin): 收口人工履约入口并修复履约筛选

This commit is contained in:
yml2213
2026-10-24 17:42:07 +08:00
parent faf56e567e
commit 790de676c6
27 changed files with 495 additions and 1327 deletions
@@ -100,6 +100,44 @@ test('订单列表 platformOrderId 为拼多多 order_sn 时走索引快路径',
assert.deepEqual(calls[0]?.params, [orderSn])
})
test('订单列表按当前履约模式筛选,不再依赖任务执行器', async () => {
const calls: Array<{ sql: string; params: unknown[] }> = []
await listOrdersWithExecutor(createExecutor(calls, 0), {
fulfillmentMode: 'manual',
})
assert.match(calls[0]?.sql || '', /oi\.fulfillment_mode = \$1/)
assert.match(calls[0]?.sql || '', /oi\.fulfillment_mode <> \$1/)
assert.doesNotMatch(calls[0]?.sql || '', /COUNT\(DISTINCT/)
assert.doesNotMatch(calls[0]?.sql || '', /ft\.executor_key/)
assert.deepEqual(calls[0]?.params, ['manual'])
})
test('订单列表待判定筛选不扫描任务执行器', async () => {
const calls: Array<{ sql: string; params: unknown[] }> = []
await listOrdersWithExecutor(createExecutor(calls, 0), {
fulfillmentMode: 'pending',
})
assert.match(calls[0]?.sql || '', /NOT EXISTS/)
assert.match(calls[0]?.sql || '', /oi\.fulfillment_mode IN/)
assert.doesNotMatch(calls[0]?.sql || '', /COUNT\(DISTINCT/)
assert.deepEqual(calls[0]?.params, [])
})
test('订单列表混合履约筛选按订单项聚合判定', async () => {
const calls: Array<{ sql: string; params: unknown[] }> = []
await listOrdersWithExecutor(createExecutor(calls, 0), {
fulfillmentMode: 'mixed',
})
assert.match(calls[0]?.sql || '', /HAVING COUNT\(DISTINCT oi\.fulfillment_mode\) > 1/)
assert.deepEqual(calls[0]?.params, [])
})
function createExecutor(
calls: Array<{ sql: string; params: unknown[] }>,
total: number,