This commit is contained in:
邹宗楠
2026-01-07 15:21:22 +08:00
parent f63d8d0bc8
commit 5ee8f4c32a
10 changed files with 62078 additions and 61291 deletions

View File

@@ -697,42 +697,41 @@ func (c *PurchaseHandler) SelfDeliverDelivered(order *model.GoodsOrder, userName
api := getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "")
db := dao.GetDB()
err = api.OrderArrived(utils.Str2Int64(order.VendorOrderID))
if err == nil {
riderInfo := &utils.RiderInfo{
OrderId: order.VendorOrderID,
ThirdCarrierOrderId: order.VendorWaybillID,
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 = "老板1"
riderInfo.CourierPhone = store.Tel1
riderInfo.ThirdCarrierOrderId = order.VendorOrderID
} else {
for _, v := range waybills {
if v.Status != model.OrderStatusCanceled && v.Status != model.OrderStatusFinished && v.Status != model.OrderStatusEndEnd {
riderInfo.CourierName = v.CourierName
riderInfo.CourierPhone = v.CourierMobile
riderInfo.ThirdCarrierOrderId = v.VendorWaybillID
continue
}
riderInfo := &utils.RiderInfo{
OrderId: order.VendorOrderID,
ThirdCarrierOrderId: order.VendorWaybillID,
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 = "老板1"
riderInfo.CourierPhone = store.Tel1
riderInfo.ThirdCarrierOrderId = order.VendorOrderID
} else {
for _, v := range waybills {
if v.Status != model.OrderStatusCanceled && v.Status != model.OrderStatusFinished && v.Status != model.OrderStatusEndEnd {
riderInfo.CourierName = v.CourierName
riderInfo.CourierPhone = v.CourierMobile
riderInfo.ThirdCarrierOrderId = v.VendorWaybillID
continue
}
}
if riderInfo.CourierName == "" || riderInfo.CourierPhone == "" {
riderInfo.CourierName = "老板2"
riderInfo.CourierPhone = "18048531223"
}
if riderInfo.ThirdCarrierOrderId == "" {
riderInfo.ThirdCarrierOrderId = order.VendorOrderID
}
err = c.GetOrderRider(order.VendorOrgCode, order.VendorStoreID, utils.Struct2Map(riderInfo, "", true))
}
if riderInfo.CourierName == "" || riderInfo.CourierPhone == "" {
riderInfo.CourierName = "老板2"
riderInfo.CourierPhone = "18048531223"
}
if riderInfo.ThirdCarrierOrderId == "" {
riderInfo.ThirdCarrierOrderId = order.VendorOrderID
}
if err = c.GetOrderRider(order.VendorOrgCode, order.VendorStoreID, utils.Struct2Map(riderInfo, "", true)); err == nil {
err = api.OrderArrived(utils.Str2Int64(order.VendorOrderID))
}
}
return err