This commit is contained in:
2026-08-17 18:32:38 +08:00
parent 5c22018edd
commit 5199146e97
13 changed files with 194 additions and 17 deletions
@@ -48,6 +48,7 @@ public class FinanceExportProviderService {
private static final int SCHEMA_VERSION = 1;
private static final int MAX_BATCH_SIZE = 500;
private static final int QUERY_PAGE_SIZE = 200;
private static final int MAX_SNAPSHOT_TOKEN_LENGTH = 512;
private static final Set<String> TYPES = Set.of(CUSTOMER_ACCOUNT_LIST, CUSTOMER_ACCOUNT_LEDGER,
FEE_SOURCE_LIST, RECONCILIATION_STATEMENT_LIST, RECEIVABLE_SETTLEMENT_LIST,
@@ -148,13 +149,15 @@ public class FinanceExportProviderService {
int limit = request.source().limit();
Map<String, Object> p = request.parameters();
if (CUSTOMER_ACCOUNT_LIST.equals(type)) {
int page = offset / limit + 1;
var result = accountService.list(page, limit, null, text(p, "status"), longValue(p, "customerId", false));
int querySize = Math.min(limit, QUERY_PAGE_SIZE);
int page = offset / querySize + 1;
var result = accountService.list(page, querySize, null, text(p, "status"), longValue(p, "customerId", false));
return new BatchRows(result.data().stream().map(this::accountRow).toList(), result.page().total());
}
if (CUSTOMER_ACCOUNT_LEDGER.equals(type)) {
int page = offset / limit + 1;
var result = operationService.listDerivedCustomerAccountLedger(longValue(p, "customerId", true), page, limit,
int querySize = Math.min(limit, QUERY_PAGE_SIZE);
int page = offset / querySize + 1;
var result = operationService.listDerivedCustomerAccountLedger(longValue(p, "customerId", true), page, querySize,
text(p, "businessType"), date(p, "startDate"), date(p, "endDate"));
return new BatchRows(result.data().stream().map(this::ledgerRow).toList(), result.page().total());
}