From 702aac1b000e336b248c4c551ec6a8f02f0b3f09 Mon Sep 17 00:00:00 2001 From: gazebo Date: Wed, 8 Aug 2018 14:03:49 +0800 Subject: [PATCH 1/3] - change several abnormal case caused by out of order msg to Infof. --- business/scheduler/defsch/defsch.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/business/scheduler/defsch/defsch.go b/business/scheduler/defsch/defsch.go index f610a3c83..342f8a338 100644 --- a/business/scheduler/defsch/defsch.go +++ b/business/scheduler/defsch/defsch.go @@ -304,7 +304,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo if s.isBillCandidate(order, bill) { } else { // s.CancelWaybill(bill) - globals.SugarLogger.Warnf("OnWaybillStatusChanged CourierArrived order(%d, %s) bill(%d, %s), bill:%v shouldn't get here", order.WaybillVendorID, order.VendorWaybillID, bill.WaybillVendorID, bill.VendorWaybillID, bill) + globals.SugarLogger.Infof("OnWaybillStatusChanged CourierArrived order(%d, %s) bill(%d, %s), bill:%v shouldn't get here", order.WaybillVendorID, order.VendorWaybillID, bill.WaybillVendorID, bill.VendorWaybillID, bill) } case model.WaybillStatusFailed: // todo WaybillStatusFailed理解成订单整个失败了,不需要再尝试创建运单了,注意这里应该加个zabbix日志的报警 s.removeWaybillFromMap(savedOrderInfo, bill) @@ -339,7 +339,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo // do nothing } else { // s.CancelWaybill(bill) - globals.SugarLogger.Warnf("OnWaybillStatusChanged Delivering order(%d, %s) bill(%d, %s), bill:%v shouldn't get here", order.WaybillVendorID, order.VendorWaybillID, bill.WaybillVendorID, bill.VendorWaybillID, bill) + globals.SugarLogger.Infof("OnWaybillStatusChanged Delivering order(%d, %s) bill(%d, %s), bill:%v shouldn't get here", order.WaybillVendorID, order.VendorWaybillID, bill.WaybillVendorID, bill.VendorWaybillID, bill) } case model.WaybillStatusDelivered: s.resetTimer(savedOrderInfo, bill, isPending) @@ -354,7 +354,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo if !s.isBillCandidate(order, bill) { // 一般只会消息乱序才会到这里,即新订单消息在运单接单消息后到达 // 典型的一个:1223633660228537567 - globals.SugarLogger.Warnf("OnWaybillStatusChanged Delivered order(%d, %s) bill(%d, %s), bill:%v shouldn't get here", order.WaybillVendorID, order.VendorWaybillID, bill.WaybillVendorID, bill.VendorWaybillID, bill) + globals.SugarLogger.Infof("OnWaybillStatusChanged Delivered order(%d, %s) bill(%d, %s), bill:%v shouldn't get here", order.WaybillVendorID, order.VendorWaybillID, bill.WaybillVendorID, bill.VendorWaybillID, bill) if order.WaybillVendorID == model.VendorIDUnknown { s.updateOrderByBill(order, bill, false) } From 8bb1badb2c28d221f1a8d1675a30263ed78f1e8b Mon Sep 17 00:00:00 2001 From: gazebo Date: Wed, 8 Aug 2018 14:20:25 +0800 Subject: [PATCH 2/3] - refactor cancel waybill reason. --- business/controller/dada/waybill.go | 2 +- business/controller/mtps/waybill.go | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/business/controller/dada/waybill.go b/business/controller/dada/waybill.go index 83b004256..abeaebb9e 100644 --- a/business/controller/dada/waybill.go +++ b/business/controller/dada/waybill.go @@ -128,7 +128,7 @@ func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) { func (c *WaybillController) CancelWaybill(bill *model.Waybill) (err error) { reasonID := dadaapi.ReasonIDOther - reasonMsg := "other reason" + reasonMsg := "send not in time" if bill.Status < model.WaybillStatusAccepted { reasonID = dadaapi.ReasonIDNobodyAccept reasonMsg = "ReasonIDNobodyAccept" diff --git a/business/controller/mtps/waybill.go b/business/controller/mtps/waybill.go index f56dcf69e..099747b2e 100644 --- a/business/controller/mtps/waybill.go +++ b/business/controller/mtps/waybill.go @@ -237,15 +237,14 @@ func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) { } func (c *WaybillController) CancelWaybill(bill *model.Waybill) (err error) { - reasonID := mtpsapi.CancelReasonMerchantOther - reasonMsg := "other reason" + reasonID := mtpsapi.CancelReasonRidderSendNotIntime + reasonMsg := "CancelReasonRidderSendNotIntime" if bill.Status < model.WaybillStatusAccepted { + reasonID = mtpsapi.CancelReasonMerchantOther + reasonMsg = "nobody accept order" } else if bill.Status < model.WaybillStatusCourierArrived { reasonID = mtpsapi.CancelReasonRideerGetGoodNotIntime reasonMsg = "CancelReasonRideerGetGoodNotIntime" - } else { - reasonID = mtpsapi.CancelReasonRidderSendNotIntime - reasonMsg = "CancelReasonRidderSendNotIntime" } _, err = api.MtpsAPI.CancelOrder(utils.Str2Int64(bill.VendorWaybillID2), bill.VendorWaybillID, reasonID, reasonMsg) return nil From ca40c540806a9671d7bbae20e53e025ded41d1b1 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 9 Aug 2018 09:35:01 +0800 Subject: [PATCH 3/3] - change Warnf to Infof in model.WaybillStatusFailed. --- business/scheduler/defsch/defsch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/scheduler/defsch/defsch.go b/business/scheduler/defsch/defsch.go index 342f8a338..86334f8d9 100644 --- a/business/scheduler/defsch/defsch.go +++ b/business/scheduler/defsch/defsch.go @@ -317,7 +317,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo } } else { // 创建运单失败时,可能到这里来(比如:818874313000121) - globals.SugarLogger.Warnf("OnWaybillStatusChanged Failed bill:%v shouldn't got here, order details:%v", bill, order) + globals.SugarLogger.Infof("OnWaybillStatusChanged Failed bill:%v shouldn't got here, order details:%v", bill, order) } case model.WaybillStatusCanceled: s.removeWaybillFromMap(savedOrderInfo, bill)