fix(reporting-service): 将过期收益累加到总部储蓄账户统计

- 修改 assembleFixedAccounts 方法接受过期收益总额参数
- 将过期分享收益累加到 HQ_COMMUNITY (S0000000001) 的累计收入中
- 添加日志记录累加过程

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-07 05:53:51 -08:00
parent db833fdf45
commit c22ce4ecc4
1 changed files with 21 additions and 3 deletions

View File

@ -116,8 +116,11 @@ export class SystemAccountReportApplicationService {
this.rewardServiceClient.getExpiredRewardsSummary(params), this.rewardServiceClient.getExpiredRewardsSummary(params),
]); ]);
// 组装固定账户数据 // 组装固定账户数据,并将过期收益累加到总部储蓄账户
const fixedAccounts = this.assembleFixedAccounts(allSystemAccounts.fixedAccounts); const fixedAccounts = this.assembleFixedAccounts(
allSystemAccounts.fixedAccounts,
expiredRewards.totalAmount,
);
// 组装省账户汇总 // 组装省账户汇总
const provinceSummary = this.assembleRegionSummary(allSystemAccounts.provinceAccounts); const provinceSummary = this.assembleRegionSummary(allSystemAccounts.provinceAccounts);
@ -299,9 +302,11 @@ export class SystemAccountReportApplicationService {
/** /**
* *
* [2026-01-07] (HQ_COMMUNITY / S0000000001)
*/ */
private assembleFixedAccounts( private assembleFixedAccounts(
fixedAccounts: AllSystemAccountsResponse['fixedAccounts'], fixedAccounts: AllSystemAccountsResponse['fixedAccounts'],
expiredRewardsTotal: number = 0,
): SystemAccountReportResponse['fixedAccounts'] { ): SystemAccountReportResponse['fixedAccounts'] {
const result: SystemAccountReportResponse['fixedAccounts'] = { const result: SystemAccountReportResponse['fixedAccounts'] = {
costAccount: null, costAccount: null,
@ -314,7 +319,20 @@ export class SystemAccountReportApplicationService {
for (const account of fixedAccounts) { for (const account of fixedAccounts) {
const fieldName = FIXED_ACCOUNT_TYPES[account.accountType]; const fieldName = FIXED_ACCOUNT_TYPES[account.accountType];
if (fieldName && fieldName in result) { 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;
}
} }
} }