From 27e64819b7c9c397c6921f4876c981e67171daa1 Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 7 Jan 2026 04:39:47 -0800 Subject: [PATCH] =?UTF-8?q?feat(wallet-service):=20=E7=9C=81/=E5=B8=82?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E8=B4=A6=E6=88=B7=E5=A2=9E=E5=8A=A0=E7=B4=AF?= =?UTF-8?q?=E8=AE=A1=E8=BD=AC=E5=87=BA=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - provinceAccounts 和 cityAccounts 返回结构增加 totalTransferred 字段 - 完善分类账统计,与固定系统账户保持一致 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../services/wallet-application.service.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/services/wallet-service/src/application/services/wallet-application.service.ts b/backend/services/wallet-service/src/application/services/wallet-application.service.ts index 6f3db56c..b8ddc693 100644 --- a/backend/services/wallet-service/src/application/services/wallet-application.service.ts +++ b/backend/services/wallet-service/src/application/services/wallet-application.service.ts @@ -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 = { '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);