@@ -22,6 +22,8 @@ namespace Learun.Application.WebApi | |||||
private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); | private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); | ||||
LessonInfoIBLL lessonInfoIbll = new LessonInfoBLL(); | LessonInfoIBLL lessonInfoIbll = new LessonInfoBLL(); | ||||
EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); | EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); | ||||
private OLPElectiveStuSelectCountIBLL oLPElectiveStuSelectCountIBLL = new OLPElectiveStuSelectCountBLL(); | |||||
private LessonInfoIBLL lessonInfoIBLL = new LessonInfoBLL(); | |||||
/// <summary> | /// <summary> | ||||
/// 注册接口 | /// 注册接口 | ||||
@@ -123,6 +125,17 @@ namespace Learun.Application.WebApi | |||||
//相同时间不能报名 | //相同时间不能报名 | ||||
return Success("本学期此时间段已有报名的选修课!"); | 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("正在提交,请等待!"); | 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) | if (sslleListOfNow2.Count() > 0) | ||||
{ | { | ||||
foreach (var item in sslleListOfNow2) | foreach (var item in sslleListOfNow2) | ||||
@@ -13,7 +13,7 @@ using Nancy; | |||||
namespace Learun.Application.WebApi.Modules | namespace Learun.Application.WebApi.Modules | ||||
{ | { | ||||
public class TimeTable : BaseNoLoginApi | |||||
public class TimeTable : BaseApi | |||||
{ | { | ||||
public TimeTable() | public TimeTable() | ||||
: base("/learun/adms/timetable") | : base("/learun/adms/timetable") | ||||
@@ -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() | public bool GetAny() | ||||
{ | { | ||||
try | try | ||||
@@ -191,6 +191,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
#region 扩展字段 | #region 扩展字段 | ||||
[NotMapped] | [NotMapped] | ||||
public string LessonTypeName { get; set; } | public string LessonTypeName { get; set; } | ||||
[NotMapped] | |||||
public string LessonTypeCode { get; set; } | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -35,6 +35,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// <summary> | /// <summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
LessonInfoEntity GetLessonInfoEntityByLessonNo(string lessonNo); | LessonInfoEntity GetLessonInfoEntityByLessonNo(string lessonNo); | ||||
LessonInfoEntity GetLessonInfoAndTypeByLessonNo(string lessonNo); | |||||
bool GetAny(); | bool GetAny(); | ||||
#endregion | #endregion | ||||
@@ -168,6 +168,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 获取LessonInfo表实体数据和课程类型 | |||||
/// <param name="keyValue">主键</param> | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
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<LessonInfoEntity>(sql).FirstOrDefault(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
#endregion | #endregion | ||||
#region 提交数据 | #region 提交数据 | ||||
@@ -0,0 +1,143 @@ | |||||
using Learun.Util; | |||||
using System; | |||||
using System.Data; | |||||
using System.Collections.Generic; | |||||
namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2022-10-26 11:05 | |||||
/// 描 述:学生选课次数维护 | |||||
/// </summary> | |||||
public class OLPElectiveStuSelectCountBLL : OLPElectiveStuSelectCountIBLL | |||||
{ | |||||
private OLPElectiveStuSelectCountService oLPElectiveStuSelectCountService = new OLPElectiveStuSelectCountService(); | |||||
#region 获取数据 | |||||
/// <summary> | |||||
/// 获取页面显示列表数据 | |||||
/// </summary> | |||||
/// <param name="pagination">分页参数</param> | |||||
/// <param name="queryJson">查询参数</param> | |||||
/// <returns></returns> | |||||
public IEnumerable<OLPElectiveStuSelectCountEntity> GetPageList(Pagination pagination, string queryJson) | |||||
{ | |||||
try | |||||
{ | |||||
return oLPElectiveStuSelectCountService.GetPageList(pagination, queryJson); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 获取OLPElectiveStuSelectCount表实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <returns></returns> | |||||
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 提交数据 | |||||
/// <summary> | |||||
/// 删除实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
public void DeleteEntity(string keyValue) | |||||
{ | |||||
try | |||||
{ | |||||
oLPElectiveStuSelectCountService.DeleteEntity(keyValue); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 保存实体数据(新增、修改) | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <param name="entity">实体</param> | |||||
/// <returns></returns> | |||||
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 | |||||
} | |||||
} |
@@ -0,0 +1,65 @@ | |||||
using Learun.Util; | |||||
using System; | |||||
using System.ComponentModel.DataAnnotations.Schema; | |||||
namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2022-10-26 11:05 | |||||
/// 描 述:学生选课次数维护 | |||||
/// </summary> | |||||
public class OLPElectiveStuSelectCountEntity | |||||
{ | |||||
#region 实体成员 | |||||
/// <summary> | |||||
/// Id | |||||
/// </summary> | |||||
[Column("ID")] | |||||
public string Id { get; set; } | |||||
/// <summary> | |||||
/// 学年度 | |||||
/// </summary> | |||||
[Column("ACADEMICYEARNO")] | |||||
public string AcademicYearNo { get; set; } | |||||
/// <summary> | |||||
/// 学期 | |||||
/// </summary> | |||||
[Column("SEMESTER")] | |||||
public string Semester { get; set; } | |||||
/// <summary> | |||||
/// DeptNo | |||||
/// </summary> | |||||
[Column("DEPTNO")] | |||||
public string DeptNo { get; set; } | |||||
/// <summary> | |||||
/// 选课次数上限 | |||||
/// </summary> | |||||
[Column("SELECTMAXCOUNT")] | |||||
public int? SelectMaxCount { get; set; } | |||||
#endregion | |||||
#region 扩展操作 | |||||
/// <summary> | |||||
/// 新增调用 | |||||
/// </summary> | |||||
public void Create() | |||||
{ | |||||
this.Id = Guid.NewGuid().ToString(); | |||||
} | |||||
/// <summary> | |||||
/// 编辑调用 | |||||
/// </summary> | |||||
/// <param name="keyValue"></param> | |||||
public void Modify(string keyValue) | |||||
{ | |||||
this.Id = keyValue; | |||||
} | |||||
#endregion | |||||
#region 扩展字段 | |||||
#endregion | |||||
} | |||||
} | |||||
@@ -0,0 +1,49 @@ | |||||
using Learun.Util; | |||||
using System.Data; | |||||
using System.Collections.Generic; | |||||
namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2022-10-26 11:05 | |||||
/// 描 述:学生选课次数维护 | |||||
/// </summary> | |||||
public interface OLPElectiveStuSelectCountIBLL | |||||
{ | |||||
#region 获取数据 | |||||
/// <summary> | |||||
/// 获取页面显示列表数据 | |||||
/// </summary> | |||||
/// <param name="queryJson">查询参数</param> | |||||
/// <returns></returns> | |||||
IEnumerable<OLPElectiveStuSelectCountEntity> GetPageList(Pagination pagination, string queryJson); | |||||
/// <summary> | |||||
/// 获取OLPElectiveStuSelectCount表实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <returns></returns> | |||||
OLPElectiveStuSelectCountEntity GetOLPElectiveStuSelectCountEntity(string keyValue); | |||||
OLPElectiveStuSelectCountEntity GetOLPElectiveStuSelectCountEntity(string AcademicYearNo,string Semester,string DeptNo); | |||||
#endregion | |||||
#region 提交数据 | |||||
/// <summary> | |||||
/// 删除实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
void DeleteEntity(string keyValue); | |||||
/// <summary> | |||||
/// 保存实体数据(新增、修改) | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <param name="entity">实体</param> | |||||
void SaveEntity(string keyValue, OLPElectiveStuSelectCountEntity entity); | |||||
#endregion | |||||
} | |||||
} |
@@ -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 | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2022-10-26 11:05 | |||||
/// 描 述:学生选课次数维护 | |||||
/// </summary> | |||||
public class OLPElectiveStuSelectCountService : RepositoryFactory | |||||
{ | |||||
#region 获取数据 | |||||
/// <summary> | |||||
/// 获取页面显示列表数据 | |||||
/// </summary> | |||||
/// <param name="pagination">查询参数</param> | |||||
/// <param name="queryJson">查询参数</param> | |||||
/// <returns></returns> | |||||
public IEnumerable<OLPElectiveStuSelectCountEntity> 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<OLPElectiveStuSelectCountEntity>(strSql.ToString(), dp, pagination); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 获取OLPElectiveStuSelectCount表实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <returns></returns> | |||||
public OLPElectiveStuSelectCountEntity GetOLPElectiveStuSelectCountEntity(string keyValue) | |||||
{ | |||||
try | |||||
{ | |||||
return this.BaseRepository("CollegeMIS").FindEntity<OLPElectiveStuSelectCountEntity>(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<OLPElectiveStuSelectCountEntity>(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 提交数据 | |||||
/// <summary> | |||||
/// 删除实体数据 | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
public void DeleteEntity(string keyValue) | |||||
{ | |||||
try | |||||
{ | |||||
this.BaseRepository("CollegeMIS").Delete<OLPElectiveStuSelectCountEntity>(t => t.Id == keyValue); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 保存实体数据(新增、修改) | |||||
/// </summary> | |||||
/// <param name="keyValue">主键</param> | |||||
/// <param name="entity">实体</param> | |||||
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 | |||||
} | |||||
} |
@@ -228,6 +228,10 @@ | |||||
<Compile Include="EducationalAdministration\MobileTest\MobileTestEntity.cs" /> | <Compile Include="EducationalAdministration\MobileTest\MobileTestEntity.cs" /> | ||||
<Compile Include="EducationalAdministration\MobileTest\MobileTestIBLL.cs" /> | <Compile Include="EducationalAdministration\MobileTest\MobileTestIBLL.cs" /> | ||||
<Compile Include="EducationalAdministration\MobileTest\MobileTestService.cs" /> | <Compile Include="EducationalAdministration\MobileTest\MobileTestService.cs" /> | ||||
<Compile Include="EducationalAdministration\OLPElectiveStuSelectCount\OLPElectiveStuSelectCountBLL.cs" /> | |||||
<Compile Include="EducationalAdministration\OLPElectiveStuSelectCount\OLPElectiveStuSelectCountEntity.cs" /> | |||||
<Compile Include="EducationalAdministration\OLPElectiveStuSelectCount\OLPElectiveStuSelectCountIBLL.cs" /> | |||||
<Compile Include="EducationalAdministration\OLPElectiveStuSelectCount\OLPElectiveStuSelectCountService.cs" /> | |||||
<Compile Include="EducationalAdministration\OpenLessonPlan\OpenLessonPlanBLL.cs" /> | <Compile Include="EducationalAdministration\OpenLessonPlan\OpenLessonPlanBLL.cs" /> | ||||
<Compile Include="EducationalAdministration\OpenLessonPlan\OpenLessonPlanIBLL.cs" /> | <Compile Include="EducationalAdministration\OpenLessonPlan\OpenLessonPlanIBLL.cs" /> | ||||
<Compile Include="EducationalAdministration\OpenLessonPlan\OpenLessonPlanService.cs" /> | <Compile Include="EducationalAdministration\OpenLessonPlan\OpenLessonPlanService.cs" /> | ||||