/// <summary> /// 获取店铺下某个门店的每天的业绩排行 /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <returns></returns> public DataGridModel <BranchShopDayFeat> GetBranchShopFeat(DateTime?startDate = null, DateTime?endDate = null, int pageNo = 1, int pageSize = 10) { if (!startDate.HasValue) { startDate = DateTime.Now.Date.AddDays(-7); } if (!endDate.HasValue) { endDate = DateTime.Now.Date; } CheckUserLogin(); if (startDate.HasValue && startDate.Value < CurrentShopBranch.CreateDate) { startDate = CurrentShopBranch.CreateDate.Date; } BranchShopDayFeatsQuery query = new BranchShopDayFeatsQuery(); query.StartDate = startDate.Value; query.EndDate = endDate.Value; query.ShopId = CurrentShopBranch.ShopId; query.BranchShopId = CurrentShopBranch.Id; query.PageNo = pageNo; query.PageSize = pageSize; var model = Himall.Application.OrderAndSaleStatisticsApplication.GetDayAmountSale(query); DataGridModel <BranchShopDayFeat> result = new DataGridModel <BranchShopDayFeat>() { rows = model.Models, total = model.Total }; return(result); }
// GET: Web/Home public ActionResult Index2() { BranchShopDayFeatsQuery query = new BranchShopDayFeatsQuery(); query.StartDate = DateTime.Now.Date.AddDays(-10); query.EndDate = DateTime.Now.Date; query.ShopId = 288; query.BranchShopId = 21; var model = Himall.Application.OrderAndSaleStatisticsApplication.GetDayAmountSale(query); return(View()); }
/// <summary> /// 店铺下某个门店每天的销售排行及销量 /// </summary> /// <param name="query"></param> /// <returns></returns> public static QueryPageModel <BranchShopDayFeat> GetDayAmountSale(BranchShopDayFeatsQuery query) { var list = _iOrderAndSaleStatisticsService.GetDayAmountSale(query.StartDate, query.EndDate, query.BranchShopId); var pageList = list.Skip((query.PageNo - 1) * query.PageSize).Take(query.PageSize).ToList(); foreach (var m in pageList) { m.Rank = _iOrderAndSaleStatisticsService.GetRank(m.Day, query.ShopId, m.SaleAmount); } QueryPageModel <BranchShopDayFeat> result = new QueryPageModel <BranchShopDayFeat>(); result.Total = list.Count(); result.Models = pageList; return(result); }