sfps
This commit is contained in:
@@ -3,6 +3,7 @@ package delivery
|
||||
import (
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"math/big"
|
||||
"time"
|
||||
|
||||
@@ -100,7 +101,7 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) {
|
||||
}
|
||||
|
||||
if orderId == "" { // 订单id为空是,是定时轮询操作,不做此状态
|
||||
waybillList, _ := dao.GetWaybills(dao.GetDB(), v.VendorOrderID)
|
||||
waybillList, _ := dao.GetWaybills(dao.GetDB(), v.VendorOrderID, nil)
|
||||
if len(waybillList) > 0 && waybillList[0].Status > model.WaybillStatusEndBegin {
|
||||
globals.SugarLogger.Debugf("订单物流状态结束,不在推送订单状态:orderID[%s],wayBillId[%s]", v.VendorOrderID, waybillList[0].VendorWaybillID)
|
||||
continue
|
||||
@@ -207,6 +208,8 @@ func GetOrderRiderInfoToPlatform(orderId string, wayBillStatus int) {
|
||||
continue
|
||||
case model.VendorIDDD: // 抖店小时达
|
||||
continue
|
||||
case model.VendorIDJX: // 京西平台
|
||||
continue
|
||||
default:
|
||||
globals.SugarLogger.Errorf("Order source error, non system order: %s", v.VendorOrderID)
|
||||
continue
|
||||
@@ -277,6 +280,14 @@ func UpdateOrder2Complete() {
|
||||
}
|
||||
|
||||
func makeRiderInfo(fakeWayBill *model.Waybill, riderInfo *mtpsapi.RiderInfo) {
|
||||
order, _ := partner.CurOrderManager.LoadOrder(fakeWayBill.VendorOrderID, fakeWayBill.OrderVendorID)
|
||||
storeId := 0
|
||||
if order.StoreID != 0 {
|
||||
storeId = order.StoreID
|
||||
} else {
|
||||
storeId = order.JxStoreID
|
||||
}
|
||||
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), storeId, order.VendorID, order.VendorOrgCode)
|
||||
switch fakeWayBill.Status {
|
||||
case 5: // 呼叫骑手
|
||||
riderInfo.LogisticsContext = "呼叫骑手,新建运单"
|
||||
@@ -290,8 +301,10 @@ func makeRiderInfo(fakeWayBill *model.Waybill, riderInfo *mtpsapi.RiderInfo) {
|
||||
fakeWayBill.VendorStatus = utils.Int64ToStr(model.WaybillStatusCourierAssigned)
|
||||
case 12: // 骑手接单
|
||||
riderInfo.LogisticsContext = model.RiderWaitGetGoods
|
||||
riderInfo.LogisticsStatus = 12
|
||||
riderInfo.LogisticsStatus = 10
|
||||
riderInfo.OpCode = tiktok_api.TiktokLogisticsORDERRECEIVED
|
||||
riderInfo.Latitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lat))
|
||||
riderInfo.Longitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lng))
|
||||
// 下一状态以及推送时间
|
||||
fakeWayBill.Status = model.WaybillStatusCourierArrived
|
||||
fakeWayBill.VendorStatus = utils.Int64ToStr(model.WaybillStatusCourierArrived)
|
||||
@@ -299,6 +312,8 @@ func makeRiderInfo(fakeWayBill *model.Waybill, riderInfo *mtpsapi.RiderInfo) {
|
||||
riderInfo.LogisticsContext = model.RiderToStore
|
||||
riderInfo.LogisticsStatus = 15
|
||||
riderInfo.OpCode = tiktok_api.TiktokLogisticsRIDERARRIVED
|
||||
riderInfo.Latitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lat))
|
||||
riderInfo.Longitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lng))
|
||||
// 下一状态以及推送时间
|
||||
fakeWayBill.Status = model.WaybillStatusDelivering
|
||||
fakeWayBill.VendorStatus = utils.Int64ToStr(model.WaybillStatusDelivering)
|
||||
@@ -306,6 +321,8 @@ func makeRiderInfo(fakeWayBill *model.Waybill, riderInfo *mtpsapi.RiderInfo) {
|
||||
riderInfo.LogisticsContext = model.RiderGetOrderDelivering
|
||||
riderInfo.LogisticsStatus = 20
|
||||
riderInfo.OpCode = tiktok_api.TiktokLogisticsRIDERPICKUP
|
||||
riderInfo.Latitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lat))
|
||||
riderInfo.Longitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lng))
|
||||
// 下一状态以及推送时间
|
||||
fakeWayBill.Status = model.WaybillStatusDelivered
|
||||
fakeWayBill.VendorStatus = utils.Int64ToStr(model.WaybillStatusDelivered)
|
||||
@@ -313,6 +330,8 @@ func makeRiderInfo(fakeWayBill *model.Waybill, riderInfo *mtpsapi.RiderInfo) {
|
||||
riderInfo.LogisticsContext = model.RiderGetOrderDelivered
|
||||
riderInfo.LogisticsStatus = 40
|
||||
riderInfo.OpCode = tiktok_api.TiktokLogisticsDELIVERED
|
||||
riderInfo.Latitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(order.ConsigneeLat))
|
||||
riderInfo.Longitude = utils.Float64ToStr(jxutils.IntCoordinate2Standard(order.ConsigneeLng))
|
||||
// 下一状态以及推送时间
|
||||
fakeWayBill.Status = model.WaybillStatusFailed
|
||||
fakeWayBill.VendorStatus = utils.Int64ToStr(model.WaybillStatusFailed)
|
||||
@@ -322,7 +341,7 @@ func makeRiderInfo(fakeWayBill *model.Waybill, riderInfo *mtpsapi.RiderInfo) {
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateFakeWayBillToTiktok 轮询更新假订单到抖音
|
||||
// UpdateFakeWayBillToTiktok 轮询更新假订单到抖音(抖音/美团/饿百)
|
||||
func UpdateFakeWayBillToTiktok() {
|
||||
scheduleTimer, _ := rand.Int(rand.Reader, big.NewInt(1000))
|
||||
randTimeSchedule := scheduleTimer.Int64()
|
||||
@@ -354,6 +373,7 @@ func UpdateFakeWayBillToTiktok() {
|
||||
LogisticsStatus: fakeWayBill[i].Status,
|
||||
}
|
||||
|
||||
// 设置骑手和下一状态时间
|
||||
makeRiderInfo(fakeWayBill[i], riderInfo)
|
||||
|
||||
if riderInfo.LogisticsContext != model.RiderGetOrderDeliverFailed && riderInfo.LogisticsContext != model.RiderGetOrderDeliverOther && riderInfo.LogisticsContext != model.RiderWaitRider {
|
||||
@@ -398,7 +418,7 @@ func UpdateFakeWayBillToTiktok() {
|
||||
globals.SugarLogger.Debugf("UPDATA goods_order Err :%s", err.Error())
|
||||
}
|
||||
// 饿百订单推送订单送达
|
||||
if fakeWayBill[i].OrderVendorID == model.VendorIDEBAI {
|
||||
if fakeWayBill[i].OrderVendorID == model.VendorIDEBAI || fakeWayBill[i].OrderVendorID == model.VendorIDMTWM {
|
||||
if err := handler.Swtich2SelfDelivered(order, "JingXiAdmin"); err != nil {
|
||||
globals.SugarLogger.Errorf("Swtich2SelfDelivered err := %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user