feat(P20T2-1,P20T2-2,P20T2-3): 卡授权/交易/支付标记/发票绑定/ERP出站后端

这个提交包含在:
2026-03-11 06:41:11 +08:00
父节点 539c2cc4dd
当前提交 dc74d9e53f
共修改 23 个文件,包含 4265 行新增和 218 行删除
+6 -2
查看文件
@@ -47,10 +47,12 @@ function parseInvoiceListQuery(query) {
function ensureInvoiceReadableByUser(request, invoice) {
const roleCodes = request.employee.roleCodes;
const permissionCodes = request.employee.permissionCodes ?? [];
if (
roleCodes.includes("admin") ||
roleCodes.includes("finance") ||
roleCodes.includes("finance_mgr")
roleCodes.includes("finance_mgr") ||
permissionCodes.includes("travel.payment.manage")
) {
return true;
}
@@ -110,7 +112,9 @@ function registerInvoicePoolReadRoutes(fastify) {
const query = parseInvoiceListQuery(request.query);
const canViewOwn = fastify.hasPermission(request.employee, "invoice.view_own");
const canManage = fastify.hasPermission(request.employee, "invoice.manage");
const canManage =
fastify.hasPermission(request.employee, "invoice.manage") ||
fastify.hasPermission(request.employee, "travel.payment.manage");
if (!canViewOwn && !canManage) {
throw new AppError({
@@ -43,6 +43,7 @@ function mapInvoiceSummary(item) {
totalAmount: toMoneyString(item.total_amount),
linkedReimbursementId: item.linked_reimbursement_id,
linkedItemId: item.linked_item_id,
linkedTravelOrderId: item.travel_order_id ?? null,
originalName: item.original_name,
mimeType: item.mime_type,
fileSize: item.file_size,
@@ -99,6 +100,7 @@ function normalizeInvoiceResponse(invoice) {
totalAmount: toMoneyString(invoice.total_amount),
linkedReimbursementId: invoice.linked_reimbursement_id,
linkedItemId: invoice.linked_item_id,
linkedTravelOrderId: invoice.travel_order_id ?? null,
verification: mapVerificationRecord(latestVerification),
isDuplicateOverride: invoice.is_duplicate_override ?? false,
overrideRefFormNumber: invoice.override_ref_form_number ?? null,
@@ -41,6 +41,7 @@ function buildInvoiceSummarySelect() {
total_amount: true,
linked_reimbursement_id: true,
linked_item_id: true,
travel_order_id: true,
original_name: true,
mime_type: true,
file_size: true,
@@ -85,6 +86,7 @@ function buildInvoiceDetailSelect(options = {}) {
total_amount: true,
linked_reimbursement_id: true,
linked_item_id: true,
travel_order_id: true,
is_duplicate_override: true,
override_ref_form_number: true,
override_reason: true,