diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/LessonInfoOfElectiveOnlineController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/LessonInfoOfElectiveOnlineController.cs
index 8b261d341..704d075c0 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/LessonInfoOfElectiveOnlineController.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/LessonInfoOfElectiveOnlineController.cs
@@ -19,6 +19,8 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
private LessonInfoOfElectiveOnlineIBLL lessonInfoOfElectiveOnlineIBLL = new LessonInfoOfElectiveOnlineBLL();
private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
CdMajorIBLL CdMajorIBLL = new CdMajorBLL();
+ private StuSelectLessonListOfElectiveOnlineIBLL stuSelectLessonListOfElectiveOnlineIBLL = new StuSelectLessonListOfElectiveOnlineBLL();
+
#region 视图功能
@@ -241,6 +243,138 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
return Success("线上选课还未开始!");
}
+ ///
+ /// 判断队列结果
+ ///
+ ///
+ public ActionResult GetApplyResult(string keyvalue)
+ {
+ var loginUserInfo = LoginUserInfo.Get();
+ //学员信息
+ var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(loginUserInfo.enCode);
+ if (stuInfoBasicEntity == null)
+ {
+ return Success("当前学员不存在!");
+ }
+ //课程信息
+ var olpeEntity = lessonInfoOfElectiveOnlineIBLL.GetLessonInfoOfElectiveOnlineEntity(keyvalue);
+ if (olpeEntity == null)
+ {
+ return Success("当前课程不存在!");
+ }
+
+ //当前学员本学期是否有报名课程:每学期一门
+ //var sslleEntity = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineEntityByStuNo(loginUserInfo.enCode, "");
+ //if (sslleEntity != null)
+ //{
+ // if (sslleEntity.OLPEId != keyvalue && sslleEntity.Status != 3)
+ // {
+ // return Success("已存在报名课程,每学期只能选择一门选修课!如需报名其他课程请先取消。");
+ // }
+ // if (sslleEntity.Status == 1)
+ // {
+ // return Success("报名审核中,请耐心等待!");
+ // }
+ // else if (sslleEntity.Status == 2)
+ // {
+ // return Success("已存在报名成功的课程,只能选择一门选修课!");
+ // }
+
+ //}
+ //else
+ //{
+ // //所选课程的报名人数是否已满
+ // var aa = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineListByOLPEId(keyvalue);
+ // var aaa = aa.Count(x => x.Status == 1 || x.Status == 2);
+ // if (aaa >= olpeEntity.StuNumMax)
+ // {
+ // return Success("当前课程报名人数已满,请选择其他课程!");
+ // }
+ //}
+
+ //每学期两门(几门根据系统配置文件值确定)
+ var sslleEntity = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineEntityByStuNo(loginUserInfo.enCode, keyvalue);
+ if (sslleEntity != null)
+ {
+ if (sslleEntity.Status == 1)
+ {
+ return Success("当前课程报名审核中,请耐心等待!");
+ }
+ else if (sslleEntity.Status == 2)
+ {
+ return Success("当前课程已报名成功!");
+ }
+ }
+ else
+ {
+ //所选课程的报名人数是否已满
+ var aa = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineListByOLPEId(keyvalue);
+ var aaa = aa.Count(x => x.Status == 1 || x.Status == 2);
+ if (aaa >= olpeEntity.StuNumMax)
+ {
+ return Success("当前课程报名人数已满,请选择其他课程!");
+ }
+ //每学期最多两门
+ var sslleList = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineListByStuNo(loginUserInfo.enCode);
+ var sslleListOfNow = sslleList.Where(x => x.AcademicYearNo == olpeEntity.AcademicYearNo && x.Semester == olpeEntity.Semester);
+ var sslleListOfNow1 = sslleListOfNow.Where(x => x.Status == 1 || x.Status == 2);
+ //if (sslleListOfNow1.Count() >= 2)
+ if (sslleListOfNow1.Count() >= Config.GetValue("OnlineElectiveLessonApplyMax").ToInt())
+ {
+ return Success("每学期最多选择" + Config.GetValue("OnlineElectiveLessonApplyMax").ToInt() + "门线上选修课!");
+ }
+ //相同时间不能报名
+ if (!string.IsNullOrEmpty(olpeEntity.LessonSection) && sslleListOfNow1.Where(x => x.LessonSection == olpeEntity.LessonSection).Any())
+ {
+ //相同时间不能报名
+ return Success("本学期此时间段已有报名的选修课!");
+ }
+
+ }
+
+ return Fail("正在提交,请等待!");
+ }
+
+ ///
+ /// 取消报名
+ ///
+ ///
+ ///
+ public ActionResult CancelApply(string keyvalue)
+ {
+ var loginUserInfo = LoginUserInfo.Get();
+ //学员信息
+ var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(loginUserInfo.enCode);
+ if (stuInfoBasicEntity == null)
+ {
+ return Fail("当前学员不存在!");
+ }
+ //课程信息
+ var olpeEntity = lessonInfoOfElectiveOnlineIBLL.GetLessonInfoOfElectiveOnlineEntity(keyvalue);
+ if (olpeEntity == null)
+ {
+ return Fail("当前课程不存在!");
+ }
+ //当前学员是否已经报名该课程
+ var sslleEntity = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineEntityByStuNo(loginUserInfo.enCode, keyvalue);
+ if (sslleEntity != null)
+ {
+ if (sslleEntity.Status != 2)
+ {
+ stuSelectLessonListOfElectiveOnlineIBLL.DeleteEntity(sslleEntity.Id);
+ return Success("取消成功");
+ }
+ else
+ {
+ return Fail("取消失败,当前课程已报名成功!");
+ }
+ }
+ else
+ {
+ return Fail("当前课程未报名,无需取消!");
+ }
+ }
+
#endregion
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuSelectLessonListOfElectiveOnlineController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuSelectLessonListOfElectiveOnlineController.cs
index cbaee1a3d..734f92fba 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuSelectLessonListOfElectiveOnlineController.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuSelectLessonListOfElectiveOnlineController.cs
@@ -233,12 +233,12 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
if (aa == 1)//是
{
//判断选课的课程的报名人数是否已满
- if (olpeEntity.StuNum >= olpeEntity.StuNumMax)
+ if (olpeEntity.StuNum.HasValue && olpeEntity.StuNum.Value >= olpeEntity.StuNumMax)
{
return Fail("当前选课的课程人数已满!");
}
//选课的课程报名人数加1
- olpeEntity.StuNum = olpeEntity.StuNum + 1;
+ olpeEntity.StuNum = olpeEntity.StuNum.HasValue ? olpeEntity.StuNum.Value + 1 : 1 ;
lessonInfoOfElectiveOnlineIBLL.SaveEntity(olpeEntity.Id, olpeEntity);
//报名成功
sslleEntity.Status = 2;
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonInfoOfElectiveOnline/StudentIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonInfoOfElectiveOnline/StudentIndex.js
index a1be98ab5..582c22dbc 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonInfoOfElectiveOnline/StudentIndex.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/LessonInfoOfElectiveOnline/StudentIndex.js
@@ -74,8 +74,6 @@ var bootstrap = function ($, learun) {
location.reload();
});
- //todo:待一个个查看
-
// 报名
$('#lr_apply').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');
@@ -92,7 +90,7 @@ var bootstrap = function ($, learun) {
_postData.keyValue = keyValue;
_postData.StuNo = learun.clientdata.get(['userinfo']).enCode;
$.ajax({
- url: WebApiUrl + '/Learun/LessonInfoOfElectiveOnlineStudent/SignIn',
+ url: WebApiUrl + '/Learun/LessonInfoOfElectiveOnline/SignIn',
data: _postData,
type: "POST",
dataType: "json",
@@ -142,6 +140,15 @@ var bootstrap = function ($, learun) {
$('#lr_cancel').on('click', function () {
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
+ var Status = $('#gridtable').jfGridValue('Status');
+ if (Status == "2") {//报名成功
+ learun.alert.warning("当前课程已报名成功,无法取消!");
+ return false;
+ }
+ if (Status != "1") {//审核中
+ learun.alert.warning("当前课程未报名或者报名失败,无法取消!");
+ return false;
+ }
learun.layerConfirm('是否确认取消报名该课程!', function (res) {
if (res) {
learun.postForm(top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/CancelApply', { keyValue: keyValue }, function () {
@@ -183,7 +190,7 @@ var bootstrap = function ($, learun) {
if (cellvalue == 1) {
return '审核中';
} else if (cellvalue == 2) {
- return '已报名';
+ return '报名成功';
} else if (cellvalue == 3) {
return '报名失败';
} else {
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config
index 9bf35fd50..6ec74a1f8 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config
@@ -146,6 +146,8 @@
+
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj
index 68aa02d5a..92de25cee 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj
@@ -220,6 +220,7 @@
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/LessonInfoOfElectiveOnlineApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/LessonInfoOfElectiveOnlineApi.cs
new file mode 100644
index 000000000..acdbdcc1b
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/LessonInfoOfElectiveOnlineApi.cs
@@ -0,0 +1,295 @@
+using System;
+using Nancy;
+using Learun.Util;
+using System.Collections.Generic;
+using Learun.Application.TwoDevelopment.EducationalAdministration;
+using System.Linq;
+
+namespace Learun.Application.WebApi
+{
+ ///
+ /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
+ /// Copyright (c) 2013-2018 北京泉江科技有限公司
+ /// 创 建:超级管理员
+ /// 日 期:2023-06-05 17:06
+ /// 描 述:线上选修选课
+ ///
+ public class LessonInfoOfElectiveOnlineApi : BaseNoAuthentication
+ {
+ private LessonInfoOfElectiveOnlineIBLL lessonInfoOfElectiveOnlineIbll = new LessonInfoOfElectiveOnlineBLL();
+ private StuSelectLessonListOfElectiveOnlineIBLL stuSelectLessonListOfElectiveOnlineIBLL = new StuSelectLessonListOfElectiveOnlineBLL();
+ private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
+ LessonInfoIBLL lessonInfoIbll = new LessonInfoBLL();
+ EmpInfoIBLL empInfoIbll = new EmpInfoBLL();
+ private LessonInfoIBLL lessonInfoIBLL = new LessonInfoBLL();
+
+ ///
+ /// 注册接口
+ ///
+ public LessonInfoOfElectiveOnlineApi()
+ : base("/Learun/LessonInfoOfElectiveOnline")
+ {
+ Get["/pagelist"] = GetPageList;
+ Get["/studentpagelist"] = StudentGetPageList;
+ Get["/form"] = GetForm;
+ Post["/Cancel"] = Cancel;
+ Post["/SignIn"] = SignIn;
+ Post["/SignInByMobile"] = SignInByMobile;
+ Post["/GetApplyResult"] = GetApplyResult;
+ }
+
+ ///
+ /// 判断队列结果
+ ///
+ ///
+ ///
+ private Response GetApplyResult(dynamic _)
+ {
+ dynamic parameter = this.GetReqData();
+ string keyValue = parameter.keyValue;
+ string account = parameter.StuNo;
+ //学员信息
+ var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account);
+ if (stuInfoBasicEntity == null)
+ {
+ return Fail("当前学员不存在!");
+ }
+ //课程信息
+ var olpeEntity = lessonInfoOfElectiveOnlineIbll.GetLessonInfoOfElectiveOnlineEntity(keyValue);
+ if (olpeEntity == null)
+ {
+ return Fail("当前课程不存在!");
+ }
+
+ //当前学员本学期是否有报名课程:每学期一门
+ //var sslleEntity = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineEntityByStuNo(account, "");
+ //if (sslleEntity != null)
+ //{
+ // if (sslleEntity.OLPEId != keyValue && sslleEntity.Status != 3)
+ // {
+ // return Success("已存在报名课程,每学期只能选择一门选修课!如需报名其他课程请先取消。");
+ // }
+ // if (sslleEntity.Status == 1)
+ // {
+ // return Success("报名审核中,请耐心等待!");
+ // }
+ // else if (sslleEntity.Status == 2)
+ // {
+ // return Success("已存在报名成功的课程,只能选择一门选修课!");
+ // }
+
+ //}
+ //else
+ //{
+ // //所选课程的报名人数是否已满
+ // var aa = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineListByOLPEId(keyValue);
+ // var aaa = aa.Count(x => x.Status == 1 || x.Status == 2);
+ // if (aaa >= olpeEntity.StuNumMax)
+ // {
+ // return Success("当前课程报名人数已满,请选择其他课程!");
+ // }
+ //}
+
+ //每学期两门(几门根据系统配置文件值确定)
+ var sslleEntity = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineEntityByStuNo(account, keyValue);
+ if (sslleEntity != null)
+ {
+ if (sslleEntity.Status == 1)
+ {
+ return Fail("当前课程报名审核中,请耐心等待!");
+ }
+ else if (sslleEntity.Status == 2)
+ {
+ return Fail("当前课程已报名成功!");
+ }
+ }
+ else
+ {
+ //所选课程的报名人数是否已满
+ var aa = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineListByOLPEId(keyValue);
+ var aaa = aa.Count(x => x.Status == 1 || x.Status == 2);
+ if (aaa >= olpeEntity.StuNumMax)
+ {
+ return Fail("当前课程报名人数已满,请选择其他课程!");
+ }
+ //每学期最多两门
+ var sslleList = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineListByStuNo(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);
+ if (sslleListOfNow1.Count() >= Config.GetValue("OnlineElectiveLessonApplyMax").ToInt())
+ {
+ return Fail("每学期最多选择" + Config.GetValue("OnlineElectiveLessonApplyMax").ToInt() + "门线上选修课!");
+ }
+ //相同时间不能报名
+ if (sslleListOfNow1.Where(x => x.LessonSection == olpeEntity.LessonSection).Any())
+ {
+ //相同时间不能报名
+ return Fail("本学期此时间段已有报名的选修课!");
+ }
+
+ }
+
+ return Fail("正在提交,请等待!");
+ }
+
+ #region 获取数据
+
+ ///
+ /// 获取页面显示列表分页数据
+ ///
+ ///
+ ///
+ public Response GetPageList(dynamic _)
+ {
+ ReqPageParam parameter = this.GetReqData();
+ var data = lessonInfoOfElectiveOnlineIbll.GetPageListOfStudent(parameter.pagination, parameter.queryJson).OrderByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x => x.LessonNo).ThenBy(x => x.EmpNo);
+ var jsonData = new
+ {
+ rows = data,
+ total = parameter.pagination.total,
+ page = parameter.pagination.page,
+ records = parameter.pagination.records
+ };
+ return Success(jsonData);
+ }
+ public Response StudentGetPageList(dynamic _)
+ {
+ ReqPageParam parameter = this.GetReqData();
+ var data = stuSelectLessonListOfElectiveOnlineIBLL.GetPageList(parameter.pagination, parameter.queryJson).OrderByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x => x.LessonNo).ThenBy(x => x.EmpNo);
+ var jsonData = new
+ {
+ rows = data,
+ total = parameter.pagination.total,
+ page = parameter.pagination.page,
+ records = parameter.pagination.records
+ };
+ return Success(jsonData);
+ }
+ ///
+ /// 获取表单数据
+ ///
+ ///
+ ///
+ public Response GetForm(dynamic _)
+ {
+ string keyValue = this.GetReqData();
+ var JournalReceiveData = lessonInfoOfElectiveOnlineIbll.GetLessonInfoOfElectiveOnlineEntity(keyValue);
+ if (lessonInfoIbll.GetLessonInfoEntityByLessonNo(JournalReceiveData.LessonNo) != null)
+ {
+ if (!string.IsNullOrEmpty(lessonInfoIbll.GetLessonInfoEntityByLessonNo(JournalReceiveData.LessonNo).Introduction))
+ JournalReceiveData.Introduction = WebHelper.NoHtml(WebHelper.HtmlDecode(lessonInfoIbll.GetLessonInfoEntityByLessonNo(JournalReceiveData.LessonNo).Introduction)) ?? "";
+ }
+ if (empInfoIbll.GetEmpInfoEntityByEmpNo(JournalReceiveData.EmpNo) != null)
+ {
+ if (!string.IsNullOrEmpty(empInfoIbll.GetEmpInfoEntityByEmpNo(JournalReceiveData.EmpNo).resume))
+ JournalReceiveData.resume = WebHelper.NoHtml(WebHelper.HtmlDecode(empInfoIbll.GetEmpInfoEntityByEmpNo(JournalReceiveData.EmpNo).resume)) ?? "";
+ }
+ var jsonData = new
+ {
+ JournalReceive = JournalReceiveData,
+ };
+ return Success(jsonData);
+ }
+ #endregion
+
+ #region 提交数据
+
+ ///
+ /// 删除实体数据
+ ///
+ ///
+ ///
+ public Response Cancel(dynamic _)
+ {
+ dynamic parameter = this.GetReqData();
+ string keyValue = parameter.keyValue;
+ string account = parameter.StuNo;
+ //学员信息
+ var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(account);
+ if (stuInfoBasicEntity == null)
+ {
+ return Fail("当前学员不存在!");
+ }
+ //课程信息
+ var olpeEntity = lessonInfoOfElectiveOnlineIbll.GetLessonInfoOfElectiveOnlineEntity(keyValue);
+ if (olpeEntity == null)
+ {
+ return Fail("当前课程不存在!");
+ }
+ //当前学员是否已经报名该课程
+ var sslleEntity = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineEntityByStuNo(account, keyValue);
+ if (sslleEntity != null)
+ {
+ if (sslleEntity.Status != 2)
+ {
+ stuSelectLessonListOfElectiveOnlineIBLL.DeleteEntity(sslleEntity.Id);
+ return Fail("取消成功");
+ }
+ else
+ {
+ return Fail("取消失败,当前课程已报名成功!");
+ }
+ }
+ else
+ {
+ return Fail("当前课程未报名,无需取消!");
+ }
+ }
+ ///
+ /// 报名
+ ///
+ ///
+ ///
+ public Response SignIn(dynamic _)
+ {
+ //dynamic parameter = this.GetReqData();
+ //string keyValue = parameter.keyValue;
+ //string account = parameter.StuNo;
+
+ var parameter = this.GetReq();
+ string keyValue = parameter.keyValue;
+ string account = parameter.StuNo;
+
+ SignUpOnlineHelper.Instance.Start();
+ //进队列
+ SignUpOnlineHelper.AddQueue(account, keyValue);
+
+ return Success("操作成功");
+ }
+ public Response SignInByMobile(dynamic _)
+ {
+ dynamic parameter = this.GetReqData();
+ string keyValue = parameter.keyValue;
+ string account = parameter.StuNo;
+
+ SignUpOnlineHelper.Instance.Start();
+ //进队列
+ SignUpOnlineHelper.AddQueue(account, keyValue);
+
+ return Success("操作成功");
+ }
+
+ #endregion
+
+ #region 私有类
+
+ ///
+ /// 表单实体类
+ ///
+ private class ReqFormEntity
+ {
+ public string keyValue { get; set; }
+ public string strEntity { get; set; }
+ }
+ ///
+ /// 报名模型
+ ///
+ private class SignModel
+ {
+ public string keyValue { get; set; }
+ public string StuNo { get; set; }
+ }
+ #endregion
+
+ }
+}
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config
index 8083ced83..296ae2ea8 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config
@@ -107,6 +107,8 @@
+
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfoOfElectiveOnline/LessonInfoOfElectiveOnlineEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfoOfElectiveOnline/LessonInfoOfElectiveOnlineEntity.cs
index 9468ab5b2..33516ddb2 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfoOfElectiveOnline/LessonInfoOfElectiveOnlineEntity.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfoOfElectiveOnline/LessonInfoOfElectiveOnlineEntity.cs
@@ -291,6 +291,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
///
[NotMapped]
public int Status { get; set; }
+ [NotMapped]
+ public string Introduction { get; set; }
+ [NotMapped]
+ public string resume;
#endregion
}
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfoOfElectiveOnline/LessonInfoOfElectiveOnlineService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfoOfElectiveOnline/LessonInfoOfElectiveOnlineService.cs
index fbe4acb69..eb616ee51 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfoOfElectiveOnline/LessonInfoOfElectiveOnlineService.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/LessonInfoOfElectiveOnline/LessonInfoOfElectiveOnlineService.cs
@@ -76,7 +76,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
foreach (var item in list)
{
//模式二:正式选课
- var aa = this.BaseRepository("CollegeMIS").FindList(x => x.OLPEId == item.Id);//todo:改实体,改字段
+ var aa = this.BaseRepository("CollegeMIS").FindList(x => x.LIOEOId == item.Id);
//已报名人数
item.StuNumOfApply = aa.Where(x => (x.Status == 1 || x.Status == 2)).Count();
//审核通过人数
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SignUpOnlineHelper.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SignUpOnlineHelper.cs
new file mode 100644
index 000000000..efe6f6273
--- /dev/null
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/SignUpOnlineHelper.cs
@@ -0,0 +1,232 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Learun.Util;
+using Microsoft.AspNet.SignalR;
+
+namespace Learun.Application.TwoDevelopment.EducationalAdministration
+{
+ public class SignUpOnlineHelper
+ {
+
+ public readonly static SignUpOnlineHelper Instance = new SignUpOnlineHelper();
+ public SignUpOnlineHelper()
+ { }
+ public static Queue ListQueue = new Queue();
+ private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
+ private LessonInfoOfElectiveOnlineIBLL lessonInfoOfElectiveOnlineIBLL = new LessonInfoOfElectiveOnlineBLL();
+ private StuSelectLessonListOfElectiveOnlineIBLL stuSelectLessonListOfElectiveOnlineIBLL = new StuSelectLessonListOfElectiveOnlineBLL();
+ private Thread t;
+
+ public static void AddQueue(string stuNo, string lioeoId) //入列
+ {
+ StuSelectLessonListOfElectiveOnlineEntity entity = new StuSelectLessonListOfElectiveOnlineEntity();
+ entity.StuNo = stuNo;
+ entity.LIOEOId = lioeoId;
+ ListQueue.Enqueue(entity);
+ }
+ public void Start()//启动
+ {
+ if (t == null)
+ {
+ t = new Thread(threadStart);
+ t.IsBackground = true;
+ t.Start();
+ }
+ else
+ {
+ if (!t.IsAlive)
+ {
+ t = new Thread(threadStart);
+ t.IsBackground = true;
+ t.Start();
+ }
+ }
+ }
+
+ private void threadStart()
+ {
+ while (true)
+ {
+ if (ListQueue.Count > 0)
+ {
+ try
+ {
+ ScanQueue();
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ else
+ {
+ //没有任务,休息3秒钟
+ Thread.Sleep(3000);
+ }
+ }
+ }
+
+ //要执行的方法
+ private void ScanQueue()
+ {
+ while (ListQueue.Count > 0)
+ {
+ try
+ {
+ //从队列中取出
+ StuSelectLessonListOfElectiveOnlineEntity entity = ListQueue.Dequeue();
+ //处理数据:
+
+ //学员信息
+ var stuInfoBasicEntity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(entity.StuNo);
+ if (stuInfoBasicEntity == null)
+ {
+ //return Fail("当前学员不存在!");
+ return;
+ }
+ //课程信息
+ var olpeEntity = lessonInfoOfElectiveOnlineIBLL.GetLessonInfoOfElectiveOnlineEntity(entity.LIOEOId);
+ if (olpeEntity == null)
+ {
+ //return Fail("当前课程不存在!");
+ return;
+ }
+ //所选课程的报名人数是否已满
+ var aa = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineListByOLPEId(olpeEntity.Id);
+ var aaa = aa.Where(x => x.Status == 1 || x.Status == 2).Count();
+ if (aaa >= olpeEntity.StuNumMax)
+ {
+ //return Fail("当前课程报名人数已满,请选择其他课程!");
+ return;
+ }
+
+ //当前学员本学期是否有报名课程:每学期一门
+ //var sslleEntity = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineEntityByStuNo(entity.StuNo, "");
+ //if (sslleEntity != null)
+ //{
+ // if (sslleEntity.OLPEId != entity.OLPEId && sslleEntity.Status != 3)
+ // {
+ // //return Fail("已存在报名课程,每学期只能选择一门选修课!如需报名其他课程请先取消。");
+ // return;
+ // }
+ // if (sslleEntity.Status == 1)
+ // {
+ // //return Fail("报名审核中,请耐心等待!");
+ // return;
+ // }
+ // else if (sslleEntity.Status == 2)
+ // {
+ // //return Fail("已存在报名成功的课程,只能选择一门选修课!");
+ // return;
+ // }
+ // else if (sslleEntity.Status == 3)//移除报名失败的数据
+ // {
+ // stuSelectLessonListOfElectiveOnlineIBLL.DeleteEntity(sslleEntity.Id);
+ // }
+
+ //}
+
+
+ //每学期两门(几门根据系统配置文件值确定)
+ var sslleList = stuSelectLessonListOfElectiveOnlineIBLL.GetStuSelectLessonListOfElectiveOnlineListByStuNo(entity.StuNo);
+ 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("OnlineElectiveLessonApplyMax").ToInt())
+ {
+ //return Fail("每学期最多选择两门选修课!");
+ return;
+ }
+ else
+ {
+ var m = sslleListOfNow1.FirstOrDefault(x => x.LIOEOId == olpeEntity.Id);
+ if (m != null)
+ {
+ if (m.Status == 1)
+ {
+ //return Fail("当前课程报名审核中,请耐心等待!");
+ return;
+ }
+ else if (m.Status == 2)
+ {
+ //return Fail("当前课程已报名成功!");
+ return;
+ }
+ }
+ }
+ if (sslleListOfNow2.Count() > 0)
+ {
+ foreach (var item in sslleListOfNow2)
+ {
+ stuSelectLessonListOfElectiveOnlineIBLL.DeleteEntity(item.Id);
+ }
+ }
+ //相同时间不能报名
+ if (!string.IsNullOrEmpty(olpeEntity.LessonSection) && sslleListOfNow1.Where(x => x.LessonSection == olpeEntity.LessonSection).Any())
+ {
+ //相同时间不能报名
+ return;
+ }
+ //相同课程不能报名
+ if (sslleListOfNow1.Where(x => x.LessonNo == olpeEntity.LessonNo).Any())
+ {
+ //相同课程不能报名
+ return;
+ }
+ //新增报名数据
+ var model = new StuSelectLessonListOfElectiveOnlineEntity()
+ {
+ LIOEOId = 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
+ };
+ stuSelectLessonListOfElectiveOnlineIBLL.SaveEntity("", model);
+
+
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+ }
+
+ }
+
+
+
+}
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuSelectLessonListOfElectiveOnline/StuSelectLessonListOfElectiveOnlineService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuSelectLessonListOfElectiveOnline/StuSelectLessonListOfElectiveOnlineService.cs
index f8c1a4ac4..956fc4198 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuSelectLessonListOfElectiveOnline/StuSelectLessonListOfElectiveOnlineService.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuSelectLessonListOfElectiveOnline/StuSelectLessonListOfElectiveOnlineService.cs
@@ -211,7 +211,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
{
db.ExecuteBySql("update StuSelectLessonListOfElectiveOnline set Status=2 where Id='" + item + "'");
}
- olpentity.StuNum += stulist.Length;
+ olpentity.StuNum = olpentity.StuNum.HasValue ? olpentity.StuNum.Value + stulist.Length : stulist.Length;
db.Update(olpentity);
db.Commit();
}
@@ -272,7 +272,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
//修改LessonInfoOfElectiveOnline通过人数
if (count > 0)
{
- olpentity.StuNum = olpentity.StuNum - count;
+ olpentity.StuNum = olpentity.StuNum.HasValue ? olpentity.StuNum.Value - count : 0 ;
db.Update(olpentity);
}
db.Commit();
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 104ca2923..788d7dc46 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
@@ -95,6 +95,7 @@
+