refactor(order): 结账单状态常量化并锁定仲裁结单统计口径
仲裁结案会把结账单置为终态 settled,但该状态一直是裸字符串;同时 adminfinance 按日结算聚合只按
accepted 过滤,容易被误读成"仲裁单掉出统计"。本次只做卫生与口径固化,不改任何行为:
- order 新增 CheckoutStatus{Submitted,Countered,Accepted,Disputed,Settled},包内沿用非导出别名
- dispute 的仲裁结案与争议取消分支改用常量;distribution 不能反向依赖 order,本地声明同名常量
- adminfinance 聚合里的 oc.status = 'accepted' 改为常量绑定,并注释说明仲裁单不计入是有意口径
- 新增 distribution 结账单退款重算用例(该分支原先无覆盖):accepted/settled 按结账单实际租金,
submitted 不被采用;dashboard 用例补一张 settled 结账单,钉住"不计入已结算订单数"
This commit is contained in:
@@ -375,7 +375,7 @@ func applyArbitrationActualSettlement(order *model.RentalOrder, checkout *model.
|
||||
checkout.OwnerIncomeAmountCent = settlement.OwnerIncomeCent
|
||||
checkout.ShortfallCent = settlement.ShortfallCent
|
||||
checkout.OvershootAmountCent = settlement.OvershootAmountCent
|
||||
checkout.Status = "settled"
|
||||
checkout.Status = ordermodule.CheckoutStatusSettled
|
||||
}
|
||||
|
||||
func isPlatformManagedOrder(order model.RentalOrder) bool {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"hfb_sys/backend/internal/model"
|
||||
"hfb_sys/backend/internal/modules/notification"
|
||||
ordermodule "hfb_sys/backend/internal/modules/order"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
@@ -145,9 +146,9 @@ func restoreCheckoutDispute(tx *gorm.DB, row *model.Dispute, order *model.Rental
|
||||
}
|
||||
checkout.Status = row.PreviousCheckoutStatus
|
||||
if checkout.Status == "" {
|
||||
checkout.Status = "submitted"
|
||||
checkout.Status = ordermodule.CheckoutStatusSubmitted
|
||||
if order.Status == "pending_checkout_accept" {
|
||||
checkout.Status = "countered"
|
||||
checkout.Status = ordermodule.CheckoutStatusCountered
|
||||
}
|
||||
}
|
||||
checkout.RenterRejectedAt = nil
|
||||
|
||||
Reference in New Issue
Block a user