- 定单--->订单
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/baseapi/utils/routinepool"
|
||||
_ "git.rosy.net.cn/jx-callback/business/scheduler/defsch" // 导入缺省定单调度器
|
||||
_ "git.rosy.net.cn/jx-callback/business/scheduler/defsch" // 导入缺省订单调度器
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
@@ -213,7 +213,7 @@ func (c *OrderController) AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptI
|
||||
}
|
||||
|
||||
// 饿了么没有拣货这个状态,直接返回成功
|
||||
// 真实流程中也不会调用这个方法,因为接收定单后状态会直接转移到已拣货
|
||||
// 真实流程中也不会调用这个方法,因为接收订单后状态会直接转移到已拣货
|
||||
func (c *OrderController) PickedUpGoods(order *model.GoodsOrder) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -51,17 +51,17 @@ const (
|
||||
|
||||
OrderStatusUnknown = 0
|
||||
|
||||
OrderStatusNew = 5 // 新定单
|
||||
OrderStatusAdjust = 8 // 定单调整
|
||||
OrderStatusNew = 5 // 新订单
|
||||
OrderStatusAdjust = 8 // 订单调整
|
||||
OrderStatusAccepted = 10 // 已经接单,也即待出库,待拣货
|
||||
OrderStatusFinishedPickup = 15 // 拣货完成
|
||||
OrderStatusDelivering = 20 // 开始配送,配送员已取货,从这里开始就是运单消息了
|
||||
|
||||
OrderStatusEndBegin = 100 // 以上的状态就是结束状态
|
||||
OrderStatusDelivered = 105 // 妥投
|
||||
OrderStatusFinished = 110 // 定单已完成
|
||||
OrderStatusCanceled = 115 // 定单已取消
|
||||
OrderStatusFailed = 120 // 定单已失败
|
||||
OrderStatusFinished = 110 // 订单已完成
|
||||
OrderStatusCanceled = 115 // 订单已取消
|
||||
OrderStatusFailed = 120 // 订单已失败
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -38,7 +38,7 @@ type GoodsOrder struct {
|
||||
WaybillVendorID int `orm:"column(waybill_vendor_id)"`
|
||||
WaybillStatus int
|
||||
WaybillVendorStatus string `orm:"size(16)"`
|
||||
DuplicatedCount int // 重复新定单消息数,这个一般不是由于消息重发赞成的(消息重发由OrderStatus过滤),一般是业务逻辑赞成的
|
||||
DuplicatedCount int // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的
|
||||
OrderCreatedAt time.Time `orm:"type(datetime);index"`
|
||||
OrderFinishedAt time.Time `orm:"type(datetime)"`
|
||||
ModelTimeInfo
|
||||
@@ -69,7 +69,7 @@ type OrderSku struct {
|
||||
OrderCreatedAt time.Time `orm:"type(datetime);index"` // 分区考虑
|
||||
}
|
||||
|
||||
// 同样商品在一个定单中可能重复出现(比如搞活动时,相同商品价格不一样,第一个有优惠)
|
||||
// 同样商品在一个订单中可能重复出现(比如搞活动时,相同商品价格不一样,第一个有优惠)
|
||||
// 所以这里不能用唯一索引
|
||||
func (o *OrderSku) TableIndex() [][]string {
|
||||
return [][]string{
|
||||
@@ -90,7 +90,7 @@ type Waybill struct {
|
||||
VendorStatus string `orm:"size(16)"`
|
||||
ActualFee int64 // 实际要支付给快递公司的实际费用
|
||||
DesiredFee int64 // 根据合同计算出来的预期费用
|
||||
DuplicatedCount int // 重复新定单消息数,这个一般不是由于消息重发赞成的(消息重发由OrderStatus过滤),一般是业务逻辑赞成的
|
||||
DuplicatedCount int // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的
|
||||
WaybillCreatedAt time.Time `orm:"type(datetime);index"`
|
||||
WaybillFinishedAt time.Time `orm:"type(datetime)"`
|
||||
ModelTimeInfo
|
||||
@@ -109,16 +109,16 @@ func (w *Waybill) TableIndex() [][]string {
|
||||
}
|
||||
}
|
||||
|
||||
// 包含定单与运单的状态及事件vendor status
|
||||
// 包含订单与运单的状态及事件vendor status
|
||||
type OrderStatus struct {
|
||||
ID int64 `orm:"column(id)"`
|
||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)"`
|
||||
VendorID int `orm:"column(vendor_id)"`
|
||||
OrderType int // 0:定单,1:运单
|
||||
OrderType int // 0:订单,1:运单
|
||||
Status int // 如果Status为OrderStatusEvent,表示VendorStatus只是一个通知事件,不是状态变化
|
||||
VendorStatus string `orm:"size(16)"`
|
||||
StatusTime time.Time `orm:"type(datetime);index"`
|
||||
DuplicatedCount int // 收到的重复状态转换(或消息)数,一般是由于重发赞成的
|
||||
DuplicatedCount int // 收到的重复状态转换(或消息)数,一般是由于重发造成的
|
||||
ModelTimeInfo
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ func init() {
|
||||
scheduler.CurrentScheduler = sch
|
||||
}
|
||||
|
||||
// 以下是定单
|
||||
// 以下是订单
|
||||
func (s *DefScheduler) OnOrderNew(order *model.GoodsOrder) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ type Scheduler interface {
|
||||
RegisterPurchasePlatform(vendorID int, handler PurchasePlatformHandler)
|
||||
RegisterDeliveryPlatform(vendorID int, handler DeliveryPlatformHandler)
|
||||
|
||||
// 以下是定单
|
||||
// 以下是订单
|
||||
OnOrderNew(order *model.GoodsOrder) (err error)
|
||||
OnOrderAccepted(order *model.GoodsOrder) (err error)
|
||||
OnOrderStatusChanged(status *model.OrderStatus) (err error)
|
||||
|
||||
@@ -29,7 +29,7 @@ func InitOrder() {
|
||||
go orderMsgHandlerRoutine()
|
||||
|
||||
// todo 这样操作在有多个进程时,会有问题
|
||||
// 另外当前这个模式可能会出现同一个定单的消息,虽然远程推送过来顺序是对的,但经过处理后推送到freshfood时乱序(因为每个消息的处理时间是不确定的)
|
||||
// 另外当前这个模式可能会出现同一个订单的消息,虽然远程推送过来顺序是对的,但经过处理后推送到freshfood时乱序(因为每个消息的处理时间是不确定的)
|
||||
handlePendingOrderMsg()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user