/// <summary> /// 取消考勤补签 /// </summary> private void CancelAttendSign(ViewTimLessonStudent lessonStudent) { if (lessonStudent == null) { //未找到考勤信息 throw new BussinessException(ModelType.Timetable, 48); } if (!this._teacherId.Equals(lessonStudent.TeacherId, StringComparison.Ordinal)) { //补签老师与上课老师不一致 throw new BussinessException(ModelType.Timetable, 49); } if (lessonStudent.AdjustType != (int)AdjustType.SUPPLEMENTNOTCONFIRMED) { //当前状态不可操作 throw new BussinessException(ModelType.Timetable, 50); } //如果是180分钟的课次会有两条课次信息 这里获取下面批量更新 var lessonList = _viewLessonStudentRepository.Value .GetLessonList(lessonStudent.SchoolId, lessonStudent.ClassId, lessonStudent.ClassDate, lessonStudent.StudentId); var stuLessonIdList = lessonList.Select(x => x.LessonStudentId); //取消补签 _lessonStudentRepository.Value.UpdateStuAttend(stuLessonIdList, AdjustType.DEFAULT, AttendStatus.NotClockIn, DateTime.Now, Guid.NewGuid().ToString().Replace("-", "")); }
/// <summary> /// 正常考勤补签 /// <para>作 者:zhiwei.Tang</para> /// <para>创建时间:2019-03-12</para> /// </summary> /// <param name="lessonStudent">学生考勤</param> /// <exception cref="BussinessException"> /// 异常ID:48 异常描述:未找到考勤信息 /// 异常ID:49 异常描述:补签老师与上课老师不一致 /// 异常ID:50 异常描述:当前状态不可补签 /// </exception> private void UpdateStuAttend(ViewTimLessonStudent lessonStudent) { if (lessonStudent == null) { //未找到考勤信息 throw new BussinessException(ModelType.Timetable, 48); } //校验是否绑定家校互联 this.VerifyStudentBindWeiXin(lessonStudent.StudentId); if (!this._teacherId.Equals(lessonStudent.TeacherId, StringComparison.Ordinal)) { //补签老师与上课老师不一致 throw new BussinessException(ModelType.Timetable, 49); } if (lessonStudent.AttendStatus == (int)AttendStatus.Normal) { //当前状态不可补签 throw new BussinessException(ModelType.Timetable, 50); } if (lessonStudent.AdjustType != (int)AdjustType.DEFAULT) { //当前状态不可补签 throw new BussinessException(ModelType.Timetable, 50); } //如果是180分钟的课次会有两条课次信息 这里获取下面批量更新 var lessonList = _viewLessonStudentRepository.Value .GetLessonList(lessonStudent.SchoolId, lessonStudent.ClassId, lessonStudent.ClassDate, lessonStudent.StudentId); var stuLessonIdList = lessonList.Select(x => x.LessonStudentId); string replenishCode = Guid.NewGuid().ToString().Replace("-", ""); //更新插班补课考勤课次 _lessonStudentRepository.Value.UpdateStuAttend(stuLessonIdList, AdjustType.SUPPLEMENTNOTCONFIRMED, AttendStatus.NotClockIn, DateTime.Now, replenishCode); //微信通知 //班级名称 string className = CourseService.GetByCourseId(lessonStudent.CourseId)?.ClassCnName ?? string.Empty; //上课时间段 var classTimeList = lessonList.Select(x => x.ClassBeginTime + "-" + x.ClassEndTime); string classTime = $"{lessonStudent.ClassDate.ToString("yyyy.MM.dd")} {string.Join("、", classTimeList)}"; //教室 var roomService = new ClassRoomService(lessonStudent.ClassRoomId); string classRoom = roomService.ClassRoomInfo?.RoomNo ?? string.Empty; //推送 this.PushWeChatNotice(lessonStudent.StudentId, className, classRoom, classTime, replenishCode); }