diff --git a/New_College.Services/T_EnrollmentPlanedescServices.cs b/New_College.Services/T_EnrollmentPlanedescServices.cs index 12f71bf..589140f 100644 --- a/New_College.Services/T_EnrollmentPlanedescServices.cs +++ b/New_College.Services/T_EnrollmentPlanedescServices.cs @@ -1738,51 +1738,58 @@ namespace New_College.Services List PlanIds = new List() { }; foreach (var item in planstringids) { - var newids = item.Split(",").Select(x => int.Parse(x)).ToList(); - PlanIds.AddRange(newids); + if (!string.IsNullOrWhiteSpace(item)) + { + var newids = item.Split(",").Select(x => int.Parse(x)).ToList(); + PlanIds.AddRange(newids); + } } var descinfo = await _dal.Query(x => x.IsDelete == false && PlanIds.Contains(x.Id)); foreach (var item in info) { - var planids = item.PlanMajorIds.Split(",").Select(x => int.Parse(x)).ToList(); + if (!string.IsNullOrWhiteSpace(item.PlanMajorIds)) + { + var planids = item.PlanMajorIds.Split(",").Select(x => int.Parse(x)).ToList(); var nowdesc = descinfo.Where(x => planids.Contains(x.Id)).ToList(); if (nowdesc.Count <= 0) continue; //此处处理针对于霍兰德推荐的具有相同学校的案例 var count = list.Where(x => x.UniversityName == item.UniversityName).ToList(); - if (count.Count > 0) - { - var newinfos = nowdesc.Select(x => new PlanInfo() + if (count.Count > 0) { - Money = x.Tuitionfee, - Year = x.Studyyears == null ? "-" : x.Studyyears == "" ? "-" : x.Studyyears, - PlanName = x.MajorName, - PlanNum = x.Plancount, - Scoreline = x.Scoreline - }).ToList(); - count.FirstOrDefault().Infos.AddRange(newinfos); - } - else - { - string yearname = string.Empty; - if (query.CustomerId.HasValue) - { - yearname = (await this._CustomerInfoRepository.QueryById(query.CustomerId)).Year.ToString(); - } - list.Add(new VolunteerTableResult() - { - UniversityName = item.UniversityName, - - Infos = nowdesc.Select(x => new PlanInfo() + var newinfos = nowdesc.Select(x => new PlanInfo() { Money = x.Tuitionfee, Year = x.Studyyears == null ? "-" : x.Studyyears == "" ? "-" : x.Studyyears, - YearName = yearname, PlanName = x.MajorName, PlanNum = x.Plancount, Scoreline = x.Scoreline - }).ToList() - }); + }).ToList(); + count.FirstOrDefault().Infos.AddRange(newinfos); + + } + else + { + string yearname = string.Empty; + if (query.CustomerId.HasValue) + { + yearname = (await this._CustomerInfoRepository.QueryById(query.CustomerId)).Year.ToString(); + } + list.Add(new VolunteerTableResult() + { + UniversityName = item.UniversityName, + + Infos = nowdesc.Select(x => new PlanInfo() + { + Money = x.Tuitionfee, + Year = x.Studyyears == null ? "-" : x.Studyyears == "" ? "-" : x.Studyyears, + YearName = yearname, + PlanName = x.MajorName, + PlanNum = x.Plancount, + Scoreline = x.Scoreline + }).ToList() + }); + } } } @@ -1871,9 +1878,11 @@ namespace New_College.Services var id = 0; foreach (var item in query.details) { - - PlanIds.AddRange(item.PlanMagorIds); - id = item.PlanMagorIds.First(); + if (item.PlanMagorIds != null && item.PlanMagorIds.Count() > 0) + { + PlanIds.AddRange(item.PlanMagorIds); + id = item.PlanMagorIds.First(); + } } string yearName = string.Empty; var plandescmodels = await this.t_EnrollmentPlanedesc.QueryById(id); @@ -1888,51 +1897,55 @@ namespace New_College.Services var universityinfo = await d_UniversityRepository.Query(x => universityids.Contains(x.Id) && x.IsDelete == false, "Rank asc"); foreach (var item in query.details) { - var nowdesc = descinfo.Where(x => item.PlanMagorIds.Contains(x.Id)).ToList(); - if (nowdesc.Count <= 0) - continue; - var nowuniversityinfo = universityinfo.Where(x => x.Id == item.UniversityId).FirstOrDefault(); - if (nowuniversityinfo == null) - continue; - //此处处理针对于霍兰德推荐的具有相同学校的案例 - var count = list.Where(x => x.UniversityName == item.UniversityName).ToList(); - if (count.Count > 0) + if (item.PlanMagorIds != null && item.PlanMagorIds.Count() > 0) { - var newinfos = nowdesc.Select(x => new PlanInfo() + + var nowdesc = descinfo.Where(x => item.PlanMagorIds.Contains(x.Id)).ToList(); + if (nowdesc.Count <= 0) + continue; + var nowuniversityinfo = universityinfo.Where(x => x.Id == item.UniversityId).FirstOrDefault(); + if (nowuniversityinfo == null) + continue; + //此处处理针对于霍兰德推荐的具有相同学校的案例 + var count = list.Where(x => x.UniversityName == item.UniversityName).ToList(); + if (count.Count > 0) { - MajorId = x.Id, - Money = x.Tuitionfee, - Year = x.Studyyears, - PlanName = x.MajorName, - PlanNum = x.Plancount, - Scoreline = x.Scoreline - }).ToList(); - count.FirstOrDefault().Infos.AddRange(newinfos); - } - else - { - list.Add(new SimuVolunteerTableResult() - { - Logo = nowuniversityinfo.Logo, - Nhef = nowuniversityinfo.Nhef > 0, - Rank = nowuniversityinfo.Rank, - Sff = nowuniversityinfo.Sff > 0, - Syl = nowuniversityinfo.Syl > 0, - UniversityId = item.UniversityId, - UniversityName = item.UniversityName, - Province = nowuniversityinfo.Area_Name, - Nature = nowuniversityinfo.Nature, - Infos = nowdesc.Select(x => new PlanInfo() + var newinfos = nowdesc.Select(x => new PlanInfo() { MajorId = x.Id, Money = x.Tuitionfee, Year = x.Studyyears, PlanName = x.MajorName, PlanNum = x.Plancount, - Scoreline = x.Scoreline, - YearName = yearName - }).ToList() - }); + Scoreline = x.Scoreline + }).ToList(); + count.FirstOrDefault().Infos.AddRange(newinfos); + } + else + { + list.Add(new SimuVolunteerTableResult() + { + Logo = nowuniversityinfo.Logo, + Nhef = nowuniversityinfo.Nhef > 0, + Rank = nowuniversityinfo.Rank, + Sff = nowuniversityinfo.Sff > 0, + Syl = nowuniversityinfo.Syl > 0, + UniversityId = item.UniversityId, + UniversityName = item.UniversityName, + Province = nowuniversityinfo.Area_Name, + Nature = nowuniversityinfo.Nature, + Infos = nowdesc.Select(x => new PlanInfo() + { + MajorId = x.Id, + Money = x.Tuitionfee, + Year = x.Studyyears, + PlanName = x.MajorName, + PlanNum = x.Plancount, + Scoreline = x.Scoreline, + YearName = yearName + }).ToList() + }); + } } } return new MessageModel>() { success = true, msg = "获取成功", response = list };