From 3913764277f2b71b19b74f5334b4627e1e5aad61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com> Date: Tue, 14 Nov 2023 15:58:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=B8=80=E9=94=AE=E5=A1=AB?= =?UTF-8?q?=E6=8A=A5=E6=8E=A5=E5=8F=A3=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Back/D_PlanMajorDescController.cs | 2 +- New_College.Api/New_College.Model.xml | 2 +- New_College.Api/New_College.xml | 7 +++ .../Helper/MajorPlanScoreTool.cs | 47 +++++++++++++++++++ .../ViewModels/Query/OneSubmitGoRequest.cs | 6 +-- .../D_PlanMajorDescServices.cs | 8 ++-- 6 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 New_College.Common/Helper/MajorPlanScoreTool.cs diff --git a/New_College.Api/Controllers/Back/D_PlanMajorDescController.cs b/New_College.Api/Controllers/Back/D_PlanMajorDescController.cs index be3a4e6..789a5c6 100644 --- a/New_College.Api/Controllers/Back/D_PlanMajorDescController.cs +++ b/New_College.Api/Controllers/Back/D_PlanMajorDescController.cs @@ -37,7 +37,7 @@ namespace New_College.Api.Controllers { var response = await _d_PlanMajorDescServices.GetPlanMajorList(request); - if (!response.data.Any() || response.dataCount <= 0) + if (response.data==null||!response.data.Any() || response.dataCount <= 0) { return new MessageModel>() { diff --git a/New_College.Api/New_College.Model.xml b/New_College.Api/New_College.Model.xml index 4d1ccb9..b0a78f3 100644 --- a/New_College.Api/New_College.Model.xml +++ b/New_College.Api/New_College.Model.xml @@ -3667,7 +3667,7 @@ - 冲稳保 类型 + 冲稳保 类型:冲2,稳1,保0 diff --git a/New_College.Api/New_College.xml b/New_College.Api/New_College.xml index 1f2de7b..ce4392a 100644 --- a/New_College.Api/New_College.xml +++ b/New_College.Api/New_College.xml @@ -113,6 +113,13 @@ 服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下 + + + 一键填报 + + + + 服务器接口,因为是模板生成,所以首字母是大写的,自己可以重构下 diff --git a/New_College.Common/Helper/MajorPlanScoreTool.cs b/New_College.Common/Helper/MajorPlanScoreTool.cs new file mode 100644 index 0000000..de3ec34 --- /dev/null +++ b/New_College.Common/Helper/MajorPlanScoreTool.cs @@ -0,0 +1,47 @@ +using Org.BouncyCastle.Asn1.Ocsp; +using System; +using System.Collections.Generic; +using System.Text; + +namespace New_College.Common +{ + public class MajorPlanScoreTool + { + /// + /// 冲稳保计算 + /// + /// + /// + public static int GetPlanScore(int LowScore, int requestScore) + { + int minscore = requestScore - 15;//最小 + int constscore = requestScore;//中位数 + int maxscore = requestScore + 15;//最大 + + int type = LowScore <= minscore ? 0 : minscore < LowScore && LowScore <= constscore ? 1 : LowScore > constscore && LowScore <= maxscore ? 2 : -1; + + //if (LowScore <= minscore) + //{ + // return "保"; + //} + //else if (minscore < LowScore && LowScore <= constscore) + //{ + // return "稳"; + //} + //else if (LowScore > constscore && LowScore <= maxscore) + //{ + + // return "冲"; + + //} + //else + //{ + // return ""; + //} + + return type; + + } + + } +} diff --git a/New_College.Model/ViewModels/Query/OneSubmitGoRequest.cs b/New_College.Model/ViewModels/Query/OneSubmitGoRequest.cs index 13e4a82..d367de0 100644 --- a/New_College.Model/ViewModels/Query/OneSubmitGoRequest.cs +++ b/New_College.Model/ViewModels/Query/OneSubmitGoRequest.cs @@ -94,11 +94,11 @@ namespace New_College.Model.ViewModels /// public class OneSubmitGoResponse { - + public int LowScoreRank { get; set; } /// - /// 冲稳保 类型 + /// 冲稳保 类型:冲2,稳1,保0 /// - public string Type { get; set; } + public int Type { get; set; } /// /// 排名 /// diff --git a/New_College.Services/D_PlanMajorDescServices.cs b/New_College.Services/D_PlanMajorDescServices.cs index 47f0cc8..d7c40ed 100644 --- a/New_College.Services/D_PlanMajorDescServices.cs +++ b/New_College.Services/D_PlanMajorDescServices.cs @@ -10,6 +10,7 @@ using SqlSugar; using System.Linq.Expressions; using System; using System.Linq; +using New_College.Common; namespace New_College.Services { @@ -66,7 +67,7 @@ namespace New_College.Services .AndIF(!string.IsNullOrWhiteSpace(request.Nature), c => c.Nature == request.Nature) //.AndIF(request. > 0, c => SqlFunc.Between(c.LowScore, request.Score, request.Score)) 位次区间 .ToExpression(); - var query = await _dal.QueryPage(expression, request.PageIndex, request.PageSize, " order by LowScoreRank desc"); + var query = await _dal.QueryPage(expression, request.PageIndex, request.PageSize, " LowScoreRank desc "); var majorarry = query.data.Select(c => c.Major).ToArray(); var universityarry = query.data.Select(c => c.UniversityName).ToArray(); @@ -116,10 +117,11 @@ namespace New_College.Services UniversityId = c.UId, UniversityName = c.UniversityName, SubjectClam = c.SelectSubject, - Type = "冲",//还缺冲稳保 + Type = MajorPlanScoreTool.GetPlanScore(c.LowScore, request.Score),//还缺冲稳保 PlanId = c.Id, UniversityCode = c.EnrollmentCode, MajorCode = c.MajorCode, + LowScoreRank = c.LowScoreRank, PlanItems = list.Where(e => e.UniversityName.Equals(c.UniversityName) && e.Major.Equals(c.Major) && e.MajorCode.Equals(c.MajorCode)).Select(s => new PlanItem() { PlanCount = s.PlanCount, @@ -128,7 +130,7 @@ namespace New_College.Services Year = s.AcademicYear }).OrderByDescending(k => k.Year).ToList() - }).ToList(); + }).OrderByDescending(c => c.Type).OrderBy(c => c.LowScoreRank).ToList(); return new PageModel() { data = responselist,