From 06efab95960a3900393352c3b27ff41d02693cab Mon Sep 17 00:00:00 2001 From: zhangjf Date: Fri, 20 Feb 2026 08:36:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E5=87=BA=E5=92=8C=E5=BA=94?= =?UTF-8?q?=E6=94=B6=E6=AC=BE=E6=A8=A1=E5=9D=97=E6=96=B0=E5=A2=9EExcel?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 后端: - fund-exp: 新增ExpenseExcel导出实体、导出接口和listExpenses方法 - fund-receipt: 新增ReceivableExcel导出实体、导出接口和listReceivables方法 前端: - fund-admin: 支出管理页面新增导出按钮 - fund-admin: 应收款管理页面新增导出按钮 - fund-admin: 新增exportExpense和exportReceivable API --- fund-admin/src/api/expense.ts | 36 +++++ fund-admin/src/api/receivable.ts | 36 +++++ fund-admin/src/views/expense/index.vue | 35 ++++- fund-admin/src/views/receivable/index.vue | 32 ++++- .../exp/controller/FundExpenseController.java | 34 +++++ .../fundplatform/exp/dto/ExpenseExcel.java | 122 ++++++++++++++++ .../exp/service/FundExpenseService.java | 5 + .../service/impl/FundExpenseServiceImpl.java | 13 ++ .../controller/ExpenseTypeController.class | Bin 5703 -> 5699 bytes .../controller/FundExpenseController.class | Bin 7231 -> 10334 bytes .../exp/controller/HealthController.class | Bin 1463 -> 1463 bytes .../exp/data/entity/ExpenseType.class | Bin 2129 -> 2129 bytes .../exp/data/entity/FundExpense.class | Bin 5475 -> 5475 bytes .../exp/data/mapper/ExpenseTypeMapper.class | Bin 422 -> 422 bytes .../exp/data/mapper/FundExpenseMapper.class | Bin 422 -> 422 bytes .../data/service/ExpenseTypeDataService.class | Bin 829 -> 829 bytes .../data/service/FundExpenseDataService.class | Bin 829 -> 829 bytes .../fundplatform/exp/dto/ExpenseExcel.class | Bin 0 -> 3475 bytes .../exp/service/FundExpenseService.class | Bin 1672 -> 1953 bytes .../service/impl/ExpenseTypeServiceImpl.class | Bin 15132 -> 14937 bytes .../service/impl/FundExpenseServiceImpl.class | Bin 26879 -> 27135 bytes .../compile/default-compile/inputFiles.lst | 1 + .../controller/ReceivableController.java | 33 +++++ .../receipt/dto/ReceivableExcel.java | 134 ++++++++++++++++++ .../receipt/service/ReceivableService.java | 5 + .../service/impl/ReceivableServiceImpl.java | 13 ++ .../receipt/ReceiptApplication.class | Bin 831 -> 831 bytes .../receipt/aop/ApiLogAspect.class | Bin 6463 -> 6387 bytes .../controller/FundReceiptController.class | Bin 4248 -> 0 bytes .../receipt/controller/HealthController.class | Bin 1479 -> 0 bytes .../controller/ReceivableController.class | Bin 6639 -> 0 bytes .../receipt/data/entity/FundReceipt.class | Bin 5179 -> 5179 bytes .../receipt/data/entity/Receivable.class | Bin 4599 -> 4599 bytes .../data/mapper/FundReceiptMapper.class | Bin 430 -> 430 bytes .../data/mapper/ReceivableMapper.class | Bin 427 -> 427 bytes .../data/service/FundReceiptDataService.class | Bin 849 -> 849 bytes .../data/service/ReceivableDataService.class | Bin 843 -> 843 bytes .../receipt/dto/FundReceiptDTO.class | Bin 4466 -> 4462 bytes .../receipt/dto/ReceivableDTO.class | Bin 3220 -> 3220 bytes .../receipt/dto/ReceivableExcel.class | Bin 0 -> 3879 bytes .../receipt/service/FundReceiptService.class | Bin 1192 -> 0 bytes .../receipt/service/ReceivableService.class | Bin 1568 -> 1849 bytes .../service/impl/FundReceiptServiceImpl.class | Bin 14810 -> 0 bytes .../service/impl/ReceivableServiceImpl.class | Bin 23389 -> 0 bytes .../receipt/vo/FundReceiptVO.class | Bin 6274 -> 6274 bytes .../receipt/vo/ReceivableVO.class | Bin 6582 -> 6582 bytes .../compile/default-compile/createdFiles.lst | 6 - .../compile/default-compile/inputFiles.lst | 1 + 48 files changed, 496 insertions(+), 10 deletions(-) create mode 100644 fund-exp/src/main/java/com/fundplatform/exp/dto/ExpenseExcel.java create mode 100644 fund-exp/target/classes/com/fundplatform/exp/dto/ExpenseExcel.class create mode 100644 fund-receipt/src/main/java/com/fundplatform/receipt/dto/ReceivableExcel.java delete mode 100644 fund-receipt/target/classes/com/fundplatform/receipt/controller/FundReceiptController.class delete mode 100644 fund-receipt/target/classes/com/fundplatform/receipt/controller/HealthController.class delete mode 100644 fund-receipt/target/classes/com/fundplatform/receipt/controller/ReceivableController.class create mode 100644 fund-receipt/target/classes/com/fundplatform/receipt/dto/ReceivableExcel.class delete mode 100644 fund-receipt/target/classes/com/fundplatform/receipt/service/FundReceiptService.class delete mode 100644 fund-receipt/target/classes/com/fundplatform/receipt/service/impl/FundReceiptServiceImpl.class delete mode 100644 fund-receipt/target/classes/com/fundplatform/receipt/service/impl/ReceivableServiceImpl.class diff --git a/fund-admin/src/api/expense.ts b/fund-admin/src/api/expense.ts index 3a512fb..21d016b 100644 --- a/fund-admin/src/api/expense.ts +++ b/fund-admin/src/api/expense.ts @@ -62,3 +62,39 @@ export function rejectExpense(id: number, comment: string) { export function confirmPayExpense(id: number, payChannel: string, payVoucher?: string) { return request.put(`/exp/api/v1/exp/expense/${id}/confirm-pay?payChannel=${payChannel}&payVoucher=${payVoucher || ''}`) } + +// 导出支出明细 +export function exportExpense(params?: { title?: string; expenseType?: number; approvalStatus?: number; payStatus?: number }) { + const baseUrl = import.meta.env.VITE_API_URL || '' + const token = localStorage.getItem('token') + const tenantId = localStorage.getItem('tenantId') || '1' + + const queryParams = new URLSearchParams() + if (params?.title) queryParams.append('title', params.title) + if (params?.expenseType) queryParams.append('expenseType', String(params.expenseType)) + if (params?.approvalStatus !== undefined) queryParams.append('approvalStatus', String(params.approvalStatus)) + if (params?.payStatus !== undefined) queryParams.append('payStatus', String(params.payStatus)) + + const queryString = queryParams.toString() + const url = `${baseUrl}/exp/api/v1/exp/expense/export${queryString ? '?' + queryString : ''}` + + return fetch(url, { + headers: { + Authorization: `Bearer ${token}`, + 'X-Tenant-Id': tenantId + } + }).then(response => { + if (!response.ok) throw new Error('导出失败') + + const contentDisposition = response.headers.get('Content-Disposition') + let filename = '支出明细.xlsx' + if (contentDisposition) { + const match = contentDisposition.match(/filename\*=utf-8''(.+)/i) + if (match && match[1]) { + filename = decodeURIComponent(match[1]) + } + } + + return response.blob().then(blob => ({ blob, filename })) + }) +} diff --git a/fund-admin/src/api/receivable.ts b/fund-admin/src/api/receivable.ts index 9c6c206..14e889f 100644 --- a/fund-admin/src/api/receivable.ts +++ b/fund-admin/src/api/receivable.ts @@ -49,3 +49,39 @@ export function getReceiptById(id: number) { export function createReceipt(data: any) { return request.post('/receipt/api/v1/receipt/receipt', data) } + +// 导出应收款明细 +export function exportReceivable(params?: { projectId?: number; customerId?: number; status?: string; confirmStatus?: number }) { + const baseUrl = import.meta.env.VITE_API_URL || '' + const token = localStorage.getItem('token') + const tenantId = localStorage.getItem('tenantId') || '1' + + const queryParams = new URLSearchParams() + if (params?.projectId) queryParams.append('projectId', String(params.projectId)) + if (params?.customerId) queryParams.append('customerId', String(params.customerId)) + if (params?.status) queryParams.append('status', params.status) + if (params?.confirmStatus !== undefined) queryParams.append('confirmStatus', String(params.confirmStatus)) + + const queryString = queryParams.toString() + const url = `${baseUrl}/receipt/api/v1/receipt/receivable/export${queryString ? '?' + queryString : ''}` + + return fetch(url, { + headers: { + Authorization: `Bearer ${token}`, + 'X-Tenant-Id': tenantId + } + }).then(response => { + if (!response.ok) throw new Error('导出失败') + + const contentDisposition = response.headers.get('Content-Disposition') + let filename = '应收款明细.xlsx' + if (contentDisposition) { + const match = contentDisposition.match(/filename\*=utf-8''(.+)/i) + if (match && match[1]) { + filename = decodeURIComponent(match[1]) + } + } + + return response.blob().then(blob => ({ blob, filename })) + }) +} diff --git a/fund-admin/src/views/expense/index.vue b/fund-admin/src/views/expense/index.vue index 53ec85f..7cc0679 100644 --- a/fund-admin/src/views/expense/index.vue +++ b/fund-admin/src/views/expense/index.vue @@ -40,6 +40,7 @@
新增支出 + 导出Excel
@@ -262,7 +263,7 @@