/// <summary> /// 会员购买力列表 /// </summary> /// <param name="query"></param> /// <returns></returns> public static QueryPageModel <DTO.MemberPurchasingPower> GetPurchasingPowerMember(MemberPowerQuery query) { var result = _iMemberService.GetPurchasingPowerMember(query); QueryPageModel <DTO.MemberPurchasingPower> model = new QueryPageModel <MemberPurchasingPower>(); model.Total = result.Total; model.Models = AutoMapper.Mapper.Map <List <DTO.MemberPurchasingPower> >(result.Models); var userIds = model.Models.Select(p => p.Id).ToArray(); var memberCategorys = _iMemberService.GetMemberBuyCategoryByUserIds(userIds); var grades = MemberGradeApplication.GetMemberGradeList(); var integrals = MemberIntegralApplication.GetMemberIntegrals(userIds); foreach (var item in model.Models) { var intergral = integrals.Where(a => a.MemberId == item.Id).Select(a => a.HistoryIntegrals).FirstOrDefault(); //填充等级数据 item.GradeName = MemberGradeApplication.GetMemberGradeByIntegral(grades, intergral).GradeName; //填充分类数据 var categoryNames = memberCategorys.Where(p => p.UserId == item.Id).Select(p => p.CategoryName).Take(3).ToArray(); if (categoryNames.Length == 0) { continue; } item.CategoryNames = string.Join(",", categoryNames); } return(model); }
/// <summary> /// 根据查询条件分页获取会员信息 /// </summary> /// <param name="query"></param> /// <returns></returns> public static QueryPageModel <DTO.Members> GetMemberList(MemberQuery query) { if (query.GradeId.HasValue) { var expenditureRange = MemberApplication.GetMemberGradeRange(query.GradeId.Value); query.MinIntegral = expenditureRange.MinIntegral; query.MaxIntegral = expenditureRange.MaxIntegral; } var list = _iMemberService.GetMembers(query); var members = Mapper.Map <QueryPageModel <DTO.Members> >(list); var grades = MemberGradeApplication.GetMemberGradeList(); foreach (var m in members.Models) { var memberIntegral = MemberIntegralApplication.GetMemberIntegral(m.Id); //获取等级 m.GradeName = MemberGradeApplication.GetMemberGradeByIntegral(grades, memberIntegral.HistoryIntegrals).GradeName; if (memberIntegral != null) { m.AvailableIntegral = memberIntegral.AvailableIntegrals; m.HistoryIntegral = memberIntegral.HistoryIntegrals; } } return(members); }
public static QueryPageModel <MemberIntegral> GetMemberIntegrals(IntegralQuery query) { var data = _iMemberIntegralService.GetMemberIntegralList(query); var members = GetService <IMemberService>().GetMembers(data.Models.Select(p => (long)p.MemberId).ToList()); var grades = MemberGradeApplication.GetMemberGrades(); var result = new List <MemberIntegral>(); foreach (var item in data.Models) { var member = members.FirstOrDefault(p => p.Id == item.MemberId); result.Add(new MemberIntegral { Id = item.Id, AvailableIntegrals = item.AvailableIntegrals, HistoryIntegrals = item.HistoryIntegrals, MemberGrade = MemberGradeApplication.GetMemberGradeByIntegral(grades, item.HistoryIntegrals).GradeName, UserName = member.UserName, MemberId = member.Id, CreateDate = member.CreateDate, }); } return(new QueryPageModel <MemberIntegral> { Models = result, Total = data.Total }); }
public static QueryPageModel <ManagerInfo> GetMemberList(ManagerQuery query) { var list = _iManagerService.GetManagersList(query); var members = Mapper.Map <QueryPageModel <ManagerInfo> >(list); var grades = MemberGradeApplication.GetMemberGradeList(); foreach (var m in members.Models) { var memberIntegral = MemberIntegralApplication.GetMemberIntegral(m.Id); m.GradeName = MemberGradeApplication.GetMemberGradeByIntegral(grades, memberIntegral.HistoryIntegrals).GradeName; if (memberIntegral != null) { m.AvailableIntegral = memberIntegral.AvailableIntegrals; m.HistoryIntegral = memberIntegral.HistoryIntegrals; } } return(members); }