diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index b5cefcad0..600a98c1b 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -489,3 +489,28 @@ func (c *OrderManager) GetWaybills(ctx *jxcontext.Context, fromDateStr, toDateSt dao.Commit(db) return pagedInfo, err } + +func (c *OrderManager) GetOrderEvents(ctx *jxcontext.Context, vendorOrderID string, vendorID int, orderType int) (statusList []*model.OrderStatus, err error) { + sql := ` + SELECT * + FROM order_status t1 + WHERE 1 = 1 + ` + sqlParams := []interface{}{ + vendorOrderID, + vendorID, + } + if orderType == -1 { + sql += " AND t1.ref_vendor_order_id = ? AND t1.ref_vendor_id = ?" + } else { + sql += " AND t1.vendor_order_id = ? AND t1.vendor_id = ? AND t1.order_type = ?" + sqlParams = append(sqlParams, orderType) + } + sql += " ORDER BY t1.status_time" + + db := dao.GetDB() + if err = dao.GetRows(db, &statusList, sql, sqlParams...); err != nil { + return nil, err + } + return statusList, nil +} diff --git a/business/jxstore/cms/cms.go b/business/jxstore/cms/cms.go index 6939709f0..d165c749e 100644 --- a/business/jxstore/cms/cms.go +++ b/business/jxstore/cms/cms.go @@ -41,6 +41,7 @@ func InitServiceInfo(version, buildDate, gitCommit string) { "waybillStatus": model.WaybillStatusName, "bankName": model.BankName, "promotionStatusName": model.PromotionStatusName, + "orderTypeName": model.OrderTypeName, }, } Init() diff --git a/business/model/const.go b/business/model/const.go index 92428ed01..6d633129d 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -56,6 +56,10 @@ var ( WaybillStatusCanceled: "WaybillStatusCanceled", WaybillStatusFailed: "WaybillStatusFailed", } + OrderTypeName = map[int]string{ + OrderTypeOrder: "订单", + OrderTypeWaybill: "运单", + } ) const ( diff --git a/business/model/order.go b/business/model/order.go index 2683a0fa0..54d43adc5 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -125,19 +125,19 @@ func (w *Waybill) TableIndex() [][]string { // 包含订单与运单的状态及事件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:运单 - RefVendorOrderID string `orm:"column(ref_vendor_order_id);size(48)"` - RefVendorID int `orm:"column(ref_vendor_id)"` - Status int // 如果Status为OrderStatusEvent,表示VendorStatus只是一个通知事件,不是状态变化 - VendorStatus string `orm:"size(255)"` - StatusTime time.Time `orm:"type(datetime);index"` - DuplicatedCount int // 收到的重复状态转换(或消息)数,一般是由于重发造成的 - Remark string `orm:"size(255)"` - ModelTimeInfo - LockStatus int `orm:"-"` // todo 只是用于传递状态,应该可以优化掉 + ID int64 `orm:"column(id)" json:"id"` + VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` + VendorID int `orm:"column(vendor_id)" json:"vendorID"` + OrderType int `json:"orderType"` // 0:订单,1:运单 + RefVendorOrderID string `orm:"column(ref_vendor_order_id);size(48)" json:"refVendorOrderID"` + RefVendorID int `orm:"column(ref_vendor_id)" json:"refVendorID"` + Status int `json:"status"` // 如果Status为OrderStatusEvent,表示VendorStatus只是一个通知事件,不是状态变化 + VendorStatus string `orm:"size(255)" json:"vendorStatus"` + StatusTime time.Time `orm:"type(datetime);index" json:"statusTime"` + DuplicatedCount int `json:"-"` // 收到的重复状态转换(或消息)数,一般是由于重发造成的 + Remark string `orm:"size(255)" json:"remark"` + ModelTimeInfo `json:"-"` + LockStatus int `orm:"-" json:"-"` // todo 只是用于传递状态,应该可以优化掉 } func (v *OrderStatus) TableIndex() [][]string { diff --git a/business/model/promotion.go b/business/model/promotion.go index 7cd64c31a..2d33f2101 100644 --- a/business/model/promotion.go +++ b/business/model/promotion.go @@ -18,7 +18,13 @@ const ( ) var ( - PromotionStatusName map[int]string + PromotionStatusName = map[int]string{ + PromotionStatusLocalCreated: "未确认", + PromotionStatusRemoteFailed: "失败", + PromotionStatusRemoteCreated: "正常", + PromotionStatusCanceled: "取消", + PromotionStatusEnded: "结束", + } ) type Promotion struct { @@ -41,16 +47,6 @@ type Promotion struct { Remark string `orm:"type(text)" json:"-"` } -func init() { - PromotionStatusName = map[int]string{ - PromotionStatusLocalCreated: "创建中", - PromotionStatusRemoteFailed: "失败", - PromotionStatusRemoteCreated: "正常", - PromotionStatusCanceled: "取消", - PromotionStatusEnded: "结束", - } -} - func (*Promotion) TableUnique() [][]string { return [][]string{ []string{"Name", "VendorID", "Type", "DeletedAt"}, diff --git a/business/model/sku.go b/business/model/sku.go index 28285ffe3..d6ce6847a 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -92,11 +92,6 @@ var ( ) var ( - CategoryTypeName map[int]string - SkuStatusName map[int]string -) - -func init() { CategoryTypeName = map[int]string{ SkuCategoryNormal: "普通类别", SkuCategorySpecial: "特殊类别", @@ -106,7 +101,7 @@ func init() { SkuStatusDontSale: "下架", SkuStatusNormal: "上架", } -} +) // 这个指的是厂商(比如京东到家,饿百)自已的商品分类,与商家自己的商品分类是两回事 type SkuVendorCategory struct { diff --git a/business/model/store.go b/business/model/store.go index b7ada8b7b..bb0404774 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -24,13 +24,6 @@ const ( ) var ( - StoreStatusName map[int]string - DeliveryRangeTypeName map[int]string - DeliveryTypeName map[int]string - BankName map[string]string -) - -func init() { StoreStatusName = map[int]string{ StoreStatusDisabled: "禁用", StoreStatusClosed: "休息", @@ -109,7 +102,7 @@ func init() { "QLBANK": "齐鲁银行", "YDRCB": "尧都农村商业银行", } -} +) type Store struct { ModelIDCULD @@ -130,6 +123,11 @@ type Store struct { DeliveryRange string `orm:"type(text)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon,则为逗号分隔坐标,分号分隔的坐标点(坐标与Lng和Lat一样,都是整数),比如 121361504,31189308;121420555,31150238。否则为半径,单位为米 Status int `json:"status"` + IDCardFront string `orm:"size(255);column(id_card_front)" json:"idCardFront"` + IDCardBack string `orm:"size(255);column(id_card_back)" json:"idCardBack"` + IDCardHand string `orm:"size(255);column(id_card_hand)" json:"idCardHand"` + Licence string `orm:"size(255)" json:"licence"` + DeliveryType int8 `orm:"-" json:"-"` } diff --git a/controllers/jx_order.go b/controllers/jx_order.go index 1a0b58073..3547777c9 100644 --- a/controllers/jx_order.go +++ b/controllers/jx_order.go @@ -239,3 +239,19 @@ func (c *OrderController) GetWaybills() { return retVal, "", err }) } + +// @Title 查询订单/运单事件 +// @Description 查询订单/运单事件 +// @Param token header string true "认证token" +// @Param vendorOrderID query string true "订单/运单ID" +// @Param vendorID query int true "订单/运单所属厂商ID)" +// @Param orderType query int true "订单:0;运单:1;订单+运单:-1" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /GetOrderEvents [get] +func (c *OrderController) GetOrderEvents() { + c.callGetOrderEvents(func(params *tOrderGetOrderEventsParams) (retVal interface{}, errCode string, err error) { + retVal, err = orderman.FixedOrderManager.GetOrderEvents(params.Ctx, params.VendorOrderID, params.VendorID, params.OrderType) + return retVal, "", err + }) +} diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index 02801677d..287f04ab3 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -143,6 +143,14 @@ func init() { MethodParams: param.Make(), Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"], + beego.ControllerComments{ + Method: "GetOrderEvents", + Router: `/GetOrderEvents`, + AllowHTTPMethods: []string{"get"}, + MethodParams: param.Make(), + Params: nil}) + beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"], beego.ControllerComments{ Method: "GetOrderInfo",