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 ef5da5b16..f0b91b23d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/OpenLessonPlanOfElectiveStudentApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/OpenLessonPlanOfElectiveStudentApi.cs @@ -22,6 +22,8 @@ namespace Learun.Application.WebApi private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); LessonInfoIBLL lessonInfoIbll = new LessonInfoBLL(); EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); + private OLPElectiveStuSelectCountIBLL oLPElectiveStuSelectCountIBLL = new OLPElectiveStuSelectCountBLL(); + private LessonInfoIBLL lessonInfoIBLL = new LessonInfoBLL(); /// /// 注册接口 @@ -123,6 +125,17 @@ namespace Learun.Application.WebApi //相同时间不能报名 return Success("本学期此时间段已有报名的选修课!"); } + + //专业选修课根据学生选课次数表判断选课上限 + var lesson = lessonInfoIBLL.GetLessonInfoAndTypeByLessonNo(olpeEntity.LessonNo); + if (lesson != null && lesson.LessonTypeCode.Contains("Professional")) + { + var oLPElectiveStuSelectCount = oLPElectiveStuSelectCountIBLL.GetOLPElectiveStuSelectCountEntity(olpeEntity.AcademicYearNo, olpeEntity.Semester, stuInfoBasicEntity.DeptNo); + if (oLPElectiveStuSelectCount != null && sslleListOfNow1.Count() > oLPElectiveStuSelectCount.SelectMaxCount) + { + return Fail("本系部最多选择" + oLPElectiveStuSelectCount.SelectMaxCount + "门专业选修课!"); + } + } } return Fail("正在提交,请等待!"); @@ -381,6 +394,17 @@ namespace Learun.Application.WebApi } } } + + //专业选修课根据学生选课次数表判断选课上限 + var lesson = lessonInfoIBLL.GetLessonInfoAndTypeByLessonNo(olpeEntity.LessonNo); + if (lesson != null && lesson.LessonTypeCode.Contains("Professional")) + { + var oLPElectiveStuSelectCount = oLPElectiveStuSelectCountIBLL.GetOLPElectiveStuSelectCountEntity(olpeEntity.AcademicYearNo, olpeEntity.Semester, stuInfoBasicEntity.DeptNo); + if (oLPElectiveStuSelectCount != null && sslleListOfNow1.Count() > oLPElectiveStuSelectCount.SelectMaxCount) + { + return Fail("本系部最多选择" + oLPElectiveStuSelectCount.SelectMaxCount + "门专业选修课!"); + } + } if (sslleListOfNow2.Count() > 0) { foreach (var item in sslleListOfNow2) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs index 457e01c62..4dab75aab 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs @@ -13,7 +13,7 @@ using Nancy; namespace Learun.Application.WebApi.Modules { - public class TimeTable : BaseNoLoginApi + public class TimeTable : BaseApi { public TimeTable() : base("/learun/adms/timetable") diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoBLL.cs index 1bdfcc200..fd7ec8c62 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoBLL.cs @@ -108,6 +108,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } + public LessonInfoEntity GetLessonInfoAndTypeByLessonNo(string lessonNo) + { + try + { + return lessonInfoService.GetLessonInfoAndTypeByLessonNo(lessonNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public bool GetAny() { try diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoEntity.cs index 2e8fa4042..e8c1bd572 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoEntity.cs @@ -191,6 +191,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration #region 扩展字段 [NotMapped] public string LessonTypeName { get; set; } + [NotMapped] + public string LessonTypeCode { get; set; } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoIBLL.cs index 9e56b4fd0..209c34244 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoIBLL.cs @@ -35,6 +35,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// LessonInfoEntity GetLessonInfoEntityByLessonNo(string lessonNo); + + LessonInfoEntity GetLessonInfoAndTypeByLessonNo(string lessonNo); bool GetAny(); #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoService.cs index 716339fb2..8393d2912 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfo/LessonInfoService.cs @@ -168,6 +168,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 获取LessonInfo表实体数据和课程类型 + /// 主键 + /// + /// + public LessonInfoEntity GetLessonInfoAndTypeByLessonNo(string lessonNo) + { + try + { + string sql = $"select a.*,b.LessonTypeCode from LessonInfo a join CdLessonType b on a.LessonTypeId=b.LTId where a.LessonNo='{lessonNo}'"; + return this.BaseRepository("CollegeMIS").FindList(sql).FirstOrDefault(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OLPElectiveStuSelectCount/OLPElectiveStuSelectCountBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OLPElectiveStuSelectCount/OLPElectiveStuSelectCountBLL.cs new file mode 100644 index 000000000..94177df01 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OLPElectiveStuSelectCount/OLPElectiveStuSelectCountBLL.cs @@ -0,0 +1,143 @@ +using Learun.Util; +using System; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-10-26 11:05 + /// 描 述:学生选课次数维护 + /// + public class OLPElectiveStuSelectCountBLL : OLPElectiveStuSelectCountIBLL + { + private OLPElectiveStuSelectCountService oLPElectiveStuSelectCountService = new OLPElectiveStuSelectCountService(); + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + return oLPElectiveStuSelectCountService.GetPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取OLPElectiveStuSelectCount表实体数据 + /// + /// 主键 + /// + public OLPElectiveStuSelectCountEntity GetOLPElectiveStuSelectCountEntity(string keyValue) + { + try + { + return oLPElectiveStuSelectCountService.GetOLPElectiveStuSelectCountEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public OLPElectiveStuSelectCountEntity GetOLPElectiveStuSelectCountEntity(string AcademicYearNo, string Semester, string DeptNo) + { + try + { + return oLPElectiveStuSelectCountService.GetOLPElectiveStuSelectCountEntity(AcademicYearNo, Semester, DeptNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + oLPElectiveStuSelectCountService.DeleteEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + public void SaveEntity(string keyValue, OLPElectiveStuSelectCountEntity entity) + { + try + { + oLPElectiveStuSelectCountService.SaveEntity(keyValue, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OLPElectiveStuSelectCount/OLPElectiveStuSelectCountEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OLPElectiveStuSelectCount/OLPElectiveStuSelectCountEntity.cs new file mode 100644 index 000000000..7b9fc47ab --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OLPElectiveStuSelectCount/OLPElectiveStuSelectCountEntity.cs @@ -0,0 +1,65 @@ +using Learun.Util; +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-10-26 11:05 + /// 描 述:学生选课次数维护 + /// + public class OLPElectiveStuSelectCountEntity + { + #region 实体成员 + /// + /// Id + /// + [Column("ID")] + public string Id { get; set; } + /// + /// 学年度 + /// + [Column("ACADEMICYEARNO")] + public string AcademicYearNo { get; set; } + /// + /// 学期 + /// + [Column("SEMESTER")] + public string Semester { get; set; } + /// + /// DeptNo + /// + [Column("DEPTNO")] + public string DeptNo { get; set; } + /// + /// 选课次数上限 + /// + [Column("SELECTMAXCOUNT")] + public int? SelectMaxCount { get; set; } + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + this.Id = Guid.NewGuid().ToString(); + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + this.Id = keyValue; + } + #endregion + #region 扩展字段 + #endregion + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OLPElectiveStuSelectCount/OLPElectiveStuSelectCountIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OLPElectiveStuSelectCount/OLPElectiveStuSelectCountIBLL.cs new file mode 100644 index 000000000..3fe068d01 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OLPElectiveStuSelectCount/OLPElectiveStuSelectCountIBLL.cs @@ -0,0 +1,49 @@ +using Learun.Util; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-10-26 11:05 + /// 描 述:学生选课次数维护 + /// + public interface OLPElectiveStuSelectCountIBLL + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// + IEnumerable GetPageList(Pagination pagination, string queryJson); + /// + /// 获取OLPElectiveStuSelectCount表实体数据 + /// + /// 主键 + /// + OLPElectiveStuSelectCountEntity GetOLPElectiveStuSelectCountEntity(string keyValue); + OLPElectiveStuSelectCountEntity GetOLPElectiveStuSelectCountEntity(string AcademicYearNo,string Semester,string DeptNo); + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + void DeleteEntity(string keyValue); + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + void SaveEntity(string keyValue, OLPElectiveStuSelectCountEntity entity); + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OLPElectiveStuSelectCount/OLPElectiveStuSelectCountService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OLPElectiveStuSelectCount/OLPElectiveStuSelectCountService.cs new file mode 100644 index 000000000..c1cac8328 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OLPElectiveStuSelectCount/OLPElectiveStuSelectCountService.cs @@ -0,0 +1,183 @@ +using Dapper; +using Learun.DataBase.Repository; +using Learun.Util; +using System; +using System.Collections.Generic; +using System.Data; +using System.Text; + +namespace Learun.Application.TwoDevelopment.EducationalAdministration +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-10-26 11:05 + /// 描 述:学生选课次数维护 + /// + public class OLPElectiveStuSelectCountService : RepositoryFactory + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" + t.Id, + t.AcademicYearNo, + t.Semester, + t.DeptNo, + t.SelectMaxCount + "); + strSql.Append(" FROM OLPElectiveStuSelectCount t "); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["AcademicYearNo"].IsEmpty()) + { + dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String); + strSql.Append(" AND t.AcademicYearNo = @AcademicYearNo "); + } + if (!queryParam["Semester"].IsEmpty()) + { + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + strSql.Append(" AND t.Semester = @Semester "); + } + if (!queryParam["DeptNo"].IsEmpty()) + { + dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String); + strSql.Append(" AND t.DeptNo = @DeptNo "); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取OLPElectiveStuSelectCount表实体数据 + /// + /// 主键 + /// + public OLPElectiveStuSelectCountEntity GetOLPElectiveStuSelectCountEntity(string keyValue) + { + try + { + return this.BaseRepository("CollegeMIS").FindEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + public OLPElectiveStuSelectCountEntity GetOLPElectiveStuSelectCountEntity(string AcademicYearNo, + string Semester, string DeptNo) + { + try + { + return this.BaseRepository("CollegeMIS").FindEntity(x => x.AcademicYearNo == AcademicYearNo && x.Semester == Semester && x.DeptNo == DeptNo); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + this.BaseRepository("CollegeMIS").Delete(t => t.Id == keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveEntity(string keyValue, OLPElectiveStuSelectCountEntity entity) + { + try + { + if (!string.IsNullOrEmpty(keyValue)) + { + entity.Modify(keyValue); + this.BaseRepository("CollegeMIS").Update(entity); + } + else + { + entity.Create(); + this.BaseRepository("CollegeMIS").Insert(entity); + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj index aaba5d27d..45c4cd545 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj @@ -228,6 +228,10 @@ + + + +