From ed1aa900598257b8df937b49d78ee7952a790465 Mon Sep 17 00:00:00 2001 From: ndbs Date: Thu, 11 Aug 2022 14:42:26 +0800 Subject: [PATCH] =?UTF-8?q?app2.0=20=E6=89=8B=E6=9C=BA=E7=AB=AF=E5=AD=A6?= =?UTF-8?q?=E7=94=9F10=E5=A4=A9=E8=AF=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/TimeTable.cs | 87 ++++++++++++++++++- 1 file changed, 85 insertions(+), 2 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 22104a168..74cc17b24 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs @@ -22,11 +22,15 @@ namespace Learun.Application.WebApi.Modules Get["/StuList"] = GetStuInfo; Get["/StuLessonInfo"] = GetStuLessonInfo; Get["/timeTableData"] = GetTimeTableData; + Get["/TenDay"] = GetTenDay; } private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); private ArrangeLessonTermOfElectiveIBLL arrangeLessonTermOfElectiveIBLL = new ArrangeLessonTermOfElectiveBLL(); private StuAttendanceLeaveIBLL stuAttendanceLeaveIBLL = new StuAttendanceLeaveBLL(); private StuAttendanceIBLL stuAttendanceIBLL = new StuAttendanceBLL(); + private EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); + private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); + private SchoolCalendarIBLL schoolCalendarIbll = new SchoolCalendarBLL(); /// /// 课程表【教师功能、学生功能】 @@ -113,7 +117,7 @@ namespace Learun.Application.WebApi.Modules } - + /// /// 全院课程表【按班级分组】 /// @@ -171,11 +175,88 @@ namespace Learun.Application.WebApi.Modules }).OrderBy(x => x.LessonSortNo).ThenBy(x => x.ClassNo).ToList(); result.ClassDataList = dataTemp; - + return Success(result); } + /// + /// 课程表【教师功能、学生功能】 + /// + /// + /// + public Response GetTenDay(dynamic _) + { + var param = this.GetReqData(); + var startdate = DateTime.Today; + var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd"); + var endDate = Common.CalculateLastDateOfWeek(startdate).ToString("yyyy-MM-dd"); + + //获取学年,学期 + var semesterAndYear = Common.GetSemesterAndYear(startDate); + var strAcademicYear = semesterAndYear.AcademicYearLong; + var strSemester = semesterAndYear.Semester; + + var entity = schoolCalendarIbll.GetSchoolCalendarEntityByNo(semesterAndYear.AcademicYearShort, semesterAndYear.Semester); + var StartTime = entity.StartTime.Value; + + + var Data = arrangeLessonTermIBLL.GetTimeTableInEducation("", "", "", "", ""); + if (param.Description == "学生") + { + var Stulist = stuInfoBasicIBLL.GetAllList().Where(x => x.StuNo == param.Account).FirstOrDefault(); + if (Stulist != null) + { + Data = arrangeLessonTermIBLL.GetTimeTableInEducation(param.StartDate, param.EndDate, param.ClassNo, "", ""); + } + } + else if (param.Description == "教师") + { + //教师 + var empInfo = empInfoIbll.GetAllList().Where(x => x.EmpNo == userInfo.account).FirstOrDefault().EmpNo; + if (empInfo != null) + { + Data = arrangeLessonTermIBLL.GetTimeTableInEducation(param.StartDate, param.EndDate, "", param.EmpNo, ""); + } + } + + var formatData = from d in Data.AsEnumerable() + let tt = d.LessonTime.Split('-')[0] + group d by tt into g + orderby g.Key + select new + { + time = g.Key, + list = from e in Data.AsEnumerable() + let ee = e.LessonTime.Split('-')[0] + where ee == g.Key + select new + { + ALTId = e.ALTId, + day = e.LessonTime.Split('-')[0], + jc = e.LessonTime.Split('-')[1], + curriculum = e.LessonSortNo == "2" ? e.LessonName + "[选修]" : e.LessonName, + teacher = e?.EmpName, + classRoom = string.IsNullOrEmpty(e.ClassroomName) ? "" : e.ClassroomName.Trim(), + academicyear = semesterAndYear.AcademicYearShort, + semester = strSemester, + lessonNo = e?.LessonNo, + teachClassNo = e?.TeachClassNo, + empno = e?.EmpNo, + lessonTime = e.LessonTime, + lessonDate = e.LessonDate.ToString("yyyy-MM-dd"), + classRoomNo = string.IsNullOrEmpty(e.ClassRoomNo) ? "" : e.ClassRoomNo.Trim(), + lessonSortNo = e.LessonSortNo, + e?.OLPEId, + className = string.IsNullOrEmpty(e.ClassName) ? "" : e.ClassName + } + } + ; + var result = new + { schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = formatData }; + return Success(result); + + } /// /// 数字转中文 /// @@ -238,6 +319,8 @@ namespace Learun.Application.WebApi.Modules /// 教师编号 /// public string EmpNo { get; set; } + public string Description { get; set; } + public string Account { get; set; } } public class TimeTableData {