fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 23s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 2s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 23s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 2s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
namespace Service.Budget;
|
||||
namespace Service.Budget;
|
||||
|
||||
public interface IBudgetService
|
||||
{
|
||||
@@ -183,6 +183,12 @@ public class BudgetService(
|
||||
.Where(b => b.Category == category && !b.NoLimit)
|
||||
.ToList();
|
||||
|
||||
// 月度统计中,只包含月度预算;年度统计中,包含所有预算
|
||||
if (statType == BudgetPeriodType.Month)
|
||||
{
|
||||
relevant = relevant.Where(b => b.Type == BudgetPeriodType.Month).ToList();
|
||||
}
|
||||
|
||||
if (relevant.Count == 0)
|
||||
{
|
||||
return result;
|
||||
@@ -204,12 +210,7 @@ public class BudgetService(
|
||||
{
|
||||
// 限额折算
|
||||
var itemLimit = budget.Limit;
|
||||
if (statType == BudgetPeriodType.Month && budget.Type == BudgetPeriodType.Year)
|
||||
{
|
||||
// 月度视图下,年度预算不参与限额计算
|
||||
itemLimit = 0;
|
||||
}
|
||||
else if (statType == BudgetPeriodType.Year && budget.Type == BudgetPeriodType.Month)
|
||||
if (statType == BudgetPeriodType.Year && budget.Type == BudgetPeriodType.Month)
|
||||
{
|
||||
// 年度视图下,月度预算折算为年度
|
||||
itemLimit = budget.Limit * 12;
|
||||
@@ -229,13 +230,13 @@ public class BudgetService(
|
||||
IsMandatoryExpense = budget.IsMandatoryExpense
|
||||
}, referenceDate);
|
||||
|
||||
if (budget.Type == statType)
|
||||
if (statType == BudgetPeriodType.Month)
|
||||
{
|
||||
totalCurrent += currentAmount;
|
||||
}
|
||||
else if (statType == BudgetPeriodType.Year && budget.Type == BudgetPeriodType.Month)
|
||||
else if (statType == BudgetPeriodType.Year)
|
||||
{
|
||||
// 年度视图下,月度预算计入其当前值(作为对年度目前的贡献)
|
||||
// 年度视图下,累加所有预算的当前值
|
||||
totalCurrent += currentAmount;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user