From ac95ccb6db4a32e5fc90e4be0d983d9b5af2f103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=99=93=E5=AF=92?= <823756726@qq.com> Date: Tue, 10 Sep 2024 15:06:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AD=A6=E7=94=9F=E6=8A=A5?= =?UTF-8?q?=E5=90=8D=E9=80=89=E4=BF=AE=E8=AF=BE=E6=97=A0=E5=93=8D=E5=BA=94?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9api=E6=B5=8B=E8=AF=95=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OpenLessonPlanOfElective/StudentIndex.js | 3 +- .../OpenLessonPlanOfElectiveStudentApi.cs | 132 ++++++++++++++++-- .../XmlConfig/database.config | 9 +- 3 files changed, 133 insertions(+), 11 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/StudentIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/StudentIndex.js index 92d7a180d..90e2abc1b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/StudentIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/StudentIndex.js @@ -121,7 +121,8 @@ var bootstrap = function ($, learun) { }, 5000); } else { - learun.alert.warning("系统异常,请稍后!"); + //learun.alert.warning("系统异常,请稍后!"); + learun.alert.warning(res.info); return false; } }, diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/OpenLessonPlanOfElectiveStudentApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/OpenLessonPlanOfElectiveStudentApi.cs index f0b91b23d..762cb11a9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/OpenLessonPlanOfElectiveStudentApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/OpenLessonPlanOfElectiveStudentApi.cs @@ -256,14 +256,14 @@ namespace Learun.Application.WebApi //string account = parameter.StuNo; var parameter = this.GetReq(); - string keyValue = parameter.keyValue; - string account = parameter.StuNo; - - SignUpHelper.Instance.Start(); - //进队列 - SignUpHelper.AddQueue(account, keyValue); + //string keyValue = parameter.keyValue; + //string account = parameter.StuNo; - return Success("操作成功"); + //SignUpHelper.Instance.Start(); + ////进队列 + //SignUpHelper.AddQueue(account, keyValue); + return SignInPre(parameter.StuNo, parameter.keyValue); + //return Success("操作成功"); } public Response SignInByMobile(dynamic _) { @@ -463,7 +463,123 @@ namespace Learun.Application.WebApi #endregion #region 私有类 - + private Response SignInPre(string account, string keyValue) + { + try + { + //学员信息 + var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account); + if (stuInfoBasicEntity == null) + { + //return Fail("当前学员不存在!"); + return Fail("当前学员不存在!"); + } + //课程信息 + var olpeEntity = openLessonPlanOfElectiveIbll.GetOpenLessonPlanOfElectiveEntity(keyValue); + if (olpeEntity == null) + { + //return Fail("当前课程不存在!"); + return Fail("当前课程不存在!"); + } + //所选课程的报名人数是否已满 + var aa = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveListByOLPEId(olpeEntity.Id); + var aaa = aa.Where(x => x.Status == 1 || x.Status == 2).Count(); + if (aaa >= olpeEntity.StuNumMax) + { + //return Fail("当前课程报名人数已满,请选择其他课程!"); + return Fail("当前课程报名人数已满,请选择其他课程!"); + } + //每学期两门 + var sslleList = stuSelectLessonListOfElectiveIBLL.GetStuSelectLessonListOfElectiveListByStuNo(account); + var sslleListOfNow = sslleList.Where(x => x.AcademicYearNo == olpeEntity.AcademicYearNo && x.Semester == olpeEntity.Semester); + var sslleListOfNow1 = sslleListOfNow.Where(x => x.Status == 1 || x.Status == 2); + var sslleListOfNow2 = sslleListOfNow.Where(x => x.Status == 3); + if (sslleListOfNow1.Count() >= Config.GetValue("ElectiveLessonApplyMax").ToInt()) + { + return Fail("每学期最多选择两门选修课!"); + //return; + } + else + { + var m = sslleListOfNow1.FirstOrDefault(x => x.OLPEId == olpeEntity.Id); + if (m != null) + { + if (m.Status == 1) + { + return Fail("当前课程报名审核中,请耐心等待!"); + //return; + } + else if (m.Status == 2) + { + return Success("当前课程已报名成功!"); + //return; + } + } + } + if (sslleListOfNow2.Count() > 0) + { + foreach (var item in sslleListOfNow2) + { + stuSelectLessonListOfElectiveIBLL.DeleteEntity(item.Id); + } + } + //相同时间不能报名 + if (sslleListOfNow1.Where(x => x.LessonSection == olpeEntity.LessonSection).Any()) + { + return Success("本学期此时间段已有报名的选修课!"); + } + //相同课程不能报名 + if (sslleListOfNow1.Where(x => x.LessonNo == olpeEntity.LessonNo).Any()) + { + //return Fail("相同课程不能报名!"); + return Success("本学期此课程已报名!"); + } + //新增报名数据 + var model = new StuSelectLessonListOfElectiveEntity() + { + OLPEId = olpeEntity.Id, + NoticeBookNo = stuInfoBasicEntity.NoticeNo, + StuNo = stuInfoBasicEntity.StuNo, + DeptNo = stuInfoBasicEntity.DeptNo, + MajorNo = stuInfoBasicEntity.MajorNo, + ClassNo = stuInfoBasicEntity.ClassNo, + MajorDetailNo = stuInfoBasicEntity.MajorDetailNo, + MajorDetailName = stuInfoBasicEntity.MajorDetailName, + StuName = stuInfoBasicEntity.StuName, + GenderNo = stuInfoBasicEntity.GenderNo, + Grade = stuInfoBasicEntity.Grade, + AcademicYearNo = olpeEntity.AcademicYearNo, + Semester = olpeEntity.Semester, + LessonNo = olpeEntity.LessonNo, + LessonName = olpeEntity.LessonName, + LessonSortNo = olpeEntity.LessonSortNo, + LessonSection = olpeEntity.LessonSection, + LessonTime = olpeEntity.LessonTime, + EmpNo = olpeEntity.EmpNo, + EmpName = olpeEntity.EmpName, + ClassRoomNo = olpeEntity.ClassRoomNo, + ClassRoomName = olpeEntity.ClassRoomName, + StudyScore = olpeEntity.StudyScore, + StartWeek = olpeEntity.StartWeek, + EndWeek = olpeEntity.EndWeek, + StartDate = olpeEntity.StartDate, + EndDate = olpeEntity.EndDate, + CreateTime = DateTime.Now, + Status = 1, + OrdinaryScoreScale = 1, + TermInScoreScale = 1, + TermEndScoreScale = 1, + OtherScoreScale = 1, + F_SchoolId = olpeEntity.F_SchoolId + }; + stuSelectLessonListOfElectiveIBLL.SaveEntity("", model); + return Success("报名成功"); + } + catch (Exception) + { + return Fail("系统异常!请联系管理员"); + } + } /// /// 表单实体类 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/database.config b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/database.config index 79f6c2827..3ab521cc2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/database.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/database.config @@ -25,7 +25,12 @@ --> - + + + + + + \ No newline at end of file