This commit is contained in:
邹宗楠
2023-05-18 09:02:07 +08:00
parent b7c1e8638b
commit 55600bedb0
13 changed files with 275 additions and 159 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"git.rosy.net.cn/baseapi/platformapi/mtpsapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model"
@@ -485,6 +486,36 @@ func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeiso
return result, nil
}
func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId string) (money int64, err error) {
statusList, err := orderman.FixedOrderManager.GetWayBillStatusList(orderId, deliverId, model.VendorIDMTPS)
if err != nil {
return 0, err
}
// 已经分配骑手,且超过十五分钟,不扣款
if len(statusList) != model.NO {
for i := len(statusList) - 1; i >= 0; i-- {
switch statusList[i].VendorStatus {
case utils.Int2Str(mtpsapi.OrderStatusWaitingForSchedule): // 待调度
return 0, nil
case utils.Int2Str(mtpsapi.OrderStatusCanceled): // 取消不管
continue
case utils.Int2Str(mtpsapi.OrderStatusDeliverred): // 送达
continue
case utils.Int2Str(mtpsapi.OrderStatusAccepted): // 接单
// 接单取消扣凉快
return 200, nil
case utils.Int2Str(mtpsapi.OrderStatusPickedUp): // 取货
bill, err := partner.CurOrderManager.LoadWaybill(deliverId, model.VendorIDDada)
if err != nil {
return 0, err
}
return bill.DesiredFee, nil
}
}
}
return 0, err
}