public async Task <ResponsePagingBase> GetShopPage([FromBody] GetShopPageRequest request) { try { var action = new GetShopByAreaAction(_shopBll, _areaBll, _platformBll); return(await action.ProcessAction(HttpContext, request)); } catch (Exception ex) { Log.Error(request, ex, this.GetType()); return(new ResponsePagingBase().GetResponseCodeError()); } }
/// <summary> /// 通过地区获取店面信息 /// </summary> /// <param name="httpContext"></param> /// <param name="request"></param> /// <returns></returns> public async Task <ResponsePagingBase> ProcessAction(HttpContext httpContext, GetShopPagingReqest request) { var shopRequest = new GetShopPageRequest() { LoginUserId = request.LoginUserId, PageCurrent = request.PageCurrent, PageSize = request.PageSize, }; if (!ComLib.HandleRequest(httpContext, shopRequest)) { return(ResponsePagingBase.Success(new List <OpShopView>(), 0)); } var shops = await _shopBll.GetShopPage(shopRequest); if (shops == null || shops.Item2 == 0) { return(ResponsePagingBase.Success(new List <OpShopView>(), 0)); } var areaIds = new List <long>(); foreach (var g in shops.Item1) { areaIds.Add(g.Province.Value); areaIds.Add(g.City.Value); areaIds.Add(g.District.Value); areaIds.Add(g.Street.Value); } var areas = await _areaBll.GetArea(areaIds.Distinct().ToList()); return(ResponsePagingBase.Success(shops.Item1.Select(p => new OpShopView() { ShopName = p.ShopName, ShopTelphone = p.ShopTelphone, ShopAddress = p.ShopAddress, ShopLinkMan = p.ShopLinkMan, Province = GetAreaName(p.Province.Value, areas), City = GetAreaName(p.City.Value, areas), District = GetAreaName(p.District.Value, areas), Stree = GetAreaName(p.Street.Value, areas) }), shops.Item2)); }
/// <summary> /// 通过地区获取店面信息 /// </summary> /// <param name="httpContext"></param> /// <param name="request"></param> /// <returns></returns> public async Task <ResponsePagingBase> ProcessAction(HttpContext httpContext, GetShopPageRequest request) { if (request.SceneType != (int)GetShopPageSceneTypeEnum.DataLimitSetting && !ComLib.HandleRequest(httpContext, request)) { return(ResponsePagingBase.Success(new List <GetShopPageView>(), 0)); } var shops = await _shopBll.GetShopPage(request); var leaderNames = GetLeaderNames(shops.Item1.ToList(), request.SceneType); return(ResponsePagingBase.Success(shops.Item1.Select(p => new GetShopPageView() { ShopId = p.ShopId, ShopName = p.ShopName, ShopTelphone = p.ShopTelphone, ProvinceName = GetAreaName(p.Province), CityName = GetAreaName(p.City), DistrictName = GetAreaName(p.District), LicenseNum = string.Empty, ShopAddress = p.ShopAddress, LeaderName = GetLeaderName(p.OrgId, request.SceneType, leaderNames) }), shops.Item2)); }
/// <summary> /// 查询门店信息 /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <Tuple <IEnumerable <Shop>, int> > GetShopPage(GetShopPageRequest request) { return(await _shopDal.GetShopPage(request)); }
/// <summary> /// 查询门店信息 /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <Tuple <IEnumerable <Shop>, int> > GetShopPage(GetShopPageRequest request) { return(await this.ExecutePageAsync <Shop>(request.PageCurrent, request.PageSize, "shop_linkMan as ShopLinkMan,shop_id as ShopId,shop_code as ShopCode,shop_name as ShopName,stock_id as StockId,org_id as OrgId,cash_id as CashId,bank_id as BankId,member_pay_id as MemberPayId,status as Status,pycode as Pycode,shop_telphone as ShopTelphone,shop_address as ShopAddress,creater,createdtime,modifier,modifiedtime,province,city,district,street", "cm_shop", request.GetQuerySql(), "createdtime desc")); }