From d25929e46156ccdb31267773457104f615836077 Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Wed, 4 Feb 2026 15:04:33 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=89=B9=E9=87=8F=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WalletTransactionController.java | 25 ++++++++----------- .../service/WalletTransactionService.java | 2 +- .../impl/WalletTransactionServiceImpl.java | 25 ++++++++++++++----- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletTransactionController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletTransactionController.java index 3b37287be..063e454a2 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletTransactionController.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/WalletTransactionController.java @@ -252,10 +252,9 @@ public class WalletTransactionController { DataScope dataScope = null; Long count = walletTransactionMapper.count(dto, dataScope); - if (count > 5000) throw new RuntimeException("导出数据超出5000条,请缩小查询范围"); + if (count > 3 * 10000) throw new RuntimeException("导出数据超出30000条,请缩小查询范围"); - List list = walletTransactionService.scopeList(dto, dataScope); - walletTransactionService.exportByTemplate(response, dto, "file/个人充值明细.xlsx", list); + walletTransactionService.exportByTemplate(response, dto, "file/个人充值明细.xlsx", dataScope); } @Operation(summary = "充值统计", description = "充值统计") @@ -276,10 +275,9 @@ public class WalletTransactionController { DataScope dataScope = null; Long count = walletTransactionMapper.count(dto, dataScope); - if (count > 5000) throw new RuntimeException("导出数据超出5000条,请缩小查询范围"); + if (count > 3 * 10000) throw new RuntimeException("导出数据超出30000条,请缩小查询范围"); - List list = walletTransactionService.scopeList(dto, dataScope); - walletTransactionService.exportByTemplate(response, dto, "file/个人记账扣款明细.xlsx", list); + walletTransactionService.exportByTemplate(response, dto, "file/个人记账扣款明细.xlsx", dataScope); } @Operation(summary = "记账扣款统计", description = "记账扣款统计") @@ -300,10 +298,9 @@ public class WalletTransactionController { DataScope dataScope = null; Long count = walletTransactionMapper.count(dto, dataScope); - if (count > 5000) throw new RuntimeException("导出数据超出5000条,请缩小查询范围"); + if (count > 3 * 10000) throw new RuntimeException("导出数据超出30000条,请缩小查询范围"); - List list = walletTransactionService.scopeList(dto, dataScope); - walletTransactionService.exportByTemplate(response, dto, "file/个人消费明细.xlsx", list); + walletTransactionService.exportByTemplate(response, dto, "file/个人消费明细.xlsx", dataScope); } @Operation(summary = "消费统计", description = "消费统计") @@ -323,10 +320,9 @@ public class WalletTransactionController { DataScope dataScope = null; Long count = walletTransactionMapper.count(dto, dataScope); - if (count > 5000) throw new RuntimeException("导出数据超出5000条,请缩小查询范围"); + if (count > 3 * 10000) throw new RuntimeException("导出数据超出30000条,请缩小查询范围"); - List list = walletTransactionService.scopeList(dto, dataScope); - walletTransactionService.exportByTemplate(response, dto, "file/个人退款明细.xlsx", list); + walletTransactionService.exportByTemplate(response, dto, "file/个人退款明细.xlsx", dataScope); } @Operation(summary = "退款统计", description = "退款统计") @@ -347,10 +343,9 @@ public class WalletTransactionController { DataScope dataScope = null; Long count = walletTransactionMapper.count(dto, dataScope); - if (count > 5000) throw new RuntimeException("导出数据超出5000条,请缩小查询范围"); + if (count > 3 * 10000) throw new RuntimeException("导出数据超出30000条,请缩小查询范围"); - List list = walletTransactionService.scopeList(dto, dataScope); - walletTransactionService.exportByTemplate(response, dto, "file/退还各自食堂明细.xlsx", list); + walletTransactionService.exportByTemplate(response, dto, "file/退还各自食堂明细.xlsx", dataScope); } @Operation(summary = "退还各自食堂统计", description = "退还各自食堂统计") diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletTransactionService.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletTransactionService.java index 99eeb0657..aa64d50c9 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletTransactionService.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/WalletTransactionService.java @@ -67,7 +67,7 @@ public interface WalletTransactionService extends IService list); + void exportByTemplate(HttpServletResponse response, WalletTransactionDto dto, String fileName, DataScope dataScope); /** * 后台充值统计(导出) diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletTransactionServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletTransactionServiceImpl.java index 7369a6f21..02b2e3e06 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletTransactionServiceImpl.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/WalletTransactionServiceImpl.java @@ -315,8 +315,10 @@ public class WalletTransactionServiceImpl extends ServiceImpl list) { + public void exportByTemplate(HttpServletResponse response, WalletTransactionDto dto, String fileName, DataScope dataScope) { try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(ResourceUtil.getStream(fileName)).build()) { WriteSheet writeSheet = EasyExcel.writerSheet().build(); FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); @@ -326,9 +328,17 @@ public class WalletTransactionServiceImpl extends ServiceImpl pageList = scopePageList(new Page(currentPage, pageSize), dto, dataScope); + if (ObjectUtil.isEmpty(pageList) || ObjectUtil.isEmpty(pageList.getRecords())) break; + List list = pageList.getRecords(); + // 处理excel start for (WalletTransactionVo v : list) { v.setLineNumber(lineNumber); lineNumber++; @@ -340,10 +350,13 @@ public class WalletTransactionServiceImpl extends ServiceImpl