Beispiel #1
0
        /// <summary>
        /// 获取默认数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private async Task <ResponseBase> GetStatisticsPurchaseDefault(GetStatisticsPurchaseRequest request)
        {
            List <DbStatisticsPurchaseView> statisticsPurchase = 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();

                statisticsPurchase = await _reportBll.GetStatisticsPurchase(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);

                    statisticsPurchase = await _reportBll.GetStatisticsPurchase(areaInfo.Item1, statisticsTime.Item1,
                                                                                statisticsTime.Item2, areaInfo.Item2);

                    arealevel = areaInfo.Item2;
                }
                break;

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

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

            return(ResponseBase.Success(result));
        }