From 8d3cca715103af9855e50a04173ec4f3797366bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Thu, 4 Dec 2025 18:34:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E7=9A=84=E8=80=83=E8=AF=95=E6=88=90=E7=BB=A9?= =?UTF-8?q?=20=E6=8F=90=E7=A4=BA=E9=94=99=E8=AF=AF=20=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E8=80=83=E8=AF=95=E6=88=90=E7=BB=A9=E6=97=B6?= =?UTF-8?q?=20=E5=87=BA=E7=8E=B0=E4=BA=86=E6=97=A0=E6=95=88=E7=9A=84?= =?UTF-8?q?=E5=AD=A6=E6=A0=A1=E4=BC=9A=E5=BF=BD=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ExamClassInfoController.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Learn.Archives.API/Controllers/ExamClassInfoController.cs b/Learn.Archives.API/Controllers/ExamClassInfoController.cs index 1318266..e3f022b 100644 --- a/Learn.Archives.API/Controllers/ExamClassInfoController.cs +++ b/Learn.Archives.API/Controllers/ExamClassInfoController.cs @@ -116,6 +116,12 @@ namespace Learn.Archives.API.Controllers } var grade = GradeHelper.GetStudentGradeBaseByGrade(s.Grade); var sub = ImportExamInfoSubjectDic(s); + if(sub is null) + { + s.Error = "遇到了无法处理成绩值! 请检查本行的成绩"; + errorExcelInfo.Add(s); + return null; + } var name = s.Class + s.Student; if (!userDic.ContainsKey(name)) { @@ -305,12 +311,12 @@ namespace Learn.Archives.API.Controllers var res = new Dictionary(); foreach (var item in c) { - if(string.IsNullOrWhiteSpace(item.Value)) + if (string.IsNullOrWhiteSpace(item.Value)) res.Add(item.Key, 0m); else if (decimal.TryParse(item.Value.Trim(), out decimal r)) res.Add(item.Key, r); else - res.Add(item.Key, 0m); + return null; } return res; } @@ -350,8 +356,9 @@ namespace Learn.Archives.API.Controllers var db = sService.Context; foreach (var schoolArr in userInfoArr.GroupBy(s => s.SchoolId)) { - var school = await sService.GetFirstAsync(s => s.Id == schoolArr.Key); + if(school is null) + continue; var classArr = await db.Queryable() .Where(c => c.SchoolId == school.Id && c.GradeLevel == exam.GradeLevel && -- 2.40.1