Example #1
0
        /// <summary>
        /// 描述:审核终审通过
        /// <para>作者:瞿琦</para>
        /// <para>创建时间:2018-11-2</para>
        /// </summary>
        public override void ProcessAuditSuccess()
        {
            try
            {
                //3、将审核通过数据添加到已生效数据表
                var autClassQuery = _tblAutClassRepository.Value.LoadList(x => x.AuditId == TblAutAudit.AuditId);     //班级课表
                var classTimQuery = _tblAutClassTimeRepository.Value.LoadList(x => x.AuditId == TblAutAudit.AuditId); //班级上课时间表

                //3.1先删除原来学期的课表数据
                TermCourseTimetableService termTimService = new TermCourseTimetableService(this._termId);
                termTimService.Remove();

                var timeClassList = classTimQuery.Select(x => new TblTimClassTime
                {
                    ClassTimeId  = x.ClassTimeId,
                    ClassId      = x.ClassId,
                    SchoolTimeId = x.SchoolTimeId,
                    CreateTime   = DateTime.Now,
                    SchoolId     = x.SchoolId
                }).ToList();
                LogWriter.Write(this, "班级时间段表" + timeClassList.Count);
                if (timeClassList.Any())
                {
                    ClassCourseTimetableService.AddTimClassTime(timeClassList); //添加班级上课时间表数据
                }

                var classList = autClassQuery.Select(x => new TblDatClass
                {
                    ClassId      = x.ClassId,
                    ClassNo      = x.ClassNo,
                    ClassRoomId  = x.ClassRoomId,
                    TermId       = x.TermId,
                    RoomCourseId = x.RoomCourseId,
                    CourseId     = x.CourseId,
                    CourseLeveId = x.CourseLeveId,
                    TeacherId    = x.TeacherId,
                    CourseNum    = x.CourseNum,
                    StudentsNum  = x.StudentsNum,
                    CreateTime   = DateTime.Now,
                    UpdateTime   = DateTime.Now,
                    SchoolId     = x.SchoolId,
                    ClassType    = (int)ClassType.Default
                }).ToList();
                LogWriter.Write(this, "班级表" + classList.Count);
                if (classList.Any())
                {
                    ClassCourseTimetableService.AddDatClass(classList);  //添加班级表数据
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        /// <summary>
        /// 获取未通过审核的班级课表详情
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2018-09-22</para>
        /// <para></para>
        /// </summary>
        /// <param name="classId">班级Id</param>
        /// <returns>一个班级的课程表详细信息</returns>
        /// <exception cref="BussinessException">
        /// 异常ID:1,异常描述:班级信息对象为空
        /// </exception>
        public async Task <ClassTimetableResponse> GetNoPassClassTimetable(long classId)
        {
            //获取班级
            var classInfo = await _tblAutClassRepository.Value.GetAsync(base.TblAutAudit.AuditId, classId);

            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(_termId);
            //获取学期信息
            TblDatTerm term = schoolTimeService.TblDatTerm;
            //这个学期所有的上课时间
            var allTermClassTime = schoolTimeService.TblDatSchoolTime.OrderBy(x => x.BeginTime).ToList();

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

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

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

            var timClassTime = await _tblAutClassTimeRepository.Value.GetByClassId(base.TblAutAudit.AuditId, 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);
        }