⚡ 优化应收合计查询并补充导出汇总

This commit is contained in:
caojia
2026-11-12 15:58:25 +08:00
parent fb9a4e1b29
commit 621128530a
5 changed files with 173 additions and 9 deletions
@@ -1,6 +1,7 @@
package com.bms.receivable.task;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
@@ -75,10 +76,18 @@ public class ArBillGeneratePreviewExportRunner {
put(taskId, userId, "RUNNING", 5, "正在查询订单", null, 0, fileName, null);
List<PrcOrderBill> bills = billService.previewBill(query, scope);
put(taskId, userId, "RUNNING", 40, "正在生成 Excel", null, bills.size(), fileName, null);
List<ArBillGeneratePreviewExportRow> rows = new ArrayList<>(bills.size());
List<ArBillGeneratePreviewExportRow> rows = new ArrayList<>(bills.size() + 1);
BigDecimal totalAmount = BigDecimal.ZERO;
for (PrcOrderBill bill : bills) {
rows.add(ArBillGeneratePreviewExportRow.from(bill));
if (bill.getIncomeTotal() != null) {
totalAmount = totalAmount.add(bill.getIncomeTotal());
}
}
ArBillGeneratePreviewExportRow totalRow = new ArBillGeneratePreviewExportRow();
totalRow.setOrderNo("合计");
totalRow.setIncomeTotal(totalAmount);
rows.add(totalRow);
ExcelUtil<ArBillGeneratePreviewExportRow> util = new ExcelUtil<>(ArBillGeneratePreviewExportRow.class);
if (ArBillDateType.PICKUP_DATE == ArBillDateType.of(query.getDateType())) {
util.hideColumn("bizDate");