diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamStudentController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamStudentController.cs index 4a1450be1..f34ba8599 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamStudentController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/Exam_ExamStudentController.cs @@ -175,7 +175,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers return Success("清空(" + res + ")条数据成功!"); } - public ActionResult ImportTable(string AcademicYearNo, string Semester, string ESType) + public ActionResult ImportTable(string AcademicYearNo, int Semester, string ESType) { int res = exam_ExamStudentIBLL.ImportForm(AcademicYearNo, Semester, ESType); return Success("同步(" + res + ")条数据成功!"); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentBLL.cs index 40b6dad4f..528d9974e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentBLL.cs @@ -43,7 +43,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } - public IEnumerable GetPageListForExam(Pagination pagination, string queryJson) + public IEnumerable GetPageListForExam(Pagination pagination, string queryJson) { try { @@ -217,7 +217,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// /// - public int ImportForm(string AcademicYearNo, string Semester, string ESType) + public int ImportForm(string AcademicYearNo, int Semester, string ESType) { try { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentIBLL.cs index 4fea94b3d..acebaafaf 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentIBLL.cs @@ -72,7 +72,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// /// - int ImportForm(string AcademicYearNo, string Semester, string ESType); + int ImportForm(string AcademicYearNo, int Semester, string ESType); #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentService.cs index 92370ceb7..66be89ca7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentService.cs @@ -343,83 +343,37 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// /// - public int ImportForm(string AcademicYearNo, string Semester, string ESType) + public int ImportForm(string AcademicYearNo, int Semester, string ESType) { try { - var historyStu = this.BaseRepository("CollegeMIS").FindList(); - int XQ = Convert.ToInt32(Semester); - List AddLStuist = new List(); + StringBuilder strSql = new StringBuilder(); if (ESType == "1") { - var StuInfoBasic = this.BaseRepository("CollegeMIS") - .FindList(x => x.CheckMark == "1"); - foreach (var item in StuInfoBasic) - { - var stuList = new Exam_ExamStudentEntity - { - ESId = Guid.NewGuid().ToString(), - ClassNo = item.ClassNo, - AcademicYearNo = AcademicYearNo, - Semester = XQ, - StuNo = item.StuNo, - StuName = item.StuName, - ESType = "1", - ESEnabled = true - }; - if (historyStu.Count(x => x.StuNo == stuList.StuNo && x.StuName == stuList.StuName && x.AcademicYearNo == AcademicYearNo && x.Semester == XQ && x.ESType == "1") == AddLStuist.Count(s => s.StuNo == stuList.StuNo && s.StuName == stuList.StuName && s.AcademicYearNo == AcademicYearNo && s.Semester == XQ && s.ESType == "1")) - { - AddLStuist.Add(stuList); - } - } + strSql.Append( + $@"insert into Exam_ExamStudent(ESId,ClassNo,AcademicYearNo,Semester,StuNo,StuName,ESType,ESEnabled) + select newid(), a.classno, '{AcademicYearNo}', '{Semester}', a.stuno, a.stuname, '{ESType}', 1 from StuInfoBasic a where CheckMark = '1' and stuno not in (select stuno from Exam_ExamStudent where AcademicYearNo = '{AcademicYearNo}' and Semester = '{Semester}' and ESType = '1')"); } - else if (ESType == "2") + else { - var StuScoreNotPass = this.BaseRepository("CollegeMIS") - .FindList(x => x.CheckMark == "1"); - foreach (var item in StuScoreNotPass) + strSql.Append(@" insert into Exam_ExamStudent(ESId,ClassNo,AcademicYearNo,Semester,StuNo,StuName,ESType,ESEnabled) "); + strSql.Append($"select newid(),a.classno,'{AcademicYearNo}','{Semester}',a.stuno,a.stuname,'{ESType}',1 from "); + if (ESType == "2") { - var stuList = new Exam_ExamStudentEntity - { - ESId = Guid.NewGuid().ToString(), - ClassNo = item.ClassNo, - AcademicYearNo = AcademicYearNo, - Semester = XQ, - StuNo = item.StuNo, - StuName = item.StuName, - ESType = "2", - ESEnabled = true - }; - if (historyStu.Count(x => x.StuNo == stuList.StuNo && x.StuName == stuList.StuName && x.AcademicYearNo == AcademicYearNo && x.Semester == XQ && x.ESType == "2") == AddLStuist.Count(s => s.StuNo == stuList.StuNo && s.StuName == stuList.StuName && s.AcademicYearNo == AcademicYearNo && s.Semester == XQ && s.ESType == "2")) - { - AddLStuist.Add(stuList); - } + strSql.Append(" StuScore "); } - } - else if (ESType == "3") - { - var StuScoreNotPassTwo = this.BaseRepository("CollegeMIS") - .FindList(x => x.CheckMark == "1"); - foreach (var item in StuScoreNotPassTwo) + else { - var stuList = new Exam_ExamStudentEntity - { - ESId = Guid.NewGuid().ToString(), - ClassNo = item.ClassNo, - AcademicYearNo = AcademicYearNo, - Semester = XQ, - StuNo = item.StuNo, - StuName = item.StuName, - ESType = "3", - ESEnabled = true - }; - if (historyStu.Count(x => x.StuNo == stuList.StuNo && x.StuName == stuList.StuName && x.AcademicYearNo == AcademicYearNo && x.Semester == XQ && x.ESType == "3") == AddLStuist.Count(s => s.StuNo == stuList.StuNo && s.StuName == stuList.StuName && s.AcademicYearNo == AcademicYearNo && s.Semester == XQ && s.ESType == "3")) - { - AddLStuist.Add(stuList); - } + strSql.Append(" StuScoreNotPass "); } - } - return this.BaseRepository("CollegeMIS").Insert(AddLStuist); + strSql.Append(@" a left join StuInfoBasic b on b.StuNo=a.StuNo + where 1=1 and a.LessonSortNo='1' and ((a.Score>=0 and a.Score<60) or a.Score=(-5) or a.Score=(-10)) "); + strSql.Append(" and a.AcademicYearNo ='" + AcademicYearNo + "' and a.Semester ='" + Semester + "' "); + strSql.Append(" and (b.AbmormityMoveMark<>'1' or len(b.AbmormityMoveMark)=0 or b.AbmormityMoveMark is null) "); + strSql.Append($@" and a.stuno not in (select stuno from Exam_ExamStudent where AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}' and ESType='{ESType}' ) "); + strSql.Append(" group by a.stuno,a.stuname,a.classno"); + } + return this.BaseRepository("CollegeMIS").ExecuteBySql(strSql.ToString()); } catch (Exception ex) {