Beispiel #1
0
        /// <summary>
        /// 获取默认数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private async Task <ResponseBase> GetStatisticsRetailDefault(GetStatisticsRetailRequest request)
        {
            List <DbStatisticsRetailView> statisticsRetail = null;
            var statisticsTime = ComLib.GetAreaStatisticsTime(request.StartTime, request.EndTime);
            var limitShops     = string.Empty;
            var arealevel      = string.Empty;

            switch (_appTicket.DataLimitType)
            {
            case (int)DataLimitTypeEnum.All:
                var province = await _areaBll.GetProvince();

                statisticsRetail = await _reportBll.GetStatisticsRetail(string.Join(',', province.Select(p => p.AreaId)),
                                                                        statisticsTime.Item1, statisticsTime.Item2, AreaLevelEnum.Province);

                arealevel = AreaLevelEnum.Province;
                break;

            case (int)DataLimitTypeEnum.Area:
                if (!string.IsNullOrEmpty(_appTicket.DataLimitArea))
                {
                    var areaInfo = await ComLib.GetGetAreaStatisticsAreaId(_areaBll, _appTicket.DataLimitArea);

                    statisticsRetail = await _reportBll.GetStatisticsRetail(areaInfo.Item1, statisticsTime.Item1,
                                                                            statisticsTime.Item2, areaInfo.Item2);

                    arealevel = areaInfo.Item2;
                }
                break;

            case (int)DataLimitTypeEnum.Shop:
                limitShops = _appTicket.DataLimitShop;
                if (!string.IsNullOrEmpty(_appTicket.DataLimitShop))
                {
                    statisticsRetail = await _reportBll.GetStatisticsRetailByShop(_appTicket.DataLimitShop,
                                                                                  statisticsTime.Item1, statisticsTime.Item2);

                    arealevel = AreaLevelEnum.Street;
                }
                break;
            }
            var result = await GetStatisticsRetailView(statisticsTime.Item1, statisticsTime.Item2, statisticsRetail, request.Type, limitShops, arealevel);

            return(ResponseBase.Success(result));
        }