Selaa lähdekoodia

学生请假审核通过后,添加学生课表请假数据

新疆警官学校中职
zhangli 2 vuotta sitten
vanhempi
commit
6529e05a7a
3 muutettua tiedostoa jossa 70 lisäystä ja 8 poistoa
  1. +5
    -2
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuLeaveManagementApi.cs
  2. +3
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs
  3. +62
    -6
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementService.cs

+ 5
- 2
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuLeaveManagementApi.cs Näytä tiedosto

@@ -36,11 +36,14 @@ namespace Learun.Application.WebApi
Get["/form"] = GetForm;
Post["/delete"] = DeleteForm;
Post["/save"] = SaveForm;
//审核学生请假
Post["/savecheck"] = SaveCheckForm;

//判断是否可以审核
Get["/ischeck"] = IsCheck;
//学生请假--教师审核列表
Get["/checkpagelist"] = GetCheckPageList;
//审核学生请假
Post["/savecheck"] = SaveCheckForm;

}
#region 获取数据



+ 3
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs Näytä tiedosto

@@ -157,6 +157,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// </summary>
[NotMapped] public string SyncType { get; set; }

[NotMapped] public string StuName { get; set; }
[NotMapped] public string Grade { get; set; }

#endregion

#region 扩展操作


+ 62
- 6
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuLeaveManagement/StuLeaveManagementService.cs Näytä tiedosto

@@ -39,12 +39,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
var dp = new DynamicParameters(new { });
if (!queryParam["LeaveType"].IsEmpty())
{
dp.Add("LeaveType",queryParam["LeaveType"].ToString(), DbType.String);
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);
dp.Add("CheckStatus", queryParam["CheckStatus"].ToString(), DbType.String);
strSql.Append(" AND t.CheckStatus = @CheckStatus ");
}
if (!queryParam["StuNo"].IsEmpty())
@@ -90,7 +90,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
strSql.Append(" ) ");
}
}
return this.BaseRepository("CollegeMIS").FindList<StuLeaveManagementEntity>(strSql.ToString(),dp, pagination);
return this.BaseRepository("CollegeMIS").FindList<StuLeaveManagementEntity>(strSql.ToString(), dp, pagination);
}
catch (Exception ex)
{
@@ -222,7 +222,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
{
try
{
this.BaseRepository("CollegeMIS").Delete<StuLeaveManagementEntity>(t=>t.Id == keyValue);
this.BaseRepository("CollegeMIS").Delete<StuLeaveManagementEntity>(t => t.Id == keyValue);
}
catch (Exception ex)
{
@@ -244,21 +244,77 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// <param name="entity">实体</param>
public void SaveEntity(string keyValue, StuLeaveManagementEntity entity)
{
var db = this.BaseRepository("CollegeMIS");
try
{
db.BeginTrans();
if (!string.IsNullOrEmpty(keyValue))
{
entity.Modify(keyValue);
this.BaseRepository("CollegeMIS").Update(entity);
db.Update(entity);

if (entity.CheckStatus.Trim() == "1" && entity.StartTime != null)
{
//请假审核通过后,该学生的对应日期的课表改为请假
var model = db.FindList<StuLeaveManagementEntity>(
$"select * from StuLeaveManagement where Id='{keyValue}'").FirstOrDefault();
//请假开始时间和结束时间
var startTime = Convert.ToDateTime(model.StartTime?.ToString("yyyy-MM-dd") + " 00:00:00");
var endTime = Convert.ToDateTime(model.EndTime?.ToString("yyyy-MM-dd") + " 23:59:59");

//排课数据
var arrangeLessonTermList = db.FindList<ArrangeLessonTermEntity>($@"select a.*,b.StuName,b.Grade from [dbo].[ArrangeLessonTerm] a
join stuinfobasic b on a.teachclassno=b.classno
where b.stuno='{model.CreateUserNo}'
and a.lessondate between '{startTime}' and '{endTime}'");

var deptList = db.FindList<CdDeptEntity>();
var majorList = db.FindList<CdMajorEntity>();
var classInfoList = db.FindList<ClassInfoEntity>();
foreach (var arrangeLessonTerm in arrangeLessonTermList)
{
StuAttendanceLeaveEntity stuAttendanceLeave = new StuAttendanceLeaveEntity();
stuAttendanceLeave.Create();
stuAttendanceLeave.AcademicYearNo = arrangeLessonTerm.AcademicYearNo;
stuAttendanceLeave.Semester = arrangeLessonTerm.Semester;
stuAttendanceLeave.StuNo = model.CreateUserNo;
stuAttendanceLeave.StuName = arrangeLessonTerm.StuName;
stuAttendanceLeave.Grade = arrangeLessonTerm.Grade;
stuAttendanceLeave.DeptNo = arrangeLessonTerm.DeptNo;
stuAttendanceLeave.DeptName = deptList.Where(x => x.DeptNo == arrangeLessonTerm.DeptNo)
.FirstOrDefault()?.DeptName;
stuAttendanceLeave.MajorNo = arrangeLessonTerm.MajorNo;
stuAttendanceLeave.MajorName = majorList.Where(x => x.MajorNo == arrangeLessonTerm.MajorNo)
.FirstOrDefault()?.MajorName;
stuAttendanceLeave.ClassNo = arrangeLessonTerm.TeachClassNo;
stuAttendanceLeave.ClassName = classInfoList
.Where(x => x.ClassNo == arrangeLessonTerm.TeachClassNo).FirstOrDefault()?.ClassName;
stuAttendanceLeave.LessonNo = arrangeLessonTerm.LessonNo;
stuAttendanceLeave.LessonName = arrangeLessonTerm.LessonName;
stuAttendanceLeave.TeachClassNo = arrangeLessonTerm.TeachClassNo;
stuAttendanceLeave.LessonSortNo = arrangeLessonTerm.LessonSortNo;
//stuAttendanceLeave.LessonSortName = arrangeLessonTerm.LessonSortName;
stuAttendanceLeave.LessonDate = arrangeLessonTerm.LessonDate;
stuAttendanceLeave.LessonTime = arrangeLessonTerm.LessonTime;
stuAttendanceLeave.LeaveType = "1";
stuAttendanceLeave.EmpNo = arrangeLessonTerm.EmpNo;
stuAttendanceLeave.ClassRoomNo = arrangeLessonTerm.ClassroomNo;

db.Insert(stuAttendanceLeave);
}
}
}
else
{
entity.Create();
this.BaseRepository("CollegeMIS").Insert(entity);
db.Insert(entity);
}

db.Commit();
}
catch (Exception ex)
{
db.Rollback();
if (ex is ExceptionEx)
{
throw;


Ladataan…
Peruuta
Tallenna