From 927de95b69959d931329d5febc5b7b4652cf6872 Mon Sep 17 00:00:00 2001 From: ndbs Date: Tue, 15 Nov 2022 11:37:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=87=BA=E5=8B=A4=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/TimeTable.cs | 53 +++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) 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;