- GetOrderEvents
- idcard and licence for store
This commit is contained in:
@@ -489,3 +489,28 @@ func (c *OrderManager) GetWaybills(ctx *jxcontext.Context, fromDateStr, toDateSt
|
|||||||
dao.Commit(db)
|
dao.Commit(db)
|
||||||
return pagedInfo, err
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ func InitServiceInfo(version, buildDate, gitCommit string) {
|
|||||||
"waybillStatus": model.WaybillStatusName,
|
"waybillStatus": model.WaybillStatusName,
|
||||||
"bankName": model.BankName,
|
"bankName": model.BankName,
|
||||||
"promotionStatusName": model.PromotionStatusName,
|
"promotionStatusName": model.PromotionStatusName,
|
||||||
|
"orderTypeName": model.OrderTypeName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Init()
|
Init()
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ var (
|
|||||||
WaybillStatusCanceled: "WaybillStatusCanceled",
|
WaybillStatusCanceled: "WaybillStatusCanceled",
|
||||||
WaybillStatusFailed: "WaybillStatusFailed",
|
WaybillStatusFailed: "WaybillStatusFailed",
|
||||||
}
|
}
|
||||||
|
OrderTypeName = map[int]string{
|
||||||
|
OrderTypeOrder: "订单",
|
||||||
|
OrderTypeWaybill: "运单",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -125,19 +125,19 @@ func (w *Waybill) TableIndex() [][]string {
|
|||||||
|
|
||||||
// 包含订单与运单的状态及事件vendor status
|
// 包含订单与运单的状态及事件vendor status
|
||||||
type OrderStatus struct {
|
type OrderStatus struct {
|
||||||
ID int64 `orm:"column(id)"`
|
ID int64 `orm:"column(id)" json:"id"`
|
||||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)"`
|
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
||||||
VendorID int `orm:"column(vendor_id)"`
|
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||||
OrderType int // 0:订单,1:运单
|
OrderType int `json:"orderType"` // 0:订单,1:运单
|
||||||
RefVendorOrderID string `orm:"column(ref_vendor_order_id);size(48)"`
|
RefVendorOrderID string `orm:"column(ref_vendor_order_id);size(48)" json:"refVendorOrderID"`
|
||||||
RefVendorID int `orm:"column(ref_vendor_id)"`
|
RefVendorID int `orm:"column(ref_vendor_id)" json:"refVendorID"`
|
||||||
Status int // 如果Status为OrderStatusEvent,表示VendorStatus只是一个通知事件,不是状态变化
|
Status int `json:"status"` // 如果Status为OrderStatusEvent,表示VendorStatus只是一个通知事件,不是状态变化
|
||||||
VendorStatus string `orm:"size(255)"`
|
VendorStatus string `orm:"size(255)" json:"vendorStatus"`
|
||||||
StatusTime time.Time `orm:"type(datetime);index"`
|
StatusTime time.Time `orm:"type(datetime);index" json:"statusTime"`
|
||||||
DuplicatedCount int // 收到的重复状态转换(或消息)数,一般是由于重发造成的
|
DuplicatedCount int `json:"-"` // 收到的重复状态转换(或消息)数,一般是由于重发造成的
|
||||||
Remark string `orm:"size(255)"`
|
Remark string `orm:"size(255)" json:"remark"`
|
||||||
ModelTimeInfo
|
ModelTimeInfo `json:"-"`
|
||||||
LockStatus int `orm:"-"` // todo 只是用于传递状态,应该可以优化掉
|
LockStatus int `orm:"-" json:"-"` // todo 只是用于传递状态,应该可以优化掉
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *OrderStatus) TableIndex() [][]string {
|
func (v *OrderStatus) TableIndex() [][]string {
|
||||||
|
|||||||
@@ -18,7 +18,13 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
PromotionStatusName map[int]string
|
PromotionStatusName = map[int]string{
|
||||||
|
PromotionStatusLocalCreated: "未确认",
|
||||||
|
PromotionStatusRemoteFailed: "失败",
|
||||||
|
PromotionStatusRemoteCreated: "正常",
|
||||||
|
PromotionStatusCanceled: "取消",
|
||||||
|
PromotionStatusEnded: "结束",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
type Promotion struct {
|
type Promotion struct {
|
||||||
@@ -41,16 +47,6 @@ type Promotion struct {
|
|||||||
Remark string `orm:"type(text)" json:"-"`
|
Remark string `orm:"type(text)" json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
|
||||||
PromotionStatusName = map[int]string{
|
|
||||||
PromotionStatusLocalCreated: "创建中",
|
|
||||||
PromotionStatusRemoteFailed: "失败",
|
|
||||||
PromotionStatusRemoteCreated: "正常",
|
|
||||||
PromotionStatusCanceled: "取消",
|
|
||||||
PromotionStatusEnded: "结束",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*Promotion) TableUnique() [][]string {
|
func (*Promotion) TableUnique() [][]string {
|
||||||
return [][]string{
|
return [][]string{
|
||||||
[]string{"Name", "VendorID", "Type", "DeletedAt"},
|
[]string{"Name", "VendorID", "Type", "DeletedAt"},
|
||||||
|
|||||||
@@ -92,11 +92,6 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
CategoryTypeName map[int]string
|
|
||||||
SkuStatusName map[int]string
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
CategoryTypeName = map[int]string{
|
CategoryTypeName = map[int]string{
|
||||||
SkuCategoryNormal: "普通类别",
|
SkuCategoryNormal: "普通类别",
|
||||||
SkuCategorySpecial: "特殊类别",
|
SkuCategorySpecial: "特殊类别",
|
||||||
@@ -106,7 +101,7 @@ func init() {
|
|||||||
SkuStatusDontSale: "下架",
|
SkuStatusDontSale: "下架",
|
||||||
SkuStatusNormal: "上架",
|
SkuStatusNormal: "上架",
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
// 这个指的是厂商(比如京东到家,饿百)自已的商品分类,与商家自己的商品分类是两回事
|
// 这个指的是厂商(比如京东到家,饿百)自已的商品分类,与商家自己的商品分类是两回事
|
||||||
type SkuVendorCategory struct {
|
type SkuVendorCategory struct {
|
||||||
|
|||||||
@@ -24,13 +24,6 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
StoreStatusName map[int]string
|
|
||||||
DeliveryRangeTypeName map[int]string
|
|
||||||
DeliveryTypeName map[int]string
|
|
||||||
BankName map[string]string
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
StoreStatusName = map[int]string{
|
StoreStatusName = map[int]string{
|
||||||
StoreStatusDisabled: "禁用",
|
StoreStatusDisabled: "禁用",
|
||||||
StoreStatusClosed: "休息",
|
StoreStatusClosed: "休息",
|
||||||
@@ -109,7 +102,7 @@ func init() {
|
|||||||
"QLBANK": "齐鲁银行",
|
"QLBANK": "齐鲁银行",
|
||||||
"YDRCB": "尧都农村商业银行",
|
"YDRCB": "尧都农村商业银行",
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
type Store struct {
|
type Store struct {
|
||||||
ModelIDCULD
|
ModelIDCULD
|
||||||
@@ -130,6 +123,11 @@ type Store struct {
|
|||||||
DeliveryRange string `orm:"type(text)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon,则为逗号分隔坐标,分号分隔的坐标点(坐标与Lng和Lat一样,都是整数),比如 121361504,31189308;121420555,31150238。否则为半径,单位为米
|
DeliveryRange string `orm:"type(text)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon,则为逗号分隔坐标,分号分隔的坐标点(坐标与Lng和Lat一样,都是整数),比如 121361504,31189308;121420555,31150238。否则为半径,单位为米
|
||||||
Status int `json:"status"`
|
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:"-"`
|
DeliveryType int8 `orm:"-" json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -239,3 +239,19 @@ func (c *OrderController) GetWaybills() {
|
|||||||
return retVal, "", err
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -143,6 +143,14 @@ func init() {
|
|||||||
MethodParams: param.Make(),
|
MethodParams: param.Make(),
|
||||||
Params: nil})
|
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.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "GetOrderInfo",
|
Method: "GetOrderInfo",
|
||||||
|
|||||||
Reference in New Issue
Block a user