/// <summary> /// 新增考勤确认信息 /// <para>作 者:郭伟佳</para> /// <para>创建时间:2019-03-15</para> /// </summary> /// <param name="request">老师签字确认信息请求对象</param> private async Task AddAttendConfirmAsync(StudentAttendConfirmRequest request) { TblFinAttendanceConfirm attendanceConfirm = new TblFinAttendanceConfirm() { AttendanceConfirmId = IdGenerator.NextId(), SchoolId = _schoolId, TeacherId = request.TeacherId, ClassId = request.ClassId, Month = request.Month, TeacherSignUrl = request.TeacherSignUrl }; await _confirmRepository.Value.AddTask(attendanceConfirm); }
/// <summary> /// 获取班级老师考勤信息 /// <para>作 者:郭伟佳</para> /// <para>创建时间:2019-03-14</para> /// </summary> /// <param name="teacherId">老师Id</param> /// <param name="studentLessonList">学生课程考勤列表信息</param> /// <param name="teacherInfo">老师信息</param> /// <param name="attendConfirmInfo">老师考勤确认信息</param> /// <param name="year">年份</param> /// <param name="month">0表示学期,其他数字表示月份</param> /// <returns></returns> private StudentAttendTeacherInfoResponse GetTeacherAttendInfo(string teacherId, List <ViewStudentAttendance> studentLessonList, ClassTimetableTeacherResponse teacherInfo, TblFinAttendanceConfirm attendConfirmInfo, int year, int month) { //获取班级老师考勤信息(不包括补课、调课) var teacherLessonInfoList = studentLessonList.Where(a => a.TeacherId == teacherId && a.AdjustType == (int)AdjustType.DEFAULT && a.ClassBeginDate <= DateTime.Now) .OrderBy(x => x.LessonType) .ThenBy(y => y.ClassBeginDate) .GroupBy(g => new { g.ClassDate, g.LessonType, g.ClassBeginTime, g.LessonCount }); if (teacherLessonInfoList.Any()) { var teacherLessonList = teacherLessonInfoList.Where(a => (month > 0 && a.Key.ClassDate.Year == year && a.Key.ClassDate.Month == month) || month == 0); return(new StudentAttendTeacherInfoResponse() { TeacherId = teacherId, TeacherName = teacherInfo?.TeacherName, AttendLessonCount = teacherLessonInfoList.Sum(c => c.Key.LessonCount), CurrentMonthLessonCount = (month == 0 ? "--" : teacherLessonList.Sum(c => c.Key.LessonCount).ToString()), //当月出勤 SignatureUrl = attendConfirmInfo?.TeacherSignUrl, //获取老师考勤课程 TeacherLessons = teacherLessonList.Select(c => new StudentAttendTeacherLessonResponse() { LessonDate = c.Key.ClassDate.ToString("MM/dd"), LessonCount = teacherLessonList.Where(d => d.Key.ClassDate == c.Key.ClassDate).Sum(e => e.Key.LessonCount), LessonType = (LessonType)c.Key.LessonType, StatusName = teacherLessonList.Where(d => d.Key.ClassDate == c.Key.ClassDate).Sum(e => e.Key.LessonCount).ToString() }).ToList() }); } return(null); }