feat(server): 完成 P2 后端能力(支付幂等、委派回收、OCR异步、审计)

这个提交包含在:
2026-02-07 21:54:29 +08:00
父节点 7ea25e9d72
当前提交 c4df9a419a
共修改 23 个文件,包含 2102 行新增和 70 行删除
+15 -3
查看文件
@@ -171,6 +171,7 @@ model Employee {
submitted_reimbursements ReimbursementForm[] @relation("ReimbursementSubmitter")
owned_reimbursements ReimbursementForm[] @relation("ReimbursementOwner")
paid_reimbursements ReimbursementForm[] @relation("ReimbursementPaidBy")
owned_invoices InvoicePool[] @relation("InvoiceOwner")
uploaded_invoices InvoicePool[] @relation("InvoiceUploader")
@@ -276,6 +277,7 @@ model AuditLog {
@@index([request_id])
@@index([actor_id, created_at])
@@index([created_at, actor_id, action], map: "idx_audit_logs_query")
@@map("audit_logs")
}
@@ -327,15 +329,21 @@ model ReimbursementForm {
total_amount Decimal @default(0) @db.Decimal(14, 2)
status ReimbursementStatus @default(draft)
description String?
payment_voucher_no String? @db.VarChar(50)
payment_date DateTime? @db.Date
payment_channel String? @db.VarChar(20)
paid_at DateTime?
paid_by String? @db.Uuid
created_at DateTime @default(now())
created_by String? @db.Uuid
updated_at DateTime @updatedAt
updated_by String? @db.Uuid
submitter Employee @relation("ReimbursementSubmitter", fields: [submitter_id], references: [id], onDelete: Restrict)
owner Employee @relation("ReimbursementOwner", fields: [owner_id], references: [id], onDelete: Restrict)
department Department @relation(fields: [department_id], references: [id], onDelete: Restrict)
submitter Employee @relation("ReimbursementSubmitter", fields: [submitter_id], references: [id], onDelete: Restrict)
owner Employee @relation("ReimbursementOwner", fields: [owner_id], references: [id], onDelete: Restrict)
paid_by_employee Employee? @relation("ReimbursementPaidBy", fields: [paid_by], references: [id], onDelete: SetNull)
department Department @relation(fields: [department_id], references: [id], onDelete: Restrict)
items ReimbursementItem[]
invoice_pool_items InvoicePool[]
@@ -345,6 +353,7 @@ model ReimbursementForm {
@@index([owner_id])
@@index([submitter_id])
@@index([department_id])
@@index([paid_by])
@@index([status])
@@index([reimbursement_date])
@@map("reimbursement_forms")
@@ -414,6 +423,8 @@ model InvoicePool {
ocr_attempts Int @default(0)
ocr_last_error String?
ocr_completed_at DateTime?
ocr_locked_at DateTime?
ocr_lock_owner String? @db.VarChar(128)
invoice_code String?
invoice_number String?
@@ -447,6 +458,7 @@ model InvoicePool {
@@index([file_sha256])
@@index([invoice_code, invoice_number])
@@index([status])
@@index([status, ocr_locked_at, created_at], map: "idx_invoice_pool_ocr_queue")
@@index([linked_reimbursement_id])
@@map("invoice_pool")
}