实现报销材料连续预览(07-27-yang-jun-reimbursement-readiness)
ci-e2e / e2e (push) Canceled after 0s
ci-minimal / check-minimal (push) Canceled after 0s

这个提交包含在:
2026-08-01 00:17:54 +08:00
父节点 b6485a278e
当前提交 8a9279efce
共修改 26 个文件,包含 1211 行新增和 178 行删除
@@ -0,0 +1,22 @@
const SAFE_DOCUMENT_CATEGORIES = new Set([
"vat_invoice",
"full_vat_invoice",
"electronic_train_ticket",
]);
function normalizeSafeMetaString(value, maxLength = 64) {
if (typeof value !== "string") return null;
const normalized = value.trim();
return normalized ? normalized.slice(0, maxLength) : null;
}
function mapInvoiceDocumentMeta(invoice) {
const result = invoice?.ocr_result?.result_json;
const category = normalizeSafeMetaString(result?.documentCategory);
return {
documentCategory: SAFE_DOCUMENT_CATEGORIES.has(category) ? category : null,
documentSubtype: normalizeSafeMetaString(result?.documentSubtype),
};
}
module.exports = { mapInvoiceDocumentMeta };