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..fe3934459 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,98 @@ 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; + + if (param.StartDate.IsEmpty() && param.EndDate.IsEmpty()) + { + // 校历 + var entity = schoolCalendarIbll.GetSchoolCalendarEntityByNo(semesterAndYear.AcademicYearShort, semesterAndYear.Semester); + var StartTime = entity.StartTime.Value; + startDate = Common.CalculateFirstDateOfWeek(StartTime.AddDays(3)).ToString("yyyy-MM-dd");//StartTime.AddDays(((curWeek - 1) * 14)).ToString("yyyy-MM-dd"); + if (Convert.ToDateTime(startDate) < StartTime) + { + startDate = StartTime.ToString("yyyy-MM-dd"); + } + endDate = Common.CalculateFirstDateOfWeek(StartTime).AddDays(12).ToString("yyyy-MM-dd"); + param.StartDate = startDate; + param.EndDate = endDate; + } + 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}学期", startDate = startDate, endDate = endDate, weekList = formatData }; + return Success(result); + + } /// /// 数字转中文 /// @@ -238,6 +329,8 @@ namespace Learun.Application.WebApi.Modules /// 教师编号 /// public string EmpNo { get; set; } + public string Description { get; set; } + public string Account { get; set; } } public class TimeTableData { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassService.cs index 55e623e53..8f6791f3d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamPlanClass/Exam_ExamPlanClassService.cs @@ -327,32 +327,27 @@ where l.EPLId='{EPLId}' //排考记录表 var examPlan = db.FindEntity(EPId); //查询当前考试记录所有考试课程 - var lessonList = db.FindList(x => x.EPId == EPId); + var lessonList = db.FindList($@"select a.*,b.LessonTypeId,b.MajorNo as TeachMajorNo FROM [dbo].[Exam_ExamPlanLesson] a +left join [dbo].[Exam_ExamLesson] b on a.ELId=b.ELId +where a.EPId='{EPId}'"); foreach (var lesson in lessonList) { - var lessonno = lesson.LessonNo; - if (lesson.LessonNo.Contains("(")) - { - lessonno = lesson.LessonNo.Split('(')[0]; - } - //查询课程信息 - var lessoninfo = db.FindList($@"select top 1 t.LessonTypeName,l.* from lessoninfo l - join [dbo].[CdLessonType] t on l.LessonTypeId = t.LTId where l.LessonNo='{lessonno}' ").FirstOrDefault(); - if (lessoninfo != null) + var cdLessonType = db.FindEntity(lesson.LessonTypeId); + if (cdLessonType != null) { - if (lessoninfo.LessonTypeName.Contains("专业")) + if (cdLessonType.LessonTypeName.Contains("专业")) { //专业课添加此专业的所有班级 var addSql = $@"insert into Exam_ExamPlanClass SELECT NEWID(),'{lesson.EPLId}',c.ClassName,t.ClassNo,count(1) as StuNum FROM Exam_ExamStudent t left join classinfo c on t.ClassNo=c.ClassNo WHERE t.ESEnabled=1 and t.AcademicYearNo='{examPlan.AcademicYearNo}' and t.Semester='{examPlan.Semester}' and t.Grade='{lesson.Grade}' -and t.ESType='{examPlan.PlanType}' and c.majorno='{lessoninfo.TeachMajorNo}' +and t.ESType='{examPlan.PlanType}' and c.majorno='{lesson.TeachMajorNo}' and t.ClassNo not in (select ClassNo from [dbo].[Exam_ExamPlanClass] where EPLId='{lesson.EPLId}') group by t.ClassNo,t.AcademicYearNo,t.Semester,t.ESType,c.ClassName "; db.ExecuteBySql(addSql); } - else if (lessoninfo.LessonTypeName.Contains("公共") || lessoninfo.LessonTypeName.Contains("公开")) + else if (cdLessonType.LessonTypeName.Contains("公共") || cdLessonType.LessonTypeName.Contains("公开")) { //公共课添加所有班级 var addSql = $@"insert into Exam_ExamPlanClass