FL6 完善财务台账与导出审计
这个提交包含在:
@@ -89,6 +89,30 @@ function buildAnomaly(overrides = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
function buildFinanceLedgerItem(overrides = {}) {
|
||||
return {
|
||||
id: "99999999-9999-4999-8999-999999999999",
|
||||
form_number: "BX-20260406-001",
|
||||
reimbursement_date: new Date("2026-04-05T00:00:00.000Z"),
|
||||
status: "paid",
|
||||
total_amount: "1688.00",
|
||||
description: "财务台账测试报销",
|
||||
payment_voucher_no: "PAY-001",
|
||||
payment_date: new Date("2026-04-06T00:00:00.000Z"),
|
||||
payment_channel: "bank",
|
||||
paid_at: new Date("2026-04-06T13:00:00.000Z"),
|
||||
created_at: new Date("2026-04-05T09:00:00.000Z"),
|
||||
updated_at: new Date("2026-04-06T13:00:00.000Z"),
|
||||
owner: { id: ACTOR_ID, employee_no: "E001", name: "张三" },
|
||||
submitter: { id: ACTOR_ID, employee_no: "E001", name: "张三" },
|
||||
department: { id: "dept-1", name: "财务部" },
|
||||
paid_by_employee: { id: ACTOR_ID, employee_no: "F001", name: "财务" },
|
||||
invoice_pool_items: [{ id: "invoice-1", status: "archived", archived_reason: "used_complete" }],
|
||||
_count: { attachments: 1, invoice_pool_items: 1 },
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
async function buildApp(options = {}) {
|
||||
const app = Fastify();
|
||||
const actor = options.actor ?? {
|
||||
@@ -100,6 +124,8 @@ async function buildApp(options = {}) {
|
||||
const entityRiskFlagFindMany = options.entityRiskFlagFindMany ?? vi.fn().mockResolvedValue([buildRiskFlag()]);
|
||||
const travelReconciliationItemFindMany =
|
||||
options.travelReconciliationItemFindMany ?? vi.fn().mockResolvedValue([buildAnomaly()]);
|
||||
const reimbursementFormFindMany = options.reimbursementFormFindMany ?? vi.fn().mockResolvedValue([buildFinanceLedgerItem()]);
|
||||
const reimbursementFormCount = options.reimbursementFormCount ?? vi.fn().mockResolvedValue(1);
|
||||
const auditCreate = options.auditCreate ?? vi.fn().mockResolvedValue({});
|
||||
|
||||
app.decorate("authenticate", async (request) => {
|
||||
@@ -137,6 +163,10 @@ async function buildApp(options = {}) {
|
||||
travelReconciliationItem: {
|
||||
findMany: travelReconciliationItemFindMany,
|
||||
},
|
||||
reimbursementForm: {
|
||||
findMany: reimbursementFormFindMany,
|
||||
count: reimbursementFormCount,
|
||||
},
|
||||
auditLog: {
|
||||
create: auditCreate,
|
||||
},
|
||||
@@ -153,6 +183,8 @@ async function buildApp(options = {}) {
|
||||
paymentBatchItemFindMany,
|
||||
entityRiskFlagFindMany,
|
||||
travelReconciliationItemFindMany,
|
||||
reimbursementFormFindMany,
|
||||
reimbursementFormCount,
|
||||
auditCreate,
|
||||
};
|
||||
}
|
||||
@@ -183,6 +215,8 @@ describe("ap operations export route", () => {
|
||||
expect(response.headers["content-type"]).toContain("text/csv");
|
||||
expect(response.headers["content-disposition"]).toContain("ap-operations-");
|
||||
expect(response.body).toContain("待付款批次");
|
||||
expect(response.body).toContain("财务台账");
|
||||
expect(response.body).toContain("BX-20260406-001");
|
||||
expect(response.body).toContain("异常付款项");
|
||||
expect(response.body).toContain("风险标记");
|
||||
expect(response.body).toContain("对账异常");
|
||||
@@ -230,6 +264,7 @@ describe("ap operations export route", () => {
|
||||
failedPaymentItemTotal: 1,
|
||||
openRiskFlagTotal: 1,
|
||||
reconciliationAnomalyTotal: 1,
|
||||
financeLedgerTotal: 1,
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
|
||||
在新工单中引用
屏蔽一个用户