From 5ec310124d144d03abce716a3c5577370285fccb Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 20 Jan 2026 08:42:02 -0800 Subject: [PATCH] =?UTF-8?q?fix(contribution):=20=E7=A1=AE=E4=BF=9D=20HEADQ?= =?UTF-8?q?UARTERS=20=E8=B4=A6=E6=88=B7=E5=AD=98=E5=9C=A8=E5=90=8E?= =?UTF-8?q?=E5=86=8D=E6=9B=B4=E6=96=B0=E7=AE=97=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 Record to update not found 错误,在调用 addContribution 前 先调用 ensureSystemAccountsExist 确保系统账户记录已创建。 Co-Authored-By: Claude Opus 4.5 --- .../application/services/contribution-calculation.service.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/services/contribution-service/src/application/services/contribution-calculation.service.ts b/backend/services/contribution-service/src/application/services/contribution-calculation.service.ts index 889b314e..40049533 100644 --- a/backend/services/contribution-service/src/application/services/contribution-calculation.service.ts +++ b/backend/services/contribution-service/src/application/services/contribution-calculation.service.ts @@ -285,6 +285,8 @@ export class ContributionCalculationService { (sum, u) => sum.add(u.amount), new ContributionAmount(0), ); + // 确保 HEADQUARTERS 账户存在 + await this.systemAccountRepository.ensureSystemAccountsExist(); await this.systemAccountRepository.addContribution('HEADQUARTERS', totalUnallocatedAmount); // 发布 HEADQUARTERS 账户同步事件