feat(wallet-service): 省/市区域账户增加累计转出字段
- provinceAccounts 和 cityAccounts 返回结构增加 totalTransferred 字段 - 完善分类账统计,与固定系统账户保持一致 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
07fe3e3140
commit
27e64819b7
|
|
@ -3338,12 +3338,13 @@ export class WalletApplicationService {
|
|||
// =============== 系统账户报表统计 API - 增强版 ===============
|
||||
// [2026-01-05] 新增:获取所有系统账户列表(固定+区域)
|
||||
// [2026-01-07] 更新:账户余额改为 usdtAvailable + settleableUsdt,与累计收入统计保持一致
|
||||
// [2026-01-07] 更新:省/市区域账户增加 totalTransferred 字段,完善分类账统计
|
||||
// 回滚方式:删除以下方法
|
||||
|
||||
async getAllSystemAccounts(): Promise<{
|
||||
fixedAccounts: Array<{ accountSequence: string; accountType: string; usdtBalance: string; totalReceived: string; totalTransferred: string; status: string; createdAt: string }>;
|
||||
provinceAccounts: Array<{ accountSequence: string; regionCode: string; regionName: string; usdtBalance: string; totalReceived: string; status: string }>;
|
||||
cityAccounts: Array<{ accountSequence: string; regionCode: string; regionName: string; usdtBalance: string; totalReceived: string; status: string }>;
|
||||
provinceAccounts: Array<{ accountSequence: string; regionCode: string; regionName: string; usdtBalance: string; totalReceived: string; totalTransferred: string; status: string }>;
|
||||
cityAccounts: Array<{ accountSequence: string; regionCode: string; regionName: string; usdtBalance: string; totalReceived: string; totalTransferred: string; status: string }>;
|
||||
}> {
|
||||
this.logger.log('[getAllSystemAccounts] 查询所有系统账户...');
|
||||
const wallets = await this.prisma.walletAccount.findMany({
|
||||
|
|
@ -3357,8 +3358,8 @@ export class WalletApplicationService {
|
|||
const transferredMap = new Map(transferredStats.map(s => [s.accountSequence, s._sum.amount]));
|
||||
const fixedAccountTypes: Record<string, string> = { 'S0000000001': 'HQ_COMMUNITY', 'S0000000002': 'COST_ACCOUNT', 'S0000000003': 'OPERATION_ACCOUNT', 'S0000000004': 'RWAD_POOL_PENDING', 'S0000000005': 'SHARE_RIGHT_POOL', 'S0000000006': 'FEE_COLLECTION' };
|
||||
const fixedAccounts: Array<{ accountSequence: string; accountType: string; usdtBalance: string; totalReceived: string; totalTransferred: string; status: string; createdAt: string }> = [];
|
||||
const provinceAccounts: Array<{ accountSequence: string; regionCode: string; regionName: string; usdtBalance: string; totalReceived: string; status: string }> = [];
|
||||
const cityAccounts: Array<{ accountSequence: string; regionCode: string; regionName: string; usdtBalance: string; totalReceived: string; status: string }> = [];
|
||||
const provinceAccounts: Array<{ accountSequence: string; regionCode: string; regionName: string; usdtBalance: string; totalReceived: string; totalTransferred: string; status: string }> = [];
|
||||
const cityAccounts: Array<{ accountSequence: string; regionCode: string; regionName: string; usdtBalance: string; totalReceived: string; totalTransferred: string; status: string }> = [];
|
||||
for (const wallet of wallets) {
|
||||
const seq = wallet.accountSequence;
|
||||
const received = Number(receivedMap2.get(seq) || 0);
|
||||
|
|
@ -3368,9 +3369,9 @@ export class WalletApplicationService {
|
|||
if (seq.startsWith('S')) {
|
||||
fixedAccounts.push({ accountSequence: seq, accountType: fixedAccountTypes[seq] || 'UNKNOWN', usdtBalance: String(totalBalance), totalReceived: String(received), totalTransferred: String(transferred), status: wallet.status, createdAt: wallet.createdAt.toISOString() });
|
||||
} else if (seq.startsWith('9')) {
|
||||
provinceAccounts.push({ accountSequence: seq, regionCode: seq.substring(1), regionName: '省区域 ' + seq.substring(1), usdtBalance: String(totalBalance), totalReceived: String(received), status: wallet.status });
|
||||
provinceAccounts.push({ accountSequence: seq, regionCode: seq.substring(1), regionName: '省区域 ' + seq.substring(1), usdtBalance: String(totalBalance), totalReceived: String(received), totalTransferred: String(transferred), status: wallet.status });
|
||||
} else if (seq.startsWith('8')) {
|
||||
cityAccounts.push({ accountSequence: seq, regionCode: seq.substring(1), regionName: '市区域 ' + seq.substring(1), usdtBalance: String(totalBalance), totalReceived: String(received), status: wallet.status });
|
||||
cityAccounts.push({ accountSequence: seq, regionCode: seq.substring(1), regionName: '市区域 ' + seq.substring(1), usdtBalance: String(totalBalance), totalReceived: String(received), totalTransferred: String(transferred), status: wallet.status });
|
||||
}
|
||||
}
|
||||
this.logger.log('[getAllSystemAccounts] 固定: ' + fixedAccounts.length + ', 省: ' + provinceAccounts.length + ', 市: ' + cityAccounts.length);
|
||||
|
|
|
|||
Loading…
Reference in New Issue