- 实现GetStoresOrderSaleInfo
This commit is contained in:
@@ -28,11 +28,13 @@ type tWaybillExt struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type StoresOrderSaleInfo struct {
|
type StoresOrderSaleInfo struct {
|
||||||
StoreID int `json:"storeID"`
|
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||||
Status int `json:"status"`
|
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
|
||||||
Count int `json:"count"`
|
Status int `json:"status"`
|
||||||
SalePrice int64 `json:"salePrice"`
|
Count int `json:"count"`
|
||||||
ActualPay int64 `json:"actualPay"`
|
ShopPrice int64 `json:"shopPrice"`
|
||||||
|
SalePrice int64 `json:"salePrice"`
|
||||||
|
ActualPayPrice int64 `json:"actualPayPrice"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//此函数会被GetStoreOrderCountInfo2取代
|
//此函数会被GetStoreOrderCountInfo2取代
|
||||||
@@ -617,6 +619,32 @@ func (c *OrderManager) GetOrdersFinancial(ctx *jxcontext.Context, fromDateStr, t
|
|||||||
return pagedInfo, err
|
return pagedInfo, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *OrderManager) GetStoresOrderSaleInfo(ctx *jxcontext.Context, storeIDList []int, fromTime time.Time, toTime time.Time, statusList []int) (saleInfo *StoresOrderSaleInfo, err error) {
|
func (c *OrderManager) GetStoresOrderSaleInfo(ctx *jxcontext.Context, storeIDList []int, fromTime time.Time, toTime time.Time, statusList []int) (saleInfoList []*StoresOrderSaleInfo, err error) {
|
||||||
return saleInfo, err
|
if toTime.Sub(fromTime) > time.Hour*24*60 {
|
||||||
|
return nil, fmt.Errorf("查询时间范围不能超过2个月")
|
||||||
|
}
|
||||||
|
sql := `
|
||||||
|
SELECT IF(t1.jx_store_id > 0, t1.jx_store_id, t1.store_id) store_id, t1.vendor_id, IF(t1.status < ?, 0, t1.status) status,
|
||||||
|
COUNT(*) count, SUM(t1.shop_price) shop_price, SUM(t1.sale_price) sale_price, SUM(t1.actual_pay_price) actual_pay_price
|
||||||
|
FROM goods_order t1
|
||||||
|
WHERE t1.order_created_at >= ? AND t1.order_created_at <= ?
|
||||||
|
`
|
||||||
|
sqlParams := []interface{}{
|
||||||
|
model.OrderStatusEndBegin,
|
||||||
|
fromTime,
|
||||||
|
toTime,
|
||||||
|
}
|
||||||
|
if len(storeIDList) > 0 {
|
||||||
|
sql += " AND IF(t1.jx_store_id > 0, t1.jx_store_id, t1.store_id) IN (" + dao.GenQuestionMarks(len(storeIDList)) + ")"
|
||||||
|
sqlParams = append(sqlParams, storeIDList)
|
||||||
|
}
|
||||||
|
if len(statusList) > 0 {
|
||||||
|
sql += " AND t1.status IN (" + dao.GenQuestionMarks(len(statusList)) + ")"
|
||||||
|
sqlParams = append(sqlParams, statusList)
|
||||||
|
}
|
||||||
|
sql += `
|
||||||
|
GROUP BY 1,2,3
|
||||||
|
ORDER BY 1,2,3`
|
||||||
|
err = dao.GetRows(dao.GetDB(), &saleInfoList, sql, sqlParams...)
|
||||||
|
return saleInfoList, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -700,6 +700,15 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
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: "GetStoresOrderSaleInfo",
|
||||||
|
Router: `/GetStoresOrderSaleInfo`,
|
||||||
|
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.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: "GetWaybills",
|
Method: "GetWaybills",
|
||||||
|
|||||||
Reference in New Issue
Block a user