fix(system-accounts): 修复省市系统账户自动创建的数据流问题

1. contribution-service: 修复 CITY 类型账户的 provinceCode 映射
   - 之前 CITY 的 provinceCode 被错误设为 cityCode
   - 现在正确传递 provinceCode 用于创建省份

2. mining-wallet-service: 修复系统账户创建事件的 topic
   - 之前发布到 mining-wallet.system-account.created
   - 现在发布到 cdc.mining-wallet.outbox 供 mining-admin-service 同步

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-21 00:28:48 -08:00
parent cded4b2134
commit 96da7518bf
2 changed files with 7 additions and 6 deletions

View File

@ -121,13 +121,14 @@ export class ContributionDistributionPublisherService {
return result.systemContributions.map((sys) => ({
accountType: sys.accountType,
amount: sys.amount.value.toString(),
// 直接使用 regionCode没有就用传入的参数
// 省份代码PROVINCE 用自己的 regionCodeCITY 需要传递省份代码用于创建省份
provinceCode:
sys.accountType === 'PROVINCE'
? sys.regionCode || provinceCode
: sys.accountType === 'CITY'
? sys.regionCode || cityCode
? provinceCode // CITY 需要省份代码来创建省份(如果省份不存在)
: undefined,
// 城市代码:只有 CITY 类型有
cityCode:
sys.accountType === 'CITY' ? sys.regionCode || cityCode : undefined,
neverExpires: sys.accountType === 'OPERATION', // 运营账户永不过期

View File

@ -396,13 +396,13 @@ export class ContributionWalletService {
});
this.logger.log(`Auto-created province system account: ${account.code}`);
// 发布系统账户创建事件到 Outbox
// 发布系统账户创建事件到 Outbox(用于 mining-admin-service 同步)
await tx.outboxEvent.create({
data: {
aggregateType: 'SystemAccount',
aggregateId: account.id,
eventType: 'WalletSystemAccountCreated',
topic: 'mining-wallet.system-account.created',
topic: 'cdc.mining-wallet.outbox',
key: account.code,
payload: {
id: account.id,
@ -481,13 +481,13 @@ export class ContributionWalletService {
});
this.logger.log(`Auto-created city system account: ${account.code}`);
// 发布系统账户创建事件到 Outbox
// 发布系统账户创建事件到 Outbox(用于 mining-admin-service 同步)
await tx.outboxEvent.create({
data: {
aggregateType: 'SystemAccount',
aggregateId: account.id,
eventType: 'WalletSystemAccountCreated',
topic: 'mining-wallet.system-account.created',
topic: 'cdc.mining-wallet.outbox',
key: account.code,
payload: {
id: account.id,