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 306b5ec18..50a57bd0b 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 @@ -204,6 +204,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuLeaveManagementApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuLeaveManagementApi.cs index 8479f9349..e66e6b3f2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuLeaveManagementApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuLeaveManagementApi.cs @@ -36,6 +36,11 @@ namespace Learun.Application.WebApi Get["/form"] = GetForm; Post["/delete"] = DeleteForm; Post["/save"] = SaveForm; + //审核学生请假 + Post["/savecheck"] = SaveCheckForm; + + //学生请假--教师审核列表 + Get["/checkpagelist"] = GetCheckPageList; } #region 获取数据 @@ -58,6 +63,24 @@ namespace Learun.Application.WebApi return Success(jsonData); } /// + /// 学生请假--教师审核列表 + /// + /// + /// + public Response GetCheckPageList(dynamic _) + { + ReqPageParam parameter = this.GetReqData(); + var data = stuLeaveManagementIBLL.GetCheckPageList(parameter.pagination, parameter.queryJson); + var jsonData = new + { + rows = data, + total = parameter.pagination.total, + page = parameter.pagination.page, + records = parameter.pagination.records + }; + return Success(jsonData); + } + /// /// 获取表单数据 /// /// @@ -74,7 +97,6 @@ namespace Learun.Application.WebApi } - #endregion #region 提交数据 @@ -102,6 +124,57 @@ namespace Learun.Application.WebApi stuLeaveManagementIBLL.SaveEntity(parameter.keyValue, entity); return Success("保存成功!"); } + + /// + /// 判断是否可以审核 + /// + /// + /// + public Response IsCheck(dynamic _) + { + string keyValue = this.GetReqData(); + var stuLeaveManagementData = stuLeaveManagementIBLL.GetStuLeaveManagementEntity(keyValue); + bool isDeptDirector = false; //登录用户是否是系主任标识 + var deptDirectorRoleId = Config.GetValue("DeptDirectorRoleId"); + var loginInfoRoleIds = LoginUserInfo.Get().roleIds; + if (loginInfoRoleIds.IndexOf(',') == -1) + { + if (loginInfoRoleIds == deptDirectorRoleId) + { + isDeptDirector = true; + } + } + else + { + if (loginInfoRoleIds.Split(',').Contains(deptDirectorRoleId)) + { + isDeptDirector = true; + } + } + if (stuLeaveManagementData.LeaveDay > 2 && !isDeptDirector) + { + return Fail("该请假申请大于2天,需要由系主任审核!"); + } + + return Success(""); + } + + /// + /// 审核学生请假 + /// + /// + /// + public Response SaveCheckForm(dynamic _) + { + var loginInfo = LoginUserInfo.Get(); + ReqFormEntity parameter = this.GetReqData(); + StuLeaveManagementEntity entity = parameter.strEntity.ToObject(); + entity.CheckUserId = loginInfo.userId; + entity.CheckUserNo = loginInfo.account; + entity.CheckTime = DateTime.Now; + stuLeaveManagementIBLL.SaveEntity(parameter.keyValue, entity); + return Success("保存成功!"); + } #endregion #region 私有类 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementBLL.cs index cdc1dbf71..df7909d56 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementBLL.cs @@ -43,6 +43,31 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 学生请假教师审核列表 + /// + /// + /// + /// + public IEnumerable GetCheckPageList(Pagination pagination, string queryJson) + { + try + { + return stuLeaveManagementService.GetCheckPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 获取StuLeaveManagement表实体数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementIBLL.cs index 4f2798c34..dfadc6db0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementIBLL.cs @@ -21,6 +21,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 查询参数 /// IEnumerable GetPageList(Pagination pagination, string queryJson); + IEnumerable GetCheckPageList(Pagination pagination, string queryJson); /// /// 获取StuLeaveManagement表实体数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementService.cs index bd09b5f5c..10968868c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementService.cs @@ -105,6 +105,87 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + + public IEnumerable GetCheckPageList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT t.*,s.StuName as CreateUserName,s.ClassNo,s.DeptNo,s.MajorNo,c.ClassDiredctorNo,c.ClassTutorNo "); + strSql.Append(" FROM StuLeaveManagement t left join StuInfoBasic s on t.CreateUserNo=s.StuNo left join ClassInfo c on s.ClassNo=c.ClassNo "); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["LeaveType"].IsEmpty()) + { + dp.Add("LeaveType", queryParam["LeaveType"].ToString(), DbType.String); + strSql.Append(" AND t.LeaveType = @LeaveType "); + } + if (!queryParam["CheckStatus"].IsEmpty()) + { + dp.Add("CheckStatus", queryParam["CheckStatus"].ToString(), DbType.String); + strSql.Append(" AND t.CheckStatus = @CheckStatus "); + } + if (!queryParam["StuNo"].IsEmpty()) + { + dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); + strSql.Append(" AND t.CreateUserNo = @StuNo "); + } + //班级班主任/辅导员/系主任 + var ClassManagerNo = LoginUserInfo.Get().account; + if (!string.IsNullOrEmpty(ClassManagerNo)) + { + dp.Add("ClassManagerNo", ClassManagerNo, DbType.String); + strSql.Append(" AND (c.ClassDiredctorNo = @ClassManagerNo or c.ClassTutorNo = @ClassManagerNo "); + //登录用户是否是系主任:若是,展示大于2天的请假记录; + var deptDirectorRoleId = Config.GetValue("DeptDirectorRoleId"); + if (deptDirectorRoleId != null) + { + var loginInfoRoleIds = LoginUserInfo.Get().roleIds; + if (loginInfoRoleIds.IndexOf(',') == -1) + { + if (loginInfoRoleIds == deptDirectorRoleId) + { + strSql.Append(" or t.LeaveDay>2 )"); + } + else + { + strSql.Append(" ) "); + } + } + else + { + if (loginInfoRoleIds.Split(',').Contains(deptDirectorRoleId)) + { + strSql.Append(" or t.LeaveDay>2 )"); + } + else + { + strSql.Append(" ) "); + } + } + } + else + { + strSql.Append(" ) "); + } + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 获取StuLeaveManagement表实体数据 ///