diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 8bf2b8127..103a3f8dc 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1031,7 +1031,7 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context, store, _ := dao.GetStoreDetail(db, storeID, order.VendorID, "") payPercentage := store.PayPercentage if payPercentage <= 50 { - order.NewEarningPrice = order.TotalShopMoney * int64((100 - payPercentage/2)) / 100 + order.NewEarningPrice = order.TotalShopMoney * utils.Float64TwoInt64(utils.Int2Float64(100)-utils.Int2Float64(payPercentage)/2) / 100 } else { order.NewEarningPrice = order.EarningPrice } diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 58d9eca2e..fef54b149 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -534,8 +534,9 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo } } else if order.Status > model.OrderStatusEndBegin { s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) // 取消三方配送调度 - s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) // 转自送 - s.SelfDeliverDelivered(order, "自送或三方") // 取消当前运单调度 + s.SelfDeliverDelivering(order, "自配送中") + s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) // 转自送 + s.SelfDeliverDelivered(order, "自送或三方") // 取消当前运单调度 partner.CurOrderManager.OnOrderMsg(order, "订单处于结束状态来的运单", "取消三方运单,转自送1") } else { needAddTip := order.WaybillTipMoney > 0 && !model.IsWaybillPlatformOwn(bill) @@ -632,18 +633,19 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo } // 订单处于配送状态来的新分配骑手运单 - //if order.Status >= model.OrderStatusDelivering && order.Status < model.OrderStatusEndBegin && bill.Status < model.OrderStatusDelivering { - // if order.DeliveryType == model.OrderDeliveryTypeStoreSelf { - // s.SelfDeliverDelivering(order, "自配送中") - // s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) // 转自送 - // } else { - // s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) - // } - //} + if order.Status >= model.OrderStatusDelivering && order.Status < model.OrderStatusEndBegin && bill.Status <= model.OrderStatusDelivering { + if order.DeliveryType == model.OrderDeliveryTypeStoreSelf || order.DeliveryType == model.OrderDeliveryTypeSelfTake { + s.SelfDeliverDelivering(order, "自配送中") + s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) // 转自送 + } else { + s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) + } + } //订单已经是结束状态之后来的运单143945553920000001 if order.Status > model.OrderStatusEndBegin { s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) + s.SelfDeliverDelivering(order, "自配送中") s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) // 转自送 s.SelfDeliverDelivered(order, "自配送结束") // 取消当前运单调度 partner.CurOrderManager.OnOrderMsg(order, "订单处于结束状态来的运单", "取消三方运单,转自送") @@ -1027,6 +1029,9 @@ func (s *DefScheduler) swtich2SelfDeliverWithRetry(savedOrderInfo *WatchOrderInf globals.SugarLogger.Debugf("swtich2SelfDeliverWithRetry orderID:%s", order.VendorOrderID) if order.WaybillVendorID != order.VendorID { // && err != scheduler.ErrOrderStatusAlreadySatisfyCurOperationELM && err != scheduler.ErrOrderStatusAlreadySatisfyCurOperationMTWM if err := s.Swtich2SelfDeliver(order, ""); err != nil && (err != scheduler.ErrOrderStatusAlreadySatisfyCurOperation && !strings.Contains(err.Error(), "1047") && !strings.Contains(err.Error(), "301251")) { //301251饿了转自送 1047美团混合送 + if strings.Contains(err.Error(), "1047") || strings.Contains(err.Error(), "301251") { + s.SelfDeliverDelivering(order, "非专送、快送、混合送订单,转自送失败,调用deriving转自送") + } globals.SugarLogger.Infof("swtich2SelfDeliverWithRetry failed, bill:%v, err:%v", bill, err) if retryCount > 0 { utils.AfterFuncWithRecover(duration, func() {