Beispiel #1
0
        public void ResetTodayStatistic()
        {
            //遍历所有的店铺发送指令
            var offlintStores = _offlineStoreQueryService.StoreList().Where(x => x.TodaySale > 0);

            if (offlintStores.Any())
            {
                foreach (var offlintStore in offlintStores)
                {
                    var command = new ResetTodayStatisticCommand
                    {
                        AggregateRootId = offlintStore.Id
                    };
                    _commandService.SendAsync(command);
                }
            }
        }
        public ListPageResponse ListPage([FromBody] ListPageRequest request)
        {
            request.CheckNotNull(nameof(request));

            var pageSize = 20;
            var stores   = _offlineStoreQueryService.StoreList();
            var total    = stores.Count();

            //筛选
            if (!request.Name.IsNullOrEmpty())
            {
                stores = stores.Where(x => x.Name.Contains(request.Name));
            }
            if (!request.Region.IsNullOrEmpty())
            {
                stores = stores.Where(x => x.Region.Contains(request.Region));
            }
            total = stores.Count();
            //分页
            stores = stores.OrderByDescending(x => x.CreatedOn).Skip(pageSize * (request.Page - 1)).Take(pageSize);

            return(new ListPageResponse
            {
                Total = total,
                OfflineStores = stores.Select(x => new OfflineStore
                {
                    Id = x.Id,
                    UserId = x.UserId,
                    Name = x.Name,
                    Thumb = x.Thumb,
                    Phone = x.Phone,
                    Region = x.Region,
                    Address = x.Address,
                    TodaySale = x.TodaySale,
                    Description = x.Description,
                    Labels = x.Labels.Split("|", true),
                    TotalSale = x.TotalSale,
                    Persent = x.Persent,
                    Longitude = x.Longitude,
                    Latitude = x.Latitude,
                    CreatedOn = x.CreatedOn.GetTimeSpan(),
                    IsLocked = x.IsLocked
                }).ToList()
            });
        }
Beispiel #3
0
        public BaseApiResponse OfflineStores([FromBody] OfflineStoresRequest request)
        {
            request.CheckNotNull(nameof(request));
            //查询
            var offlineStores = _offlineStoreQueryService.StoreList().Where(x => !x.IsLocked);
            var pageSize      = 20;
            var total         = offlineStores.Count();

            //筛选
            if (!request.Name.IsNullOrEmpty())
            {
                offlineStores = offlineStores.Where(x => x.Name.Contains(request.Name));
            }
            total = offlineStores.Count();
            //分页
            offlineStores = offlineStores.Skip(pageSize * (request.Page - 1)).Take(pageSize);

            return(new OfflineStoresResponse
            {
                Total = total,
                OfflineStores = offlineStores.Select(x => new OfflineStore {
                    Id = x.Id,
                    UserId = x.UserId,
                    Name = x.Name,
                    Thumb = x.Thumb,
                    Phone = x.Phone,
                    Description = x.Description,
                    Region = x.Region,
                    Address = x.Address,
                    Persent = x.Persent,
                    Labels = x.Labels.Split("|", true),
                    Longitude = x.Longitude,
                    Latitude = x.Latitude,
                    IsLocked = x.IsLocked,
                    CreatedOn = x.CreatedOn.GetTimeSpan()
                }).ToList()
            });
        }