diff --git a/business/jxcallback/scheduler/basesch/basesch.go b/business/jxcallback/scheduler/basesch/basesch.go index 74186005b..70ee190b5 100644 --- a/business/jxcallback/scheduler/basesch/basesch.go +++ b/business/jxcallback/scheduler/basesch/basesch.go @@ -247,8 +247,8 @@ func (c *BaseScheduler) CreateWaybill(platformVendorID int, order *model.GoodsOr func (c *BaseScheduler) CancelWaybill(bill *model.Waybill, cancelReasonID int, cancelReason string) (err error) { // 部分快递平台在取消成功后有时会不发运单取消消息过来(比如达达,904200512000442),为避免二次取消报错,添加状态判断 - if c.IsReallyCallPlatformAPI && bill.Status != model.WaybillStatusCanceled { //此行测试用 - //if c.IsReallyCallPlatformAPI && bill.OrderVendorID != bill.WaybillVendorID && bill.Status != model.WaybillStatusCanceled { + //if c.IsReallyCallPlatformAPI && bill.Status != model.WaybillStatusCanceled { //此行测试用 + 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 { diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index a4f11db8a..b0e06ba64 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -1099,7 +1099,6 @@ func (s *DefScheduler) loadSavedOrderFromMap(status *model.OrderStatus, isForceL var realSavedInfo *WatchOrderInfo if savedInfo, ok := s.orderMap.Load(universalOrderID); ok { realSavedInfo = savedInfo.(*WatchOrderInfo) - globals.SugarLogger.Debugf("loadSavedOrderFromMap savedInfo=%s", utils.Format4Output(savedInfo, false)) } else { realSavedInfo = NewWatchOrderInfo(nil) s.orderMap.StoreWithTimeout(universalOrderID, realSavedInfo, orderMapStoreMaxTime) diff --git a/business/jxcallback/scheduler/defsch/defsch_ext.go b/business/jxcallback/scheduler/defsch/defsch_ext.go index fe548f292..7fb14fd97 100644 --- a/business/jxcallback/scheduler/defsch/defsch_ext.go +++ b/business/jxcallback/scheduler/defsch/defsch_ext.go @@ -45,7 +45,7 @@ func (s *DefScheduler) SelfDeliveringAndUpdateStatus(ctx *jxcontext.Context, ven err = s.SelfDeliverDelivering(order, phone) } } else { - if (order.Status < model.OrderStatusDelivering) || (order.VendorID == model.VendorIDDD && order.Status <= model.OrderStatusDelivering) { + if order.Status < model.OrderStatusDelivering || (order.VendorID == model.VendorIDDD && order.Status <= model.OrderStatusDelivering) { err = s.Swtich2SelfDeliver(order, userName) } else if order.VendorID == order.WaybillVendorID { // 状态为配送中,且是购物平台运单,不能转自送了 err = scheduler.ErrOrderStatusIsNotSuitable4CurOperation diff --git a/business/partner/delivery/uupt/waybill.go b/business/partner/delivery/uupt/waybill.go index 221414ac2..5e8a5934b 100644 --- a/business/partner/delivery/uupt/waybill.go +++ b/business/partner/delivery/uupt/waybill.go @@ -2,9 +2,11 @@ package uupt import ( "fmt" + "git.rosy.net.cn/baseapi/platformapi/baidunavi" "git.rosy.net.cn/baseapi/platformapi/mtpsapi" "git.rosy.net.cn/baseapi/platformapi/uuptapi" "git.rosy.net.cn/baseapi/utils" + "git.rosy.net.cn/jx-callback/business/jxutils" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" @@ -151,7 +153,10 @@ func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee i "special_type": uuptapi.SpecialTypeNo, "callme_withtake": uuptapi.CallMeWithTakeYes, } - if orderCode, originID, err := api.UuAPI.AddOrder(param); err != nil { + //test + apis := uuptapi.New("ccba8bd4a2d54a2fb6df97e87979f303", "2815a7a1f8e3405d81fd6263683ec4e7", "910a0dfd12bb4bc0acec147bcb1ae246") + if orderCode, originID, err := apis.AddOrder(param); err != nil { + //if orderCode, originID, err := api.UuAPI.AddOrder(param); err != nil { return nil, err } else { bill = &model.Waybill{ @@ -160,7 +165,7 @@ func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee i VendorWaybillID: orderCode, VendorWaybillID2: originID, WaybillVendorID: model.VendorIDUUPT, - DesiredFee: utils.Str2Int64(price.NeedPayMoney), + DesiredFee: jxutils.StandardPrice2Int(utils.Str2Float64(price.NeedPayMoney)), } } delivery.OnWaybillCreated(bill) @@ -168,7 +173,9 @@ func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee i } func (d DeliveryHandler) CancelWaybill(bill *model.Waybill, cancelReasonID int, cancelReason string) (err error) { - if err = api.UuAPI.CancelOrder(bill.VendorWaybillID, uuptapi.CancelReasonNormal); err != nil { + apis := uuptapi.New("ccba8bd4a2d54a2fb6df97e87979f303", "2815a7a1f8e3405d81fd6263683ec4e7", "910a0dfd12bb4bc0acec147bcb1ae246") + if err = apis.CancelOrder(bill.VendorWaybillID, uuptapi.CancelReasonNormal); err != nil { + //if err = api.UuAPI.CancelOrder(bill.VendorWaybillID, uuptapi.CancelReasonNormal); err != nil { return err } bill.Status = model.WaybillStatusCanceled @@ -182,7 +189,7 @@ func (d DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo return nil, err } else { deliveryFeeInfo = &partner.WaybillFeeInfo{} - deliveryFeeInfo.DeliveryFee = utils.Str2Int64(orderPrice.NeedPayMoney) + deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(utils.Str2Float64(orderPrice.NeedPayMoney)) } return deliveryFeeInfo, err } @@ -232,32 +239,50 @@ func (d DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeison //辅助函数 func getOrderPrice(order *model.GoodsOrder) (orderPrice *uuptapi.GetOrderPriceResp, err error) { - store, err := dao.GetStoreDetail(dao.GetDB(), order.StoreID, 0, "") + store, err := dao.GetStoreDetail(dao.GetDB(), getReallyStoreID(order.StoreID, order.JxStoreID), 0, "") if err != nil { return nil, err } - address, _, err := dao.QueryUserDeliveryAddress(dao.GetDB(), order.AddressID, nil, 0, 0) - if err != nil || len(address) == 0 { - return nil, err - } + //转换百度坐标系 + var coords []*baidunavi.Coordinate + coords = append(coords, &baidunavi.Coordinate{ + Lng: jxutils.IntCoordinate2Standard(store.Lng), + Lat: jxutils.IntCoordinate2Standard(store.Lat), + }, &baidunavi.Coordinate{ + Lat: jxutils.IntCoordinate2Standard(order.ConsigneeLat), + Lng: jxutils.IntCoordinate2Standard(order.ConsigneeLng), + }) + coords, err = api.BaiDuNaviAPI.BatchCoordinateConvert(coords, baidunavi.CoordSysGCJ02, baidunavi.CoordSysBaiDu) param := map[string]interface{}{ "origin_id": order.VendorOrderID, "from_address": store.Address, "to_address": order.ConsigneeAddress, - "city_name": address[0].CityName, + "city_name": store.CityName, "send_type": uuptapi.SendTypeHelpMeDeliver, - "to_lat": order.ConsigneeLat, - "to_lng": order.ConsigneeLng, - "from_lat": store.Lat, - "from_lng": store.Lng, + "from_lat": coords[0].Lat, + "from_lng": coords[0].Lng, + "to_lat": coords[1].Lat, + "to_lng": coords[1].Lng, } - if orderPrice, err = api.UuAPI.GetOrderPrice(param); err != nil { + //test + apis := uuptapi.New("ccba8bd4a2d54a2fb6df97e87979f303", "2815a7a1f8e3405d81fd6263683ec4e7", "910a0dfd12bb4bc0acec147bcb1ae246") + if orderPrice, err = apis.GetOrderPrice(param); err != nil { + //if orderPrice, err = api.UuAPI.GetOrderPrice(param); err != nil { return nil, err } else { return orderPrice, nil } } - +func getReallyStoreID(storeID, jxStoreID int) int { + if storeID == 0 && jxStoreID == 0 { + return 0 + } + if storeID == 0 { + return jxStoreID + } else { + return storeID + } +} func OnWaybillMsg(req *uuptapi.WaybillCallbackParam) (resp *uuptapi.CallbackResponse) { param := &model.Waybill{ VendorOrderID: req.OriginID, diff --git a/business/partner/purchase/tiktok_store/transport.go b/business/partner/purchase/tiktok_store/transport.go deleted file mode 100644 index ef32b7246..000000000 --- a/business/partner/purchase/tiktok_store/transport.go +++ /dev/null @@ -1 +0,0 @@ -package tiktok_store diff --git a/business/partner/purchase/tiktok_store/transport_callback.go b/business/partner/purchase/tiktok_store/transport_callback.go deleted file mode 100644 index c54a3e7c8..000000000 --- a/business/partner/purchase/tiktok_store/transport_callback.go +++ /dev/null @@ -1,9 +0,0 @@ -package tiktok_store - -type TransportCallbackResp struct { - Tag string `json:"tag"` - MsgID string `json:"msgID"` -} - -type ShipmentInfo struct { -}