diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs index 3359f0d1c..e56793db8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs @@ -89,7 +89,51 @@ namespace Learun.Application.WebApi.Modules public Response GetStuLessonInfo(dynamic _) { var param = this.GetReqData(); - var lessonInfos = stuAttendanceIBLL.GetStuLessonInfo(userInfo.account, param.StartDate, param.EndDate); + + var startdate = DateTime.Today; + var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd"); + var endDate = Common.CalculateLastDateOfWeek(startdate).ToString("yyyy-MM-dd"); + var lessonInfos = stuAttendanceIBLL.GetStuLessonInfo("", "", ""); + + var strAcademicYear = ""; + var strSemester = ""; + var AcademicYearShort = ""; + + // 获取学年,学期 + if (!param.StartDate.IsEmpty() && !param.EndDate.IsEmpty()) + { + var NewsemesterAndYear = Common.GetSemesterAndYear(param.StartDate); + strAcademicYear = NewsemesterAndYear.AcademicYearLong; + strSemester = NewsemesterAndYear.Semester; + AcademicYearShort = NewsemesterAndYear.AcademicYearShort; + } + else + { + var semesterAndYear = Common.GetSemesterAndYear(startDate); + strAcademicYear = semesterAndYear.AcademicYearLong; + strSemester = semesterAndYear.Semester; + AcademicYearShort = semesterAndYear.AcademicYearShort; + } + + if (param.StartDate.IsEmpty() && param.EndDate.IsEmpty()) + { + // 校历 + var entity = schoolCalendarIbll.GetSchoolCalendarEntityByNo(AcademicYearShort, strSemester); + var StartTime = entity.StartTime.Value; + //获取第几周 + var curWeek = WeekOfYear(startdate, entity.StartTime.Value, entity.EndTime.Value); + ///获取当前周次开始时间 + startDate = Common.CalculateFirstDateOfWeek(StartTime.AddDays(((curWeek - 1) * 14))).ToString("yyyy-MM-dd"); + if (curWeek == 1 && Convert.ToDateTime(startDate) < StartTime)//判断第几周 + { + startDate = StartTime.ToString("yyyy-MM-dd"); + } + endDate = Common.CalculateFirstDateOfWeek(StartTime.AddDays(((curWeek - 1) * 14))).AddDays(9).ToString("yyyy-MM-dd"); + param.StartDate = startDate; + param.EndDate = endDate; + } + lessonInfos = stuAttendanceIBLL.GetStuLessonInfo(userInfo.account, param.StartDate, param.EndDate); + var empNos = lessonInfos.Select(a => a.EmpNo).ToList(); var lessonTerms = arrangeLessonTermIBLL.GetListByEmpNo(empNos); @@ -101,7 +145,8 @@ namespace Learun.Application.WebApi.Modules a.LessonTime, a.EmpNo, a.ClassRoomName, - a.Sort + a.Sort, + a.AttendOrNo }).ToList(); var weeks = list.GroupBy(a => a.LessonDate).ToList(); @@ -113,7 +158,7 @@ namespace Learun.Application.WebApi.Modules var result = new { week, weekList }; results.Add(result); } - return Success(results); + return Success(new { results, schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", startDate = param.StartDate, endDate = param.EndDate }); } @@ -196,7 +241,7 @@ namespace Learun.Application.WebApi.Modules var strAcademicYear = ""; var strSemester = ""; var AcademicYearShort = ""; - if (!string.IsNullOrEmpty(param.StartDate)) + if (!param.StartDate.IsEmpty()) { var NewsemesterAndYear = Common.GetSemesterAndYear(param.StartDate); strAcademicYear = NewsemesterAndYear.AcademicYearLong;