1
This commit is contained in:
@@ -283,7 +283,7 @@ func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInf
|
||||
return nil, err
|
||||
}
|
||||
globals.SugarLogger.Debugf("QueryDeliverFee===============预下单获取配送费:%s", utils.Format4Output(result, false))
|
||||
deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(result.Fee)
|
||||
deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(result.DeliverFee) // jxutils.StandardPrice2Int(result.Fee)
|
||||
deliveryFeeInfo.RefDeliveryFee = deliveryFeeInfo.DeliveryFee
|
||||
}
|
||||
return deliveryFeeInfo, err
|
||||
@@ -388,8 +388,8 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee
|
||||
VendorOrderID: order.VendorOrderID,
|
||||
OrderVendorID: order.VendorID,
|
||||
WaybillVendorID: model.VendorIDDada,
|
||||
DesiredFee: jxutils.StandardPrice2Int(result.Fee),
|
||||
ActualFee: jxutils.StandardPrice2Int(result.Fee),
|
||||
DesiredFee: jxutils.StandardPrice2Int(result.DeliverFee),
|
||||
ActualFee: jxutils.StandardPrice2Int(result.DeliverFee),
|
||||
}
|
||||
delivery.OnWaybillCreated(bill)
|
||||
return bill, err
|
||||
@@ -571,8 +571,14 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId
|
||||
return 200, nil
|
||||
}
|
||||
|
||||
// fetchTime 已经有时间了,代表已经取货.次数取消扣除此订单全部金额
|
||||
// 达达存在多个订单的运单违约金额统计在一起的情况
|
||||
if dadaOrder.FetchTime != "" {
|
||||
return jxutils.StandardPrice2Int(dadaOrder.ActualFee), nil
|
||||
bill, err := partner.CurOrderManager.LoadWaybill(deliverId, model.VendorIDDada)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return bill.DesiredFee, nil
|
||||
}
|
||||
|
||||
return 0, err
|
||||
|
||||
@@ -234,11 +234,11 @@ func OnWaybillMsg(msg *fnpsapi.OrderStatusNottify) (resp *fnpsapi.CallbackRespon
|
||||
order.DesiredFee, order.ActualFee = GetDesiredFee(order.VendorOrderID)
|
||||
order.Status = model.WaybillStatusNew //5 带调度
|
||||
case fnpsapi.OrderStatusAssigned: //20分配骑手
|
||||
order.DesiredFee, order.ActualFee = GetDesiredFee(order.VendorOrderID)
|
||||
//order.DesiredFee, order.ActualFee = GetDesiredFee(order.VendorOrderID)
|
||||
order.Status = model.WaybillStatusCourierAssigned //12
|
||||
order.Remark = order.CourierName + "," + order.CourierMobile
|
||||
case fnpsapi.OrderStatusArrived: // 80 到店
|
||||
order.DesiredFee, order.ActualFee = GetDesiredFee(order.VendorOrderID)
|
||||
//order.DesiredFee, order.ActualFee = GetDesiredFee(order.VendorOrderID)
|
||||
order.Status = model.WaybillStatusCourierArrived
|
||||
case fnpsapi.OrderStatusDelivering: // 2 配送中
|
||||
order.Status = model.WaybillStatusDelivering
|
||||
@@ -324,7 +324,7 @@ func (c *DeliveryHandler) OnWaybillExcept(msg *fnpsapi.AbnormalReportNotify) (re
|
||||
// 查询订单配送费
|
||||
func GetDesiredFee(vendorOrderID string) (desiredFee, acuteFee int64) {
|
||||
if result, err := api.FnAPI.QueryOrder(vendorOrderID); err == nil {
|
||||
return result.OrderActualAmountCent, result.OrderTotalAmountCent
|
||||
return result.OrderTotalAmountCent + int64(utils.WayBillDeliveryMarkUp), result.OrderActualAmountCent
|
||||
}
|
||||
return desiredFee, acuteFee
|
||||
}
|
||||
@@ -398,7 +398,7 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId
|
||||
for i := len(order.EventLogDetails) - 1; i >= 0; i-- {
|
||||
switch order.EventLogDetails[i].OrderStatus {
|
||||
case fnpsapi.OrderStatusDelivered, fnpsapi.OrderStatusArrived, fnpsapi.OrderStatusDelivering: // 送达,到店,配送中 取消订单全额扣款
|
||||
return order.OrderActualAmountCent, nil
|
||||
return order.OrderTotalAmountCent, nil
|
||||
case fnpsapi.OrderStatusAcceptCacle, fnpsapi.OrderStatusException: // 取消和异常状态,跳过查看上一状态
|
||||
continue
|
||||
case fnpsapi.OrderStatusAcceptCreate, fnpsapi.OrderStatusAccept: // 生成运单和系统接单取消不扣除费用
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee i
|
||||
VendorWaybillID: orderCode,
|
||||
VendorWaybillID2: originID,
|
||||
WaybillVendorID: model.VendorIDUUPT,
|
||||
DesiredFee: jxutils.StandardPrice2Int(utils.Str2Float64(price.NeedPayMoney)),
|
||||
DesiredFee: jxutils.StandardPrice2Int(utils.Str2Float64(price.TotalMoney)),
|
||||
}
|
||||
}
|
||||
delivery.OnWaybillCreated(bill)
|
||||
@@ -192,7 +192,8 @@ func (d DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo
|
||||
return nil, err
|
||||
} else {
|
||||
deliveryFeeInfo = &partner.WaybillFeeInfo{}
|
||||
deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(utils.Str2Float64(orderPrice.NeedPayMoney))
|
||||
// deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(utils.Str2Float64(orderPrice.NeedPayMoney)) 优惠后金额
|
||||
deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(utils.Str2Float64(orderPrice.TotalMoney)) // 原始金额
|
||||
}
|
||||
return deliveryFeeInfo, err
|
||||
}
|
||||
@@ -308,37 +309,39 @@ func OnWaybillMsg(req *uuptapi.WaybillCallbackParam) (resp *uuptapi.CallbackResp
|
||||
dao.GetRow(dao.GetDB(), &good, sql, sqlParams)
|
||||
param.OrderVendorID = good.VendorID
|
||||
//查询运单价格
|
||||
if uuPrice, err := api.UuAPI.GetOrderDetail(req.OrderCode); err != nil {
|
||||
uuPrice, err := api.UuAPI.GetOrderDetail(req.OrderCode)
|
||||
if err != nil {
|
||||
reallyPrice = 0
|
||||
} else {
|
||||
reallyPrice = int64((utils.Str2Float64(uuPrice.OrderPrice) - utils.Str2Float64(uuPrice.PriceOff)) * 100)
|
||||
reallyPrice = int64(utils.Str2Float64(uuPrice.OrderPrice) * 100)
|
||||
}
|
||||
actualFee := int64((utils.Str2Float64(uuPrice.OrderPrice)-utils.Str2Float64(uuPrice.PriceOff))*100) - int64(utils.WayBillDeliveryMarkUp)
|
||||
switch req.State {
|
||||
case uuptapi.StateConfirmSuccess:
|
||||
param.Status = model.WaybillStatusNew //5 待调度
|
||||
param.DesiredFee = reallyPrice
|
||||
param.ActualFee = reallyPrice
|
||||
param.ActualFee = actualFee
|
||||
case uuptapi.StateRMGrabsOrder:
|
||||
param.Status = model.WaybillStatusCourierAssigned
|
||||
param.Remark = req.DriverName + "," + req.DriverMobile
|
||||
param.DesiredFee = reallyPrice
|
||||
param.ActualFee = reallyPrice
|
||||
param.ActualFee = actualFee
|
||||
case uuptapi.StateArrivedStore:
|
||||
param.Status = model.WaybillStatusCourierArrived
|
||||
param.DesiredFee = reallyPrice
|
||||
param.ActualFee = reallyPrice
|
||||
param.ActualFee = actualFee
|
||||
case uuptapi.StatePickUp:
|
||||
param.Status = model.WaybillStatusUuPickUp
|
||||
param.DesiredFee = reallyPrice
|
||||
param.ActualFee = reallyPrice
|
||||
param.ActualFee = actualFee
|
||||
case uuptapi.StateArrivedDestination:
|
||||
param.Status = model.WaybillStatusUuArrivedDestination
|
||||
param.DesiredFee = reallyPrice
|
||||
param.ActualFee = reallyPrice
|
||||
param.ActualFee = actualFee
|
||||
case uuptapi.StateReceiverGetGoods:
|
||||
param.Status = model.WaybillStatusDelivered
|
||||
param.DesiredFee = reallyPrice
|
||||
param.ActualFee = reallyPrice
|
||||
param.ActualFee = actualFee
|
||||
case uuptapi.StateOrderCancel:
|
||||
param.Status = model.WaybillStatusCanceled
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user