fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 22s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 22s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -224,7 +224,51 @@ public class BudgetApplication(
|
||||
StartDate = startDate,
|
||||
NoLimit = result.NoLimit,
|
||||
IsMandatoryExpense = result.IsMandatoryExpense,
|
||||
UsagePercentage = result.Limit > 0 ? result.Current / result.Limit * 100 : 0
|
||||
UsagePercentage = result.Limit > 0 ? result.Current / result.Limit * 100 : 0,
|
||||
Details = result.Details != null ? MapToSavingsDetailDto(result.Details) : null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 映射存款明细数据到DTO
|
||||
/// </summary>
|
||||
private static SavingsDetailDto MapToSavingsDetailDto(Service.Budget.SavingsDetail details)
|
||||
{
|
||||
return new SavingsDetailDto
|
||||
{
|
||||
IncomeItems = details.IncomeItems.Select(item => new BudgetDetailItemDto
|
||||
{
|
||||
Id = item.Id,
|
||||
Name = item.Name,
|
||||
Type = item.Type,
|
||||
BudgetLimit = item.BudgetLimit,
|
||||
ActualAmount = item.ActualAmount,
|
||||
EffectiveAmount = item.EffectiveAmount,
|
||||
CalculationNote = item.CalculationNote,
|
||||
IsOverBudget = item.IsOverBudget,
|
||||
IsArchived = item.IsArchived,
|
||||
ArchivedMonths = item.ArchivedMonths
|
||||
}).ToList(),
|
||||
ExpenseItems = details.ExpenseItems.Select(item => new BudgetDetailItemDto
|
||||
{
|
||||
Id = item.Id,
|
||||
Name = item.Name,
|
||||
Type = item.Type,
|
||||
BudgetLimit = item.BudgetLimit,
|
||||
ActualAmount = item.ActualAmount,
|
||||
EffectiveAmount = item.EffectiveAmount,
|
||||
CalculationNote = item.CalculationNote,
|
||||
IsOverBudget = item.IsOverBudget,
|
||||
IsArchived = item.IsArchived,
|
||||
ArchivedMonths = item.ArchivedMonths
|
||||
}).ToList(),
|
||||
Summary = new SavingsCalculationSummaryDto
|
||||
{
|
||||
TotalIncomeBudget = details.Summary.TotalIncomeBudget,
|
||||
TotalExpenseBudget = details.Summary.TotalExpenseBudget,
|
||||
PlannedSavings = details.Summary.PlannedSavings,
|
||||
CalculationFormula = details.Summary.CalculationFormula
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,52 @@ public record BudgetResponse
|
||||
public bool NoLimit { get; init; }
|
||||
public bool IsMandatoryExpense { get; init; }
|
||||
public decimal UsagePercentage { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 存款明细数据(仅存款预算返回)
|
||||
/// </summary>
|
||||
public SavingsDetailDto? Details { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 存款明细数据 DTO
|
||||
/// </summary>
|
||||
public record SavingsDetailDto
|
||||
{
|
||||
public List<BudgetDetailItemDto> IncomeItems { get; init; } = new();
|
||||
public List<BudgetDetailItemDto> ExpenseItems { get; init; } = new();
|
||||
public SavingsCalculationSummaryDto Summary { get; init; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 预算明细项 DTO
|
||||
/// </summary>
|
||||
public record BudgetDetailItemDto
|
||||
{
|
||||
public long Id { get; init; }
|
||||
public string Name { get; init; } = string.Empty;
|
||||
public BudgetPeriodType Type { get; init; }
|
||||
public decimal BudgetLimit { get; init; }
|
||||
public decimal ActualAmount { get; init; }
|
||||
public decimal EffectiveAmount { get; init; }
|
||||
public string CalculationNote { get; init; } = string.Empty;
|
||||
public bool IsOverBudget { get; init; }
|
||||
public bool IsArchived { get; init; }
|
||||
public int[]? ArchivedMonths { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 存款计算汇总 DTO
|
||||
/// </summary>
|
||||
public record SavingsCalculationSummaryDto
|
||||
{
|
||||
public decimal TotalIncomeBudget { get; init; }
|
||||
public decimal TotalExpenseBudget { get; init; }
|
||||
public decimal PlannedSavings { get; init; }
|
||||
public string CalculationFormula { get; init; } = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建预算请求
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user