feat(scheduler): 财务管道自动注册、水位记录与后台状态页

- 老配置读取时自动补齐六个管道任务,升级后无需手工添加
- 每个管道运行后写水位与 last_success_at,失败写 last_error
- 新增 GET /admin/fulfillment/pipeline/status 与单步重跑
- 后台「履约渠道 → 管道状态」展示启停、水位、最近执行与错误
- 定时任务管理接口不再丢弃管道自己的 config 字段
This commit is contained in:
yml2213
2026-10-31 19:13:38 +08:00
parent 2ba2656d58
commit 808949f3b8
7 changed files with 336 additions and 2 deletions
@@ -85,6 +85,12 @@ export function normalizeScheduledJobsConfig(rawValue: unknown) {
const hasDataRetention = jobs.some((item) => item.id === DATA_RETENTION_JOB_ID)
const hasPddOrderSync = jobs.some((item) => item.id === PDD_ORDER_SYNC_JOB_ID)
const hasCostFinanceSync = jobs.some((item) => item.id === COST_FINANCE_SYNC_JOB_ID)
const hasChannelAssign = jobs.some((item) => item.id === CHANNEL_ASSIGN_JOB_ID)
const hasCarrierDispatch = jobs.some((item) => item.id === CARRIER_DISPATCH_JOB_ID)
const hasProductNormalize = jobs.some((item) => item.id === PRODUCT_NORMALIZE_JOB_ID)
const hasCostSnapshot = jobs.some((item) => item.id === COST_SNAPSHOT_JOB_ID)
const hasSalesFacts = jobs.some((item) => item.id === SALES_FACTS_JOB_ID)
const hasLedgerPost = jobs.some((item) => item.id === LEDGER_POST_JOB_ID)
if (!hasWorkOrderTimeout) {
jobs.push(createDefaultWorkOrderTimeoutJob())
@@ -101,6 +107,13 @@ export function normalizeScheduledJobsConfig(rawValue: unknown) {
if (!hasCostFinanceSync) {
jobs.push(createDefaultCostFinanceSyncJob())
}
// v2 管道:老配置里没有这些任务时自动补齐,保证升级后无需手工添加。
if (!hasChannelAssign) jobs.push(createDefaultChannelAssignJob())
if (!hasCarrierDispatch) jobs.push(createDefaultCarrierDispatchJob())
if (!hasProductNormalize) jobs.push(createDefaultProductNormalizeJob())
if (!hasCostSnapshot) jobs.push(createDefaultCostSnapshotJob())
if (!hasSalesFacts) jobs.push(createDefaultSalesFactsJob())
if (!hasLedgerPost) jobs.push(createDefaultLedgerPostJob())
return {
enabled: typeof source.enabled === 'boolean' ? source.enabled : true,