feat(domain): 添加 SettlementService.GetBillingSummary 接口方法
问题:settlementService.GetBillingSummary 方法存在但未在接口中暴露 解决: 1. 在 SettlementService 接口添加 GetBillingSummary 方法 2. 添加 TestSettlementService_GetBillingSummary 测试 Coverage: - GetBillingSummary: 0% -> 100% - Total domain coverage: 72.0% -> 72.3% Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,7 @@ type SettlementService interface {
|
||||
Cancel(ctx context.Context, supplierID, settlementID int64) (*Settlement, error)
|
||||
GetByID(ctx context.Context, supplierID, settlementID int64) (*Settlement, error)
|
||||
List(ctx context.Context, supplierID int64) ([]*Settlement, error)
|
||||
GetBillingSummary(ctx context.Context, supplierID int64, startDate, endDate string) (*BillingSummary, error)
|
||||
}
|
||||
|
||||
// 收益服务接口
|
||||
|
||||
@@ -605,3 +605,19 @@ func TestGenerateSettlementNo(t *testing.T) {
|
||||
// 格式为时间戳 20060102150405
|
||||
assert.Equal(t, 14, len(no))
|
||||
}
|
||||
|
||||
// TestSettlementService_GetBillingSummary 测试通过结算服务获取账单摘要
|
||||
func TestSettlementService_GetBillingSummary(t *testing.T) {
|
||||
store := newMockSettlementStore()
|
||||
earningStore := newMockEarningStore()
|
||||
auditStore := &mockAuditStoreForSettlement{}
|
||||
|
||||
svc := NewSettlementService(store, earningStore, auditStore)
|
||||
|
||||
summary, err := svc.GetBillingSummary(context.Background(), 1001, "2024-01-01", "2024-01-31")
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, summary)
|
||||
assert.Equal(t, "2024-01-01", summary.Period.Start)
|
||||
assert.Equal(t, "2024-01-31", summary.Period.End)
|
||||
assert.Equal(t, float64(1000), summary.Summary.TotalRevenue)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user