From 4f1933c99132331852e1b255319ebfb1c029c4eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 30 Jan 2024 10:33:23 +0800 Subject: [PATCH 01/17] 1 --- business/jxstore/cms/system_store_sku.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/system_store_sku.go b/business/jxstore/cms/system_store_sku.go index b5ba8781b..48d91faf1 100644 --- a/business/jxstore/cms/system_store_sku.go +++ b/business/jxstore/cms/system_store_sku.go @@ -212,6 +212,7 @@ func CopyMtToMT(ctx *jxcontext.Context, fromStore, toStore *dao.StoreDetail, isA //} case 2: i := offSet + errList := make([]string, 0, 0) for { // 同步商品 fromFoodList, err1 := fromApi.RetailListAll(fromStore.VendorStoreID, i) @@ -220,10 +221,12 @@ func CopyMtToMT(ctx *jxcontext.Context, fromStore, toStore *dao.StoreDetail, isA } if err = BatchInitSkuMT2MT(ctx, fromFoodList, toApi, toStore.VendorStoreID, i); err != nil { - globals.SugarLogger.Debugf("BatchInitData : %s", utils.Format4Output(err, false)) + errs := utils.Format4Output(err, false) + errList = append(errList, errs) } globals.SugarLogger.Debugf("==============i: %d len: %d", i, len(fromFoodList)) if len(fromFoodList) < 100 { + globals.SugarLogger.Debugf("BatchInitData : %s", utils.Format4Output(errList, false)) return nil, nil } i++ @@ -309,6 +312,7 @@ func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi if len(foodDataList)%10 != 0 { count += 1 } + globals.SugarLogger.Debugf("=====data := %s", utils.Format4Output(foodDataList, false)) for i := 0; i < count; i++ { if i == count-1 { failedFoodList, _ := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*10:]) From 020d99b73c0d9002119eda8986653703034084f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 30 Jan 2024 10:57:19 +0800 Subject: [PATCH 02/17] 1 --- business/jxstore/cms/system_store_sku.go | 34 +++++++++++++++--------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/business/jxstore/cms/system_store_sku.go b/business/jxstore/cms/system_store_sku.go index 48d91faf1..d74457f64 100644 --- a/business/jxstore/cms/system_store_sku.go +++ b/business/jxstore/cms/system_store_sku.go @@ -212,7 +212,7 @@ func CopyMtToMT(ctx *jxcontext.Context, fromStore, toStore *dao.StoreDetail, isA //} case 2: i := offSet - errList := make([]string, 0, 0) + errList := make([]*mtwmapi.AppFoodResult, 0, 0) for { // 同步商品 fromFoodList, err1 := fromApi.RetailListAll(fromStore.VendorStoreID, i) @@ -220,18 +220,20 @@ func CopyMtToMT(ctx *jxcontext.Context, fromStore, toStore *dao.StoreDetail, isA return nil, fmt.Errorf("fromFoodList 为空 %s ,i:= %d", utils.Format4Output(err1, false), i) } - if err = BatchInitSkuMT2MT(ctx, fromFoodList, toApi, toStore.VendorStoreID, i); err != nil { - errs := utils.Format4Output(err, false) - errList = append(errList, errs) + errDataList, err := BatchInitSkuMT2MT(ctx, fromFoodList, toApi, toStore.VendorStoreID, i) + if err != nil { + globals.SugarLogger.Debugf("BatchInitData : %v", err) + } + if len(errDataList) > model.NO { + errList = append(errList, errDataList...) } globals.SugarLogger.Debugf("==============i: %d len: %d", i, len(fromFoodList)) if len(fromFoodList) < 100 { - globals.SugarLogger.Debugf("BatchInitData : %s", utils.Format4Output(errList, false)) - return nil, nil + break } i++ } - + globals.SugarLogger.Debugf("errListData := %s", utils.Format4Output(errList, false)) } return } @@ -247,7 +249,7 @@ func CopyMtToMT(ctx *jxcontext.Context, fromStore, toStore *dao.StoreDetail, isA } // BatchInitSkuMT2MT 批量创建商品 -func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mtwmapi.API, vendorStoreID string, offset int) error { +func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mtwmapi.API, vendorStoreID string, offset int) (errList []*mtwmapi.AppFoodResult, err error) { foodDataList := make([]map[string]interface{}, len(fromSku)) for k, storeSku := range fromSku { foodData := make(map[string]interface{}) @@ -258,6 +260,7 @@ func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi } skus := make([]interface{}, 0) + upc := "" for _, v := range storeSku.SkuList { if v.SkuId == "" { v.SkuId = storeSku.AppFoodCode @@ -270,6 +273,9 @@ func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi if v.BoxPrice == "" { delete(mapSkuList, "box_price") } + if v.Upc != "" { + upc = v.Upc + } mapSkuList["available_times"] = string(salesCycle) skus = append(skus, mapSkuList) } @@ -301,7 +307,10 @@ func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi foodData["sequence"] = storeSku.Sequence foodData["tag_id"] = storeSku.TagID foodData["upc"] = storeSku.UpcCode - if storeSku.UpcCode == "" { + if foodData["upc"].(string) == "" { + foodData["upc"] = upc + } + if foodData["upc"].(string) == "" { foodData["upc"] = "no_upc" } @@ -312,21 +321,20 @@ func BatchInitSkuMT2MT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi if len(foodDataList)%10 != 0 { count += 1 } - globals.SugarLogger.Debugf("=====data := %s", utils.Format4Output(foodDataList, false)) for i := 0; i < count; i++ { if i == count-1 { failedFoodList, _ := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*10:]) if len(failedFoodList) != 0 { - globals.SugarLogger.Debugf("RetailBatchInitData2 failedFoodList :%s", utils.Format4Output(failedFoodList, false)) + errList = append(errList, failedFoodList...) } } else { failedFoodList, _ := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*10:(i+1)*10]) if len(failedFoodList) != 0 { - globals.SugarLogger.Debugf("RetailBatchInitData4 failedFoodList :%s", utils.Format4Output(failedFoodList, false)) + errList = append(errList, failedFoodList...) } } } - return nil + return errList, nil } From 8ea8663e4f5fcd96f62ab1e9304633f9ebcc5174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 30 Jan 2024 11:49:37 +0800 Subject: [PATCH 03/17] 1 --- business/partner/delivery/dada/waybill.go | 1 + business/partner/delivery/sfps/waybill.go | 2 +- business/partner/delivery/uupt/waybill.go | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/business/partner/delivery/dada/waybill.go b/business/partner/delivery/dada/waybill.go index f1e0ae91a..6607664f6 100644 --- a/business/partner/delivery/dada/waybill.go +++ b/business/partner/delivery/dada/waybill.go @@ -309,6 +309,7 @@ func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInf } deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(result.DeliverFee) // jxutils.StandardPrice2Int(result.Fee) deliveryFeeInfo.RefDeliveryFee = deliveryFeeInfo.DeliveryFee + deliveryFeeInfo.RefAddFee = deliveryFeeInfo.DeliveryFee } return deliveryFeeInfo, err } diff --git a/business/partner/delivery/sfps/waybill.go b/business/partner/delivery/sfps/waybill.go index 8249b1ed0..6335258aa 100644 --- a/business/partner/delivery/sfps/waybill.go +++ b/business/partner/delivery/sfps/waybill.go @@ -293,7 +293,7 @@ func (d DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo deliveryFeeInfo = &partner.WaybillFeeInfo{} price, err := api.SfPsAPI.PreCreateOrder(param) deliveryFeeInfo.DeliveryFee = utils.Float64TwoInt64(price) - globals.SugarLogger.Debugf("GetWaybillFee deliveryFeeInfo.DeliveryFee=%d", deliveryFeeInfo.DeliveryFee) + deliveryFeeInfo.RefAddFee = utils.Float64TwoInt64(price) return deliveryFeeInfo, err } diff --git a/business/partner/delivery/uupt/waybill.go b/business/partner/delivery/uupt/waybill.go index 1ad557a8d..aad805e81 100644 --- a/business/partner/delivery/uupt/waybill.go +++ b/business/partner/delivery/uupt/waybill.go @@ -203,7 +203,7 @@ func (d DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo return nil, err } else { deliveryFeeInfo = &partner.WaybillFeeInfo{} - // deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(utils.Str2Float64(orderPrice.NeedPayMoney)) 优惠后金额 + deliveryFeeInfo.RefAddFee = jxutils.StandardPrice2Int(utils.Str2Float64(orderPrice.NeedPayMoney)) // 优惠后金额 deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(utils.Str2Float64(orderPrice.TotalMoney)) // 原始金额 } return deliveryFeeInfo, err From b66a3a08529e61a7f9d85f98eeb2390d201ebb88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 30 Jan 2024 13:49:52 +0800 Subject: [PATCH 04/17] 1 --- business/jxcallback/scheduler/defsch/defsch_ext.go | 1 - business/partner/printer/trendit/trendit.go | 8 ++++---- business/partner/printer/xpyun/xpyun.go | 12 ++++++------ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch_ext.go b/business/jxcallback/scheduler/defsch/defsch_ext.go index a2bea512b..f719bc95f 100644 --- a/business/jxcallback/scheduler/defsch/defsch_ext.go +++ b/business/jxcallback/scheduler/defsch/defsch_ext.go @@ -298,7 +298,6 @@ func (s *DefScheduler) CreateWaybillOnProvidersEx(ctx *jxcontext.Context, vendor excludeCourierVendorIDs = append(excludeCourierVendorIDs, k) } - globals.SugarLogger.Debugf("===excludeCourierVendorIDs===========:%s", utils.Format4Output(excludeCourierVendorIDs, false)) billFunc := func() { bills, err = func() (bills []*model.Waybill, err error) { if vendorID == model.VendorIDELM { diff --git a/business/partner/printer/trendit/trendit.go b/business/partner/printer/trendit/trendit.go index 2d08b6fe8..2d67ebf6f 100644 --- a/business/partner/printer/trendit/trendit.go +++ b/business/partner/printer/trendit/trendit.go @@ -477,9 +477,9 @@ func (c *PrinterHandler) getCancelOrRefundOrderContent(order *model.GoodsOrder, title, ) orderFmt += `共%d种%d件商品 -实付金额: %s --------------#%d完-------------` - orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.OrderSeq) + /*实付金额: %s*/ + orderParams = append(orderParams, order.SkuCount, order.GoodsCount /* jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice),*/, order.OrderSeq) return fmt.Sprintf(orderFmt, orderParams...) } @@ -518,8 +518,8 @@ func (c *PrinterHandler) getCancelOrRefundOrderContentBig(order *model.GoodsOrde ) orderFmt += xpyunapi.StrRepeat("-", 32) orderFmt += `共%d种%d件商品 -实付金额: %s --------------#%d完-------------` - orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.OrderSeq) + /*实付金额: %s*/ + orderParams = append(orderParams, order.SkuCount, order.GoodsCount /*jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice),*/, order.OrderSeq) return fmt.Sprintf(orderFmt, orderParams...) } diff --git a/business/partner/printer/xpyun/xpyun.go b/business/partner/printer/xpyun/xpyun.go index 0641f4623..1a27bd09a 100644 --- a/business/partner/printer/xpyun/xpyun.go +++ b/business/partner/printer/xpyun/xpyun.go @@ -471,10 +471,10 @@ func (c *PrinterHandler) getCancelOrRefundOrderContent(order *model.GoodsOrder, order.OrderSeq, ) orderFmt += xpyunapi.StrRepeat("-", 32) - orderFmt += `共%d种%d件商品 -实际支付:%s
` + orderFmt += `共%d种%d件商品` + /*实际支付:%s
`*/ orderFmt += xpyunapi.StrRepeat("-", 14) + "#%d完" + xpyunapi.StrRepeat("-", 14) + `
` - orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.OrderSeq) + orderParams = append(orderParams, order.SkuCount, order.GoodsCount /*jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice),*/, order.OrderSeq) return fmt.Sprintf(orderFmt, orderParams...) } @@ -516,9 +516,9 @@ func (c *PrinterHandler) getCancelOrRefundOrderContentBig(order *model.GoodsOrde order.OrderSeq, ) orderFmt += xpyunapi.StrRepeat("-", 32) - orderFmt += `共%d种%d件商品 -实际支付:%s
` + orderFmt += `共%d种%d件商品` + /*实际支付:%s
`*/ orderFmt += xpyunapi.StrRepeat("-", 14) + "#%d完" + xpyunapi.StrRepeat("-", 14) + `
` - orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.OrderSeq) + orderParams = append(orderParams, order.SkuCount, order.GoodsCount /*jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice),*/, order.OrderSeq) return fmt.Sprintf(orderFmt, orderParams...) } From 2c5afd16959e892ed69ebe86655d5ba729e20b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 2 Feb 2024 09:07:49 +0800 Subject: [PATCH 05/17] 1 --- business/jxcallback/scheduler/defsch/defsch.go | 6 +++++- business/partner/purchase/tiktok_store/order.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 12cd02527..f488e4b51 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -1099,7 +1099,11 @@ func (s *DefScheduler) swtich2SelfDeliverWithRetry(savedOrderInfo *WatchOrderInf } else { s.notify3rdPartyWaybill(order, bill, false) s.removeWaybillFromMap(savedOrderInfo, order.VendorID) - partner.CurOrderManager.OnOrderMsg(order, "转自送成功", "") + data := "断点打印" + if err != nil { + data = err.Error() + } + partner.CurOrderManager.OnOrderMsg(order, "转自送成功", data) } } else { s.cancelOtherWaybills(savedOrderInfo, nil, partner.CancelWaybillReasonOther, partner.CancelWaybillReasonStrNotAcceptIntime) diff --git a/business/partner/purchase/tiktok_store/order.go b/business/partner/purchase/tiktok_store/order.go index 3c790bbef..331ff37ac 100644 --- a/business/partner/purchase/tiktok_store/order.go +++ b/business/partner/purchase/tiktok_store/order.go @@ -596,7 +596,7 @@ func (c *PurchaseHandler) Swtich2SelfDeliver(order *model.GoodsOrder, userName s if remoteWaybill.Status >= tiktokShop.ShipmentStatusArrived && remoteWaybill.Status != tiktokShop.ShipmentStatusCanceled { //骑手取货后不可取消 return errors.New("抖音配送骑手已取货,不可转门店自配送/三方配送") } - if remoteWaybill.Status < tiktokShop.ShipmentStatusArrived || remoteWaybill.Status == tiktokShop.ShipmentStatusCanceled { //存在运单 + if remoteWaybill.Status < tiktokShop.ShipmentStatusArrived /*|| remoteWaybill.Status == tiktokShop.ShipmentStatusCanceled */ { //存在运单 if err := api.ShopOrderDispatcher(utils.Str2Int64(order.VendorStoreID), order.VendorOrderID, tiktokShop.DispatcherFeeTypeCancel); err != nil { return err } From f522916985601cf0e75c3ef05fc053e8b14568d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 2 Feb 2024 10:41:14 +0800 Subject: [PATCH 06/17] 1 --- business/jxcallback/orderman/order.go | 8 ++++---- business/jxcallback/scheduler/basesch/basesch.go | 10 +++++----- business/jxcallback/scheduler/basesch/basesch_ext.go | 6 +++--- business/jxcallback/scheduler/defsch/defsch.go | 8 ++++---- business/jxcallback/scheduler/defsch/defsch_ext.go | 4 ++-- business/partner/delivery/mtps/waybill.go | 1 + business/partner/purchase/mtwm/order_afs.go | 2 +- business/partner/purchase/tao_vegetable/order_afs.go | 2 +- .../partner/purchase/tiktok_store/order_afs_utils.go | 2 +- 9 files changed, 22 insertions(+), 21 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 07e3cc1df..51d124f3a 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -263,7 +263,7 @@ func (c *OrderManager) OnOrderStatusChanged(vendorOrgCode string, orderStatus *m if orderStatus.OrderType == model.OrderTypeOrder { waybill, _ := dao.GetWaybills(db, order2.VendorOrderID, []int64{model.VendorIDMTPS, model.VendorIDDada, model.VendorIDFengNiao, model.VendorIDUUPT, model.VendorIDSFPS}) for _, v := range waybill { - if err := partner.GetDeliveryPlatformFromVendorID(v.WaybillVendorID).Handler.CancelWaybill(v, 0, "订单被取消了"); err != nil { + if err := partner.GetDeliveryPlatformFromVendorID(v.WaybillVendorID).Handler.CancelWaybill(v, 0, "订单被取消了1"); err != nil { partner.CurOrderManager.OnOrderMsg(order2, fmt.Sprintf("订单[%s]被取消了,运单[%s]取消失败Err: %s", order.VendorOrderID, v.VendorWaybillID, err.Error()), "") } else { partner.CurOrderManager.OnOrderMsg(order2, fmt.Sprintf("订单[%s]被取消了,运单[%s]取消成功", order.VendorOrderID, v.VendorWaybillID), "") @@ -1529,7 +1529,7 @@ func MergeJdsOrders(ctx *jxcontext.Context, vendorOrderIDs []string) (vendorOrde if waybill != nil { if waybill.WaybillVendorID != model.VendorIDJDWL { if handler := partner.GetDeliveryPlatformFromVendorID(waybill.WaybillVendorID); handler != nil { - err = handler.Handler.CancelWaybill(waybill, 0, "订单合并被取消") + err = handler.Handler.CancelWaybill(waybill, 0, "订单合并被取消2") } } } @@ -1661,7 +1661,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) } if waybill != nil { if handler := partner.GetDeliveryPlatformFromVendorID(waybill.WaybillVendorID); handler != nil { - err = handler.Handler.CancelWaybill(waybill, 0, "订单转移被取消") + err = handler.Handler.CancelWaybill(waybill, 0, "订单转移被取消3") } } } @@ -1841,7 +1841,7 @@ func SendJdwlForJdsOrder(ctx *jxcontext.Context, vendorOrderID string) (err erro } } if handler := partner.GetDeliveryPlatformFromVendorID(model.VendorIDJDWL); handler != nil { - err = handler.Handler.CancelWaybill(waybill, 0, "订单已发送其他物流") + err = handler.Handler.CancelWaybill(waybill, 0, "订单已发送其他物流4") } if err != nil { return err diff --git a/business/jxcallback/scheduler/basesch/basesch.go b/business/jxcallback/scheduler/basesch/basesch.go index ad1a1228b..6a6bffd06 100644 --- a/business/jxcallback/scheduler/basesch/basesch.go +++ b/business/jxcallback/scheduler/basesch/basesch.go @@ -134,7 +134,7 @@ func (c *BaseScheduler) SelfDeliverDelivering(order *model.GoodsOrder, userName err = nil } else { bill, _ := partner.CurOrderManager.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID) - err = c.CancelWaybill(bill, partner.CancelWaybillReasonOther, userName+":"+partner.CancelWaybillReasonStrActive) + err = c.CancelWaybill(bill, partner.CancelWaybillReasonOther, userName+":5"+partner.CancelWaybillReasonStrActive) partner.CurOrderManager.OnOrderMsg(order, "美团外卖运单无法取消,", err.Error()) return err } @@ -144,7 +144,7 @@ func (c *BaseScheduler) SelfDeliverDelivering(order *model.GoodsOrder, userName tiktokWayBillStatus, err2 := partner.GetPurchasePlatformFromVendorID(order.VendorID).OrderLogisticsStatus(order.VendorOrderID) if tiktokWayBillStatus != nil && tiktokWayBillStatus.LogisticsStatus >= tiktokShop.ShipmentStatusReceived && tiktokWayBillStatus.LogisticsStatus != tiktokShop.ShipmentStatusCanceled { //取消抖音配送转自送 - err = c.CancelWaybill(localBill, partner.CancelWaybillReasonDYPSCancel, partner.CancelWaybillReasonStrDYPSCancel+"抖音骑手已经接单,无法取消") + err = c.CancelWaybill(localBill, partner.CancelWaybillReasonDYPSCancel, partner.CancelWaybillReasonStrDYPSCancel+"抖音骑手已经接单,无法取消6") partner.CurOrderManager.OnOrderMsg(order, "取消抖音配送,转用门店自配送/三方配送", "抖音骑手已经接单,无法取消") return err } else if tiktokWayBillStatus != nil && tiktokWayBillStatus.LogisticsStatus == -1 { // 先转自送,自送不成功取消平台配送. @@ -155,7 +155,7 @@ func (c *BaseScheduler) SelfDeliverDelivering(order *model.GoodsOrder, userName partner.GetPurchasePlatformFromVendorID(order.VendorID).SelfDeliverDelivering(order, "") } else if err = partner.GetPurchasePlatformFromVendorID(order.VendorID).CancelLogisticsByWmOrderId(order, "", "", order.VendorStoreID, order.VendorOrderID); err != nil { partner.CurOrderManager.OnOrderMsg(order, "取消抖音配送异常:", err.Error()) - if err = c.CancelWaybill(localBill, partner.CancelWaybillReasonDYPSCancel, partner.CancelWaybillReasonStrDYPSCancel); err != nil { + if err = c.CancelWaybill(localBill, partner.CancelWaybillReasonDYPSCancel, partner.CancelWaybillReasonStrDYPSCancel+"7"); err != nil { partner.CurOrderManager.OnOrderMsg(order, "取消抖音平台运单错误,无法转自送", err.Error()) return err } @@ -192,7 +192,7 @@ func (c *BaseScheduler) SelfDeliverDelivered(order *model.GoodsOrder, userName s if err = partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).SelfDeliverDelivered(order, userName); err == nil { bill, _ := partner.CurOrderManager.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID) if bill != nil && bill.WaybillVendorID != model.VendorJXFakeWL && bill.WaybillVendorID != model.VendorIDUnknown { - c.CancelWaybill(bill, partner.CancelWaybillReasonOther, userName+":"+partner.CancelWaybillReasonStrActive) + c.CancelWaybill(bill, partner.CancelWaybillReasonOther, userName+":"+partner.CancelWaybillReasonStrActive+"8") } } return err @@ -261,7 +261,7 @@ func (c *BaseScheduler) CancelWaybill(bill *model.Waybill, cancelReasonID int, c if c.IsReallyCallPlatformAPI && bill.OrderVendorID != bill.WaybillVendorID && bill.Status != model.WaybillStatusCanceled { if handlerInfo := partner.GetDeliveryPlatformFromVendorID(bill.WaybillVendorID); handlerInfo != nil { if err = utils.CallFuncLogErrorWithInfo(func() error { - if err := handlerInfo.Handler.CancelWaybill(bill, cancelReasonID, cancelReason); err != nil { + if err := handlerInfo.Handler.CancelWaybill(bill, cancelReasonID, cancelReason+"9"); err != nil { return err } return nil diff --git a/business/jxcallback/scheduler/basesch/basesch_ext.go b/business/jxcallback/scheduler/basesch/basesch_ext.go index 7e957ecbe..cf29a1a80 100644 --- a/business/jxcallback/scheduler/basesch/basesch_ext.go +++ b/business/jxcallback/scheduler/basesch/basesch_ext.go @@ -220,7 +220,7 @@ func (c *BaseScheduler) CancelWaybillByID(ctx *jxcontext.Context, vendorWaybillI return err } order, _ := partner.CurOrderManager.LoadOrder(bill.VendorOrderID, bill.OrderVendorID) - partner.CurOrderManager.OnOrderMsg(order, utils.Int64ToStr(model.WaybillStatusCancel), "商户发起运单取消") + partner.CurOrderManager.OnOrderMsg(order, utils.Int64ToStr(model.WaybillStatusCancel), "商户发起运单取消10") return err } @@ -260,7 +260,7 @@ func (c *BaseScheduler) AgreeOrRefuseRefund(ctx *jxcontext.Context, afsOrderID s order.DeliveryFlag |= model.OrderDeliveryFlagMaskScheduleDisabled partner.CurOrderManager.UpdateOrderFields(order, []string{"DeliveryFlag"}) for _, v := range waybills { - c.CancelWaybill(v, partner.CancelWaybillReasonOther, ctx.GetUserName()+":"+partner.CancelWaybillReasonStrActive) + c.CancelWaybill(v, partner.CancelWaybillReasonOther, ctx.GetUserName()+":11"+partner.CancelWaybillReasonStrActive) } } if afsCount == orderCount && order.VendorID == model.VendorIDJX { @@ -275,7 +275,7 @@ func (c *BaseScheduler) AgreeOrRefuseRefund(ctx *jxcontext.Context, afsOrderID s order.VendorStatus = "10" // 饿百取消订单 partner.CurOrderManager.UpdateOrderFields(order, []string{"DeliveryFlag", "Status", "VendorStatus"}) for _, v := range waybills { - c.CancelWaybill(v, partner.CancelWaybillReasonOther, ctx.GetUserName()+":"+partner.CancelWaybillReasonStrActive) + c.CancelWaybill(v, partner.CancelWaybillReasonOther, ctx.GetUserName()+":12"+partner.CancelWaybillReasonStrActive) } } diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index f488e4b51..74803bcdb 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -450,7 +450,7 @@ func (s *DefScheduler) OnOrderStatusChanged(order *model.GoodsOrder, status *mod } } } - s.cancelOtherWaybills(savedOrderInfo, curWaybill, partner.CancelWaybillReasonOther, partner.CancelWaybillReasonStrOrderAlreadyFinished) + s.cancelOtherWaybills(savedOrderInfo, curWaybill, partner.CancelWaybillReasonOther, partner.CancelWaybillReasonStrOrderAlreadyFinished+"13") if status.Status >= model.OrderStatusEndBegin { s.orderMap.Delete(jxutils.GetUniversalOrderIDFromOrderStatus(status)) } @@ -518,10 +518,10 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo // 将订单冲购物平台转自送(混合送转自送) s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) } else { - s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) + s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime+"14") } } else if order.Status > model.OrderStatusEndBegin { - s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) // 取消三方配送调度 + s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime+"15") // 取消三方配送调度 s.SelfDeliverDelivering(order, "自配送中") s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) // 转自送 s.SelfDeliverDelivered(order, "自送或三方") // 取消当前运单调度 @@ -533,7 +533,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo if !model.IsOrderHaveOwnWaybill(order) { // 既有运单不是购物平台运单 oldBill := savedOrderInfo.waybills[order.WaybillVendorID] if oldBill != nil { - s.ProxyCancelWaybill(order, oldBill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) + s.ProxyCancelWaybill(order, oldBill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime+"16") } else { globals.SugarLogger.Warnf("OnWaybillStatusChanged bill:%v, oldBill is null, strange!!!", bill) } diff --git a/business/jxcallback/scheduler/defsch/defsch_ext.go b/business/jxcallback/scheduler/defsch/defsch_ext.go index f719bc95f..d7d82f9ab 100644 --- a/business/jxcallback/scheduler/defsch/defsch_ext.go +++ b/business/jxcallback/scheduler/defsch/defsch_ext.go @@ -33,7 +33,7 @@ func (s *DefScheduler) SelfDeliveringAndUpdateStatus(ctx *jxcontext.Context, ven if savedOrderInfo != nil { order = savedOrderInfo.order if err = s.isPossibleSwitch2SelfDelivery(order); err == nil { // 是否能转自送 - err = s.cancelOtherWaybillsCheckOrderDeliveryFlag(savedOrderInfo, nil, partner.CancelWaybillReasonOther, ctx.GetUserName()+""+partner.CancelWaybillReasonStrActive) + err = s.cancelOtherWaybillsCheckOrderDeliveryFlag(savedOrderInfo, nil, partner.CancelWaybillReasonOther, ctx.GetUserName()+"17"+partner.CancelWaybillReasonStrActive) if err == nil { if model.IsOrderDeliveryByStore(order) { if order.Status < model.OrderStatusDelivering { @@ -450,7 +450,7 @@ func (s *DefScheduler) CancelAll3rdWaybills(ctx *jxcontext.Context, vendorOrderI // 取消三方运单,取消各平台单号信息,间隔一段时间后定时任务重新调度 savedOrderInfo := s.loadSavedOrderByID(vendorOrderID, vendorID, true) if savedOrderInfo != nil { - err = s.cancelOtherWaybills(savedOrderInfo, nil, partner.CancelWaybillReasonOther, ctx.GetUserName()+":"+partner.CancelWaybillReasonStrActive) + err = s.cancelOtherWaybills(savedOrderInfo, nil, partner.CancelWaybillReasonOther, ctx.GetUserName()+":18"+partner.CancelWaybillReasonStrActive) } else { err = scheduler.ErrCanNotFindOrder } diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index e7795bbcb..586aa1b67 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -433,6 +433,7 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee } func (c *DeliveryHandler) CancelWaybill(bill *model.Waybill, cancelReasonID int, cancelReason string) (err error) { + globals.SugarLogger.Debugf("========cancelReason :=%s %s", bill.VendorOrderID, cancelReason) cancelReasonID = mtpsapi.CancelReasonMerchantOther if cancelReason == "" { cancelReason = "顾客主动取消" diff --git a/business/partner/purchase/mtwm/order_afs.go b/business/partner/purchase/mtwm/order_afs.go index a400323d9..253c2ff2c 100644 --- a/business/partner/purchase/mtwm/order_afs.go +++ b/business/partner/purchase/mtwm/order_afs.go @@ -182,7 +182,7 @@ func (c *PurchaseHandler) onAfsOrderMsg(msg *mtwmapi.CallbackMsg) (retVal *mtwma for _, v := range wayBill { handlerInfo := partner.GetDeliveryPlatformFromVendorID(v.WaybillVendorID) if handlerInfo != nil { - handlerInfo.Handler.CancelWaybill(v, 0, "订单转移被取消") + handlerInfo.Handler.CancelWaybill(v, 0, "订单转移被取消10") } } } diff --git a/business/partner/purchase/tao_vegetable/order_afs.go b/business/partner/purchase/tao_vegetable/order_afs.go index 84399bc3a..7da4a2256 100644 --- a/business/partner/purchase/tao_vegetable/order_afs.go +++ b/business/partner/purchase/tao_vegetable/order_afs.go @@ -401,7 +401,7 @@ func (c *PurchaseHandler) onAfsOrderMsg(status string, msg interface{}) (retVal // 取消三方运单 waybill, _ := dao.GetWaybills(db, goodsOrder.VendorOrderID, []int64{model.VendorIDMTPS, model.VendorIDDada, model.VendorIDFengNiao, model.VendorIDUUPT, model.VendorIDSFPS}) for _, v := range waybill { - err = partner.GetDeliveryPlatformFromVendorID(v.WaybillVendorID).Handler.CancelWaybill(v, 0, "订单被取消了") + err = partner.GetDeliveryPlatformFromVendorID(v.WaybillVendorID).Handler.CancelWaybill(v, 0, "订单被取消了11") if err != nil { partner.CurOrderManager.OnOrderMsg(goodsOrder, fmt.Sprintf("订单[%s]被取消了,运单[%s]取消失败Err: %s", goodsOrder.VendorOrderID, v.VendorWaybillID, err.Error()), "") } else { diff --git a/business/partner/purchase/tiktok_store/order_afs_utils.go b/business/partner/purchase/tiktok_store/order_afs_utils.go index e3be092a0..32295e6b5 100644 --- a/business/partner/purchase/tiktok_store/order_afs_utils.go +++ b/business/partner/purchase/tiktok_store/order_afs_utils.go @@ -146,7 +146,7 @@ func (c *PurchaseHandler) onAfsOrderMsg(msgId string, msg interface{}) (retVal * for _, v := range wayBill { if v.Status != model.WaybillStatusCanceled { if handlerInfo := partner.GetDeliveryPlatformFromVendorID(v.WaybillVendorID); handlerInfo != nil { - if err := handlerInfo.Handler.CancelWaybill(v, 0, "订单被取消了"); err != nil { + if err := handlerInfo.Handler.CancelWaybill(v, 0, "订单被取消了12"); err != nil { partner.CurOrderManager.OnOrderMsg(goodsOrder, "", fmt.Sprintf("抖店订单取消时,取消运单异常:%s", err.Error())) } } From 27934f3d201eb27feefc2db12d323f6ae6cf487d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 2 Feb 2024 10:57:26 +0800 Subject: [PATCH 07/17] 1 --- business/jxcallback/scheduler/defsch/defsch.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 74803bcdb..646faf776 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -544,7 +544,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo } } else { needAddTip = false - s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) + s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime+"20") } } if needAddTip { @@ -586,7 +586,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo s.updateOrderByBill(order, nil, true) } } else if model.IsOrderHaveWaybill(order) { - s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) + s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime+"21") if !isPending { globals.SugarLogger.Warnf("OnWaybillStatusChanged AcceptCanceled orderID:%s got multiple bill:%v, order details:%v", order.VendorOrderID, bill, order) } @@ -646,13 +646,13 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo s.SelfDeliverDelivering(order, "自配送中") s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) // 转自送 } else { - s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) + s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime+"22") } } //订单已经是结束状态之后来的运单143945553920000001 if order.Status > model.OrderStatusEndBegin { - s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) + s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime+"23") s.SelfDeliverDelivering(order, "自配送中") s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) // 转自送 s.SelfDeliverDelivered(order, "自配送结束") // 取消当前运单调度 @@ -680,7 +680,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo } } else if !s.isBillCandidate(order, bill) && bill.WaybillVendorID != order.VendorID { // 发生这种情况的原因就是两个接单事件几乎同时到达(来不及取消),也算正常 - s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) + s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime+"24") } if isBillAlreadyCandidate && !s.isWaybillCourierSame(savedOrderInfo, bill) && !model.IsWaybillPlatformOwn(bill) { s.notify3rdPartyWaybill(order, bill, isBillAlreadyCandidate) @@ -701,7 +701,7 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo s.updateOrderByBill(order, nil, true) } } else if model.IsOrderHaveWaybill(order) { - s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime) + s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime+"25") if !isPending { globals.SugarLogger.Warnf("OnWaybillStatusChanged AcceptCanceled orderID:%s got multiple bill:%v, order details:%v", order.VendorOrderID, bill, order) } @@ -1084,7 +1084,7 @@ func (s *DefScheduler) swtich2SelfDeliverWithRetry(savedOrderInfo *WatchOrderInf //partner.CurOrderManager.UpdateOrderFields(order, []string{"DeliveryFlag"}) //partner.CurOrderManager.OnOrderMsg(order, "饿了么专送平台门店,无法切自送,需要平台推送配送异常才能转自送!", err.Error()) } else { - if s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonSwitch2SelfFailed, partner.CancelWaybillReasonStrSwitch2SelfFailed) == nil { + if s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonSwitch2SelfFailed, partner.CancelWaybillReasonStrSwitch2SelfFailed+"26") == nil { // 转自送失败的取消,要将订单中的运单状态更新 if s.isBillCandidate(order, bill) { s.updateOrderByBill(order, nil, false) From 42500420a81b93d50abb7e8b036625c3ad917933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 2 Feb 2024 11:32:05 +0800 Subject: [PATCH 08/17] 1 --- business/jxcallback/scheduler/defsch/defsch.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 646faf776..7cbbe2c28 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -646,7 +646,9 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo s.SelfDeliverDelivering(order, "自配送中") s.swtich2SelfDeliverWithRetry(savedOrderInfo, bill, switch2SelfDeliverRetryCount, switch2SelfDeliverRetryGap) // 转自送 } else { - s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime+"22") + if order.VendorWaybillID != bill.VendorWaybillID { + s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime+"22") + } } } From e0d03dc250ca1569e8c6f6d62846b196a1b2b9b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 2 Feb 2024 16:45:59 +0800 Subject: [PATCH 09/17] 1 --- business/partner/delivery/mtps/waybill.go | 1 - business/partner/purchase/ebai/waybill.go | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index 586aa1b67..e7795bbcb 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -433,7 +433,6 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee } func (c *DeliveryHandler) CancelWaybill(bill *model.Waybill, cancelReasonID int, cancelReason string) (err error) { - globals.SugarLogger.Debugf("========cancelReason :=%s %s", bill.VendorOrderID, cancelReason) cancelReasonID = mtpsapi.CancelReasonMerchantOther if cancelReason == "" { cancelReason = "顾客主动取消" diff --git a/business/partner/purchase/ebai/waybill.go b/business/partner/purchase/ebai/waybill.go index cd8969ada..277b04278 100644 --- a/business/partner/purchase/ebai/waybill.go +++ b/business/partner/purchase/ebai/waybill.go @@ -1,6 +1,8 @@ package ebai import ( + "git.rosy.net.cn/jx-callback/business/model/dao" + "git.rosy.net.cn/jx-callback/globals" "time" "git.rosy.net.cn/baseapi/platformapi/ebaiapi" @@ -65,6 +67,17 @@ func (c *PurchaseHandler) onWaybillMsg(msg *ebaiapi.CallbackMsg) (retVal *ebaiap } } }) + } else if order.VendorStatus == ebaiapi.WaybillStatusSelfDelivery { + result1, err1 := api.EbaiAPI.OrderGet(order.VendorOrderID) + if err1 == nil { + address := utils.Interface2String(result1["user"].(map[string]interface{})["address"]) + localOrder, _ := partner.CurOrderManager.LoadOrder(order.VendorOrderID, model.VendorIDEBAI) + localOrder.ConsigneeAddress = address + dao.UpdateEntity(dao.GetDB(), localOrder, "ConsigneeAddress") + } else { + globals.SugarLogger.Debugf("饿了么转自送解密用户配送地址,查询平台订单时错误:%v", err1) + } + } return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, partner.CurOrderManager.OnWaybillStatusChanged(order), order.VendorStatus) } From 913ba27fd3aa912054042a84e75a9de78e4d9331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 2 Feb 2024 17:00:04 +0800 Subject: [PATCH 10/17] 1 --- business/jxcallback/scheduler/basesch/basesch.go | 4 +++- business/jxcallback/scheduler/basesch/basesch_ext.go | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/scheduler/basesch/basesch.go b/business/jxcallback/scheduler/basesch/basesch.go index 6a6bffd06..cf86b9617 100644 --- a/business/jxcallback/scheduler/basesch/basesch.go +++ b/business/jxcallback/scheduler/basesch/basesch.go @@ -235,7 +235,9 @@ func (c *BaseScheduler) CreateWaybill(platformVendorID int, order *model.GoodsOr if storeDetail.IsService == model.YES && order.VendorID == model.VendorIDMTWM { err = fmt.Errorf("京西ID:[%d],平台id[%s],平台[美团]:错误:[%s]", storeDetail.Store.ID, storeDetail.VendorStoreID, "此门店美团平台为服务商模式,不支持本系统提供的三方配送![仅美团,其余平台订单正常使用.]") } else { - + if order.VendorID == model.VendorIDEBAI && strings.Contains(order.ConsigneeAddress, EBaiOrderAddressHide) { + return nil, fmt.Errorf("由于饿了么用户数据隐私保护,发三方配送前请先将订单转为自配送,获取详情地址") + } // 生成三方运单 bill, err = handlerInfo.Handler.CreateWaybill(order, maxDeliveryFee) if err != nil { diff --git a/business/jxcallback/scheduler/basesch/basesch_ext.go b/business/jxcallback/scheduler/basesch/basesch_ext.go index cf29a1a80..bee3aea75 100644 --- a/business/jxcallback/scheduler/basesch/basesch_ext.go +++ b/business/jxcallback/scheduler/basesch/basesch_ext.go @@ -26,6 +26,10 @@ const ( autoSelfTakeCode = "135246" ) +const ( + EBaiOrderAddressHide = "[隐私保护]顾客地址已隐藏" +) + func (c *BaseScheduler) CreateWaybillOnProviders(ctx *jxcontext.Context, order *model.GoodsOrder, courierVendorIDs, excludeCourierVendorIDs []int, maxDeliveryFee int64, createOnlyOne bool) (bills []*model.Waybill, err error) { storeCourierList, err := dao.GetStoreCourierList2(dao.GetDB(), []int{jxutils.GetSaleStoreIDFromOrder(order)}, courierVendorIDs, model.StoreStatusOpened, []int{model.StoreAuditStatusOnline, model.StoreAuditStatusUpdated}) if err != nil { From f7c0605e00db7c6f8f686a7bd1947b1be1fe71d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sun, 4 Feb 2024 09:43:48 +0800 Subject: [PATCH 11/17] 1 --- controllers/taobao_vegetable.go | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/controllers/taobao_vegetable.go b/controllers/taobao_vegetable.go index 809fdf278..07905d1f0 100644 --- a/controllers/taobao_vegetable.go +++ b/controllers/taobao_vegetable.go @@ -231,19 +231,16 @@ func (c *TaoBaoVegetableController) CancelOnSaleRefundOrder() { return } - if order.Status < model.OrderStatusDelivering || order.Status == model.OrderStatusCanceled { - if order.Status == model.OrderStatusCanceled { - c.Data["json"] = tao_vegetable.CallBackResultOnSaleCancel(nil) - c.ServeJSON() - } - - if order.Status >= model.OrderStatusDelivering { - c.Data["json"] = tao_vegetable.CallBackResultOnSaleCancel(fmt.Errorf("不支持售中取消")) - c.ServeJSON() - } else { - c.Data["json"] = tao_vegetable.CallBackResultOnSaleCancel(nil) - c.ServeJSON() - } + if order.Status == model.OrderStatusCanceled { + c.Data["json"] = tao_vegetable.CallBackResultOnSaleCancel(nil) + c.ServeJSON() + } + if order.Status >= model.OrderStatusDelivering { + c.Data["json"] = tao_vegetable.CallBackResultOnSaleCancel(fmt.Errorf("不支持售中取消")) + c.ServeJSON() + } else { + c.Data["json"] = tao_vegetable.CallBackResultOnSaleCancel(nil) + c.ServeJSON() } } } From 2eaee86a91cf1ac9d2e134225a564dbf8c609294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sun, 4 Feb 2024 14:51:16 +0800 Subject: [PATCH 12/17] 1 --- business/partner/purchase/tiktok_store/order.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/business/partner/purchase/tiktok_store/order.go b/business/partner/purchase/tiktok_store/order.go index 331ff37ac..3d7f3d109 100644 --- a/business/partner/purchase/tiktok_store/order.go +++ b/business/partner/purchase/tiktok_store/order.go @@ -255,12 +255,17 @@ func (p *PurchaseHandler) GetOrderRider(vendorOrgCode, vendorStoreID string, par param["longitude"] = utils.Float64ToStr(lng) } } + + order, _ := partner.CurOrderManager.LoadOrder(param["order_id"].(string), model.VendorIDDD) if vendorStoreID == "" { - order, _ := partner.CurOrderManager.LoadOrder(param["order_id"].(string), model.VendorIDDD) vendorStoreID = order.VendorStoreID } - return getAPI(vendorOrgCode, 0, vendorStoreID).OrderStatusAndPsInfoNew(param, vendorStoreID) + err = getAPI(vendorOrgCode, 0, vendorStoreID).OrderStatusAndPsInfoNew(param, vendorStoreID) + if err != nil { + partner.CurOrderManager.OnOrderMsg(order, param["opcode"].(string), "抖音配送信息回传记录异常:"+err.Error()) + } + return err } func (p *PurchaseHandler) GetOrder(vendorOrgCode, vendorOrderID, vendorStoreID string) (order *model.GoodsOrder, err error) { From ec6dba5ba6caacea9c53e283e304116f79d68f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sun, 4 Feb 2024 15:35:54 +0800 Subject: [PATCH 13/17] 1 --- .../partner/purchase/tiktok_store/order.go | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/business/partner/purchase/tiktok_store/order.go b/business/partner/purchase/tiktok_store/order.go index 3d7f3d109..4f1a97df8 100644 --- a/business/partner/purchase/tiktok_store/order.go +++ b/business/partner/purchase/tiktok_store/order.go @@ -3,6 +3,7 @@ package tiktok_store import ( "errors" "fmt" + instantShopping_reportRiderLocation_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_reportRiderLocation/request" "regexp" "strings" "time" @@ -261,13 +262,38 @@ func (p *PurchaseHandler) GetOrderRider(vendorOrgCode, vendorStoreID string, par vendorStoreID = order.VendorStoreID } - err = getAPI(vendorOrgCode, 0, vendorStoreID).OrderStatusAndPsInfoNew(param, vendorStoreID) - if err != nil { - partner.CurOrderManager.OnOrderMsg(order, param["opcode"].(string), "抖音配送信息回传记录异常:"+err.Error()) + api := getAPI(vendorOrgCode, 0, vendorStoreID) + // 同步骑手状态 + if err = api.OrderStatusAndPsInfoNew(param, vendorStoreID); err != nil { + partner.CurOrderManager.OnOrderMsg(order, param["opcode"].(string), "抖音订单三方配送状态信息回传记录异常:"+err.Error()) } + if err = SyncOrderRiderLine(vendorOrgCode, vendorStoreID, param); err != nil { + partner.CurOrderManager.OnOrderMsg(order, param["opcode"].(string), "抖音订单三方配送轨迹信息回传记录异常:"+err.Error()) + } + return err } +// SyncOrderRiderLine 同步骑手轨迹 +func SyncOrderRiderLine(vendorOrgCode, vendorStoreID string, param map[string]interface{}) error { + // 同步骑手轨迹(其实状态和轨迹应该分开同步才对) + param2 := &instantShopping_reportRiderLocation_request.InstantShoppingReportRiderLocationParam{ + ShopOrderId: param["order_id"].(string), + DistributionCode: tiktokShop.JxLogistics2Tiktok(param["logistics_provider_code"].(string)), + DistributionDeliveryId: param["order_id"].(string), + RiderName: param["courier_name"].(string), + RiderPhoneType: 0, + RiderPhone: param["courier_phone"].(string), + RiderLongitude: param["longitude"].(string), + RiderLatitude: param["latitude"].(string), + ReportTime: time.Now().Unix(), + } + if len(param["courier_phone"].(string)) > 11 { + param2.RiderPhoneType = 1 + } + return getAPI(vendorOrgCode, 0, vendorStoreID).OrderStatusReportRiderLocation(param2) +} + func (p *PurchaseHandler) GetOrder(vendorOrgCode, vendorOrderID, vendorStoreID string) (order *model.GoodsOrder, err error) { order, _, err = p.getOrder(vendorOrgCode, vendorOrderID, vendorStoreID) return order, err From f72cdc368ca1ffb7bf6eaa4abea3cd7b5a70fff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 5 Feb 2024 16:55:29 +0800 Subject: [PATCH 14/17] 1 --- business/jxstore/cms/store.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 12fa98d47..0012e6c15 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1848,11 +1848,8 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor if err != nil || storeDetail == nil { return 0, fmt.Errorf("基础门店信息异常,请联系管理员") } - if storeDetail != nil && payload["address"] != nil && payload["address"].(string) != storeDetail.Address { - // // 修改门店地址 - // storeDetail.Address = payload["address"].(string) - // dao.UpdateEntity(db, storeDetail, "Address") - // // 添加同步 + if storeDetail != nil && payload["address"] != nil { + // 添加同步 valid["address"] = payload["address"].(string) syncStatus |= model.SyncFlagStoreName address = payload["address"].(string) From 031f64a902236aea2edcbcbf78a7daab7bda1e46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 5 Feb 2024 17:16:54 +0800 Subject: [PATCH 15/17] 1 --- business/jxstore/cms/store.go | 2 ++ business/partner/purchase/mtwm/store.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 0012e6c15..ed6098102 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1919,6 +1919,8 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor valid["address"] = address } + globals.SugarLogger.Debugf("=valid============ : %s", utils.Format4Output(valid, false)) + globals.SugarLogger.Debugf("=valid============ : %s", utils.Format4Output(isUpdateStoreNeedSync(valid), false)) if isUpdateStoreNeedSync(valid) { // 同步修改门店已经配送门店 _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) // address原来的userName 因为storeMap无法保存address,所以美团暂时使用该参数代替 //updateCourierStores(ctx, storeID) diff --git a/business/partner/purchase/mtwm/store.go b/business/partner/purchase/mtwm/store.go index 5ad0a0eb8..7ac2ad352 100644 --- a/business/partner/purchase/mtwm/store.go +++ b/business/partner/purchase/mtwm/store.go @@ -230,6 +230,7 @@ func (p *PurchaseHandler) DeleteStore(db *dao.DaoDB, storeID int, userName strin } func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName string) (err error) { + globals.SugarLogger.Debugf("===========data : %s",utils.Format4Output(storeID,false)) if db == nil { db = dao.GetDB() } @@ -280,6 +281,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin } if globals.EnableMtwmStoreWrite { + globals.SugarLogger.Debugf("===========data : %s",utils.Format4Output(params,false)) errList.AddErr(mtapi.PoiSave(storeDetail.VendorStoreID, params)) } if storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 { From 84bf5e7b2aa1e989f3868341da2626a3af61e0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sun, 18 Feb 2024 09:22:27 +0800 Subject: [PATCH 16/17] 1 --- business/jxstore/cms/store.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index ed6098102..9045e8357 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1140,6 +1140,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa kv[model.FieldStatus] = status //} } + globals.SugarLogger.Debugf("data := %s,%d", utils.Format4Output(kv, false), store.ID) _, err2 := dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, dummy, kv, userName, map[string]interface{}{ model.FieldStoreID: store.ID, }, model.FieldSyncStatus, syncStatus) From de044289d655e116d8c302dfeb2e79dd79afb324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Sun, 18 Feb 2024 10:25:25 +0800 Subject: [PATCH 17/17] 1 --- business/model/dao/dao_bz.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/business/model/dao/dao_bz.go b/business/model/dao/dao_bz.go index 3c6fc8fd2..ff39590fe 100644 --- a/business/model/dao/dao_bz.go +++ b/business/model/dao/dao_bz.go @@ -142,7 +142,10 @@ func UpdateEntityLogicallyAndUpdateSyncStatus(db *DaoDB, item interface{}, kvs m if userName != "" { params[model.FieldLastOperator] = userName } + globals.SugarLogger.Debugf("=========MergeMaps := %s", utils.Format4Output(utils.MergeMaps(kvs, params), false)) num2, err2 := UpdateEntityByKV(db, value.Interface(), utils.MergeMaps(kvs, params), nil) + globals.SugarLogger.Debugf("=========num := %d", num2) + globals.SugarLogger.Debugf("=========err := %v", err2) if err = err2; err == nil { num += num2 } else {