feat: 移除预算相关的停止状态属性和相关功能,简化预算管理逻辑
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 11s
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 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 11s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -161,9 +161,9 @@ public class BudgetService(
|
||||
Count = 0
|
||||
};
|
||||
|
||||
// 获取当前分类下所有未停止的预算
|
||||
// 获取当前分类下所有预算
|
||||
var relevant = budgets
|
||||
.Where(b => b.Category == category && !b.IsStopped)
|
||||
.Where(b => b.Category == category)
|
||||
.ToList();
|
||||
|
||||
if (relevant.Count == 0)
|
||||
@@ -409,8 +409,6 @@ public class BudgetService(
|
||||
|
||||
private async Task<decimal> CalculateCurrentAmountAsync(BudgetRecord budget, DateTime? now = null)
|
||||
{
|
||||
if (budget.IsStopped) return 0;
|
||||
|
||||
var referenceDate = now ?? DateTime.Now;
|
||||
var (startDate, endDate) = GetPeriodRange(budget.StartDate, budget.Type, referenceDate);
|
||||
|
||||
@@ -468,7 +466,7 @@ public class BudgetService(
|
||||
|
||||
foreach (var b in allBudgets)
|
||||
{
|
||||
if (b.IsStopped || b.Category == BudgetCategory.Savings) continue;
|
||||
if (b.Category == BudgetCategory.Savings) continue;
|
||||
|
||||
// 折算系数:根据当前请求的 periodType (Year 或 Month),将预算 b 的 Limit 折算过来
|
||||
decimal factor = 1.0m;
|
||||
@@ -589,7 +587,6 @@ public record BudgetResult
|
||||
public decimal Current { get; set; }
|
||||
public BudgetCategory Category { get; set; }
|
||||
public string[] SelectedCategories { get; set; } = Array.Empty<string>();
|
||||
public bool IsStopped { get; set; }
|
||||
public string StartDate { get; set; } = string.Empty;
|
||||
public string Period { get; set; } = string.Empty;
|
||||
public DateTime? PeriodStart { get; set; }
|
||||
@@ -617,7 +614,6 @@ public record BudgetResult
|
||||
SelectedCategories = string.IsNullOrEmpty(entity.SelectedCategories)
|
||||
? Array.Empty<string>()
|
||||
: entity.SelectedCategories.Split(','),
|
||||
IsStopped = entity.IsStopped,
|
||||
StartDate = entity.StartDate.ToString("yyyy-MM-dd"),
|
||||
Period = entity.Type switch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user