|
@@ -22,7 +22,9 @@ import com.ym.mec.jiari.JiaRiFeignService;
|
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
+
|
|
|
import feign.codec.DecodeException;
|
|
|
+
|
|
|
import org.apache.commons.collections.ListUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -1869,23 +1871,36 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
|
|
|
Date date = new Date();
|
|
|
//课程已结束,更新“未签到”学生的状态未“旷课”
|
|
|
- List<StudentAttendance> studentAttendanceList = courseScheduleDao.queryUnsignedStudentList();
|
|
|
- Date updateTime = DateUtil.stringToDate("19700101 000000",DateUtil.DATE_TIME_FORMAT);
|
|
|
- for (StudentAttendance studentAttendance : studentAttendanceList) {
|
|
|
- studentAttendance.setStatus(StudentAttendanceStatusEnum.TRUANT);
|
|
|
- studentAttendance.setRemark("课程已结束,自动补旷课");
|
|
|
- if (Objects.isNull(studentAttendance.getCurrentClassTimes())) {
|
|
|
- studentAttendance.setCurrentClassTimes(1);
|
|
|
- } else {
|
|
|
- studentAttendance.setCurrentClassTimes(studentAttendance.getCurrentClassTimes() + 1);
|
|
|
- }
|
|
|
- studentAttendance.setCreateTime(date);
|
|
|
- studentAttendance.setUpdateTime(updateTime);
|
|
|
- }
|
|
|
-
|
|
|
- if (studentAttendanceList != null && studentAttendanceList.size() > 0) {
|
|
|
- studentAttendanceDao.addStudentAttendances(studentAttendanceList);
|
|
|
- }
|
|
|
+ List<StudentAttendance> studentAttendanceList = courseScheduleDao.queryUnsignedStudentList();
|
|
|
+ if (studentAttendanceList != null && studentAttendanceList.size() > 0) {
|
|
|
+ // 获取老师的考勤记录
|
|
|
+ Map<Long, TeacherAttendance> teacherAttendanceMap = teacherAttendanceDao
|
|
|
+ .findTeacherIdByCourseSchedule(studentAttendanceList.stream().map(sa -> sa.getCourseScheduleId()).collect(Collectors.toList())).stream()
|
|
|
+ .collect(Collectors.toMap(TeacherAttendance::getCourseScheduleId, ta -> ta));
|
|
|
+
|
|
|
+ Date updateTime = DateUtil.stringToDate("19700101 000000", DateUtil.DATE_TIME_FORMAT);
|
|
|
+ for (Iterator<StudentAttendance> list = studentAttendanceList.iterator(); list.hasNext();) {
|
|
|
+ StudentAttendance studentAttendance = list.next();
|
|
|
+ TeacherAttendance teacherAttendance = teacherAttendanceMap.get(studentAttendance.getCourseScheduleId());
|
|
|
+ if (teacherAttendance != null && teacherAttendance.getSignOutTime() == null) {
|
|
|
+ list.remove();
|
|
|
+ } else {
|
|
|
+ studentAttendance.setStatus(StudentAttendanceStatusEnum.TRUANT);
|
|
|
+ studentAttendance.setRemark("课程已结束,自动补旷课");
|
|
|
+ if (Objects.isNull(studentAttendance.getCurrentClassTimes())) {
|
|
|
+ studentAttendance.setCurrentClassTimes(1);
|
|
|
+ } else {
|
|
|
+ studentAttendance.setCurrentClassTimes(studentAttendance.getCurrentClassTimes() + 1);
|
|
|
+ }
|
|
|
+ studentAttendance.setCreateTime(date);
|
|
|
+ studentAttendance.setUpdateTime(updateTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (studentAttendanceList != null && studentAttendanceList.size() > 0) {
|
|
|
+ studentAttendanceDao.addStudentAttendances(studentAttendanceList);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//自动更新课程状态至“已结束”
|
|
|
List<CourseSchedule> list = courseScheduleDao.queryFinishedWithNoUpdateStatus();
|
|
@@ -1940,10 +1955,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
- if (courseScheduleIdList.size() > 0) {
|
|
|
+ /*if (courseScheduleIdList.size() > 0) {
|
|
|
// vip课自动签退
|
|
|
teacherAttendanceDao.updateViPSignOutStatus(courseScheduleIdList.stream().map(a -> a.toString()).collect(Collectors.joining(",")));
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
return true;
|
|
|
}
|