@@ -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("线上选课还未开始!"); | |||
} | |||
/// <summary> | |||
/// 判断队列结果 | |||
/// </summary> | |||
/// <returns></returns> | |||
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("正在提交,请等待!"); | |||
} | |||
/// <summary> | |||
/// 取消报名 | |||
/// </summary> | |||
/// <param name="keyvalue"></param> | |||
/// <returns></returns> | |||
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 | |||
} | |||
@@ -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; | |||
@@ -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 '<span class=\"label label-primary\">审核中</span>'; | |||
} else if (cellvalue == 2) { | |||
return '<span class=\"label label-success\">已报名</span>'; | |||
return '<span class=\"label label-success\">报名成功</span>'; | |||
} else if (cellvalue == 3) { | |||
return '<span class=\"label label-warning\">报名失败</span>'; | |||
} else { | |||
@@ -146,6 +146,8 @@ | |||
<add key="WebApi" value="http://localhost:31173/" /> | |||
<!-- 报名选修课的最大课程数 --> | |||
<add key="ElectiveLessonApplyMax" value="2" /> | |||
<!-- 报名线上选修课的最大课程数 --> | |||
<add key="OnlineElectiveLessonApplyMax" value="2" /> | |||
<!-- 河南对接登录 --> | |||
<add key="appid" value="TZ6RW1DUNIN6C5M88I" /> | |||
<add key="secret" value="55848ef07e0f4e0c991bc8b4426100b2" /> | |||
@@ -220,6 +220,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Include="Bootstraper.cs" /> | |||
<Compile Include="Modules\LessonInfoOfElectiveOnlineApi.cs" /> | |||
<Compile Include="Modules\SSOApi.cs" /> | |||
<Compile Include="Modules\StuEnrollOfficialApi.cs" /> | |||
<Compile Include="Modules\AnnexesNoLoginApi.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 | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 | |||
/// Copyright (c) 2013-2018 北京泉江科技有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2023-06-05 17:06 | |||
/// 描 述:线上选修选课 | |||
/// </summary> | |||
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(); | |||
/// <summary> | |||
/// 注册接口 | |||
/// <summary> | |||
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; | |||
} | |||
/// <summary> | |||
/// 判断队列结果 | |||
/// </summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
private Response GetApplyResult(dynamic _) | |||
{ | |||
dynamic parameter = this.GetReqData<dynamic>(); | |||
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 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表分页数据 | |||
/// <summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response GetPageList(dynamic _) | |||
{ | |||
ReqPageParam parameter = this.GetReqData<ReqPageParam>(); | |||
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<ReqPageParam>(); | |||
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); | |||
} | |||
/// <summary> | |||
/// 获取表单数据 | |||
/// <summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
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 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// <param name="_"></param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public Response Cancel(dynamic _) | |||
{ | |||
dynamic parameter = this.GetReqData<dynamic>(); | |||
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("当前课程未报名,无需取消!"); | |||
} | |||
} | |||
/// <summary> | |||
/// 报名 | |||
/// </summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response SignIn(dynamic _) | |||
{ | |||
//dynamic parameter = this.GetReqData<dynamic>(); | |||
//string keyValue = parameter.keyValue; | |||
//string account = parameter.StuNo; | |||
var parameter = this.GetReq<SignModel>(); | |||
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<dynamic>(); | |||
string keyValue = parameter.keyValue; | |||
string account = parameter.StuNo; | |||
SignUpOnlineHelper.Instance.Start(); | |||
//进队列 | |||
SignUpOnlineHelper.AddQueue(account, keyValue); | |||
return Success("操作成功"); | |||
} | |||
#endregion | |||
#region 私有类 | |||
/// <summary> | |||
/// 表单实体类 | |||
/// <summary> | |||
private class ReqFormEntity | |||
{ | |||
public string keyValue { get; set; } | |||
public string strEntity { get; set; } | |||
} | |||
/// <summary> | |||
/// 报名模型 | |||
/// </summary> | |||
private class SignModel | |||
{ | |||
public string keyValue { get; set; } | |||
public string StuNo { get; set; } | |||
} | |||
#endregion | |||
} | |||
} |
@@ -107,6 +107,8 @@ | |||
<add key="QJUrl" value="www.qj.com"/> | |||
<!-- 报名选修课的最大课程数 --> | |||
<add key="ElectiveLessonApplyMax" value="2" /> | |||
<!-- 报名线上选修课的最大课程数 --> | |||
<add key="OnlineElectiveLessonApplyMax" value="2" /> | |||
<!--系主任角色Id--> | |||
<add key="DeptDirectorRoleId" value="9310c5f3-1a0a-4f23-9452-3e5a15b3b722" /> | |||
@@ -291,6 +291,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// </summary> | |||
[NotMapped] | |||
public int Status { get; set; } | |||
[NotMapped] | |||
public string Introduction { get; set; } | |||
[NotMapped] | |||
public string resume; | |||
#endregion | |||
} | |||
} | |||
@@ -76,7 +76,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
foreach (var item in list) | |||
{ | |||
//模式二:正式选课 | |||
var aa = this.BaseRepository("CollegeMIS").FindList<StuSelectLessonListOfElectiveEntity>(x => x.OLPEId == item.Id);//todo:改实体,改字段 | |||
var aa = this.BaseRepository("CollegeMIS").FindList<StuSelectLessonListOfElectiveOnlineEntity>(x => x.LIOEOId == item.Id); | |||
//已报名人数 | |||
item.StuNumOfApply = aa.Where(x => (x.Status == 1 || x.Status == 2)).Count(); | |||
//审核通过人数 | |||
@@ -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<StuSelectLessonListOfElectiveOnlineEntity> ListQueue = new Queue<StuSelectLessonListOfElectiveOnlineEntity>(); | |||
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; | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -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(); | |||
@@ -95,6 +95,7 @@ | |||
<Compile Include="EducationalAdministration\ElectiveMajorOnline\ElectiveMajorOnlineEntity.cs" /> | |||
<Compile Include="EducationalAdministration\ElectiveMajorOnline\ElectiveMajorOnlineIBLL.cs" /> | |||
<Compile Include="EducationalAdministration\ElectiveMajorOnline\ElectiveMajorOnlineService.cs" /> | |||
<Compile Include="EducationalAdministration\SignUpOnlineHelper.cs" /> | |||
<Compile Include="EducationalAdministration\StuSelectLessonListOfElectiveOnline\StuSelectLessonListOfElectiveOnlineBLL.cs" /> | |||
<Compile Include="EducationalAdministration\StuSelectLessonListOfElectiveOnline\StuSelectLessonListOfElectiveOnlineEntity.cs" /> | |||
<Compile Include="EducationalAdministration\StuSelectLessonListOfElectiveOnline\StuSelectLessonListOfElectiveOnlineIBLL.cs" /> | |||