From 9a3eb3594910ab546168857952d351eac6be741c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 21 Sep 2020 14:51:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/order.go | 9 +++++---- business/partner/purchase/jdshop/callback.go | 17 +++++++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/business/model/order.go b/business/model/order.go index 4c6eeb301..99cc1a475 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -28,10 +28,11 @@ const ( ) const ( - OrderTypeNormal = 0 //普通订单 - OrderTypeMatter = 1 //物料订单 - OrderTypeSupplyGoods = 2 //进货订单 - OrderTypeDefendPrice = 3 //守价订单 + OrderTypeAddressErr = -1 //地址异常订单 + OrderTypeNormal = 0 //普通订单 + OrderTypeMatter = 1 //物料订单 + OrderTypeSupplyGoods = 2 //进货订单 + OrderTypeDefendPrice = 3 //守价订单 ) var ( diff --git a/business/partner/purchase/jdshop/callback.go b/business/partner/purchase/jdshop/callback.go index 2cbb92430..8664854eb 100644 --- a/business/partner/purchase/jdshop/callback.go +++ b/business/partner/purchase/jdshop/callback.go @@ -70,13 +70,11 @@ func SaveJdsOrders(msg *jdshopapi.CallBackResult) (err error) { if err != nil || order == nil { return err } - // order.StoreID = 102919 - // order.JxStoreID = 102919 - // order.StoreName = "商城模板(成都发货)" - // order.VendorStoreID = model.JdShopMainVendorStoreID - // order.DeliveryFlag = model.OrderDeliveryFlagMaskScheduleDisabled partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order)) noticeMsg := fmt.Sprintf("京东商城新订单,订单号:[%v] ,将要发到的门店id:[%v] , 门店名:[%v]", order.VendorOrderID, order.StoreID, order.StoreName) + if order.OrderType == model.OrderTypeAddressErr { + noticeMsg += " 此订单地址有问题,需要矫正坐标!" + } ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "DDC5657B43EE11E9A9FF525400E86DC0", "京东商城来新订单了!", noticeMsg) ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "1439B3E07D3911EA881A525400E86DC0", "京东商城来新订单了!", noticeMsg) return err @@ -118,11 +116,15 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err if err = err2; err != nil { globals.SugarLogger.Infof("高德page err: %v", err) } + lng2, lat2, _ := api.AutonaviAPI.GetCoordinateFromAddress(order.ConsigneeAddress, "") + distance := jxutils.EarthDistance(lng, lat, lng2, lat2) + if distance > 1 { + order.OrderType = model.OrderTypeAddressErr + } if err == nil && lng != 0 && lat != 0 { order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng) order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat) } else { - lng2, lat2, _ := api.AutonaviAPI.GetCoordinateFromAddress(order.ConsigneeAddress, "") order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng2) order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat2) } @@ -231,6 +233,9 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err } } setJdsOrderSeq(order) + if order.OrderType == model.OrderTypeAddressErr { + buildOrderTo102919(order) + } return order, err }