From c22ce4ecc443fd2df449a2c36c51bc8effdca4e6 Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 7 Jan 2026 05:53:51 -0800 Subject: [PATCH] =?UTF-8?q?fix(reporting-service):=20=E5=B0=86=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=E6=94=B6=E7=9B=8A=E7=B4=AF=E5=8A=A0=E5=88=B0=E6=80=BB?= =?UTF-8?q?=E9=83=A8=E5=82=A8=E8=93=84=E8=B4=A6=E6=88=B7=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 assembleFixedAccounts 方法接受过期收益总额参数 - 将过期分享收益累加到 HQ_COMMUNITY (S0000000001) 的累计收入中 - 添加日志记录累加过程 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- ...stem-account-report-application.service.ts | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/backend/services/reporting-service/src/application/services/system-account-report-application.service.ts b/backend/services/reporting-service/src/application/services/system-account-report-application.service.ts index bfc70f2f..3461d7eb 100644 --- a/backend/services/reporting-service/src/application/services/system-account-report-application.service.ts +++ b/backend/services/reporting-service/src/application/services/system-account-report-application.service.ts @@ -116,8 +116,11 @@ export class SystemAccountReportApplicationService { this.rewardServiceClient.getExpiredRewardsSummary(params), ]); - // 组装固定账户数据 - const fixedAccounts = this.assembleFixedAccounts(allSystemAccounts.fixedAccounts); + // 组装固定账户数据,并将过期收益累加到总部储蓄账户 + const fixedAccounts = this.assembleFixedAccounts( + allSystemAccounts.fixedAccounts, + expiredRewards.totalAmount, + ); // 组装省账户汇总 const provinceSummary = this.assembleRegionSummary(allSystemAccounts.provinceAccounts); @@ -299,9 +302,11 @@ export class SystemAccountReportApplicationService { /** * 组装固定账户数据 + * [2026-01-07] 更新:将过期收益累加到总部储蓄账户 (HQ_COMMUNITY / S0000000001) 的累计收入中 */ private assembleFixedAccounts( fixedAccounts: AllSystemAccountsResponse['fixedAccounts'], + expiredRewardsTotal: number = 0, ): SystemAccountReportResponse['fixedAccounts'] { const result: SystemAccountReportResponse['fixedAccounts'] = { costAccount: null, @@ -314,7 +319,20 @@ export class SystemAccountReportApplicationService { for (const account of fixedAccounts) { const fieldName = FIXED_ACCOUNT_TYPES[account.accountType]; if (fieldName && fieldName in result) { - (result as any)[fieldName] = account; + // 如果是总部储蓄账户 (HQ_COMMUNITY),累加过期收益 + if (account.accountType === 'HQ_COMMUNITY' && expiredRewardsTotal > 0) { + const currentReceived = parseFloat(account.totalReceived) || 0; + const newTotalReceived = currentReceived + expiredRewardsTotal; + (result as any)[fieldName] = { + ...account, + totalReceived: newTotalReceived.toFixed(8), + }; + this.logger.log( + `[assembleFixedAccounts] HQ_COMMUNITY 累计收入: ${currentReceived} + 过期收益 ${expiredRewardsTotal} = ${newTotalReceived}`, + ); + } else { + (result as any)[fieldName] = account; + } } }