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; + } } }