修复报销票据门禁提示与 OCR 降级(08-30-b2-submit-error-ocr-fallback)

这个提交包含在:
2026-08-31 20:20:20 +08:00
父节点 8b19538584
当前提交 f57e2236f2
共修改 21 个文件,包含 1829 行新增和 49 行删除
@@ -0,0 +1,32 @@
const INVOICE_AMOUNT_EVIDENCE_STATUS = Object.freeze({
verified: "verified",
manualReview: "manual_review",
ocrFailed: "ocr_failed",
});
function resolveInvoiceAmountEvidence({
totalAmount,
ocrAttempts,
ocrLastRequestedAt,
ocrCompletedAt,
ocrLastError,
}) {
if (totalAmount != null) {
return INVOICE_AMOUNT_EVIDENCE_STATUS.verified;
}
const hasOcrExecutionEvidence =
Number(ocrAttempts ?? 0) > 0 ||
ocrLastRequestedAt != null ||
ocrCompletedAt != null ||
(typeof ocrLastError === "string" && ocrLastError.trim().length > 0);
return hasOcrExecutionEvidence
? INVOICE_AMOUNT_EVIDENCE_STATUS.ocrFailed
: INVOICE_AMOUNT_EVIDENCE_STATUS.manualReview;
}
module.exports = {
INVOICE_AMOUNT_EVIDENCE_STATUS,
resolveInvoiceAmountEvidence,
};