@@ -170,6 +170,12 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
{ | { | ||||
UserInfo userInfo = LoginUserInfo.Get(); | UserInfo userInfo = LoginUserInfo.Get(); | ||||
MeetingManagementEntity entity = strEntity.ToObject<MeetingManagementEntity>(); | MeetingManagementEntity entity = strEntity.ToObject<MeetingManagementEntity>(); | ||||
//判断会议场地是否被占用 | |||||
var isOccupy = meetingManagementIBLL.JudgeIsOccupy(entity); | |||||
if (isOccupy) | |||||
{ | |||||
return Fail("会议场地当前时间段已被占用!"); | |||||
} | |||||
entity.CreateUser = userInfo.userId; | entity.CreateUser = userInfo.userId; | ||||
entity.CreateTime = DateTime.Now; | entity.CreateTime = DateTime.Now; | ||||
entity.CheckStatus = "0"; | entity.CheckStatus = "0"; | ||||
@@ -200,6 +206,13 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
[AjaxOnly] | [AjaxOnly] | ||||
public ActionResult DoSubmit(string keyValue, string status, string processId) | public ActionResult DoSubmit(string keyValue, string status, string processId) | ||||
{ | { | ||||
//判断会议场地是否被占用 | |||||
var entity = meetingManagementIBLL.GetMeetingManagementEntity(keyValue); | |||||
var isOccupy = meetingManagementIBLL.JudgeIsOccupy(entity); | |||||
if (isOccupy) | |||||
{ | |||||
return Fail("会议场地当前时间段已被占用!"); | |||||
} | |||||
meetingManagementIBLL.DoSubmit(keyValue, status, processId); | meetingManagementIBLL.DoSubmit(keyValue, status, processId); | ||||
return Success("操作成功!"); | return Success("操作成功!"); | ||||
} | } | ||||
@@ -93,6 +93,14 @@ var bootstrap = function ($, learun) { | |||||
if (!$('body').lrValidform()) { | if (!$('body').lrValidform()) { | ||||
return false; | return false; | ||||
} | } | ||||
//验证结束时间必须大于开始时间 | |||||
var BeginTime = $("#BeginTime").val(); | |||||
var EndTime = $("#EndTime").val(); | |||||
if (new Date(EndTime) <= new Date(BeginTime)) { | |||||
learun.alert.warning("会议结束时间必须大于会议开始时间!"); | |||||
return false; | |||||
} | |||||
return true; | return true; | ||||
}; | }; | ||||
// 保存数据 | // 保存数据 | ||||
@@ -215,6 +215,30 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 判断会议场地是否被占用 | |||||
/// <param name="keyValue">主键</param> | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
public bool JudgeIsOccupy(MeetingManagementEntity entity) | |||||
{ | |||||
try | |||||
{ | |||||
return meetingManagementService.JudgeIsOccupy(entity); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 审核实体数据 | /// 审核实体数据 | ||||
/// <param name="keyValue">主键</param> | /// <param name="keyValue">主键</param> | ||||
@@ -70,6 +70,13 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||||
/// <summary> | /// <summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
void DoSubmit(string keyValue, string status, string processId); | void DoSubmit(string keyValue, string status, string processId); | ||||
/// <summary> | |||||
/// 判断会议场地是否被占用 | |||||
/// <param name="keyValue">主键</param> | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
bool JudgeIsOccupy(MeetingManagementEntity entity); | |||||
/// <summary> | /// <summary> | ||||
/// 审核实体数据 | /// 审核实体数据 | ||||
/// <param name="keyValue">主键</param> | /// <param name="keyValue">主键</param> | ||||
@@ -378,6 +378,57 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 判断会议场地是否被占用 | |||||
/// <param name="keyValue">主键</param> | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
public bool JudgeIsOccupy(MeetingManagementEntity entity) | |||||
{ | |||||
try | |||||
{ | |||||
var result = false;//默认false,代表未占用 | |||||
//查找已提交/已审核通过的会议场地 | |||||
var list = this.BaseRepository("CollegeMIS").FindList<MeetingManagementEntity>(x => x.MeetingPlace == entity.MeetingPlace && (x.CheckStatus == "1" || x.CheckStatus == "3")).OrderBy(x => x.BeginTime); | |||||
if (list.Any()) | |||||
{ | |||||
//有则判断时间是否冲突 | |||||
foreach (var item in list) | |||||
{ | |||||
//开始时间:小于区间左,则判断结束时间;区间中间,则占用;大于区间右,则不占用; | |||||
if (entity.BeginTime < item.BeginTime) | |||||
{ | |||||
//结束时间:小于区间左,则不占用; | |||||
if (entity.EndTime > item.BeginTime) | |||||
{ | |||||
result = true; | |||||
return result; | |||||
} | |||||
} | |||||
else if(entity.BeginTime < item.EndTime) | |||||
{ | |||||
result = true; | |||||
return result; | |||||
} | |||||
} | |||||
} | |||||
return result; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 审核实体数据 | /// 审核实体数据 | ||||
/// <param name="keyValue">主键</param> | /// <param name="keyValue">主键</param> | ||||