/// <summary> /// 获取订单王数据 /// </summary> /// <param name="shopId"></param> /// <returns></returns> public async Task <ResponseBase> ProcessAction(long shopId) { var ranksAll = await _shopRetailRankBll.GetLastShopRetailRank((int)ShopRetailRankTypeEnum.King); if (!ranksAll.Any()) { return(new ResponsePagingBase().GetResponseError(StatusCode.ShopRetailRank60001, "未查询到排名信息")); } var ranksValid = ranksAll.Where(p => p.IsLimit == false).OrderBy(p => p.Rank).ToList(); var myrank = ranksAll.FirstOrDefault(p => p.ShopId == shopId); if (ranksValid.Count > _shopRetailRankConfig.ShowCount) { ranksValid = ranksValid.GetRange(0, _shopRetailRankConfig.ShowCount); } var responseView = GetResponseView(myrank, ranksAll, ranksValid); if (myrank == null) { responseView.Type = (int)GetShopRetailRankAboutKingTypeEnum.Zero; return(ResponseBase.Success(responseView)); } if (myrank.BillCount < _shopRetailRankConfig.MinBillCountKing) { responseView.Type = (int)GetShopRetailRankAboutKingTypeEnum.NotEnough; responseView.NeedBillCount = _shopRetailRankConfig.MinBillCountKing - myrank.BillCount; return(ResponseBase.Success(responseView)); } responseView.Type = (int)GetShopRetailRankAboutKingTypeEnum.Enough; return(ResponseBase.Success(responseView)); }
/// <summary> /// 获取门店销售单排名信息 /// </summary> /// <param name="shopId"></param> /// <returns></returns> public async Task <ResponseBase> ProcessAction(long shopId) { var ranksAll = await _shopRetailRankBll.GetLastShopRetailRank((int)ShopRetailRankTypeEnum.Growth); if (!ranksAll.Any()) { return(new ResponsePagingBase().GetResponseError(StatusCode.ShopRetailRank60001, "未查询到排名信息")); } var ranksValid = ranksAll.Where(p => p.IsLimit == false).OrderBy(p => p.Rank).ToList(); var myrank = ranksAll.FirstOrDefault(p => p.ShopId == shopId); if (ranksValid.Count > _shopRetailRankConfig.ShowCount) { ranksValid = ranksValid.GetRange(0, _shopRetailRankConfig.ShowCount); } var responseView = GetResponseView(myrank, ranksAll, ranksValid); var limitShops = await _shopRetailRankLimitBll.GetShopRetailRankWinner(shopId); if (limitShops != null) { return(GetIsWinnerResponse(responseView)); } if (myrank == null) { return(GetBillCountZero(responseView)); } if (myrank.BillCount >= _shopRetailRankConfig.MinBillCountGrowth) { return(GetBillCountEnough(responseView)); } return(GetBillCountNotEnough(responseView)); }