diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index 4cf4f4299..b06aa606c 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -27,42 +27,6 @@ type tWaybillExt struct { StoreID int `json:"storeID" orm:"column(store_id)"` } -// todo 此函数可被GetOrders取代 -func (c *OrderManager) GetStoreOrderInfo(ctx *jxcontext.Context, storeID string, lastHours int, fromStatus, toStatus, offset, pageSize int) (orders []*model.GoodsOrderExt, err error) { - globals.SugarLogger.Debugf("GetStoreOrderInfo storeID:%s", storeID) - if lastHours > maxLastHours { - lastHours = maxLastHours - } else if lastHours == 0 { - lastHours = defLastHours - } - if toStatus == 0 { - toStatus = fromStatus - } - if offset < 0 { - offset = 0 - } - pageSize = jxutils.FormalizePageSize(pageSize) - - db := orm.NewOrm() - _, err = db.Raw(` - SELECT t1.*, - t2.status waybill_status, t2.courier_name, t2.courier_mobile, - t2.actual_fee, t2.desired_fee, t2.waybill_created_at, t2.waybill_finished_at - FROM goods_order t1 - LEFT JOIN waybill t2 ON t1.vendor_waybill_id = t2.vendor_waybill_id AND t1.waybill_vendor_id = t2.waybill_vendor_id - WHERE t1.vendor_id <> 2 AND IF(t1.vendor_id = ?, t1.store_id, IF(t1.jx_store_id != 0, t1.jx_store_id, t1.store_id) ) = ? - AND t1.order_created_at >= ? - AND t1.Status >= ? AND t1.Status <= ? - ORDER BY t1.status, t1.order_created_at - LIMIT ? OFFSET ? - `, model.VendorIDWSC, storeID, time.Now().Add(-time.Duration(lastHours)*time.Hour), fromStatus, toStatus, pageSize, offset).QueryRows(&orders) - if err == nil { - return orders, nil - } - globals.SugarLogger.Infof("GetStoreOrderInfo storeID:%s failed with error:%v", storeID, err) - return nil, err -} - func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID string, lastHours int) (countInfo []*model.GoodsOrderCountInfo, err error) { globals.SugarLogger.Debugf("GetStoreOrderCountInfo storeID:%s", storeID) if lastHours > maxLastHours { @@ -252,14 +216,18 @@ func (c *OrderManager) GetOrders(ctx *jxcontext.Context, fromDateStr, toDateStr // 如果搜索关键字可能为订单号,则当成订单号查询 if params["keyword"] != nil { if jxutils.GetPossibleVendorIDFromVendorOrderID(params["keyword"].(string)) > model.VendorIDUnknown { - params["orderID"] = params["keyword"] + params["vendorOrderID"] = params["keyword"] } } - if params["orderID"] != nil { + if params["orderID"] != nil || params["vendorOrderID"] != nil { sqlWhere = " WHERE (t1.vendor_order_id = ? OR t1.vendor_order_id2 = ?)" + vendorOrderID := params["vendorOrderID"] + if vendorOrderID == nil { + vendorOrderID = params["orderID"] + } sqlParams = []interface{}{ - params["orderID"], - params["orderID"], + vendorOrderID, + vendorOrderID, } } else { fromDate, err2 := utils.TryStr2Time(fromDateStr) @@ -338,6 +306,16 @@ func (c *OrderManager) GetOrders(ctx *jxcontext.Context, fromDateStr, toDateStr sqlParams = append(sqlParams, statuss) } } + if params["lockStatuss"] != nil { + var lockStatuss []int + if err = utils.UnmarshalUseNumber([]byte(params["lockStatuss"].(string)), &lockStatuss); err != nil { + return nil, err + } + if len(lockStatuss) > 0 { + sqlWhere += " AND t1.lock_status IN (" + dao.GenQuestionMarks(len(lockStatuss)) + ")" + sqlParams = append(sqlParams, lockStatuss) + } + } if params["cities"] != nil { var cities []int if err = utils.UnmarshalUseNumber([]byte(params["cities"].(string)), &cities); err != nil { diff --git a/controllers/jx_order.go b/controllers/jx_order.go index e0c4229f3..43212a76a 100644 --- a/controllers/jx_order.go +++ b/controllers/jx_order.go @@ -25,7 +25,6 @@ type OrderController struct { } func (c *OrderController) URLMapping() { - c.Mapping("GetStoreOrderInfo", c.GetStoreOrderInfo) c.Mapping("GetOrderSkuInfo", c.GetOrderSkuInfo) c.Mapping("FinishedPickup", c.FinishedPickup) @@ -126,25 +125,6 @@ func (c *OrderController) GetStoreOrderCountInfo() { }) } -// @Title 得到门店订单状态信息 -// @Description 得到门店订单状态信息 -// @Param token header string true "认证token" -// @Param storeID query string true "京西门店ID" -// @Param lastHours query int false "最近多少小时的信息(缺省为两天)" -// @Param fromStatus query int true "起始状态(包括)" -// @Param toStatus query int false "结束状态(包括)" -// @Param offset query int false "订单列表起始序号(以0开始,缺省为0)" -// @Param pageSize query int false "订单列表页大小(缺省为50,-1表示全部)" -// @Success 200 {object} controllers.CallResult -// @Failure 200 {object} controllers.CallResult -// @router /GetStoreOrderInfo [get] -func (c *OrderController) GetStoreOrderInfo() { - c.callGetStoreOrderInfo(func(params *tOrderGetStoreOrderInfoParams) (retVal interface{}, errCode string, err error) { - retVal, err = orderman.FixedOrderManager.GetStoreOrderInfo(params.Ctx, params.StoreID, params.LastHours, params.FromStatus, params.ToStatus, params.Offset, params.PageSize) - return retVal, "", err - }) -} - // @Title 得到订单SKU信息 // @Description 得到订单SKU信息 // @Param token header string true "认证token" @@ -223,7 +203,8 @@ func (c *OrderController) ExportMTWaybills() { // @Title 查询订单 // @Description 查询订单 // @Param token header string true "认证token" -// @Param orderID query string false "订单号,如果此项不为空,忽略其它所有查询条件" +// @Param orderID query string false "订单号,如果此项不为空,忽略其它所有查询条件(此项会废弃,用vendorOderID)" +// @Param vendorOrderID query string false "订单号,如果此项不为空,忽略其它所有查询条件" // @Param keyword query string false "查询关键字" // @Param fromDate query string false "开始日期(包含),格式(2006-01-02),如果订单号为空此项必须要求" // @Param toDate query string false "结束日期(包含),格式(2006-01-02),如果订单号为空此项必须要求" @@ -231,6 +212,7 @@ func (c *OrderController) ExportMTWaybills() { // @Param waybillVendorIDs query string false "承运人所属厂商列表[1,2,3],缺省不限制" // @Param storeIDs query string false "京西门店ID列表[1,2,3],缺省不限制" // @Param statuss query string false "订单状态列表[1,2,3],缺省不限制" +// @Param lockStatuss query string false "订单锁定状态列表[1,2,3],缺省不限制" // @Param cities query string false "城市code列表[1,2,3],缺省不限制" // @Param offset query int false "结果起始序号(以0开始,缺省为0)" // @Param pageSize query int false "结果页大小(缺省为50,-1表示全部)" diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index d665663ce..332abb819 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -628,15 +628,6 @@ func init() { Filters: 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: "GetStoreOrderInfo", - Router: `/GetStoreOrderInfo`, - AllowHTTPMethods: []string{"get"}, - MethodParams: param.Make(), - Filters: 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: "GetWaybills",