diff --git a/New_College.Api/Controllers/Front/LibraryController.cs b/New_College.Api/Controllers/Front/LibraryController.cs index 68fc675..9567167 100644 --- a/New_College.Api/Controllers/Front/LibraryController.cs +++ b/New_College.Api/Controllers/Front/LibraryController.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Data.Entity.Core.Metadata.Edm; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; @@ -7,6 +8,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using New_College.IServices; using New_College.Model; +using New_College.Model.Models; using New_College.Model.ViewModels; @@ -17,9 +19,91 @@ namespace New_College.Api.Controllers.Front public class LibraryController : ControllerBase { private readonly ID_LongIdMapServices iD_LongIdMapServices; - public LibraryController(ID_LongIdMapServices ID_LongIdMapServices) + private readonly ID_ScoreLineServices _ScoreLineServices; + public LibraryController(ID_LongIdMapServices ID_LongIdMapServices, ID_ScoreLineServices d_ScoreLineServices) { iD_LongIdMapServices = ID_LongIdMapServices; + this._ScoreLineServices = d_ScoreLineServices; + } + + + + + /// + /// 同分年份数据 + /// + /// + /// + [HttpGet] + public async Task>> GetSameScoreLine([FromQuery] ScoreLineQueryDto queryDto) + { + var response = new List(); + if (queryDto.Score <= 50) + { + return new MessageModel>() + { + msg = "请输入分数", + success = false + }; + } + var query = await _ScoreLineServices.Query(c => c.Score == queryDto.Score.ToString() && c.Province == queryDto.Pronvice); + var newscore = queryDto.Score - 1; + var tmpquery = await _ScoreLineServices.Query(c => c.Score == newscore.ToString() && c.Province == queryDto.Pronvice); + query.ForEach(a => + { + var newsuminfo = tmpquery.FirstOrDefault(a => a.Years == a.Years); + + response.Add(new SameScoreLineDataDto() + { + Count = a.Count, + Score = a.Score, + SumCount = a.SumCount, + Years = a.Years, + Type = a.Type, + ScoreRegion = newsuminfo.SumCount + "~" + a.SumCount + }); + }); + return new MessageModel>() + { + msg = "ok", + response = response.OrderByDescending(c=>c.Years).ToList(), + success = true + }; + + } + + + + /// + /// 获取省份学年位次信息列表(目前只有山东省) + /// + /// + [HttpGet] + public async Task>> GetScoreLine([FromQuery] ScoreLineQueryDto queryDto) + { + var response = new List(); + var query = await _ScoreLineServices.Query(c => c.Years == queryDto.Years && c.Province == queryDto.Pronvice); + for (int i = 0; i < query.Count(); i++) + { + response.Add(new ScoreLineResponseDto() + { + Count = query[i].Count, + Province = query[i].Province, + Score = query[i].Score, + SumCount = query[i].SumCount, + Type = query[i].Type, + ScoreRegion = i == 0 ? "1~" + query[i].SumCount : query[i - 1].SumCount + 1 + "~ " + query[i].SumCount, + Years = query[i].Years, + }); + } + + return new MessageModel>() + { + response = response, + status = 200, + success = true, + msg = "ok" + }; } /// diff --git a/New_College.Api/Controllers/Front/VolunteerController.cs b/New_College.Api/Controllers/Front/VolunteerController.cs index 705287d..e63eebd 100644 --- a/New_College.Api/Controllers/Front/VolunteerController.cs +++ b/New_College.Api/Controllers/Front/VolunteerController.cs @@ -264,8 +264,8 @@ namespace New_College.Api.Controllers.Front /// /// /// - [HttpPost] - public async Task>> GetBatchByYearArea([FromBody] YearAreaQuery query) + [HttpGet] + public async Task>> GetBatchByYearArea([FromQuery] YearAreaQuery query) { return await t_EnrollmentPlanedescServices.GetBatchByYearArea(query); } diff --git a/New_College.Api/New_College.Model.xml b/New_College.Api/New_College.Model.xml index e487b5d..a34f6ae 100644 --- a/New_College.Api/New_College.Model.xml +++ b/New_College.Api/New_College.Model.xml @@ -3890,6 +3890,21 @@ 年份 + + + 年份 + + + + + 省份 + + + + + 分数 + + 用户Id @@ -5935,6 +5950,71 @@ + + + 年份 + + + + + 科类 + + + + + 分数 + + + + + 分数区间 + + + + + 本段人数 + + + + + 累计人数 + + + + + 省份 + + + + + 年份 + + + + + 科类 + + + + + 分数 + + + + + 分数区间 + + + + + 本段人数 + + + + + 累计人数 + + 服务器VM diff --git a/New_College.Api/New_College.xml b/New_College.Api/New_College.xml index 96f5ff9..237b14d 100644 --- a/New_College.Api/New_College.xml +++ b/New_College.Api/New_College.xml @@ -251,6 +251,19 @@ + + + 同分年份数据 + + + + + + + 获取省份学年位次信息列表(目前只有山东省) + + + 获取院校库 diff --git a/New_College.Model/Models/D_ScoreLine.cs b/New_College.Model/Models/D_ScoreLine.cs index 2e1eb38..8422283 100644 --- a/New_College.Model/Models/D_ScoreLine.cs +++ b/New_College.Model/Models/D_ScoreLine.cs @@ -27,7 +27,7 @@ namespace New_College.Model.Models /// /// 分数 /// - public double Score { get; set; } + public string Score { get; set; } /// /// 本段人数 diff --git a/New_College.Model/ViewModels/Query/ScoreLineQueryDto.cs b/New_College.Model/ViewModels/Query/ScoreLineQueryDto.cs new file mode 100644 index 0000000..f259155 --- /dev/null +++ b/New_College.Model/ViewModels/Query/ScoreLineQueryDto.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace New_College.Model.ViewModels +{ + public class ScoreLineQueryDto + { + + /// + ///年份 + /// + public string Years { get; set; } + + /// + /// 省份 + /// + public string Pronvice { get; set; } + + + /// + /// 分数 + /// + public int Score { get; set; } + + + + } + + + + +} diff --git a/New_College.Model/ViewModels/ScoreLineResponseDto.cs b/New_College.Model/ViewModels/ScoreLineResponseDto.cs new file mode 100644 index 0000000..998e0b8 --- /dev/null +++ b/New_College.Model/ViewModels/ScoreLineResponseDto.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace New_College.Model.ViewModels +{ + + + public class SameScoreLineDataDto + { + + /// + /// 年份 + /// + public string Years { get; set; } + + /// + /// 科类 + /// + public string Type { get; set; } + + /// + /// 分数 + /// + public string Score { get; set; } + + + /// + /// 分数区间 + /// + public string ScoreRegion { get; set; } + + /// + /// 本段人数 + /// + public int Count { get; set; } + + /// + /// 累计人数 + /// + public int SumCount { get; set; } + + + } + + public class ScoreLineResponseDto + { + /// + /// 省份 + /// + public string Province { get; set; } + + /// + /// 年份 + /// + public string Years { get; set; } + + /// + /// 科类 + /// + public string Type { get; set; } + + /// + /// 分数 + /// + public string Score { get; set; } + + + /// + /// 分数区间 + /// + public string ScoreRegion { get; set;} + + /// + /// 本段人数 + /// + public int Count { get; set; } + + /// + /// 累计人数 + /// + public int SumCount { get; set; } + + + } +} diff --git a/New_College.Services/T_EnrollmentPlanedescServices.cs b/New_College.Services/T_EnrollmentPlanedescServices.cs index 8c13d21..82469ef 100644 --- a/New_College.Services/T_EnrollmentPlanedescServices.cs +++ b/New_College.Services/T_EnrollmentPlanedescServices.cs @@ -873,7 +873,7 @@ namespace New_College.Services return new MessageModel() { success = false, msg = "院校信息不存在" }; UniversityProbabilityResult model = new UniversityProbabilityResult() { }; - var scoreline = await _ScoreLineRepository.Query(c => c.Years == query.Year.ToString() && c.Province == query.AreaName && c.Score == query.Score); + var scoreline = await _ScoreLineRepository.Query(c => c.Years == query.Year.ToString() && c.Province == query.AreaName && c.Score == query.Score.ToString()); model.YearBatchScores = universityinfoline.Select(c => new YearBatchScore() @@ -887,7 +887,7 @@ namespace New_College.Services double tmpscore = 0; if (scoreline.Any()) { - tmpscore = scoreline.FirstOrDefault().Score; + tmpscore =double.Parse(scoreline.FirstOrDefault().Score); // model.Probability = tmpscore >= model.EstimateScore ? "" : ""; }