添加淘鲜达
This commit is contained in:
@@ -3,7 +3,9 @@ package delivery
|
||||
import (
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"math/big"
|
||||
"time"
|
||||
|
||||
@@ -19,6 +21,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
utilsTao "git.rosy.net.cn/jx-callback/business/partner/purchase/tao_vegetable"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
@@ -88,9 +91,6 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) {
|
||||
//3.当同一个订单已经上传了一次配送信息,如再次同步会更新配送信息,以最新的一次为准。
|
||||
//4.如订单已完成、已取消等状态发货将失败。
|
||||
for _, v := range orders {
|
||||
//if v.Status >= model.OrderStatusFinished || v.Status < model.OrderStatusDelivering {
|
||||
// continue
|
||||
//}
|
||||
if orderId == "" && v.VendorID == model.VendorIDDD { // 抖音门店订单除了三方配送回调时推送,不在主动推送配送消息
|
||||
continue
|
||||
}
|
||||
@@ -134,6 +134,7 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) {
|
||||
riderInfo.LogisticsStatus = v.Status
|
||||
}
|
||||
|
||||
taoDeliveryStatus := ""
|
||||
switch riderInfo.LogisticsStatus {
|
||||
case 5: // 呼叫骑手
|
||||
riderInfo.LogisticsStatus = 0
|
||||
@@ -147,12 +148,15 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) {
|
||||
case 20: //配送中
|
||||
riderInfo.LogisticsStatus = 20
|
||||
riderInfo.OpCode = tiktok_api.TiktokLogisticsRIDERPICKUP
|
||||
taoDeliveryStatus = tao_vegetable.OrderStatusDelivery // 配送中
|
||||
case 110: // 完成
|
||||
riderInfo.LogisticsStatus = 40
|
||||
riderInfo.OpCode = tiktok_api.TiktokLogisticsDELIVERED
|
||||
taoDeliveryStatus = tao_vegetable.OrderStatusDeliveryOver // 完成
|
||||
case 105: // 完成
|
||||
riderInfo.LogisticsStatus = 40
|
||||
riderInfo.OpCode = tiktok_api.TiktokLogisticsDELIVERED
|
||||
taoDeliveryStatus = tao_vegetable.OrderStatusDeliveryOver // 完成
|
||||
case 115: // 取消
|
||||
riderInfo.CourierName = ""
|
||||
riderInfo.CourierPhone = ""
|
||||
@@ -161,24 +165,28 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) {
|
||||
case 22, 0, 120: // 异常配送
|
||||
riderInfo.LogisticsStatus = 22
|
||||
riderInfo.OpCode = tiktok_api.TiktokLogisticsINDDELIVERYEXCEPTION
|
||||
taoDeliveryStatus = tao_vegetable.OrderStatusUserRejection // 完成
|
||||
default:
|
||||
continue
|
||||
}
|
||||
|
||||
if riderInfo.Longitude == "" {
|
||||
riderInfo.Longitude = utils.Float64ToStr(utils.Int2Float64(v.ConsigneeLng) / 1000000)
|
||||
}
|
||||
if riderInfo.Latitude == "" {
|
||||
riderInfo.Latitude = utils.Float64ToStr(utils.Int2Float64(v.ConsigneeLat) / 1000000)
|
||||
}
|
||||
|
||||
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), v.JxStoreID, 0, "")
|
||||
if riderInfo.CourierPhone == "" {
|
||||
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), v.JxStoreID, 0, "")
|
||||
if err == nil {
|
||||
riderInfo.CourierPhone = storeDetail.Tel1
|
||||
}
|
||||
riderInfo.CourierName = "老板"
|
||||
}
|
||||
|
||||
if riderInfo.Longitude == "" && riderInfo.LogisticsStatus != 105 {
|
||||
riderInfo.Longitude = utils.Float64ToStr(utils.Int2Float64(storeDetail.Lng) / 1000000)
|
||||
riderInfo.Latitude = utils.Float64ToStr(utils.Int2Float64(storeDetail.Lat) / 1000000)
|
||||
}
|
||||
if riderInfo.Longitude == "" && riderInfo.LogisticsStatus == 105 {
|
||||
riderInfo.Longitude = utils.Float64ToStr(utils.Int2Float64(v.ConsigneeLng) / 1000000)
|
||||
riderInfo.Latitude = utils.Float64ToStr(utils.Int2Float64(v.ConsigneeLat) / 1000000)
|
||||
}
|
||||
|
||||
if riderInfo.CourierPhone == "" {
|
||||
riderInfo.CourierName = "石锋"
|
||||
riderInfo.CourierPhone = "18048531223"
|
||||
@@ -186,6 +194,7 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) {
|
||||
if riderInfo.ThirdCarrierOrderId == "" {
|
||||
riderInfo.ThirdCarrierOrderId = riderInfo.OrderId + "_fake"
|
||||
}
|
||||
|
||||
// 目前只推送美团骑手信息
|
||||
switch v.VendorID {
|
||||
case model.VendorIDMTWM: // 美团订单
|
||||
@@ -212,6 +221,20 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) {
|
||||
continue
|
||||
case model.VendorIDJX: // 京西平台
|
||||
continue
|
||||
case model.VendorIDTaoVegetable: // 淘鲜达
|
||||
// 定时任务刷新骑手坐标
|
||||
if orderId == "" {
|
||||
if handler := partner.GetPurchaseOrderHandlerFromVendorID(v.VendorID); handler != nil {
|
||||
if err := handler.GetOrderRider(v.VendorOrgCode, v.VendorStoreID, utils.Struct2Map(riderInfo, "", true)); err != nil {
|
||||
globals.SugarLogger.Errorf("Error pushing meituan rider information :%s--%s--%v", v.VendorOrderID, utils.Format4Output(riderInfo, false), err)
|
||||
}
|
||||
}
|
||||
} else { // 订单状态改变 [配送中/用户签收/用户拒收]
|
||||
param := utilsTao.OrderStatusChangeDelivery(&v.GoodsOrder, taoDeliveryStatus)
|
||||
if err := api.TaoVegetableApi.DeliveryFinish(param); err != nil {
|
||||
globals.SugarLogger.Debugf("淘先达运单状态推送错误运单状态[%s],错误:%s", taoDeliveryStatus, err.Error())
|
||||
}
|
||||
}
|
||||
default:
|
||||
globals.SugarLogger.Errorf("Order source error, non system order: %s", v.VendorOrderID)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user