✨ 毛利分析订单导出合并为单个工作表

This commit is contained in:
caojia
2026-11-17 15:48:57 +08:00
parent 8fb042f171
commit 5c8e905a37
3 changed files with 157 additions and 8 deletions
@@ -85,6 +85,12 @@ public class PrcProfitReportExportRunner
put(taskId, userId, "RUNNING", 5, "正在查询订单", null, 0, fileName, null);
List<PrcProfitReportOrderRow> rows = reportService.selectOrderRows(query);
put(taskId, userId, "RUNNING", 40, "正在生成 Excel", null, rows.size(), fileName, null);
int maxRows = ExcelUtil.XLSX_MAX_ROW_COUNT - 1;
if (rows.size() > maxRows)
{
throw new ServiceException(String.format("单个工作表最多支持%d条订单,当前%d条,请缩小查询范围",
maxRows, rows.size()));
}
ExcelUtil<PrcProfitReportOrderRow> util = new ExcelUtil<>(PrcProfitReportOrderRow.class);
if (ProfitAreaRule.GUANGZHOU.name().equals(query.getProfitRule()))
{
@@ -95,7 +101,7 @@ public class PrcProfitReportExportRunner
file = dir.resolve(taskId + ".xlsx").normalize();
try (OutputStream output = Files.newOutputStream(file))
{
util.exportExcelToStream(rows, "订单毛利报表", output);
util.exportExcelToSingleSheetStream(rows, "订单毛利报表", output);
}
put(taskId, userId, "SUCCESS", 100, "导出完成,正在下载", null, rows.size(), fileName,
REL_DIR + "/" + taskId + ".xlsx");