fix(wallet/reporting): 修复手续费归集统计 API 的数据库表名和响应解包问题
- wallet-service: 修复 getFeeCollectionSummary 中原生 SQL 使用错误表名
- 将 ledger_entries 改为 wallet_ledger_entries(Prisma 映射表名)
- reporting-service: 修复 getFeeCollectionSummary/Entries 响应解包
- wallet-service 返回 { success, data, timestamp } 格式需要解包 data
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4e5d9685a1
commit
4dcdfb8a3c
|
|
@ -320,6 +320,7 @@ export class WalletServiceClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
// [2026-01-06] 新增:获取手续费归集账户汇总统计
|
// [2026-01-06] 新增:获取手续费归集账户汇总统计
|
||||||
|
// [2026-01-07] 修复:wallet-service 返回 { success, data, timestamp } 包装格式,需要解包
|
||||||
/**
|
/**
|
||||||
* 获取手续费归集账户汇总统计
|
* 获取手续费归集账户汇总统计
|
||||||
* 统计 S0000000006 账户收到的所有提现手续费
|
* 统计 S0000000006 账户收到的所有提现手续费
|
||||||
|
|
@ -330,10 +331,11 @@ export class WalletServiceClient {
|
||||||
this.logger.debug(`[getFeeCollectionSummary] 请求: ${url}`);
|
this.logger.debug(`[getFeeCollectionSummary] 请求: ${url}`);
|
||||||
|
|
||||||
const response = await firstValueFrom(
|
const response = await firstValueFrom(
|
||||||
this.httpService.get<FeeCollectionSummaryResponse>(url),
|
this.httpService.get<{ success: boolean; data: FeeCollectionSummaryResponse; timestamp: string }>(url),
|
||||||
);
|
);
|
||||||
|
|
||||||
return response.data;
|
// wallet-service 返回 { success, data, timestamp } 包装格式
|
||||||
|
return response.data.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(`[getFeeCollectionSummary] 失败: ${error.message}`);
|
this.logger.error(`[getFeeCollectionSummary] 失败: ${error.message}`);
|
||||||
return {
|
return {
|
||||||
|
|
@ -347,6 +349,7 @@ export class WalletServiceClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [2026-01-07] 修复:wallet-service 返回 { success, data, timestamp } 包装格式,需要解包
|
||||||
/**
|
/**
|
||||||
* 获取手续费归集账户流水明细
|
* 获取手续费归集账户流水明细
|
||||||
*/
|
*/
|
||||||
|
|
@ -369,10 +372,11 @@ export class WalletServiceClient {
|
||||||
this.logger.debug(`[getFeeCollectionEntries] 请求: ${url}`);
|
this.logger.debug(`[getFeeCollectionEntries] 请求: ${url}`);
|
||||||
|
|
||||||
const response = await firstValueFrom(
|
const response = await firstValueFrom(
|
||||||
this.httpService.get<FeeCollectionEntriesResponse>(url),
|
this.httpService.get<{ success: boolean; data: FeeCollectionEntriesResponse; timestamp: string }>(url),
|
||||||
);
|
);
|
||||||
|
|
||||||
return response.data;
|
// wallet-service 返回 { success, data, timestamp } 包装格式
|
||||||
|
return response.data.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(`[getFeeCollectionEntries] 失败: ${error.message}`);
|
this.logger.error(`[getFeeCollectionEntries] 失败: ${error.message}`);
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -3398,7 +3398,7 @@ export class WalletApplicationService {
|
||||||
COALESCE(payload_json->>'feeType', 'UNKNOWN') as "feeType",
|
COALESCE(payload_json->>'feeType', 'UNKNOWN') as "feeType",
|
||||||
SUM(amount) as amount,
|
SUM(amount) as amount,
|
||||||
COUNT(*) as count
|
COUNT(*) as count
|
||||||
FROM ledger_entries
|
FROM wallet_ledger_entries
|
||||||
WHERE account_sequence = ${feeAccountSequence}
|
WHERE account_sequence = ${feeAccountSequence}
|
||||||
AND entry_type = 'FEE_COLLECTION'
|
AND entry_type = 'FEE_COLLECTION'
|
||||||
GROUP BY COALESCE(payload_json->>'feeType', 'UNKNOWN')
|
GROUP BY COALESCE(payload_json->>'feeType', 'UNKNOWN')
|
||||||
|
|
@ -3415,7 +3415,7 @@ export class WalletApplicationService {
|
||||||
TO_CHAR(created_at, 'YYYY-MM') as month,
|
TO_CHAR(created_at, 'YYYY-MM') as month,
|
||||||
SUM(amount) as amount,
|
SUM(amount) as amount,
|
||||||
COUNT(*) as count
|
COUNT(*) as count
|
||||||
FROM ledger_entries
|
FROM wallet_ledger_entries
|
||||||
WHERE account_sequence = ${feeAccountSequence}
|
WHERE account_sequence = ${feeAccountSequence}
|
||||||
AND entry_type = 'FEE_COLLECTION'
|
AND entry_type = 'FEE_COLLECTION'
|
||||||
GROUP BY TO_CHAR(created_at, 'YYYY-MM')
|
GROUP BY TO_CHAR(created_at, 'YYYY-MM')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue