From 089748e8d0a901d2fdf2b481e08218de74102157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 21 Aug 2023 18:26:02 +0800 Subject: [PATCH 01/27] 1 --- business/jxstore/cms/user2.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/business/jxstore/cms/user2.go b/business/jxstore/cms/user2.go index f51492527..b9e6926ee 100644 --- a/business/jxstore/cms/user2.go +++ b/business/jxstore/cms/user2.go @@ -497,7 +497,12 @@ func GetStoreList4User(ctx *jxcontext.Context, mobileNum, userID string) (storeL storeIDs = append(storeIDs, v.StoreID) } } + globals.SugarLogger.Debugf("====roleList := %s", utils.Format4Output(roleList, false)) + globals.SugarLogger.Debugf("====storeIDs := %s", utils.Format4Output(storeIDs, false)) + globals.SugarLogger.Debugf("====shortRoleNameList := %s", utils.Format4Output(shortRoleNameList, false)) storeList, err = dao.GetStoreListByMobileOrStoreIDs(dao.GetDB(), mobileNum, shortRoleNameList, storeIDs) + globals.SugarLogger.Debugf("====storeList := %s", utils.Format4Output(shortRoleNameList, false)) + return storeList, err } From 6524349ab4e92d76311ffe1160db2497ce053b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 21 Aug 2023 18:42:36 +0800 Subject: [PATCH 02/27] 1 --- business/jxstore/cms/user2.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/business/jxstore/cms/user2.go b/business/jxstore/cms/user2.go index b9e6926ee..aabc2de84 100644 --- a/business/jxstore/cms/user2.go +++ b/business/jxstore/cms/user2.go @@ -497,11 +497,12 @@ func GetStoreList4User(ctx *jxcontext.Context, mobileNum, userID string) (storeL storeIDs = append(storeIDs, v.StoreID) } } - globals.SugarLogger.Debugf("====roleList := %s", utils.Format4Output(roleList, false)) - globals.SugarLogger.Debugf("====storeIDs := %s", utils.Format4Output(storeIDs, false)) - globals.SugarLogger.Debugf("====shortRoleNameList := %s", utils.Format4Output(shortRoleNameList, false)) + + if len(storeIDs) == model.NO && len(shortRoleNameList) == model.NO { + return nil, nil + } + storeList, err = dao.GetStoreListByMobileOrStoreIDs(dao.GetDB(), mobileNum, shortRoleNameList, storeIDs) - globals.SugarLogger.Debugf("====storeList := %s", utils.Format4Output(shortRoleNameList, false)) return storeList, err } @@ -518,8 +519,8 @@ func GetMyStoreListNew(ctx *jxcontext.Context, version string) (storesInfo inter } } mobile, userID := ctx.GetMobileAndUserID() - if mobile == "" { - return nil, "", fmt.Errorf("不能得到用户手机号") + if mobile == "" || userID == "" || userID == "null" || userID == "NULL" { + return nil, "", fmt.Errorf("不能得到用户手机号,%s,%s", userID, mobile) } var storeList []*dao.StoreWithCityName if storeList, err = GetStoreList4User(ctx, mobile, userID); err == nil && len(storeList) > 0 { From 201fb04e2f6c3c1c48522885a2148869c9f204a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 22 Aug 2023 11:22:09 +0800 Subject: [PATCH 03/27] 1 --- business/partner/delivery/rider.go | 8 ++++++-- business/partner/purchase/tao_vegetable/order.go | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/business/partner/delivery/rider.go b/business/partner/delivery/rider.go index 69929b741..50daa32ba 100644 --- a/business/partner/delivery/rider.go +++ b/business/partner/delivery/rider.go @@ -433,8 +433,12 @@ func UpdateFakeWayBillToTiktok() { randNumber, _ := rand.Int(rand.Reader, big.NewInt(640)) randTime := randNumber.Int64() - if randTime < 66 { - randTime += 60 + if randTime < 300 { + randTime += 300 + } + // 推送完成时加多加十分钟,相当于是配送中状态多存货十分钟 + if fakeWayBill[i].Status == model.WaybillStatusDelivered { + randTime += 480 } fakeWayBill[i].StatusTime = time.Now().Add(time.Duration(randTime) * time.Second).Local() fakeWayBill[i].WaybillFinishedAt = time.Now() diff --git a/business/partner/purchase/tao_vegetable/order.go b/business/partner/purchase/tao_vegetable/order.go index 27fa9e57b..9e7eb3327 100644 --- a/business/partner/purchase/tao_vegetable/order.go +++ b/business/partner/purchase/tao_vegetable/order.go @@ -554,10 +554,13 @@ func (c *PurchaseHandler) SelfDeliverDelivering(order *model.GoodsOrder, userNam if err != nil { return err } - if err = api.DeliveryFinish(param); err == nil { + err = api.DeliveryFinish(param) + if err == nil { paramDelivery := OrderStatusChangeDelivery(order, tao_vegetable.OrderStatusDelivery) // 开始配送 return api.DeliveryFinish(paramDelivery) + } else if strings.Contains(err.Error(), "当前状态不允许更新, 请求更新状态") { // "当前状态不允许更新, 请求更新状态: PACKAGED, 当前状态:SHIPPING" 这个时候代表上一次状态以及更新成了,返回错误消息不在处理 + return nil } return err From e236c8f76e9a58d4cc7a020c89eb7d1731cc4845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 22 Aug 2023 16:33:34 +0800 Subject: [PATCH 04/27] 1 --- .../partner/purchase/tao_vegetable/order_afs.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/business/partner/purchase/tao_vegetable/order_afs.go b/business/partner/purchase/tao_vegetable/order_afs.go index d3fcbf33c..dcc4c00ae 100644 --- a/business/partner/purchase/tao_vegetable/order_afs.go +++ b/business/partner/purchase/tao_vegetable/order_afs.go @@ -60,9 +60,12 @@ func (c *PurchaseHandler) isAfsMsg(orderStatus string, orderId string, orderCall func (c *PurchaseHandler) OnAfsOrderMsg(orderId, status string, msg interface{}) (retVal *tao_vegetable.CallBackResult) { // 取消线程池执行代码,异步返回 - //jxutils.CallMsgHandlerAsync(func() { - retVal = c.onAfsOrderMsg(status, msg) - //}, jxutils.ComposeUniversalOrderID(orderId, model.VendorIDTaoVegetable)) + jxutils.CallMsgHandlerAsync(func() { + retVal = c.onAfsOrderMsg(status, msg) + }, jxutils.ComposeUniversalOrderID(orderId, model.VendorIDTaoVegetable)) + if retVal == nil { + return tao_vegetable.CallBackResultInfo(nil) + } return retVal } @@ -74,7 +77,6 @@ func (c *PurchaseHandler) onAfsOrderMsg(status string, msg interface{}) (retVal switch status { case tao_vegetable.OrderStatusApplyAfs: refundData := msg.(*tao_vegetable.UserApplyRefundCallBack) - globals.SugarLogger.Debugf("================OrderStatusApplyAfs : %s", utils.Format4Output(msg, false)) var afsOrder *model.AfsOrder var api = getAPI("", 0, refundData.StoreId) @@ -163,7 +165,6 @@ func (c *PurchaseHandler) onAfsOrderMsg(status string, msg interface{}) (retVal } case tao_vegetable.OrderStatusCancelAfs: - globals.SugarLogger.Debugf("用户取消售后----------- %s", utils.Format4Output(msg, false)) // 删除售后单 afsOrder, err := dao.GetAfsOrders(db, model.VendorIDTaoVegetable, orderStatus.RefVendorOrderID, "") if err != nil || afsOrder == nil { @@ -206,7 +207,6 @@ func (c *PurchaseHandler) onAfsOrderMsg(status string, msg interface{}) (retVal // 你这边没有响应那么就不会退钱给用户,就会造成客诉。为什么不接售中取消呢 case tao_vegetable.OrderStatusOnSaleCancel: onSaleMsg := msg.(*tao_vegetable.OnSaleCancel) - globals.SugarLogger.Debugf("=========售中取消: %s", utils.Format4Output(msg, false)) var afsOrder *model.AfsOrder var api = getAPI("", 0, onSaleMsg.PartCancelRequest.StoreId) queryOrderDetailParam := &request591.AlibabaAelophyOrderGetRequest{OrderGetRequest: &domain591.AlibabaAelophyOrderGetOrderGetRequest{ @@ -282,9 +282,7 @@ func (c *PurchaseHandler) onAfsOrderMsg(status string, msg interface{}) (retVal err = partner.CurOrderManager.OnAfsOrderNew(afsOrder, orderStatus) } } - case tao_vegetable.OrderStatusRefundSuccess: - globals.SugarLogger.Debugf("=========售后成功: %s", utils.Format4Output(msg, false)) // 用户退款成功回调,缺货拣货时,送达回触发.此时并没有售后单 if scarceGoods != nil { refundSuccess := msg.(*tao_vegetable.RefundOrderFinish) From d6267f2ca6a755aa0bb53e968e6905e04d1bba9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 23 Aug 2023 15:18:39 +0800 Subject: [PATCH 05/27] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BE=8E=E5=9B=A2?= =?UTF-8?q?=E9=85=8D=E9=80=81,=E6=B7=BB=E5=8A=A0=E9=85=8D=E9=80=81?= =?UTF-8?q?=E8=B4=B9,=E9=AA=91=E6=89=8B=E6=8E=A5=E5=8D=95=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E6=89=A3=E9=99=A4=E9=85=8D=E9=80=81=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/waybill.go | 2 +- business/partner/partner_order.go | 2 ++ business/partner/purchase/ebai/order.go | 5 +++++ business/partner/purchase/jd/order.go | 5 +++++ business/partner/purchase/jdshop/order.go | 5 +++++ business/partner/purchase/jx/order.go | 5 +++++ business/partner/purchase/mtwm/order.go | 22 ++++++++++++++++++- business/partner/purchase/mtwm/waybill.go | 10 +++++---- .../partner/purchase/tao_vegetable/order.go | 5 +++++ .../partner/purchase/tiktok_store/order.go | 5 +++++ business/partner/purchase/yb/order.go | 5 +++++ 11 files changed, 65 insertions(+), 6 deletions(-) diff --git a/business/jxcallback/orderman/waybill.go b/business/jxcallback/orderman/waybill.go index c720a0680..cb3c5eda0 100644 --- a/business/jxcallback/orderman/waybill.go +++ b/business/jxcallback/orderman/waybill.go @@ -158,7 +158,7 @@ func (w *OrderManager) OnWaybillStatusChanged(bill *model.Waybill) (err error) { } } //单独增加顺丰派送取消运单修改配送费逻辑 - if bill.WaybillVendorID == model.VendorIDSFPS && bill.Status == model.WaybillStatusCanceled { + if (bill.WaybillVendorID == model.VendorIDSFPS || bill.WaybillVendorID == model.VendorIDMTWM) && bill.Status == model.WaybillStatusCanceled { addParams["desired_fee"] = bill.DesiredFee addParams["actual_fee"] = bill.ActualFee } diff --git a/business/partner/partner_order.go b/business/partner/partner_order.go index 552130339..e4543148d 100644 --- a/business/partner/partner_order.go +++ b/business/partner/partner_order.go @@ -92,6 +92,8 @@ type IPurchasePlatformOrderHandler interface { // 获取各个平台订单的结算信息 GetOrderSettleAccounts(order *model.GoodsOrder) (int64, error) + // GetPlatformLogisticsFee 获取美团自配送订单的配送费 + GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) } type IAddWaybillTip interface { diff --git a/business/partner/purchase/ebai/order.go b/business/partner/purchase/ebai/order.go index a8856ba4e..4a79547ea 100644 --- a/business/partner/purchase/ebai/order.go +++ b/business/partner/purchase/ebai/order.go @@ -804,3 +804,8 @@ func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64 return utils.ForceInterface2Int64(orderMap["shop_fee"]), nil } + +// GetPlatformLogisticsFee 获取自配送订单的配送费 +func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) { + return 0, nil +} diff --git a/business/partner/purchase/jd/order.go b/business/partner/purchase/jd/order.go index 6186d7418..2286d31cb 100644 --- a/business/partner/purchase/jd/order.go +++ b/business/partner/purchase/jd/order.go @@ -673,3 +673,8 @@ func (c *PurchaseHandler) GetOrderSettleAccounts(goods *model.GoodsOrder) (int64 } return settlement.SettlementAmount, nil } + +// GetPlatformLogisticsFee 获取自配送订单的配送费 +func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) { + return 0, nil +} diff --git a/business/partner/purchase/jdshop/order.go b/business/partner/purchase/jdshop/order.go index cd16bac49..2a2511edd 100644 --- a/business/partner/purchase/jdshop/order.go +++ b/business/partner/purchase/jdshop/order.go @@ -333,3 +333,8 @@ func (c *PurchaseHandler) OrderLogisticsStatus(orderId int64) (int64, error) { func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64, error) { return 0, nil } + +// GetPlatformLogisticsFee 获取自配送订单的配送费 +func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) { + return 0, nil +} diff --git a/business/partner/purchase/jx/order.go b/business/partner/purchase/jx/order.go index ec82bfbcd..01fa02392 100644 --- a/business/partner/purchase/jx/order.go +++ b/business/partner/purchase/jx/order.go @@ -160,3 +160,8 @@ func (c *PurchaseHandler) OrderLogisticsStatus(orderId int64) (int64, error) { func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64, error) { return 0, nil } + +// GetPlatformLogisticsFee 获取自配送订单的配送费 +func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) { + return 0, nil +} diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index b49e20007..7b736f1fd 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -849,7 +849,17 @@ func (c *PurchaseHandler) CancelLogisticsByWmOrderId(order *model.GoodsOrder, re // 获取订单配送状态 func (c *PurchaseHandler) OrderLogisticsStatus(orderId int64) (int64, error) { - return 0, nil + orderInfo, err := dao.GetSimpleOrder(dao.GetDB(), utils.Int64ToStr(orderId)) + if err != nil { + return 0, errors.New("获取本地门店账号信息失败,请重试") + } + + status, err := getAPI(orderInfo.VendorOrgCode, 0, "").OrderLogisticsStatus(orderId) + if err != nil { + return 0, err + } + + return status, nil } // GetOrderSettleAccounts 获取订单结算信息 @@ -868,3 +878,13 @@ func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64 } return 0, nil } + +// GetPlatformLogisticsFee 获取美团自配送订单的配送费 +func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) { + fee, err := getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), order.VendorStoreID).OrderLogisticsFee(utils.Str2Int64(order.VendorOrderID)) + if err != nil { + return 0, err + } + + return utils.Float64TwoInt64(fee * 100), nil +} diff --git a/business/partner/purchase/mtwm/waybill.go b/business/partner/purchase/mtwm/waybill.go index 01be0cf0e..8dea3827d 100644 --- a/business/partner/purchase/mtwm/waybill.go +++ b/business/partner/purchase/mtwm/waybill.go @@ -55,10 +55,12 @@ func (c *PurchaseHandler) callbackMsg2Waybill(msg *mtwmapi.CallbackMsg) (retVal retVal.StatusTime = getTimeFromTimestamp(utils.Str2Int64(msg.FormData.Get("timestamp"))) } - //if vendorStatus == "4" || vendorStatus == "8" { // 4:美团推送已经(确认骑手)订单 8:美团推送(骑手完成)订单 - // retVal.DesiredFee = utils.Float64TwoInt64(utils.Str2Float64WithDefault(msg.FormData.Get("shipping_fee"), 0)) // 订单优惠前的总费用 - // partner.CurOrderManager - //} + order, err := partner.CurOrderManager.LoadOrder(orderID, model.VendorIDMTWM) + if err == nil && order != nil { + fee, _ := partner.GetPurchasePlatformFromVendorID(order.VendorID).GetPlatformLogisticsFee(order) + retVal.ActualFee = fee + retVal.DesiredFee = fee + } return retVal } diff --git a/business/partner/purchase/tao_vegetable/order.go b/business/partner/purchase/tao_vegetable/order.go index 9e7eb3327..d96c9faec 100644 --- a/business/partner/purchase/tao_vegetable/order.go +++ b/business/partner/purchase/tao_vegetable/order.go @@ -900,3 +900,8 @@ func GetOrderTotalShopMoney(appOrgCode string, vendorStoreID string, start, end return settlement, nil } + +// GetPlatformLogisticsFee 获取自配送订单的配送费 +func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) { + return 0, nil +} diff --git a/business/partner/purchase/tiktok_store/order.go b/business/partner/purchase/tiktok_store/order.go index eea07f2aa..a3897a633 100644 --- a/business/partner/purchase/tiktok_store/order.go +++ b/business/partner/purchase/tiktok_store/order.go @@ -1017,3 +1017,8 @@ func GetOrderDetail(appOrgCode, vendorOrderID string) (*order_orderDetail_respon func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64, error) { return 0, nil } + +// GetPlatformLogisticsFee 获取自配送订单的配送费 +func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) { + return 0, nil +} diff --git a/business/partner/purchase/yb/order.go b/business/partner/purchase/yb/order.go index 594f0f808..b619e317d 100644 --- a/business/partner/purchase/yb/order.go +++ b/business/partner/purchase/yb/order.go @@ -111,3 +111,8 @@ func (c *PurchaseHandler) OrderLogisticsStatus(orderId int64) (int64, error) { func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64, error) { return 0, nil } + +// GetPlatformLogisticsFee 获取自配送订单的配送费 +func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) { + return 0, nil +} From 03c735fb6c8cb7cebd5ff48ec5e1d7547ce38678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 23 Aug 2023 15:58:49 +0800 Subject: [PATCH 06/27] 1 --- business/partner/purchase/mtwm/order.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index 7b736f1fd..a274ceb5b 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -882,6 +882,7 @@ func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64 // GetPlatformLogisticsFee 获取美团自配送订单的配送费 func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) { fee, err := getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), order.VendorStoreID).OrderLogisticsFee(utils.Str2Int64(order.VendorOrderID)) + globals.SugarLogger.Debugf("==============GetPlatformLogisticsFee : %f,%s", fee, utils.Format4Output(err, false)) if err != nil { return 0, err } From ef6b8b19fe6febdebc7c749dda102f7a9fb564dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 23 Aug 2023 16:43:03 +0800 Subject: [PATCH 07/27] 1 --- business/jxcallback/orderman/waybill.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/business/jxcallback/orderman/waybill.go b/business/jxcallback/orderman/waybill.go index cb3c5eda0..543ae4fe9 100644 --- a/business/jxcallback/orderman/waybill.go +++ b/business/jxcallback/orderman/waybill.go @@ -149,14 +149,14 @@ func (w *OrderManager) OnWaybillStatusChanged(bill *model.Waybill) (err error) { } addParams := orm.Params{} if bill.Status >= model.WaybillStatusAccepted { - if bill.Status == model.WaybillStatusAccepted { - if bill.DesiredFee > 0 { - addParams["desired_fee"] = bill.DesiredFee - } - if bill.ActualFee > 0 { - addParams["actual_fee"] = bill.ActualFee - } + //if bill.Status == model.WaybillStatusAccepted {等于10的时候没有运费 + if bill.DesiredFee > 0 { + addParams["desired_fee"] = bill.DesiredFee } + if bill.ActualFee > 0 { + addParams["actual_fee"] = bill.ActualFee + } + //} //单独增加顺丰派送取消运单修改配送费逻辑 if (bill.WaybillVendorID == model.VendorIDSFPS || bill.WaybillVendorID == model.VendorIDMTWM) && bill.Status == model.WaybillStatusCanceled { addParams["desired_fee"] = bill.DesiredFee From c460b2d2ddfda6d7982256b5726284f96ca2f177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 23 Aug 2023 16:45:42 +0800 Subject: [PATCH 08/27] 1 --- business/partner/purchase/mtwm/order.go | 1 - 1 file changed, 1 deletion(-) diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index a274ceb5b..7b736f1fd 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -882,7 +882,6 @@ func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64 // GetPlatformLogisticsFee 获取美团自配送订单的配送费 func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) { fee, err := getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), order.VendorStoreID).OrderLogisticsFee(utils.Str2Int64(order.VendorOrderID)) - globals.SugarLogger.Debugf("==============GetPlatformLogisticsFee : %f,%s", fee, utils.Format4Output(err, false)) if err != nil { return 0, err } From 245dee347a0b881aaa415f1a466695452c630357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 24 Aug 2023 15:51:30 +0800 Subject: [PATCH 09/27] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=8B=A3=E8=B4=A7?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/mtwm/order.go | 35 ++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index 7b736f1fd..c4f84abad 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -514,13 +514,36 @@ func (c *PurchaseHandler) AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptI } func (c *PurchaseHandler) PickupGoods(order *model.GoodsOrder, isSelfDelivery bool, userName string) (err error) { - isSelfDelivery = model.IsOrderDeliveryByStore(order) || model.IsOrderDeliveryBySelf(order) - if isSelfDelivery { - if globals.EnableMtwmStoreWrite { - err = getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "").PreparationMealComplete(utils.Str2Int64(order.VendorOrderID)) - } + api := getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "") + orderDetail, err := api.OrderGetOrderDetail(utils.Str2Int64(order.VendorOrderID), false) + if err != nil { + return err } - if err == nil || strings.Contains(err.Error(), "808") { // 配送类型只能为美团配送或美团企客配送 level:0, code:808 + + // 美团专送、快送、混合送、美团企客 + logisticsCode := utils.Interface2String(orderDetail["logistics_code"]) + isSelfDelivery = logisticsCode == mtwmapi.PeiSongTypeMTZSJM || logisticsCode == mtwmapi.PeiSongTypeMTZSZJ || logisticsCode == mtwmapi.PeiSongTypeKuaiDi || logisticsCode == mtwmapi.PeiSongTypeMixed || logisticsCode == mtwmapi.PeiSongTypeQiKe + //1001-专送(加盟);1002-专送(自建) + //2002-快送;3001-混合送(专送+快送) + //4015-企客远距离配送 + //此接口适用于美团专送、快送、混合送、美团企客的订单确认备货完成 + //PeiSongTypeSelf = "0000" // 商家自配 + //PeiSongTypeQuHuo = "0002" // 趣活 + //PeiSongTypeDada = "0016" // 达达 + //PeiSongTypeE = "0033" // E代送 + //PeiSongTypeMTZSJM = "1001" // 美团专送-加盟 + //PeiSongTypeMTZSZJ = "1002" // 美团专送-自建 + //PeiSongTypeMTZSPT = "1003" // 美团跑腿(原众包) + //PeiSongTypeMTZSDL = "1004" // 美团专送-城市代理 + //PeiSongTypeJiaoMa = "2001" // 角马 + //PeiSongTypeKuaiDi = "2002" // 快送 + //PeiSongTypeWholeCity = "2010" // 全城送 + //PeiSongTypeMixed = "3001" // 混合送(即美团专送+快送) + if isSelfDelivery { + err = api.PreparationMealComplete(utils.Str2Int64(order.VendorOrderID)) + } + if err == nil || strings.Contains(err.Error(), "808") { + // 配送类型只能为美团配送或美团企客配送 level:0, code:808 c.postFakeMsg(order.VendorOrderID, FakeMsgType, fakeFinishedPickup) return nil } From ffec3b3fa2fa7c5d3d1a3cf5667423568f630b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 25 Aug 2023 09:41:10 +0800 Subject: [PATCH 10/27] 1 --- business/jxcallback/orderman/order.go | 2 +- business/jxstore/misc/misc.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index d73f93519..a3ea29068 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -2696,7 +2696,7 @@ func UpdateTaoSettleInfo() { return } timeStart := time.Now().Add(-24 * 90 * time.Hour) - startTime := time.Date(timeStart.Year(), timeStart.Month(), timeStart.Day(), 0, 0, 0, 0, timeStart.Location()) + startTime := time.Date(timeStart.Year(), timeStart.Month(), timeStart.Day()-4, 0, 0, 0, 0, timeStart.Location()) timeEnd := time.Now() endTiem := time.Date(timeEnd.Year(), timeEnd.Month(), timeEnd.Day()-1, 23, 59, 59, 0, timeStart.Location()) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 0e0b2bdd8..c6e5e86c6 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -206,7 +206,10 @@ func Init() { ScheduleTimerFunc("UpdateTaoTotalMoney", func() { orderman.UpdateTaoSettleInfo() }, []string{ - "18:10:00", + "18:30:00", + "06:30:00", + "00:30:00", + "12:30:00", }) // 每分钟轮询一次,推送骑手信息 From ef9e074dd4a6073a7ef716b8c13dc022736a3016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 25 Aug 2023 16:13:02 +0800 Subject: [PATCH 11/27] 1 --- business/partner/purchase/ebai/order.go | 22 ++++++- business/partner/purchase/ebai/order_afs.go | 66 +++++++++++++++---- .../partner/purchase/tao_vegetable/order.go | 9 ++- 3 files changed, 83 insertions(+), 14 deletions(-) diff --git a/business/partner/purchase/ebai/order.go b/business/partner/purchase/ebai/order.go index 4a79547ea..8cf8e5aaf 100644 --- a/business/partner/purchase/ebai/order.go +++ b/business/partner/purchase/ebai/order.go @@ -659,9 +659,27 @@ func (c *PurchaseHandler) GetOrderRealMobile(ctx *jxcontext.Context, order *mode func (c *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *model.GoodsOrder, isAcceptIt bool, reason string) (err error) { if globals.EnableEbaiStoreWrite { if isAcceptIt { - err = api.EbaiAPI.OrderAgreeRefund(order.VendorOrderID) + err = api.EbaiAPI.OrderAgreeRefund(&ebaiapi.RefundOrderExamine{ + ReverseOrderId: "", + OrderId: order.VendorOrderID, + IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), + ActionType: ebaiapi.RefundTypeAgree, + ReasonRemarks: reason, + }) } else { - err = api.EbaiAPI.OrderDisagreeRefund(order.VendorOrderID, reason) + if reason == "" { + return fmt.Errorf("拒绝退单时,请填写拒单原因") + } + + err = api.EbaiAPI.OrderDisagreeRefund(&ebaiapi.RefundOrderExamine{ + ReverseOrderId: "", + OrderId: order.VendorOrderID, + IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), + ActionType: ebaiapi.RefundTypeAgree, + ReasonCode: "7001", + ReasonRemarks: reason, + RefundProductList: "", + }) } } return err diff --git a/business/partner/purchase/ebai/order_afs.go b/business/partner/purchase/ebai/order_afs.go index 33af86e67..988b078a5 100644 --- a/business/partner/purchase/ebai/order_afs.go +++ b/business/partner/purchase/ebai/order_afs.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "strings" + "time" "git.rosy.net.cn/baseapi/platformapi/ebaiapi" "git.rosy.net.cn/baseapi/utils" @@ -225,11 +226,32 @@ func (c *PurchaseHandler) callbackAfsMsg2Status(msg *ebaiapi.CallbackMsg) (order func (c *PurchaseHandler) AgreeOrRefuseRefund(ctx *jxcontext.Context, order *model.AfsOrder, approveType int, reason string) (err error) { if globals.EnableEbaiStoreWrite { if approveType == partner.AfsApproveTypeRefused { - err = api.EbaiAPI.OrderDisagreeReturnGoods(order.VendorOrderID, order.AfsOrderID, reason) + if reason == "" { + return fmt.Errorf("拒绝退单时请填写原因") + } + param := &ebaiapi.RefundOrderExamine{ + ReverseOrderId: order.AfsOrderID, + OrderId: order.VendorOrderID, + IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), + ActionType: ebaiapi.RefundTypeRefuseGoods, + ReasonCode: "7001", + ReasonRemarks: reason, + RefundProductList: "", + } + err = api.EbaiAPI.OrderDisagreeReturnGoods(param) } else if approveType == partner.AfsApproveTypeRefusedToRefundMoney { return errors.New("此平台暂时不支持") } else { - err = api.EbaiAPI.OrderAgreeReturnGoods(order.VendorOrderID, order.AfsOrderID) + param := &ebaiapi.RefundOrderExamine{ + ReverseOrderId: order.AfsOrderID, + OrderId: order.VendorOrderID, + IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), + ActionType: ebaiapi.RefundTypeAgreeGoods, + ReasonCode: "", + ReasonRemarks: reason, + RefundProductList: "", + } + err = api.EbaiAPI.OrderAgreeReturnGoods(param) } } return err @@ -250,19 +272,41 @@ func (c *PurchaseHandler) RefundOrder(ctx *jxcontext.Context, order *model.Goods // 发起部分退款 售后/售中 func (c *PurchaseHandler) PartRefundOrder(ctx *jxcontext.Context, order *model.GoodsOrder, refundSkuList []*model.OrderSku, reason string) (err error) { if globals.EnableEbaiStoreWrite { + //获取afsOrder + var afsOrderInfo *model.AfsOrder + result, err := api.EbaiAPI.OrderPartRefundGet(order.VendorOrderID) + if err != nil { + return err + } + afsOrderInfo = CurPurchaseHandler.AfsOrderDetail2Financial(result) + //售后部分多次退款 if order.Status > model.OrderStatusEndBegin { - //获取afsOrder - var afsOrderInfo *model.AfsOrder - result, err := api.EbaiAPI.OrderPartRefundGet(order.VendorOrderID) - if err != nil { - return err - } - afsOrderInfo = CurPurchaseHandler.AfsOrderDetail2Financial(result) - if err := api.EbaiAPI.OrderAgreePartRefund(afsOrderInfo.VendorOrderID, orderSkus2AfsSkus(refundSkuList), afsOrderInfo.AfsOrderID); err != nil { - return err + param := &ebaiapi.RefundOrderExamine{ + ReverseOrderId: afsOrderInfo.AfsOrderID, + OrderId: afsOrderInfo.VendorOrderID, + IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), + ActionType: ebaiapi.RefundTypeAgree, + ReasonCode: "", + ReasonRemarks: reason, + RefundProductList: "", } + err = api.EbaiAPI.OrderAgreePartRefund(param) } else { + if reason == "" { + return fmt.Errorf("拒绝退单时,请填写拒单原因") + } + + //param := &ebaiapi.RefundOrderExamine{ + // ReverseOrderId: afsOrderInfo.AfsOrderID, + // OrderId: afsOrderInfo.VendorOrderID, + // IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), + // ActionType: ebaiapi.RefundTypeRefuse, + // ReasonCode: "7001", + // ReasonRemarks: reason, + // RefundProductList: "", + //} + //err = api.EbaiAPI.OrderPartRefund(param) if err := api.EbaiAPI.OrderPartRefund(order.VendorOrderID, orderSkus2AfsSkus(refundSkuList)); err != nil { return err } diff --git a/business/partner/purchase/tao_vegetable/order.go b/business/partner/purchase/tao_vegetable/order.go index d96c9faec..265e358f3 100644 --- a/business/partner/purchase/tao_vegetable/order.go +++ b/business/partner/purchase/tao_vegetable/order.go @@ -502,9 +502,16 @@ func (c *PurchaseHandler) PickupGoods(order *model.GoodsOrder, isSelfDelivery bo if err != nil { return err } - if err = getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "").DeliveryFinish(param); err != nil { + api := getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "") + err = api.DeliveryFinish(param) + + if err != nil && strings.Contains(err.Error(), "并发操作,执行失败,请重试") { + time.Sleep(200 * time.Millisecond) + api.DeliveryFinish(param) + } else if err != nil { return err } + c.postFakeMsg(order.VendorOrderID, tao_vegetable.OrderStatusPickedUp, tao_vegetable.OrderStatusPickedUp) } return err From 50ef0e1448c2822844d79cbd4e714ab12a1d4cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 25 Aug 2023 18:32:31 +0800 Subject: [PATCH 12/27] 1 --- business/jxcallback/orderman/waybill.go | 2 +- business/partner/purchase/ebai/order.go | 32 +++++++++++++++++---- business/partner/purchase/ebai/order_afs.go | 14 +++++++++ 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/business/jxcallback/orderman/waybill.go b/business/jxcallback/orderman/waybill.go index 543ae4fe9..68e547d86 100644 --- a/business/jxcallback/orderman/waybill.go +++ b/business/jxcallback/orderman/waybill.go @@ -214,7 +214,7 @@ func (w *OrderManager) addWaybillStatus(bill *model.Waybill, db *dao.DaoDB, addP "status_time": bill.StatusTime, }, addParams) utils.CallFuncLogError(func() error { - _, err = db.Db.QueryTable("waybill").Filter("vendor_waybill_id", bill.VendorWaybillID).Filter("waybill_vendor_id", bill.WaybillVendorID).Filter("status__lte", bill.Status).Update(params) + _, err = db.Db.QueryTable("waybill").Filter("vendor_waybill_id", bill.VendorWaybillID).Filter("waybill_vendor_id", bill.WaybillVendorID).Filter("status", bill.Status).Update(params) return err }, "addWaybillStatus update waybill status, bill:%v", bill) } else { diff --git a/business/partner/purchase/ebai/order.go b/business/partner/purchase/ebai/order.go index 8cf8e5aaf..1559c2455 100644 --- a/business/partner/purchase/ebai/order.go +++ b/business/partner/purchase/ebai/order.go @@ -1,6 +1,7 @@ package ebai import ( + "encoding/json" "errors" "fmt" "math" @@ -658,9 +659,16 @@ func (c *PurchaseHandler) GetOrderRealMobile(ctx *jxcontext.Context, order *mode func (c *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *model.GoodsOrder, isAcceptIt bool, reason string) (err error) { if globals.EnableEbaiStoreWrite { + var afsOrderInfo *model.AfsOrder + result, err := api.EbaiAPI.OrderPartRefundGet(order.VendorOrderID) + if err != nil { + return err + } + afsOrderInfo = CurPurchaseHandler.AfsOrderDetail2Financial(result) + if isAcceptIt { err = api.EbaiAPI.OrderAgreeRefund(&ebaiapi.RefundOrderExamine{ - ReverseOrderId: "", + ReverseOrderId: afsOrderInfo.AfsOrderID, OrderId: order.VendorOrderID, IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), ActionType: ebaiapi.RefundTypeAgree, @@ -670,16 +678,28 @@ func (c *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *mod if reason == "" { return fmt.Errorf("拒绝退单时,请填写拒单原因") } - - err = api.EbaiAPI.OrderDisagreeRefund(&ebaiapi.RefundOrderExamine{ - ReverseOrderId: "", + param := &ebaiapi.RefundOrderExamine{ + ReverseOrderId: afsOrderInfo.AfsOrderID, OrderId: order.VendorOrderID, IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), - ActionType: ebaiapi.RefundTypeAgree, + ActionType: ebaiapi.RefundTypeRefuse, ReasonCode: "7001", ReasonRemarks: reason, RefundProductList: "", - }) + } + refundProductList := make([]*ebaiapi.RefundProductList, 0, 0) + date, _ := api.EbaiAPI.GetReverseOrder(order.VendorOrderID) + for _, v := range date { + refundProduct := &ebaiapi.RefundProductList{ + SubBizOrderId: v.(map[string]interface{})["sub_biz_order_id"].(string), + PlatformSkuId: utils.Int64ToStr(utils.Interface2Int64WithDefault(v.(map[string]interface{})["platform_sku_id"], 0)), + } + + refundProductList = append(refundProductList, refundProduct) + } + refundProductListStr, _ := json.Marshal(refundProductList) + param.RefundProductList = string(refundProductListStr) + err = api.EbaiAPI.OrderDisagreeRefund(param) } } return err diff --git a/business/partner/purchase/ebai/order_afs.go b/business/partner/purchase/ebai/order_afs.go index 988b078a5..c5a91019c 100644 --- a/business/partner/purchase/ebai/order_afs.go +++ b/business/partner/purchase/ebai/order_afs.go @@ -1,6 +1,7 @@ package ebai import ( + "encoding/json" "errors" "fmt" "strings" @@ -238,6 +239,19 @@ func (c *PurchaseHandler) AgreeOrRefuseRefund(ctx *jxcontext.Context, order *mod ReasonRemarks: reason, RefundProductList: "", } + refundProductList := make([]*ebaiapi.RefundProductList, 0, 0) + date, _ := api.EbaiAPI.GetReverseOrder(order.VendorOrderID) + for _, v := range date { + refundProduct := &ebaiapi.RefundProductList{ + SubBizOrderId: v.(map[string]interface{})["sub_biz_order_id"].(string), + PlatformSkuId: utils.Int64ToStr(utils.Interface2Int64WithDefault(v.(map[string]interface{})["platform_sku_id"], 0)), + } + + refundProductList = append(refundProductList, refundProduct) + } + refundProductListStr, _ := json.Marshal(refundProductList) + param.RefundProductList = string(refundProductListStr) + err = api.EbaiAPI.OrderDisagreeReturnGoods(param) } else if approveType == partner.AfsApproveTypeRefusedToRefundMoney { return errors.New("此平台暂时不支持") From 315babf4a2ad51142a9762dbcf9ce5d66fe02a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 25 Aug 2023 20:07:06 +0800 Subject: [PATCH 13/27] 1 --- business/jxcallback/orderman/waybill.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/waybill.go b/business/jxcallback/orderman/waybill.go index 68e547d86..543ae4fe9 100644 --- a/business/jxcallback/orderman/waybill.go +++ b/business/jxcallback/orderman/waybill.go @@ -214,7 +214,7 @@ func (w *OrderManager) addWaybillStatus(bill *model.Waybill, db *dao.DaoDB, addP "status_time": bill.StatusTime, }, addParams) utils.CallFuncLogError(func() error { - _, err = db.Db.QueryTable("waybill").Filter("vendor_waybill_id", bill.VendorWaybillID).Filter("waybill_vendor_id", bill.WaybillVendorID).Filter("status", bill.Status).Update(params) + _, err = db.Db.QueryTable("waybill").Filter("vendor_waybill_id", bill.VendorWaybillID).Filter("waybill_vendor_id", bill.WaybillVendorID).Filter("status__lte", bill.Status).Update(params) return err }, "addWaybillStatus update waybill status, bill:%v", bill) } else { From ec3b5d1a9fa0cf34a20146254fdf5c2ccb90f09f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 28 Aug 2023 13:32:18 +0800 Subject: [PATCH 14/27] 1 --- .../jxcallback/scheduler/defsch/defsch.go | 14 ++-- business/partner/purchase/ebai/order.go | 29 ++++---- business/partner/purchase/ebai/order_afs.go | 72 ++++++++++++------- .../partner/purchase/tao_vegetable/order.go | 1 + 4 files changed, 68 insertions(+), 48 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 3e861e5a9..2358c0f24 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -994,14 +994,12 @@ func (s *DefScheduler) createWaybillOn3rdProviders(savedOrderInfo *WatchOrderInf } } - if _, err = s.CreateWaybillOnProviders4SavedOrder(jxcontext.AdminCtx, savedOrderInfo, nil, excludeVendorIDs, false, maxDeliveryFee); err == nil { - savedOrderInfo.retryCount++ - } else { - partner.CurOrderManager.OnOrderMsg(order, utils.Int2Str(vendorID), fmt.Sprintf("发起自动创建三方运单,目标创建运单平台[%s],创建失败:%v", jxutils.GetVendorName(vendorID), err)) - //content := "您的门店 [" + storeDetail.Name + "],OrderID:[" + order.VendorOrderID + "],自动呼叫骑手失败[" + fmt.Sprintf(err.Error()) + "],请手动呼叫骑手" - //if user, err := dao.GetUserByID(dao.GetDB(), "mobile", storeDetail.MarketManPhone); err == nil { - // ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.UserID, "平台门店状态变化", content) - //} + if vendorID != model.NO { + if _, err = s.CreateWaybillOnProviders4SavedOrder(jxcontext.AdminCtx, savedOrderInfo, nil, excludeVendorIDs, false, maxDeliveryFee); err == nil { + savedOrderInfo.retryCount++ + } else { + partner.CurOrderManager.OnOrderMsg(order, utils.Int2Str(vendorID), fmt.Sprintf("发起自动创建三方运单,目标创建运单平台[%s],创建失败:%v", jxutils.GetVendorName(vendorID), err)) + } } } } else { diff --git a/business/partner/purchase/ebai/order.go b/business/partner/purchase/ebai/order.go index 1559c2455..54491e862 100644 --- a/business/partner/purchase/ebai/order.go +++ b/business/partner/purchase/ebai/order.go @@ -1,7 +1,6 @@ package ebai import ( - "encoding/json" "errors" "fmt" "math" @@ -679,26 +678,30 @@ func (c *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *mod return fmt.Errorf("拒绝退单时,请填写拒单原因") } param := &ebaiapi.RefundOrderExamine{ - ReverseOrderId: afsOrderInfo.AfsOrderID, - OrderId: order.VendorOrderID, - IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), - ActionType: ebaiapi.RefundTypeRefuse, - ReasonCode: "7001", - ReasonRemarks: reason, - RefundProductList: "", + ReverseOrderId: afsOrderInfo.AfsOrderID, + OrderId: order.VendorOrderID, + IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), + ActionType: ebaiapi.RefundTypeRefuse, + ReasonCode: "7001", + ReasonRemarks: reason, } refundProductList := make([]*ebaiapi.RefundProductList, 0, 0) date, _ := api.EbaiAPI.GetReverseOrder(order.VendorOrderID) for _, v := range date { + v2 := v.(map[string]interface{}) refundProduct := &ebaiapi.RefundProductList{ - SubBizOrderId: v.(map[string]interface{})["sub_biz_order_id"].(string), - PlatformSkuId: utils.Int64ToStr(utils.Interface2Int64WithDefault(v.(map[string]interface{})["platform_sku_id"], 0)), + SubBizOrderId: v2["sub_biz_order_id"].(string), + PlatformSkuId: utils.Int64ToStr(utils.Interface2Int64WithDefault(v2["platform_sku_id"], 0)), + } + switch utils.MustInterface2Int64(v2["fund_calculate_type"]) { + case 0: + refundProduct.Number = utils.Int64ToStr(utils.MustInterface2Int64(v2["refund_quantity"])) + case 1: + refundProduct.RefundAmount = utils.Int64ToStr(utils.MustInterface2Int64(v2["refund_user_amount"])) } - refundProductList = append(refundProductList, refundProduct) } - refundProductListStr, _ := json.Marshal(refundProductList) - param.RefundProductList = string(refundProductListStr) + param.RefundProductList = refundProductList err = api.EbaiAPI.OrderDisagreeRefund(param) } } diff --git a/business/partner/purchase/ebai/order_afs.go b/business/partner/purchase/ebai/order_afs.go index c5a91019c..197dd1d07 100644 --- a/business/partner/purchase/ebai/order_afs.go +++ b/business/partner/purchase/ebai/order_afs.go @@ -1,7 +1,6 @@ package ebai import ( - "encoding/json" "errors" "fmt" "strings" @@ -231,39 +230,42 @@ func (c *PurchaseHandler) AgreeOrRefuseRefund(ctx *jxcontext.Context, order *mod return fmt.Errorf("拒绝退单时请填写原因") } param := &ebaiapi.RefundOrderExamine{ - ReverseOrderId: order.AfsOrderID, - OrderId: order.VendorOrderID, - IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), - ActionType: ebaiapi.RefundTypeRefuseGoods, - ReasonCode: "7001", - ReasonRemarks: reason, - RefundProductList: "", + ReverseOrderId: order.AfsOrderID, + OrderId: order.VendorOrderID, + IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), + ActionType: ebaiapi.RefundTypeRefuseGoods, + ReasonCode: "7001", + ReasonRemarks: reason, } refundProductList := make([]*ebaiapi.RefundProductList, 0, 0) date, _ := api.EbaiAPI.GetReverseOrder(order.VendorOrderID) for _, v := range date { + v2 := v.(map[string]interface{}) refundProduct := &ebaiapi.RefundProductList{ - SubBizOrderId: v.(map[string]interface{})["sub_biz_order_id"].(string), - PlatformSkuId: utils.Int64ToStr(utils.Interface2Int64WithDefault(v.(map[string]interface{})["platform_sku_id"], 0)), + SubBizOrderId: v2["sub_biz_order_id"].(string), + PlatformSkuId: utils.Int64ToStr(utils.Interface2Int64WithDefault(v2["platform_sku_id"], 0)), + } + switch utils.MustInterface2Int64(v2["fund_calculate_type"]) { + case 0: + refundProduct.Number = utils.Int64ToStr(utils.MustInterface2Int64(v2["refund_quantity"])) + case 1: + refundProduct.RefundAmount = utils.Int64ToStr(utils.MustInterface2Int64(v2["refund_user_amount"])) } - refundProductList = append(refundProductList, refundProduct) } - refundProductListStr, _ := json.Marshal(refundProductList) - param.RefundProductList = string(refundProductListStr) + param.RefundProductList = refundProductList err = api.EbaiAPI.OrderDisagreeReturnGoods(param) } else if approveType == partner.AfsApproveTypeRefusedToRefundMoney { return errors.New("此平台暂时不支持") } else { param := &ebaiapi.RefundOrderExamine{ - ReverseOrderId: order.AfsOrderID, - OrderId: order.VendorOrderID, - IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), - ActionType: ebaiapi.RefundTypeAgreeGoods, - ReasonCode: "", - ReasonRemarks: reason, - RefundProductList: "", + ReverseOrderId: order.AfsOrderID, + OrderId: order.VendorOrderID, + IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), + ActionType: ebaiapi.RefundTypeAgreeGoods, + ReasonCode: "", + ReasonRemarks: reason, } err = api.EbaiAPI.OrderAgreeReturnGoods(param) } @@ -297,14 +299,30 @@ func (c *PurchaseHandler) PartRefundOrder(ctx *jxcontext.Context, order *model.G //售后部分多次退款 if order.Status > model.OrderStatusEndBegin { param := &ebaiapi.RefundOrderExamine{ - ReverseOrderId: afsOrderInfo.AfsOrderID, - OrderId: afsOrderInfo.VendorOrderID, - IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), - ActionType: ebaiapi.RefundTypeAgree, - ReasonCode: "", - ReasonRemarks: reason, - RefundProductList: "", + ReverseOrderId: afsOrderInfo.AfsOrderID, + OrderId: afsOrderInfo.VendorOrderID, + IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), + ActionType: ebaiapi.RefundTypeAgree, + ReasonCode: "", + ReasonRemarks: reason, } + date, _ := api.EbaiAPI.GetReverseOrder(order.VendorOrderID) + refundProductList := make([]*ebaiapi.RefundProductList, 0, 0) + for _, v := range date { + v2 := v.(map[string]interface{}) + refundProduct := &ebaiapi.RefundProductList{ + SubBizOrderId: v2["sub_biz_order_id"].(string), + PlatformSkuId: utils.Int64ToStr(utils.Interface2Int64WithDefault(v2["platform_sku_id"], 0)), + } + switch utils.MustInterface2Int64(v2["fund_calculate_type"]) { + case 0: + refundProduct.Number = utils.Int64ToStr(utils.MustInterface2Int64(v2["refund_quantity"])) + case 1: + refundProduct.RefundAmount = utils.Int64ToStr(utils.MustInterface2Int64(v2["refund_user_amount"])) + } + refundProductList = append(refundProductList, refundProduct) + } + param.RefundProductList = refundProductList err = api.EbaiAPI.OrderAgreePartRefund(param) } else { if reason == "" { diff --git a/business/partner/purchase/tao_vegetable/order.go b/business/partner/purchase/tao_vegetable/order.go index 265e358f3..546392265 100644 --- a/business/partner/purchase/tao_vegetable/order.go +++ b/business/partner/purchase/tao_vegetable/order.go @@ -180,6 +180,7 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode string, vendorOrderID int64, ve order.BusinessType = model.BusinessTypeImmediate order.ExpectedDeliveredTime = getTimeFromTimestamp(earliestTime + 30*60) // 预计最晚送达时间 } + order.PickDeadline = order.ExpectedDeliveredTime.Add(-1 * time.Hour) // 用户信息 order.ConsigneeName = *orderDetail.ReceiveInfo.ReceiverName From ddad83cd063e275a966e7eb13ad9df85e74e62b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 28 Aug 2023 15:58:58 +0800 Subject: [PATCH 15/27] 1 --- business/jxcallback/orderman/order.go | 21 ++++++++++++++++----- business/partner/purchase/mtwm/order.go | 9 +++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index a3ea29068..2f13601de 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -2457,13 +2457,24 @@ func DelOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID, id } for _, v := range order.Skus { if v.ID == int64(id) { - sql := ` + if v.Count == model.YES { + sql := ` DELETE FROM order_sku WHERE id = ? ` - sqlParams := []interface{}{v.ID} - dao.ExecuteSQL(db, sql, sqlParams) - shopPrice = v.ShopPrice * int64(v.Count) - earningPrice = v.EarningPrice * int64(v.Count) + sqlParams := []interface{}{v.ID} + dao.ExecuteSQL(db, sql, sqlParams) + } else { + sql := ` + UPDATE order_sku SET count = ? WHERE id = ? + ` + sqlParams := []interface{}{v.Count - 1, v.ID} + dao.ExecuteSQL(db, sql, sqlParams) + } + + shopPrice = v.ShopPrice * int64(1) + earningPrice = v.EarningPrice * int64(1) + //shopPrice = v.ShopPrice * int64(v.Count) + //earningPrice = v.EarningPrice * int64(v.Count) } } order.ShopPrice -= shopPrice diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index c4f84abad..43b68cf67 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -395,6 +395,15 @@ func (c *PurchaseHandler) onOrderMsg(msg *mtwmapi.CallbackMsg) (response *mtwmap c.OnOrderDetail(orderMap, partner.UpdatedPeration) } }) + // 美团订单完成时,获取跑腿费用 + if fee, feeErr := partner.GetPurchasePlatformFromVendorID(order.VendorID).GetPlatformLogisticsFee(order); feeErr != nil { + bill, err := partner.CurOrderManager.LoadWaybill(order.VendorOrderID, model.VendorIDMTWM) + if bill == nil && err == nil { + bill.ActualFee = fee + bill.DesiredFee = fee + dao.UpdateEntity(dao.GetDB(), bill, "ActualFee", "DesiredFee") + } + } } } From ca532fda8e4930f01a566c4ad740a4601fcc41cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 28 Aug 2023 17:52:32 +0800 Subject: [PATCH 16/27] 1 --- business/partner/purchase/ebai/order.go | 59 +++++++++++-------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/business/partner/purchase/ebai/order.go b/business/partner/purchase/ebai/order.go index 54491e862..4eb5e631d 100644 --- a/business/partner/purchase/ebai/order.go +++ b/business/partner/purchase/ebai/order.go @@ -665,43 +665,38 @@ func (c *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *mod } afsOrderInfo = CurPurchaseHandler.AfsOrderDetail2Financial(result) + param := &ebaiapi.RefundOrderExamine{ + ReverseOrderId: afsOrderInfo.AfsOrderID, + OrderId: order.VendorOrderID, + IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), + ActionType: ebaiapi.RefundTypeRefuse, + ReasonRemarks: reason, + } + refundProductList := make([]*ebaiapi.RefundProductList, 0, 0) + date, _ := api.EbaiAPI.GetReverseOrder(order.VendorOrderID) + for _, v := range date { + v2 := v.(map[string]interface{}) + refundProduct := &ebaiapi.RefundProductList{ + SubBizOrderId: v2["sub_biz_order_id"].(string), + PlatformSkuId: utils.Int64ToStr(utils.Interface2Int64WithDefault(v2["platform_sku_id"], 0)), + } + switch utils.MustInterface2Int64(v2["fund_calculate_type"]) { + case 0: + refundProduct.Number = utils.Int64ToStr(utils.MustInterface2Int64(v2["refund_quantity"])) + case 1: + refundProduct.RefundAmount = utils.Int64ToStr(utils.MustInterface2Int64(v2["refund_user_amount"])) + } + refundProductList = append(refundProductList, refundProduct) + } + param.RefundProductList = refundProductList + if isAcceptIt { - err = api.EbaiAPI.OrderAgreeRefund(&ebaiapi.RefundOrderExamine{ - ReverseOrderId: afsOrderInfo.AfsOrderID, - OrderId: order.VendorOrderID, - IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), - ActionType: ebaiapi.RefundTypeAgree, - ReasonRemarks: reason, - }) + err = api.EbaiAPI.OrderAgreeRefund(param) } else { if reason == "" { return fmt.Errorf("拒绝退单时,请填写拒单原因") } - param := &ebaiapi.RefundOrderExamine{ - ReverseOrderId: afsOrderInfo.AfsOrderID, - OrderId: order.VendorOrderID, - IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), - ActionType: ebaiapi.RefundTypeRefuse, - ReasonCode: "7001", - ReasonRemarks: reason, - } - refundProductList := make([]*ebaiapi.RefundProductList, 0, 0) - date, _ := api.EbaiAPI.GetReverseOrder(order.VendorOrderID) - for _, v := range date { - v2 := v.(map[string]interface{}) - refundProduct := &ebaiapi.RefundProductList{ - SubBizOrderId: v2["sub_biz_order_id"].(string), - PlatformSkuId: utils.Int64ToStr(utils.Interface2Int64WithDefault(v2["platform_sku_id"], 0)), - } - switch utils.MustInterface2Int64(v2["fund_calculate_type"]) { - case 0: - refundProduct.Number = utils.Int64ToStr(utils.MustInterface2Int64(v2["refund_quantity"])) - case 1: - refundProduct.RefundAmount = utils.Int64ToStr(utils.MustInterface2Int64(v2["refund_user_amount"])) - } - refundProductList = append(refundProductList, refundProduct) - } - param.RefundProductList = refundProductList + param.ReasonCode = "7001" err = api.EbaiAPI.OrderDisagreeRefund(param) } } From ad35f8fcc1cefa67c0b0990158ded4f2ee2d4c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 28 Aug 2023 18:17:13 +0800 Subject: [PATCH 17/27] 1 --- business/partner/purchase/ebai/order.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/business/partner/purchase/ebai/order.go b/business/partner/purchase/ebai/order.go index 4eb5e631d..c9744fa8b 100644 --- a/business/partner/purchase/ebai/order.go +++ b/business/partner/purchase/ebai/order.go @@ -658,15 +658,8 @@ func (c *PurchaseHandler) GetOrderRealMobile(ctx *jxcontext.Context, order *mode func (c *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *model.GoodsOrder, isAcceptIt bool, reason string) (err error) { if globals.EnableEbaiStoreWrite { - var afsOrderInfo *model.AfsOrder - result, err := api.EbaiAPI.OrderPartRefundGet(order.VendorOrderID) - if err != nil { - return err - } - afsOrderInfo = CurPurchaseHandler.AfsOrderDetail2Financial(result) - param := &ebaiapi.RefundOrderExamine{ - ReverseOrderId: afsOrderInfo.AfsOrderID, + ReverseOrderId: "", OrderId: order.VendorOrderID, IdempotentId: utils.Int64ToStr(time.Now().UnixNano()), ActionType: ebaiapi.RefundTypeRefuse, @@ -687,6 +680,9 @@ func (c *PurchaseHandler) AgreeOrRefuseCancel(ctx *jxcontext.Context, order *mod refundProduct.RefundAmount = utils.Int64ToStr(utils.MustInterface2Int64(v2["refund_user_amount"])) } refundProductList = append(refundProductList, refundProduct) + if param.ReverseOrderId == "" { + param.ReverseOrderId = v2["refund_order_id"].(string) + } } param.RefundProductList = refundProductList From 6f4f5242688ce47918babea63af51d424abe0ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 29 Aug 2023 14:03:00 +0800 Subject: [PATCH 18/27] 1 --- business/jxstore/cms/store.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 43d8a8ce2..665320401 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1113,6 +1113,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa } } + globals.SugarLogger.Debugf("valid =======: %s", utils.Format4Output(valid, false)) if len(valid) > 0 { if globals.IsAddEvent { mapBefore := refutil.FindMapAndStructMixed(valid, beforStore) @@ -1122,7 +1123,10 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa defer func() { dao.Rollback(db, txDB) }() - if num, err = dao.UpdateEntityLogically(db, store, valid, userName, nil); err == nil && num == 1 { + + num, err = dao.UpdateEntityLogically(db, store, valid, userName, nil) + globals.SugarLogger.Debugf("=======num := %s err = %v", utils.Format4Output(num, false), err) + if err == nil && num == 1 { if isUpdateStoreNeedSync(valid) { dummy := &model.StoreMap{} kv := make(map[string]interface{}) @@ -1134,10 +1138,12 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa _, err2 := dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, dummy, kv, userName, map[string]interface{}{ model.FieldStoreID: store.ID, }, model.FieldSyncStatus, syncStatus) + globals.SugarLogger.Debugf("=======UpdateEntityLogicallyAndUpdateSyncStatus := %s err = %s", utils.Format4Output(err2, false), utils.Format4Output(err, false)) if err = err2; err == nil { dao.Commit(db, txDB) _, err = CurVendorSync.SyncStore(ctx, db, -1, store.ID, false, userName) if valid["tel1"] != nil || valid["tel2"] != nil { + globals.SugarLogger.Debugf("store_detail := %s", utils.Format4Output(store, false)) TryAddStoreBossRole4StoreByMobile(ctx, store.ID, []string{utils.Interface2String(valid["tel1"]), utils.Interface2String(valid["tel2"])}) } if syncStatus&model.SyncFlagStoreAddress != 0 || valid["tel1"] != nil || valid["payeeName"] != nil { From 2ca22c810057aecc72c07ef6a3a5134613f64c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 29 Aug 2023 14:27:09 +0800 Subject: [PATCH 19/27] 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 665320401..a7c912e84 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -909,6 +909,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa payload["autoEnableAt"] = utils.Time2Date(utils.Str2Time(utils.Interface2String(payload["autoEnableAt"]))) } valid := dao.StrictMakeMapByStructObject2(payload, store, &outStore, userName) + globals.SugarLogger.Debugf("==================1 valid := %s", utils.Format4Output(valid, false)) if err = checkStoreDeliveryRange(utils.Interface2String(valid["deliveryRange"])); err != nil { return 0, err } From 90e9c7502e26997b6d136b29ffb2c66b1fd1b0fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 29 Aug 2023 14:34:32 +0800 Subject: [PATCH 20/27] 1 --- business/jxstore/cms/store.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index a7c912e84..3a5c3432a 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -909,7 +909,6 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa payload["autoEnableAt"] = utils.Time2Date(utils.Str2Time(utils.Interface2String(payload["autoEnableAt"]))) } valid := dao.StrictMakeMapByStructObject2(payload, store, &outStore, userName) - globals.SugarLogger.Debugf("==================1 valid := %s", utils.Format4Output(valid, false)) if err = checkStoreDeliveryRange(utils.Interface2String(valid["deliveryRange"])); err != nil { return 0, err } @@ -1114,7 +1113,6 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa } } - globals.SugarLogger.Debugf("valid =======: %s", utils.Format4Output(valid, false)) if len(valid) > 0 { if globals.IsAddEvent { mapBefore := refutil.FindMapAndStructMixed(valid, beforStore) @@ -1126,7 +1124,6 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa }() num, err = dao.UpdateEntityLogically(db, store, valid, userName, nil) - globals.SugarLogger.Debugf("=======num := %s err = %v", utils.Format4Output(num, false), err) if err == nil && num == 1 { if isUpdateStoreNeedSync(valid) { dummy := &model.StoreMap{} @@ -1139,12 +1136,10 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa _, err2 := dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, dummy, kv, userName, map[string]interface{}{ model.FieldStoreID: store.ID, }, model.FieldSyncStatus, syncStatus) - globals.SugarLogger.Debugf("=======UpdateEntityLogicallyAndUpdateSyncStatus := %s err = %s", utils.Format4Output(err2, false), utils.Format4Output(err, false)) if err = err2; err == nil { dao.Commit(db, txDB) _, err = CurVendorSync.SyncStore(ctx, db, -1, store.ID, false, userName) if valid["tel1"] != nil || valid["tel2"] != nil { - globals.SugarLogger.Debugf("store_detail := %s", utils.Format4Output(store, false)) TryAddStoreBossRole4StoreByMobile(ctx, store.ID, []string{utils.Interface2String(valid["tel1"]), utils.Interface2String(valid["tel2"])}) } if syncStatus&model.SyncFlagStoreAddress != 0 || valid["tel1"] != nil || valid["payeeName"] != nil { From b33f4e333b5833f0d948aef1487c6f10acff81d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 29 Aug 2023 17:53:32 +0800 Subject: [PATCH 21/27] 1 --- business/jxstore/cms/store.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 3a5c3432a..851ec951d 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -210,6 +210,7 @@ var ( "freightDeductionPack": 1, "vendorStoreName": 1, "boxFee": 1, + "address": 1, } WatchVendorStoreTimeList = []string{ @@ -1792,6 +1793,21 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor // } syncStatus |= model.SyncFlagStoreName } + + // 增加门店地址修改同步 + storeDetail, err := dao.GetStoreBaseByVendorStoreID(storeMap.VendorStoreID, storeMap.VendorID) + if err != nil || storeDetail == nil { + return 0, fmt.Errorf("基础门店信息异常,请联系管理员") + } + if storeDetail != nil && payload["address"].(string) != storeDetail.Address { + // 修改门店地址 + storeDetail.Address = payload["address"].(string) + dao.UpdateEntity(db, storeDetail, "Address") + // 添加同步 + valid["address"] = payload["address"].(string) + syncStatus |= model.SyncFlagStoreName + } + //增加同步到抖店厂商的同步标志 DDFlag := false errList := errlist.ErrList{} @@ -1886,6 +1902,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor } } dao.Commit(db, txDB) + if isStoreMapNeedSync(vendorID, valid) { _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) } From 63dcfccf66d6ca086b64a53bd16c0246eecde959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 29 Aug 2023 18:01:57 +0800 Subject: [PATCH 22/27] 1 --- business/jxstore/cms/store.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 851ec951d..ccb86014d 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1799,14 +1799,6 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor if err != nil || storeDetail == nil { return 0, fmt.Errorf("基础门店信息异常,请联系管理员") } - if storeDetail != nil && payload["address"].(string) != storeDetail.Address { - // 修改门店地址 - storeDetail.Address = payload["address"].(string) - dao.UpdateEntity(db, storeDetail, "Address") - // 添加同步 - valid["address"] = payload["address"].(string) - syncStatus |= model.SyncFlagStoreName - } //增加同步到抖店厂商的同步标志 DDFlag := false @@ -1903,6 +1895,14 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor } dao.Commit(db, txDB) + if storeDetail != nil && payload["address"].(string) != storeDetail.Address { + // 修改门店地址 + storeDetail.Address = payload["address"].(string) + dao.UpdateEntity(db, storeDetail, "Address") + // 添加同步 + valid["address"] = payload["address"].(string) + syncStatus |= model.SyncFlagStoreName + } if isStoreMapNeedSync(vendorID, valid) { _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) } From 88f56043e6042a84321643ecd3c8bfc6b0d859b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 29 Aug 2023 18:12:54 +0800 Subject: [PATCH 23/27] 1 --- business/jxstore/cms/store.go | 56 +++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index ccb86014d..d70b5c60c 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1794,12 +1794,6 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor syncStatus |= model.SyncFlagStoreName } - // 增加门店地址修改同步 - storeDetail, err := dao.GetStoreBaseByVendorStoreID(storeMap.VendorStoreID, storeMap.VendorID) - if err != nil || storeDetail == nil { - return 0, fmt.Errorf("基础门店信息异常,请联系管理员") - } - //增加同步到抖店厂商的同步标志 DDFlag := false errList := errlist.ErrList{} @@ -1843,6 +1837,20 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor } } + // 增加门店地址修改同步 + storeDetail, err := dao.GetStoreBaseByVendorStoreID(storeMap.VendorStoreID, storeMap.VendorID) + if err != nil || storeDetail == nil { + return 0, fmt.Errorf("基础门店信息异常,请联系管理员") + } + if storeDetail != nil && payload["address"].(string) != storeDetail.Address { + // 修改门店地址 + storeDetail.Address = payload["address"].(string) + dao.UpdateEntity(db, storeDetail, "Address") + // 添加同步 + valid["address"] = payload["address"].(string) + syncStatus |= model.SyncFlagStoreName + } + if err == nil { if len(valid) > 0 { txDB, _ := dao.Begin(db) @@ -1853,19 +1861,23 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor } }() - if isStoreMapNeedSync(vendorID, valid) { // 对于store vendor map,只有Status改变才需要同步到厂商 - num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{ - model.FieldStoreID: storeID, - model.FieldVendorID: vendorID, - //"VendorOrgCode": vendorOrgCode, - }, model.FieldSyncStatus, syncStatus) - } else { - num, err = dao.UpdateEntityLogically(db, storeMap, valid, userName, map[string]interface{}{ - model.FieldStoreID: storeID, - model.FieldVendorID: vendorID, - //"VendorOrgCode": vendorOrgCode, - }) + // storeMap 不包含address参数 + if valid["address"] == nil { + if isStoreMapNeedSync(vendorID, valid) { // 对于store vendor map,只有Status改变才需要同步到厂商 + num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{ + model.FieldStoreID: storeID, + model.FieldVendorID: vendorID, + //"VendorOrgCode": vendorOrgCode, + }, model.FieldSyncStatus, syncStatus) + } else { + num, err = dao.UpdateEntityLogically(db, storeMap, valid, userName, map[string]interface{}{ + model.FieldStoreID: storeID, + model.FieldVendorID: vendorID, + //"VendorOrgCode": vendorOrgCode, + }) + } } + if err != nil { dao.Rollback(db, txDB) return 0, err @@ -1895,14 +1907,6 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor } dao.Commit(db, txDB) - if storeDetail != nil && payload["address"].(string) != storeDetail.Address { - // 修改门店地址 - storeDetail.Address = payload["address"].(string) - dao.UpdateEntity(db, storeDetail, "Address") - // 添加同步 - valid["address"] = payload["address"].(string) - syncStatus |= model.SyncFlagStoreName - } if isStoreMapNeedSync(vendorID, valid) { _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) } From 6e9372ef3b4b59aada591dd87ae73fc78fcd7833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 29 Aug 2023 18:14:49 +0800 Subject: [PATCH 24/27] 1 --- business/jxstore/cms/store.go | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index d70b5c60c..a295fd12d 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -210,7 +210,6 @@ var ( "freightDeductionPack": 1, "vendorStoreName": 1, "boxFee": 1, - "address": 1, } WatchVendorStoreTimeList = []string{ @@ -1862,20 +1861,18 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor }() // storeMap 不包含address参数 - if valid["address"] == nil { - if isStoreMapNeedSync(vendorID, valid) { // 对于store vendor map,只有Status改变才需要同步到厂商 - num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{ - model.FieldStoreID: storeID, - model.FieldVendorID: vendorID, - //"VendorOrgCode": vendorOrgCode, - }, model.FieldSyncStatus, syncStatus) - } else { - num, err = dao.UpdateEntityLogically(db, storeMap, valid, userName, map[string]interface{}{ - model.FieldStoreID: storeID, - model.FieldVendorID: vendorID, - //"VendorOrgCode": vendorOrgCode, - }) - } + if isStoreMapNeedSync(vendorID, valid) { // 对于store vendor map,只有Status改变才需要同步到厂商 + num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{ + model.FieldStoreID: storeID, + model.FieldVendorID: vendorID, + //"VendorOrgCode": vendorOrgCode, + }, model.FieldSyncStatus, syncStatus) + } else { + num, err = dao.UpdateEntityLogically(db, storeMap, valid, userName, map[string]interface{}{ + model.FieldStoreID: storeID, + model.FieldVendorID: vendorID, + //"VendorOrgCode": vendorOrgCode, + }) } if err != nil { @@ -1907,7 +1904,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor } dao.Commit(db, txDB) - if isStoreMapNeedSync(vendorID, valid) { + if isStoreMapNeedSync(vendorID, valid) || valid["address"] != nil { _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) } From 8800bbb7620deff45ccbf03d4c595bb94da23216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 29 Aug 2023 18:27:40 +0800 Subject: [PATCH 25/27] 1 --- business/jxstore/cms/store.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index a295fd12d..6b1f94137 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1838,6 +1838,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor // 增加门店地址修改同步 storeDetail, err := dao.GetStoreBaseByVendorStoreID(storeMap.VendorStoreID, storeMap.VendorID) + address := "" if err != nil || storeDetail == nil { return 0, fmt.Errorf("基础门店信息异常,请联系管理员") } @@ -1848,6 +1849,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor // 添加同步 valid["address"] = payload["address"].(string) syncStatus |= model.SyncFlagStoreName + address = payload["address"].(string) } if err == nil { @@ -1860,6 +1862,9 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor } }() + if address != "" { + delete(valid, "address") + } // storeMap 不包含address参数 if isStoreMapNeedSync(vendorID, valid) { // 对于store vendor map,只有Status改变才需要同步到厂商 num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{ @@ -1904,7 +1909,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor } dao.Commit(db, txDB) - if isStoreMapNeedSync(vendorID, valid) || valid["address"] != nil { + if isStoreMapNeedSync(vendorID, valid) || address != "" { _, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) } From edbc50ab7c15aa53327182387aab969df7283a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 30 Aug 2023 09:51:18 +0800 Subject: [PATCH 26/27] 1 --- business/jxstore/misc/misc.go | 2 +- business/partner/delivery/rider.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index c6e5e86c6..bc0b04b3c 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -181,7 +181,7 @@ func Init() { // 每五分钟轮询一次推送骑手信息坐标给美团 ScheduleTimerFuncByInterval(func() { delivery.GetOrderRiderInfoToPlatform("", 0) - }, 10*time.Second, 4*time.Minute) + }, 10*time.Second, 5*time.Minute) //每天晚上23:00更新抖店 审核状态 ScheduleTimerFunc("UpdateStorePoiStatus", func() { diff --git a/business/partner/delivery/rider.go b/business/partner/delivery/rider.go index 50daa32ba..4b88d04fb 100644 --- a/business/partner/delivery/rider.go +++ b/business/partner/delivery/rider.go @@ -438,7 +438,7 @@ func UpdateFakeWayBillToTiktok() { } // 推送完成时加多加十分钟,相当于是配送中状态多存货十分钟 if fakeWayBill[i].Status == model.WaybillStatusDelivered { - randTime += 480 + randTime += 1200 } fakeWayBill[i].StatusTime = time.Now().Add(time.Duration(randTime) * time.Second).Local() fakeWayBill[i].WaybillFinishedAt = time.Now() From c0860e7984d648ef9685cbf24566214a60edb70e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 30 Aug 2023 14:40:56 +0800 Subject: [PATCH 27/27] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E9=85=8D?= =?UTF-8?q?=E9=80=81=E8=AE=A2=E5=8D=95=E9=80=81=E8=BE=BE=E6=97=B6=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E8=AE=A2=E5=8D=95=E9=85=8D=E9=80=81=E7=8A=B6=E6=80=81?= =?UTF-8?q?,=E5=92=8C=E8=9C=82=E9=B8=9F=E5=BC=82=E5=B8=B8=E5=8F=91?= =?UTF-8?q?=E5=8D=95=E5=AD=98=E5=82=A8=E8=BF=90=E5=8D=95=E7=8A=B6=E6=80=81?= =?UTF-8?q?22=E5=AF=BC=E8=87=B4=E9=87=8D=E6=96=B0=E5=8F=91=E5=8D=95?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/delivery/fn/waybill.go | 3 +- business/partner/purchase/mtwm/order.go | 37 ++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/business/partner/delivery/fn/waybill.go b/business/partner/delivery/fn/waybill.go index bcfed0c4c..639a273b5 100644 --- a/business/partner/delivery/fn/waybill.go +++ b/business/partner/delivery/fn/waybill.go @@ -300,7 +300,8 @@ func OnWaybillMsg(msg *fnpsapi.OrderStatusNottify, resultParam *fnpsapi.ShortSta order.Status = model.WaybillStatusCanceled order.VendorStatus = utils.Int2Str(fnpsapi.OrderStatusAcceptCacle) case fnpsapi.OrderStatusException: // 5 异常 - order.Status = model.WaybillStatusDeliverFailed // 22 + order.Status = model.WaybillStatusCanceled // 22 + order.VendorStatus = utils.Int2Str(fnpsapi.OrderStatusException) default: globals.SugarLogger.Warnf("onWaybillMsg unknown msg:%v", msg) } diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index 43b68cf67..d886764c8 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -3,6 +3,7 @@ package mtwm import ( "errors" "fmt" + "git.rosy.net.cn/baseapi/platformapi/mtpsapi" "math" "net/url" "regexp" @@ -601,8 +602,42 @@ func (c *PurchaseHandler) SelfDeliverDelivering(order *model.GoodsOrder, userNam // SelfDeliverDelivered 自配送订单送达 func (c *PurchaseHandler) SelfDeliverDelivered(order *model.GoodsOrder, userName string) (err error) { + if globals.EnableMtwmStoreWrite { - err = getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "").OrderArrived(utils.Str2Int64(order.VendorOrderID)) + api := getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "") + db := dao.GetDB() + + err = api.OrderArrived(utils.Str2Int64(order.VendorOrderID)) + if err == nil { + riderInfo := &mtpsapi.RiderInfo{ + OrderId: order.VendorOrderID, + ThirdCarrierOrderId: order.VendorOrderID, + CourierName: "", + CourierPhone: "", + LogisticsProviderCode: "10015", // 商家自建配送 + LogisticsStatus: utils.Str2Int(mtwmapi.WaybillStatusDelivered), + Latitude: utils.Float64ToStr(jxutils.IntCoordinate2Standard(order.ConsigneeLat)), // 送达即为客户坐标 + Longitude: utils.Float64ToStr(jxutils.IntCoordinate2Standard(order.ConsigneeLng)), + } + waybills, _ := dao.GetWaybills(db, order.VendorOrderID, nil) + if len(waybills) == model.NO { + store, _ := dao.GetStoreDetail(db, jxutils.GetSaleStoreIDFromOrder(order), order.VendorID, order.VendorOrgCode) + riderInfo.CourierName = "老板" + riderInfo.CourierPhone = store.Tel1 + } else { + for _, v := range waybills { + if v.Status >= model.OrderStatusDelivering && v.Status <= model.OrderStatusFinished { + riderInfo.CourierName = v.CourierName + riderInfo.CourierPhone = v.CourierMobile + } + } + } + if riderInfo.CourierName == "" || riderInfo.CourierPhone == "" { + riderInfo.CourierName = "老板" + riderInfo.CourierPhone = "18048531223" + } + err = c.GetOrderRider(order.VendorOrgCode, order.VendorStoreID, utils.Struct2Map(riderInfo, "", true)) + } } return err }