/// <summary>
        /// 描述:根据学期获取老师及所属课程
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018.9.25</para>
        /// </summary>
        /// <returns>学期下老师及所属课程列表</returns>

        public List <ClassCourseSearchTeacherResponse> GetTermIdByTeacherList(long termId)
        {
            TblDatClassRepository tblDatClassService = new TblDatClassRepository();

            //获取所有的老师
            var teacherList = TeachService.GetTeachers();
            TermCourseTimetableAuditService auditService = new TermCourseTimetableAuditService(termId);

            //var termTeacherIdList = new List<string>();
            var termTeacherIdList = new List <CourseInfo>();
            var courseList        = new List <CourseInfo>();

            if (auditService.NoPass) //审核中
            {
                //根据学期Id查询审核中的班级信息
                TblAutClassRepository tblAutClassRepository = new TblAutClassRepository();
                var auditId = auditService.TblAutAudit.AuditId;  //获取审核中数据的审核Id
                courseList = tblAutClassRepository.GetByAuditId(auditId).Result.Select(x => new CourseInfo
                {
                    TeacherId = x.TeacherId,
                    CourseId  = x.CourseId
                }).ToList();
                termTeacherIdList = courseList.Distinct(new TeacherComparer()).ToList();
            }
            else  //已生效
            {
                //根据学期Id查询已生效的班级信息
                courseList = tblDatClassService.GetTermIdByClass(termId).Select(x => new CourseInfo
                {
                    TeacherId = x.TeacherId,
                    CourseId  = x.CourseId
                }).ToList();
                termTeacherIdList = courseList.Distinct(new TeacherComparer()).ToList();
            }

            var classTeachList = (from x1 in termTeacherIdList
                                  join x2 in teacherList on x1.TeacherId equals x2.TeacherId
                                  select new ClassCourseSearchTeacherResponse
            {
                TeacherNo = x2.TeacherId,
                TeacherName = x2.TeacherName
            }).ToList();

            //获取老师所属的课程
            foreach (var courseItem in classTeachList)
            {
                courseItem.TeacherByCourse = courseList.Where(x => x.TeacherId == courseItem.TeacherNo).Select(x => new ClassCourseResponse
                {
                    CourseId = x.CourseId
                }).Distinct(new CourseInfoComparer()).ToList();
            }

            return(classTeachList);
        }
        /// <summary>
        /// 获取已安排补课或调课的详情
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2019-03-12</para>
        /// </summary>
        /// <param name="studentId">学生Id</param>
        /// <param name="lessonId">课次ID</param>
        /// <returns>调课详情/补课详情</returns>
        public StudentReplenishLessonsResponse GetStudentReplenishLessons(long studentId, long lessonId)
        {
            var studentAttendance = _viewCompleteStudentAttendanceRepository.Value.GetLesson(lessonId);

            if (studentAttendance == null)
            {
                //未找到该学生的补课信息
                throw new BussinessException(ModelType.Timetable, 47);
            }

            if (studentAttendance.StudentId != studentId)
            {
                //未找到该学生的补课信息
                throw new BussinessException(ModelType.Timetable, 47);
            }

            //获取一个班级学生的课次信息
            var stuDayAttendances = _viewCompleteStudentAttendanceRepository.Value.GetStudetnDayLessonList(
                studentAttendance.SchoolId, studentAttendance.ClassId, studentAttendance.ClassDate,
                studentId, LessonType.RegularCourse);

            var lessonIds  = stuDayAttendances.Select(x => x.LessonId).ToList();
            var stuLessons = _viewTimReplenishLessonStudentRepository.Value.GetLessonListByParentLessonId(lessonIds);

            if (stuLessons == null || !stuLessons.Any())
            {
                //未找到该学生的补课信息
                throw new BussinessException(ModelType.Timetable, 47);
            }

            var stuLesson = stuLessons.OrderBy(x => x.ClassBeginTime).FirstOrDefault();

            string classTime = string.Join(" ", stuLessons.Select(x => x.ClassBeginTime + "-" + x.ClassEndTime));

            var classInfo = new DefaultClassService(stuLesson.ClassId).TblDatClass;

            StudentReplenishLessonsResponse res = new StudentReplenishLessonsResponse
            {
                ClassId     = stuLesson.ClassId,
                ClassName   = CourseService.GetByCourseId(stuLesson.CourseId)?.ClassCnName,
                ClassRoom   = new ClassRoomService(stuLesson.ClassRoomId).ClassRoomInfo?.RoomNo,
                ClassTime   = classTime,
                ClassDate   = stuLesson.ClassDate.ToString("yyyy.MM.dd"),
                ClassNo     = new DefaultClassService(stuLesson.ClassId).TblDatClass?.ClassNo,
                TeacherName = TeachService.GetTeacher(stuLesson.TeacherId)?.TeacherName,
                Week        = WeekDayConvert.DayOfWeekToString(stuLesson.ClassDate.DayOfWeek)
            };

            return(res);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取班级信息
        /// <para>作     者:Huang GaoLiang </para>
        /// <para>创建时间:2018-11-02</para>
        /// </summary>
        /// <param name="datClass">班级信息</param>
        /// <param name="companyId">公司编号</param>
        /// <returns>返回班级详细信息</returns>
        /// <exception cref="BussinessException">
        /// 异常ID:7,数据异常
        /// </exception>
        private static ClassDetailResponse GetClassInfo(TblDatClass datClass, string companyId)
        {
            ClassDetailResponse dto = new ClassDetailResponse
            {
                ClassId      = datClass.ClassId,
                ClassNo      = datClass.ClassNo,
                RoomCourseId = datClass.RoomCourseId,
                ClassRoomId  = datClass.ClassRoomId,
                CourseId     = datClass.CourseId,
                CourseLeveId = datClass.CourseLeveId,
                TermId       = datClass.TermId,
                CourseNum    = datClass.CourseNum,
                StudentsNum  = datClass.StudentsNum,
                SurplusNum   = datClass.StudentsNum,
            };

            if (dto == null)
            {
                throw new BussinessException((byte)ModelType.SignUp, 7);
            }

            //1、课程名称,课程等级
            CourseResponse course = new CourseService(companyId).GetCourseDetailsAsync(dto.CourseId).Result;

            if (course != null)
            {
                dto.CourseName     = course.CourseCnName;
                dto.CourseLeveName = course.CourseLevels.FirstOrDefault(m => m.CourseLevelId == dto.CourseLeveId)
                                     ?.CourseLevelName;
            }

            dto.TeachName = TeachService.GetTeacher(datClass.TeacherId)?.TeacherName;
            dto.TermName  = TermService.GetTermByTermId(dto.TermId)?.TermName;

            //2、门牌号
            dto.ClassRoomName = new ClassRoomService(dto.ClassRoomId).ClassRoomInfo?.RoomNo;

            //、计算出剩余学位数
            dto.SurplusNum = dto.StudentsNum - MakeLessonService.GetClassScheduleNum(dto.ClassId);

            //3、获取上课时间段数据
            dto.SchoolTimeList = GetDatSchoolTimeInfo(dto.ClassId);

            dto.ClassTime = GetSchoolTime(datClass.ClassId);

            return(dto);
        }
        /// <summary>
        /// 根据学期Id和班级Id等查询条件获取学生考勤统计表信息
        /// <para>作    者:郭伟佳</para>
        /// <para>创建时间:2019-03-04</para>
        /// </summary>
        /// <param name="searchRequest">考勤查询条件</param>
        /// <returns>获取学生考勤统计表</returns>
        public async Task <StudentAttendReportResponse> GetStudentAttendanceReport(StudentAttendSearchRequest searchRequest)
        {
            var result = new StudentAttendReportResponse();
            //获取校区学生的当前学期的课程信息
            var studentLessonList = await _attendanceRepository.Value.GetAttendListByFinanceAsync(_schoolId, searchRequest);

            if (studentLessonList != null && studentLessonList.Count > 0)
            {
                //获取所有老师信息
                var teacherInfoList = TeachService.GetTeachers();
                var lessonList      = studentLessonList.Where(a => (searchRequest.Month > 0 && a.ClassDate.Year == searchRequest.Year && a.ClassDate.Month == searchRequest.Month) ||
                                                              searchRequest.Month == 0).ToList();
                result.DateInfos         = GetLessonDateInfo(lessonList);                                                                           //获取课程日期集合
                result.StudentAttendList = await GetStudentAttendList(studentLessonList, teacherInfoList, searchRequest.Year, searchRequest.Month); //获取班级学生的考勤信息

                result.TeacherAttendList = GetTeacherAttendList(studentLessonList, teacherInfoList, searchRequest.Year, searchRequest.Month);       //获取班级老师的考勤信息
            }
            return(result);
        }
        /// <summary>
        /// 获取未安排课表的班级课表信息
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2018-11-06</para>
        /// </summary>
        /// <param name="classRoomId">教室ID</param>
        /// <param name="schoolTimeId">时间段ID</param>
        /// <returns>课次表详情</returns>
        public static ClassTimetableResponse GetNoClassTimetable(long classRoomId, long schoolTimeId)
        {
            ClassTimetableResponse res = new ClassTimetableResponse
            {
                IsClassJoin = false
            };

            SchoolTimeService       service        = SchoolTimeService.CreateSchoolTimeService(schoolTimeId);
            List <TblDatSchoolTime> allSchoolTimes = service.TblDatSchoolTime;
            TblDatTerm term = service.TblDatTerm;

            //获取当前时间段
            var firstTime = allSchoolTimes.FirstOrDefault(x => x.SchoolTimeId == schoolTimeId);

            //第一节课时间段
            res.Time1 = new List <string> {
                firstTime.BeginTime, firstTime.EndTime
            };

            //上课老师
            res.Teacher = TeachService.GetIncumbentTeachers(term.SchoolId);

            //当前教室门牌号
            res.RoomNo = new SchoolClassRoomService(term.SchoolId).GetClassRoom(classRoomId)?.RoomNo;

            //课程与课程等级
            res.ClassTimetableCourse = GetClassTimetableCourseResponse(term.SchoolId, classRoomId);

            ClassTimetableSchoolTimeResult classTimetableSchoolTimeResult = GetClassTimetableSchoolTimeResult(allSchoolTimes, classRoomId, schoolTimeId, term.TermId);

            //星期几与上课时间的数据
            res.WeekDaySchoolTimes = classTimetableSchoolTimeResult
                                     .WeekDaySchoolTimes
                                     .OrderBy(m => m.WeekDay).ToList();

            res.CanClassJoin = classTimetableSchoolTimeResult.CanClassJoin;

            //第二节课时间段
            res.Time2 = classTimetableSchoolTimeResult.Time2;

            return(res);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取排课基础数据
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2019-02-19</para>
        /// </summary>
        /// <param name="classId">班级Id</param>
        /// <remarks>排课基础数据</remarks>
        private CourseBasicData GetCourseBasicData(IEnumerable <long> classId)
        {
            CourseBasicData courseBasicData = new CourseBasicData
            {
                Classs = DefaultClassService.GetClassByClassIdAsync(classId).Result //班级
            };

            //学期
            courseBasicData.Terms = TermService.GetTermByTermId(courseBasicData.Classs.Select(x => x.TermId));

            //所有课程
            courseBasicData.Courses = CourseService.GetAllAsync().Result;

            //所有课程等级
            courseBasicData.CourseLvs = CourseLevelService.GetAll();

            //老师
            courseBasicData.Teachers = TeachService.GetTeachers();

            return(courseBasicData);
        }
        /// <summary>
        /// 获取已安排课表的班级课表信息
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2018-11-06</para>
        /// </summary>
        /// <remarks>课程表班级的详情信息</remarks>
        /// <exception cref="BussinessException">
        /// 异常ID:1,异常描述:班级信息为空
        /// </exception>
        private ClassTimetableResponse GetClassTimetable()
        {
            //获取班级
            var classInfo = this.GetClass();

            if (classInfo == null)
            {
                throw new BussinessException(ModelType.Default, 1);
            }

            //基础数据
            ClassTimetableResponse res = new ClassTimetableResponse()
            {
                ClassNo            = classInfo.ClassNo,
                CourseId           = classInfo.CourseId,
                CourseLevelId      = classInfo.CourseLeveId,
                CourseNum          = classInfo.CourseNum,
                StudentsNum        = classInfo.StudentsNum,
                TeaherId           = classInfo.TeacherId,
                CanClassJoin       = false,
                WeekDaySchoolTimes = new List <ClassTimetableSchoolTimeResponse>()
            };

            SchoolTimeService schoolTimeService = new SchoolTimeService(classInfo.TermId);
            //获取学期信息
            TblDatTerm term = schoolTimeService.TblDatTerm;
            //这个学期所有的上课时间
            var allTermClassTime = schoolTimeService.TblDatSchoolTime.OrderBy(x => x.BeginTime).ToList();

            //校区老师
            res.Teacher = TeachService.GetIncumbentTeachers(term.SchoolId, classInfo.TeacherId);

            //课程信息与课程等级
            res.ClassTimetableCourse = GetClassTimetableCourseResponse(term.SchoolId, classInfo.ClassRoomId, classInfo.CourseId);

            //当前教室门牌号
            res.RoomNo = new SchoolClassRoomService(term.SchoolId).GetClassRoom(classInfo.ClassRoomId)?.RoomNo;

            var timClassTime = _classTimeRepository.Value.GetByClassId(classInfo.ClassId);

            //当前班级对应的上课时间段
            var currentClassTimes = allTermClassTime
                                    .Where(m => timClassTime.Select(x => x.SchoolTimeId).Contains(m.SchoolTimeId))
                                    .OrderBy(x => x.BeginTime).ToList();

            //班级第一个时间段
            var firstClassTime = currentClassTimes[0];

            res.Time1 = new List <string> {
                firstClassTime.BeginTime, firstClassTime.EndTime
            };
            res.Time2 = new List <string>();

            var isJoinClass = currentClassTimes.Where(x => x.WeekDay == firstClassTime.WeekDay).OrderBy(x => x.BeginTime).ToList();

            //班级第二个时间段
            if (isJoinClass.Count > 1)
            {
                var secondClassTime = isJoinClass[1];
                res.Time2 = new List <string> {
                    secondClassTime.BeginTime, secondClassTime.EndTime
                };
                res.IsClassJoin = true;
            }

            //星期几与上课时间的数据
            for (int i = 1; i <= 7; i++)
            {
                var classTime = currentClassTimes.Where(x => x.WeekDay == i).ToList();
                ClassTimetableSchoolTimeResponse ctst = new ClassTimetableSchoolTimeResponse
                {
                    HasSchoolTime1 = false,
                    SchoolTimeId1  = 0,
                    HasSchoolTime2 = false,
                    SchoolTimeId2  = 0,
                    IsChecked      = false,
                    WeekDay        = i
                };
                if (classTime.Any())
                {
                    ctst.HasSchoolTime1 = true;
                    ctst.SchoolTimeId1  = classTime[0].SchoolTimeId;
                    ctst.IsChecked      = true;

                    if (classTime.Count > 1)
                    {
                        ctst.HasSchoolTime2 = true;
                        ctst.SchoolTimeId2  = classTime[1].SchoolTimeId;
                    }
                }
                res.WeekDaySchoolTimes.Add(ctst);
            }

            return(res);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 获取的排课详情
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2018-11-06</para>
        /// </summary>
        /// <param name="enrollOrderItemId">报名课程订单Id</param>
        /// <returns>学生报名一个课程的排课详细信息</returns>
        public MakeLessonDetailResponse GetMakeLessonDetail(long enrollOrderItemId)
        {
            MakeLessonDetailResponse res = new MakeLessonDetailResponse
            {
                CourseInfos = new List <CourseInformation>()
            };

            TblOdrEnrollOrderItem enrollOrderItem = _enrollOrderItemRepository.Load(enrollOrderItemId);
            TblOdrEnrollOrder     enrollOrder     = _enrollOrderRepository.Load(enrollOrderItem.EnrollOrderId);

            TblDatCourse course = CourseService.GetByCourseId(enrollOrderItem.CourseId);

            res.RegisterInfo = new RegisterInformation()
            {
                ClassTimes    = enrollOrderItem.ClassTimes,
                ClassTimesUse = enrollOrderItem.ClassTimesUse,
                CourseName    = string.Empty,
                LevelName     = CourseLevelService.GetById(enrollOrderItem.CourseLevelId)?.LevelCnName ?? string.Empty,
                Year          = enrollOrderItem.Year,
                CourseType    = CourseType.Elective,
                TermTypeId    = enrollOrderItem.TermTypeId,
                TermTypeName  = TermTypeService.GetTermTypeName(enrollOrderItem.TermTypeId),
                EnrollDate    = enrollOrder.CreateTime
            };

            if (course != null)
            {
                res.RegisterInfo.CourseName = course.ShortName;
                res.RegisterInfo.CourseType = CourseType.Compulsory;
            }

            List <TblTimMakeLesson> makeLessons =
                _makeLessonRepository.GetUnconfirmedMakeLessonList(enrollOrderItem.EnrollOrderItemId);

            if (makeLessons.Any())
            {
                List <long> classIds = makeLessons.Select(x => x.ClassId).ToList();

                List <TblDatClass> classes = DefaultClassService.GetClassByClassIdAsync(classIds).Result;

                List <ViewRoomCourse> classRooms = ClassRoomService.GetClassRoomBySchoolId(enrollOrder.SchoolId);

                //老师
                var teacherList = TeachService.GetTeachers();

                foreach (var makeLesson in makeLessons)
                {
                    var classInfo        = classes.FirstOrDefault(x => x.ClassId == makeLesson.ClassId);
                    var classSchoolTimes = new DefaultClassService(classInfo.ClassId).ClassSchoolTimes;
                    //老师信息
                    var teacher = teacherList.FirstOrDefault(x => x.TeacherId == classInfo.TeacherId);

                    CourseInformation courseInformation = new CourseInformation
                    {
                        ClassId        = classInfo.ClassId,
                        Year           = enrollOrderItem.Year,
                        ClassNo        = classInfo.ClassNo,
                        ClassTimesUse  = makeLesson.ClassTimes,
                        CourseName     = course?.ShortName ?? string.Empty,
                        FirstClassTime = makeLesson.FirstClassTime,
                        RoomNo         = classRooms.FirstOrDefault(x => x.ClassRoomId == classInfo.ClassRoomId)?.RoomNo ?? string.Empty,
                        LevelName      = CourseLevelService.GetById(classInfo.CourseLeveId)?.LevelCnName ?? string.Empty,
                        TeacherName    = teacher?.TeacherName ?? string.Empty,
                        TermName       = TermService.GetTermByTermId(classInfo.TermId)?.TermName ?? string.Empty,
                        Week           = classSchoolTimes.Select(x => x.WeekDay)
                                         .Distinct()
                                         .OrderBy(x => x)
                                         .Select(x => WeekDayConvert.IntToString(x))
                                         .ToList(),
                        PeriodTime = new List <string>()
                    };

                    foreach (var item in classSchoolTimes)
                    {
                        string time = item.BeginTime + "-" + item.EndTime;
                        if (courseInformation.PeriodTime.Any(x => x == time))
                        {
                            continue;
                        }
                        courseInformation.PeriodTime.Add(time);
                    }

                    res.CourseInfos.Add(courseInformation);
                }
            }

            return(res);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 获取教室查看课表
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2018-11-06</para>
        /// </summary>
        /// <param name="termId">学期Id</param>
        /// <param name="companyId">公司编号</param>
        /// <returns>教室查看课表数据列表</returns>
        public async Task <List <ClassRoomCourseTimetableResponse> > GetCourseTimetable(long termId, string companyId)
        {
            List <ClassRoomCourseTimetableResponse> res = new List <ClassRoomCourseTimetableResponse>();

            //1.获取教室下有哪些班级
            List <TblDatClass> classes = _classRepository.Value.GetClassByTermIdAsync(termId)
                                         .Result
                                         .Where(x => x.ClassRoomId == _classRoomId)
                                         .ToList();

            //2.获取班级上课时间
            List <TblTimClassTime> classTimes = await _classTimeRepository.Value.GetByClassId(classes.Select(x => x.ClassId));

            //3.获取基础数据
            //3.1 课程
            List <TblDatCourse> courses = CourseService.GetAllAsync().Result;

            //3.2 课程等级
            List <CourseLevelResponse> courseLevels = new CourseLevelService(companyId).GetList().Result;

            //3.3 获取老师
            List <ClassTimetableTeacherResponse> teachers = TeachService.GetTeachers();

            //3.4.获取上课时间段基础数据
            List <TblDatSchoolTime> schoolTimes = new SchoolTimeService(termId).TblDatSchoolTime;

            int maxLength = 0;

            //4.整合数据
            for (int i = 1; i <= 7; i++)
            {
                ClassRoomCourseTimetableResponse classRoom = new ClassRoomCourseTimetableResponse
                {
                    Week       = WeekDayConvert.IntToString(i),
                    ClassTimes = new List <ClassRoomClassTime>()
                };

                var cts = (from a in classTimes                                                 //教室下的班级上课时间段
                           join b in classes on a.ClassId equals b.ClassId                      //教室下的班级
                           join c in schoolTimes on a.SchoolTimeId equals c.SchoolTimeId        //基础数据 学期下所有上课时间段
                           join d in courseLevels on b.CourseLeveId equals d.CourseLevelId      //基础数据 课程等级
                           join e in courses on b.CourseId equals e.CourseId                    //基础数据 课程
                           join f in teachers on b.TeacherId equals f.TeacherId                 //基础数据 老师信息
                           where c.WeekDay == i
                           select new ClassRoomClassTime
                {
                    BeginTime = c.BeginTime,
                    EndTime = c.EndTime,
                    CourseName = e.ShortName,
                    LevelCnName = d.LevelCnName,
                    TeacherName = f.TeacherName
                }).OrderBy(x => x.BeginTime);

                classRoom.ClassTimes.AddRange(cts);

                if (cts.Count() > maxLength)
                {
                    maxLength = cts.Count();
                }

                res.Add(classRoom);
            }

            //补齐
            foreach (var item in res)
            {
                if (item.ClassTimes.Count >= maxLength)
                {
                    continue;
                }

                while (item.ClassTimes.Count < maxLength)
                {
                    item.ClassTimes.Add(new ClassRoomClassTime());
                }
            }

            return(res);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 获取不同时间段的课表信息
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2018-09-21</para>
        /// </summary>
        /// <param name="duration">60分钟或90分钟</param>
        /// <returns>课表信息</returns>
        private TermCourseTimetableResponse GetTermCourseTimetable(TimeType duration)
        {
            TermCourseTimetableResponse res = new TermCourseTimetableResponse();

            var schTimeRes = this.GetTimetableSchoolTimeResponse(duration);

            res.SchoolTimes = schTimeRes.TimetableSchoolTimeResponses;        //上课时间表
            res.ClassRooms  = new List <TimetableClassRoomResponse>();        //教室信息

            //审核中所有班级
            var classes = _tblAutClassRepository.Value.GetByAuditId(base.TblAutAudit.AuditId).Result;

            //校区
            var schoolId = TermService.GetTermByTermId(_termId)?.SchoolId;

            //班级上课时间表
            var classTimes = new TblAutClassTimeRepository()
                             .GetBySchoolTimeId(schTimeRes.TblDatSchoolTimes.Select(x => x.SchoolTimeId), base.TblAutAudit.AuditId)
                             .Result;

            //获取老师用户信息
            var teachers = TeachService.GetTeachers();

            //所有的课程
            var courses = CourseService.GetAllAsync().Result;

            //课程等级
            var courseLv = CourseLevelService.GetCourseLevelList().Result;

            //获取校区教室
            var durationClassId = classTimes.Select(x => x.ClassId).ToList();
            SchoolClassRoomService    schoolClassRoomService = new SchoolClassRoomService(schoolId);
            List <RoomCourseResponse> roomCourseResponses    = schoolClassRoomService.RoomCourseList;

            List <long> classRoomIds = classes.Where(x => durationClassId.Contains(x.ClassId)).Select(x => x.ClassRoomId).ToList();

            classRoomIds.AddRange(roomCourseResponses.Where(x => !x.IsDisabled).Select(x => x.ClassRoomId));

            List <TblDatClassRoom> classRooms = schoolClassRoomService
                                                .ClassRoomList
                                                .Where(x => classRoomIds.Contains(x.ClassRoomId))
                                                .OrderBy(o => o.RoomNo, new NaturalStringComparer())
                                                .ToList();

            //渲染教室
            foreach (var classRoom in classRooms)
            {
                TimetableClassRoomResponse ttcrr = new TimetableClassRoomResponse
                {
                    ClassRoomId = classRoom.ClassRoomId,
                    RoomNo      = classRoom.RoomNo,
                    Classes     = new List <TimetableClassResponse>()
                };

                int lessonIndex = 0;

                int weekDay = -1;

                //教室对应的上课时间段的班级
                foreach (var schoolTime in schTimeRes.TblDatSchoolTimes)
                {
                    if (weekDay != schoolTime.WeekDay)
                    {
                        weekDay     = schoolTime.WeekDay;
                        lessonIndex = 0;
                    }

                    lessonIndex++;

                    TimetableClassResponse ttcr = new TimetableClassResponse
                    {
                        SchoolTimeId    = schoolTime.SchoolTimeId,
                        ClassId         = 0,
                        CourseId        = 0,
                        CourseName      = string.Empty,
                        CourseLeveId    = 0,
                        CourseLevelName = string.Empty,
                        TeacherId       = string.Empty,
                        TeacherName     = string.Empty,
                        WeekDay         = schoolTime.WeekDay,
                        LessonIndex     = lessonIndex
                    };

                    var classIds = (from a in classTimes
                                    join b in classes on a.ClassId equals b.ClassId
                                    where a.SchoolTimeId == schoolTime.SchoolTimeId && b.ClassRoomId == classRoom.ClassRoomId
                                    select a.ClassId).ToList();

                    if (classIds.Any())
                    {
                        var classInfo = classes.FirstOrDefault(x => x.ClassId == classIds.First());
                        ttcr.ClassId         = classInfo.ClassId;
                        ttcr.CourseId        = classInfo.CourseId;
                        ttcr.CourseName      = courses.FirstOrDefault(x => x.CourseId == classInfo.CourseId)?.ShortName;
                        ttcr.CourseLeveId    = classInfo.CourseLeveId;
                        ttcr.CourseLevelName = courseLv.FirstOrDefault(x => x.CourseLevelId == classInfo.CourseLeveId)?.LevelCnName;
                        ttcr.TeacherId       = classInfo.TeacherId;
                        ttcr.TeacherName     = teachers.FirstOrDefault(x => x.TeacherId == classInfo.TeacherId)?.TeacherName;
                    }

                    ttcrr.Classes.Add(ttcr);
                }

                res.ClassRooms.Add(ttcrr);
            }

            return(res);
        }
        /// <summary>
        /// 微信通知
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2019-03-15</para>
        /// </summary>
        private void PushWeChatNotice()
        {
            var stuInfo  = StudentService.GetStudentInfo(_request.StudentId);
            var inLesson = this._inLessonList.FirstOrDefault();

            string pushClassTime = this._outLessonList
                                   .Select(x => DateTime.Parse(x.ClassDate.ToString("yyyy-MM-dd") + " " + x.ClassBeginTime))
                                   .Min().ToString("yyyy.MM.dd HH:mm");

            //first={0}家长,您好!因{1}于{2}请假,为了保证孩子的学习效果,我们特别为孩子安排了补课,具体时间如下:
            string title =
                string.Format(
                    ClientConfigManager.HssConfig.WeChatTemplateTitle.MakeupNotice,
                    stuInfo.StudentName, stuInfo.StudentName, pushClassTime);

            //keyword1=上课时间
            var    classTimeList = this._inLessonList.Select(x => x.ClassBeginTime + "-" + x.ClassEndTime);
            string classTime     = $"{inLesson.ClassDate.ToString("yyyy.MM.dd")} {string.Join("、", classTimeList)}";

            //keyword2=班级名称
            string className = CourseService.GetByCourseId(inLesson.CourseId)?.ClassCnName ?? string.Empty;

            //keyword3=教室
            string classRoom = new ClassRoomService(inLesson.ClassRoomId)?.ClassRoomInfo?.RoomNo ?? string.Empty;

            //keyword4=老师名称
            string teacherName = TeachService.GetTeacher(inLesson.TeacherId)?.TeacherName ?? string.Empty;

            //remark=校区名称
            string schoolName = OrgService.GetSchoolBySchoolId(_schoolId)?.SchoolName ?? string.Empty;

            WxNotifyProducerService wxNotifyProducerService = WxNotifyProducerService.Instance;
            WxNotifyInDto           wxNotify = new WxNotifyInDto
            {
                Data = new List <WxNotifyItemInDto> {
                    new WxNotifyItemInDto {
                        DataKey = "first", Value = title
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword1", Value = classTime
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword2", Value = className
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword3", Value = classRoom
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword4", Value = teacherName
                    },
                    new WxNotifyItemInDto {
                        DataKey = "remark", Value = schoolName
                    }
                },
                ToUser     = StudentService.GetWxOpenId(stuInfo),
                TemplateId = WeChatTemplateConstants.MakeupNotice,
                Url        = string.Empty
            };

            wxNotifyProducerService.Publish(wxNotify);
        }