From 8ff89bdf2338e033664072ce22c66a6870437c6b Mon Sep 17 00:00:00 2001 From: ndbs Date: Mon, 13 Jun 2022 17:16:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E5=BC=80=E8=AF=BE=E8=AE=A1?= =?UTF-8?q?=E5=88=92=20=E5=BC=BA=E5=88=B6=E8=AE=BE=E7=BD=AE=E6=95=99?= =?UTF-8?q?=E5=B8=88=E4=BF=AE=E6=94=B9=E6=88=90=E7=BB=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ClassPlanTeachController.cs | 75 ++----------------- .../StuScore/StuScoreBLL.cs | 23 ++++++ .../StuScore/StuScoreIBLL.cs | 1 + .../StuScore/StuScoreService.cs | 41 ++++++++-- .../TeachClass/TeachClassBLL.cs | 24 +++++- .../TeachClass/TeachClassIBLL.cs | 2 +- .../TeachClass/TeachClassService.cs | 26 ++++++- 7 files changed, 112 insertions(+), 80 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ClassPlanTeachController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ClassPlanTeachController.cs index a1c563d14..679da222f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ClassPlanTeachController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ClassPlanTeachController.cs @@ -22,7 +22,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers private TeachClassIBLL teachClassIBLL = new TeachClassBLL(); private StuSelectLessonListIBLL StuSelectLesson = new StuSelectLessonListBLL(); private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); - + private StuScoreIBLL stuScoreIBLL = new StuScoreBLL(); #region 视图功能 /// @@ -199,80 +199,17 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers } public ActionResult QzSetTeach(string keyValue, string EmpNo) { - var entityList = teachClassIBLL.GetTeachListById(keyValue); - string Nid = ""; - if (entityList.Count > 0) + var entityList = teachClassIBLL.GetTeachListById(keyValue).ToList(); + foreach (var item in entityList) { - for (int i = 0; i < entityList.Count; i++) - { - List ssList = StuSelectLesson.GetAllList().Where( - y => y.DeptNo == entityList[i].DeptNo - && y.MajorNo == entityList[i].MajorNo - && y.F_SchoolId == entityList[i].F_SchoolId - && y.ClassNo == entityList[i].TeachClassNo - && y.LessonNo == entityList[i].LessonNo - && y.CheckMark == "1" - ).Select(x => x.SelectId.ToString()).ToList(); - Nid += string.Join(",", ssList) + ","; - } + teachClassIBLL.UpEmpNos(item.AcademicYearNo, item.Semester, item.TeachClassNo, item.LessonNo, EmpNo, item.EmpNo,item.Grade); + stuScoreIBLL.UpEmpNos(item.AcademicYearNo, item.Semester, item.TeachClassNo, item.LessonNo, EmpNo, item.EmpNo, item.Grade); } - Nid = Nid.TrimEnd(','); - StuSelectLesson.DeleteEntity(Nid); - - List TeachList = new List(); for (int i = 0; i < entityList.Count; i++) { - var stuDataList = stuInfoBasicIBLL.GetAllList().Where(s => s.DeptNo == entityList[i].DeptNo - && s.MajorNo == entityList[i].MajorNo && s.F_SchoolId == entityList[i].F_SchoolId - && s.ClassNo == entityList[i].TeachClassNo - ).ToList(); - if (stuDataList.Count > 0) - { - for (int j = 0; j < stuDataList.Count; j++) - { - StuSelectLessonListEntity TeachEntity = new StuSelectLessonListEntity(); - TeachEntity.StuNo = stuDataList[j].StuNo; - TeachEntity.DeptNo = entityList[i].DeptNo; - TeachEntity.MajorNo = entityList[i].MajorNo; - TeachEntity.ClassNo = stuDataList[j].ClassNo; - TeachEntity.MajorDetailNo = entityList[i].MajorDetailNo; - TeachEntity.MajorDetailName = entityList[i].MajorDetailName; - TeachEntity.StuName = stuDataList[j].StuName; - TeachEntity.GenderNo = stuDataList[j].GenderNo == true ? "0" : "1"; - TeachEntity.AcademicYearNo = entityList[i].AcademicYearNo; - TeachEntity.Semester = entityList[i].Semester; - TeachEntity.OpenLessonDeptNo = entityList[i].DeptNo; - TeachEntity.OpenLessonMajorNo = entityList[i].MajorNo; - TeachEntity.LessonNo = entityList[i].LessonNo; - TeachEntity.PartCode = entityList[i].PartCode; - TeachEntity.OrdinaryScoreScale = 0; - TeachEntity.TermInScoreScale = 0; - TeachEntity.TermEndScoreScale = 0; - TeachEntity.OtherScoreScale = 0; - TeachEntity.TeachClassNo = entityList[i].TeachClassNo; - TeachEntity.LessonSortNo = entityList[i].LessonSortNo; - TeachEntity.StuSortNo = entityList[i].LessonSortNo; - TeachEntity.Grade = entityList[i].Grade; - TeachEntity.StudyScore = 2; - TeachEntity.TotalStudyHour = 2; - TeachEntity.IsInEffect = "1"; - TeachEntity.IsPitchOn = "1"; - TeachEntity.F_SchoolId = entityList[i].F_SchoolId; - TeachEntity.InsertTime = DateTime.Now; - TeachList.Add(TeachEntity); - } - } - else - { - return Fail("设置失败,未发现相关学生!"); - } + teachClassIBLL.UpEmpNo(keyValue, EmpNo); //更改当前教师 } - - StuSelectLesson.SaveEntityList(TeachList); - - teachClassIBLL.UpEmpNo(keyValue, EmpNo); //更改当前教师 - return Success("设置成功!"); } #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs index f311eb7a9..cf4e029e4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs @@ -334,6 +334,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + public void UpEmpNos(string xn, string xq, string classNo, string LessonNo, string EmpNo, string HisEmpNo,string Grade) + { + try + { + stuScoreService.UpEmpNos(xn, xq, classNo, LessonNo, EmpNo, HisEmpNo,Grade); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } /// /// 获取一次补考名单数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs index 7e987896c..453da19a7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs @@ -195,6 +195,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// IEnumerable GetAllScoreListByStuNo(string stuNo); object GetScoreCharts(string academicYearNo, string semester, string classNo, string lessonNo); + void UpEmpNos(string xn, string xq, string classNo, string LessonNo, string EmpNo, string HisEmpNo, string Grade); /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs index f61e58ed3..7b0921985 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs @@ -493,6 +493,31 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + public void UpEmpNos(string xn, string xq, string classNo, string LessonNo, string EmpNo, string hisempno, string Grade) + { + try + { + StringBuilder sb = new StringBuilder(); + sb.Append(" update StuScore set EmpNo ='" + EmpNo + "' where classno = '" + classNo + "' and Semester ='" + xq + "' and AcademicYearNo ='" + xn + "' and LessonNo ='" + LessonNo + "' and empno = '" + hisempno + "' and Grade='" + Grade + "' "); + this.BaseRepository("CollegeMIS").ExecuteBySql(sb.ToString()); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #endregion private static HttpClient Client; @@ -1929,17 +1954,17 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad strSql.Append(" left join ClassInfo ci on bb.ClassNo= ci.ClassNo and ci.CheckMark='1' "); var result = this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); - + //计算专业排名,班级排名 if (result.Any()) { - var temp = result.GroupBy(x=>new { x.AcademicYearNo,x.Semester}).Select(x => new StuScoreEntity() + var temp = result.GroupBy(x => new { x.AcademicYearNo, x.Semester }).Select(x => new StuScoreEntity() { - AcademicYearNo=x.Key.AcademicYearNo, - Semester=x.Key.Semester, - StuNo=x.FirstOrDefault().StuNo, - ClassNo=x.FirstOrDefault().ClassNo, - MajorNo=x.FirstOrDefault().MajorNo + AcademicYearNo = x.Key.AcademicYearNo, + Semester = x.Key.Semester, + StuNo = x.FirstOrDefault().StuNo, + ClassNo = x.FirstOrDefault().ClassNo, + MajorNo = x.FirstOrDefault().MajorNo }).ToList(); if (temp.Any()) { @@ -1976,7 +2001,7 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad ii.RankInMajor = temp.FirstOrDefault(x => x.AcademicYearNo == ii.AcademicYearNo && x.Semester == ii.Semester).RankInMajor; ii.RankInClass = temp.FirstOrDefault(x => x.AcademicYearNo == ii.AcademicYearNo && x.Semester == ii.Semester).RankInClass; } - + } return result; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassBLL.cs index 8e07b0437..7ffe51eb1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassBLL.cs @@ -203,6 +203,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + public void UpEmpNos(string xn, string xq, string classNo, string LessonNo, string EmpNo, string HisEmpNo,string Grade) + { + try + { + teachClassEntity.UpEmpNos(xn, xq, classNo, LessonNo, EmpNo, HisEmpNo, Grade); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } /// /// 保存实体数据(新增、修改) /// 主键 @@ -226,7 +249,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassIBLL.cs index 27aeb4551..b84174ffa 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassIBLL.cs @@ -44,7 +44,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// void SaveEntity(string keyValue, TeachClassEntity entity); - + void UpEmpNos(string xn,string xq,string classNo,string LessonNo,string EmpNo,string HisEmpNo,string Grade); #endregion #region 扩展数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassService.cs index 34b009e87..a9155f15c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassService.cs @@ -209,7 +209,31 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } - + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + public void UpEmpNos(string xn, string xq, string classNo, string LessonNo, string EmpNo, string hisempno, string Grade) + { + try + { + StringBuilder sb = new StringBuilder(); + sb.Append(" update StuSelectLessonList set EmpNo ='" + EmpNo + "' where classno = '" + classNo + "' and Semester ='" + xq + "' and AcademicYearNo ='" + xn + "' and LessonNo ='" + LessonNo + "' and empno = '" + hisempno + "' and Grade = '" + Grade + "'"); + this.BaseRepository("CollegeMIS").ExecuteBySql(sb.ToString()); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #endregion