diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/util/ReportExcelUtil.java b/blade-service/logpm-report/src/main/java/com/logpm/report/util/ReportExcelUtil.java index 1cd0d4a38..56e64f072 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/util/ReportExcelUtil.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/util/ReportExcelUtil.java @@ -23,14 +23,12 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; /** * excel导出工具类 @@ -109,7 +107,7 @@ public class ReportExcelUtil { throw new ServiceException("导出数据不能大于50w,请增加检索条件"); } // 每个 sheet 放多少条数据 - Double sheetDataNum = onceSheetDataNum.doubleValue(); + Long sheetDataNum = Math.min(count, onceSheetDataNum); // 总共要几个 sheet int sheetNum = (int) Math.ceil((count / sheetDataNum)); // 总共需要查询数据库几次 @@ -129,9 +127,11 @@ public class ReportExcelUtil { for (int i = 0; i < sheetNum; i++) { // sheet编号 int finalI = i + 1; + // long ceilNum = Math.min(count, 100) + // 还剩多少条数据 + long l = count - (sheetDataNum * num); // 每页需要查几次 - long l = count - (pageSize * num); - long ceil = l > pageSize ? (int) Math.ceil(onceSheetDataNum / pageSize.doubleValue()) : (int) Math.ceil(l / pageSize.doubleValue()); + long ceil = (int) Math.ceil(l / pageSize.doubleValue()); for (int j = 0; j < ceil; j++) { // 已经查询过几次了 int finalNum = num;