- set the order status to the proper value when there is a early message camme(saveOrder).
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
package model
|
||
|
||
import "time"
|
||
|
||
func Order2Status(order *GoodsOrder) (retVal *OrderStatus) {
|
||
retVal = &OrderStatus{
|
||
VendorOrderID: order.VendorOrderID,
|
||
VendorID: order.VendorID,
|
||
OrderType: OrderTypeOrder,
|
||
RefVendorOrderID: order.VendorOrderID,
|
||
RefVendorID: order.VendorID,
|
||
Status: order.Status,
|
||
VendorStatus: order.VendorStatus,
|
||
StatusTime: order.StatusTime,
|
||
}
|
||
return retVal
|
||
}
|
||
|
||
func Waybill2Status(bill *Waybill) (retVal *OrderStatus) {
|
||
retVal = &OrderStatus{
|
||
VendorOrderID: bill.VendorWaybillID,
|
||
VendorID: bill.WaybillVendorID,
|
||
OrderType: OrderTypeWaybill,
|
||
RefVendorOrderID: bill.VendorOrderID,
|
||
RefVendorID: bill.OrderVendorID,
|
||
Status: bill.Status,
|
||
VendorStatus: bill.VendorStatus,
|
||
StatusTime: bill.StatusTime,
|
||
}
|
||
return retVal
|
||
}
|
||
|
||
// 判断订单是否是临时的,不是真实收到了new order消息后的订单
|
||
func IsOrderSolid(order *GoodsOrder) bool {
|
||
return !(order.ConsigneeName == "" && order.ID == 0)
|
||
}
|
||
|
||
func (o *GoodsOrder) GetStatusTime() time.Time {
|
||
return o.StatusTime
|
||
}
|
||
|
||
func (o *Waybill) GetStatusTime() time.Time {
|
||
return o.StatusTime
|
||
}
|
||
|
||
func (o *OrderStatus) GetStatusTime() time.Time {
|
||
return o.StatusTime
|
||
}
|