/// <summary> /// 获取销售记录数量 /// </summary> /// <param name="request"></param> /// <returns></returns> private async Task <int> GetSalesRecordsCount(GetSystemStatisticsRequest request) { var sql = string.Format("SELECT COUNT(1) from so_retail a inner join cm_shop b on a.shop_id = b.shop_id where {0}", request.GetQuerySql()); var result = await this.ExecuteScalarAsync(sql.ToString()); return(result.ToInt()); }
/// <summary> /// 获取门店数量 /// </summary> /// <param name="request"></param> /// <returns></returns> private async Task <int> GetShopCount(GetSystemStatisticsRequest request) { var sql = string.Format("SELECT COUNT(1) FROM cm_shop where {0}", request.GetQuerySql2()); var result = await this.ExecuteScalarAsync(sql.ToString()); return(result.ToInt()); }
/// <summary> /// 获取系统统计数据 /// </summary> /// <returns></returns> /// <param name="request"></param> public async Task <SystemStatisticsView> GetSystemStatistics(GetSystemStatisticsRequest request) { var shopCount = await GetShopCount(request); var salesRecordsCount = await GetSalesRecordsCount(request); return(new SystemStatisticsView() { ShopCount = shopCount, SalesRecordsCount = salesRecordsCount }); }
public async Task <ResponseBase> GetSystemStatistics() { try { var request = new GetSystemStatisticsRequest(); if (!ComLib.HandleRequest(HttpContext, request)) { return(ResponseBase.Success(new SystemStatisticsView())); } var data = await _systemBll.GetSystemStatistics(request); return(ResponseBase.Success(data)); } catch (Exception ex) { Log.Error(ex.Message, ex, this.GetType()); return(ResponseBase.CodeError()); } }
/// <summary> /// 获取系统统计数据 /// </summary> /// <returns></returns> /// <param name="request"></param> public async Task <SystemStatisticsView> GetSystemStatistics(GetSystemStatisticsRequest request) { return(await this._systemDal.GetSystemStatistics(request)); }