|  | @@ -33,7 +33,7 @@ import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentAttendance>  implements StudentAttendanceService {
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	@Autowired
 | 
	
		
			
				|  |  |  	private StudentAttendanceDao studentAttendanceDao;
 | 
	
		
			
				|  |  |  	@Autowired
 | 
	
	
		
			
				|  | @@ -265,8 +265,8 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 | 
	
		
			
				|  |  |  				case LEAVE:
 | 
	
		
			
				|  |  |  					result.put("numberOfLeavePeoples",studentStatusCount.getNumberOfStudent());
 | 
	
		
			
				|  |  |  					break;
 | 
	
		
			
				|  |  | -			default:
 | 
	
		
			
				|  |  | -				break;
 | 
	
		
			
				|  |  | +				default:
 | 
	
		
			
				|  |  | +					break;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  		});
 | 
	
	
		
			
				|  | @@ -297,18 +297,18 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 | 
	
		
			
				|  |  |  	@Override
 | 
	
		
			
				|  |  |  	@Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |  	public boolean leave(Integer userId, Long courseScheduleId, String remark) {
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  		CourseSchedule courseSchedule = courseScheduleDao.get(courseScheduleId);
 | 
	
		
			
				|  |  |  		if(courseSchedule == null){
 | 
	
		
			
				|  |  |  			throw new BizException("课程编号异常");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  		if(courseSchedule.getStatus() == CourseStatusEnum.OVER){
 | 
	
		
			
				|  |  |  			throw new BizException("课程已结束");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		Date date = new Date();
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  		int hours = 4;
 | 
	
		
			
				|  |  |  		String str = sysConfigDao.findConfigValue(SysConfigService.ADVANCE_LEAVE_HOURS);
 | 
	
		
			
				|  |  |  		if (StringUtils.isNotBlank(str)) {
 | 
	
	
		
			
				|  | @@ -318,7 +318,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 | 
	
		
			
				|  |  |  		if(DateUtil.addHours(date, hours).after(courseSchedule.getStartClassTime())){
 | 
	
		
			
				|  |  |  			throw new BizException("开课{}小时之前才可以请假",hours);
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  		StudentAttendance studentAttendance  = studentAttendanceDao.findByStatusAndCourseScheduleId(userId,courseScheduleId.intValue());
 | 
	
		
			
				|  |  |  		if(Objects.isNull(studentAttendance)){
 | 
	
		
			
				|  |  |  			studentAttendance=new StudentAttendance();
 | 
	
	
		
			
				|  | @@ -338,7 +338,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 | 
	
		
			
				|  |  |  		}else{
 | 
	
		
			
				|  |  |  			studentAttendanceDao.insert(studentAttendance);
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  		ClassGroupStudentMapper classGroupStudentMapper = classGroupStudentMapperDao.query(courseSchedule.getClassGroupId(), userId);
 | 
	
		
			
				|  |  |  		if(Objects.isNull(classGroupStudentMapper)){
 | 
	
		
			
				|  |  |  			throw new BizException("您不在此课程对应班级上");
 | 
	
	
		
			
				|  | @@ -500,7 +500,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 | 
	
		
			
				|  |  |  			if(DateUtil.minutesBetween(classEndDateTime,date) >= 0){
 | 
	
		
			
				|  |  |  				String continueCourseTime = sysConfigDao.findConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME);
 | 
	
		
			
				|  |  |  				if(StringUtils.isEmpty(continueCourseTime)){
 | 
	
		
			
				|  |  | -					continueCourseTime = "3";
 | 
	
		
			
				|  |  | +					continueCourseTime = "10";
 | 
	
		
			
				|  |  |  				}
 | 
	
		
			
				|  |  |  				List<CourseSchedule> courseSchedules = new ArrayList<>();
 | 
	
		
			
				|  |  |  				CourseSchedule cs = courseSchedule;
 | 
	
	
		
			
				|  | @@ -528,36 +528,37 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 | 
	
		
			
				|  |  |  						String courseEndDateTime;
 | 
	
		
			
				|  |  |  						for (CourseSchedule e:courseSchedules) {
 | 
	
		
			
				|  |  |  							//获取当前课程的单节课时长
 | 
	
		
			
				|  |  | -//							int signClassMinutes = courseScheduleDao.getSingleClassMinutes(e.getId());
 | 
	
		
			
				|  |  | -//							totalMinutes -= signClassMinutes;
 | 
	
		
			
				|  |  | -							//补充签到签退时间
 | 
	
		
			
				|  |  | -							courseClassDate = DateUtil.format(e.getClassDate(), DateUtil.DEFAULT_PATTERN);
 | 
	
		
			
				|  |  | -							courseStartDateTime = DateUtil.format(e.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
 | 
	
		
			
				|  |  | -							courseEndDateTime = DateUtil.format(e.getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
 | 
	
		
			
				|  |  | -							Date startDateTime = DateUtil.stringToDate(courseClassDate + " " + courseStartDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 | 
	
		
			
				|  |  | -							Date endDateTime = DateUtil.stringToDate(courseClassDate + " " + courseEndDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 | 
	
		
			
				|  |  | -							StudentAttendance byStatusAndCourseScheduleId = studentAttendanceDao.findByStatusAndCourseScheduleId(userId, e.getId().intValue());
 | 
	
		
			
				|  |  | -							if(byStatusAndCourseScheduleId != null){
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setSignOutTime(date);
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setStatus(statusEnum);
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setUpdateTime(date);
 | 
	
		
			
				|  |  | -								studentAttendanceDao.update(byStatusAndCourseScheduleId);
 | 
	
		
			
				|  |  | +							int signClassMinutes = courseScheduleDao.getSingleClassMinutes(e.getId());
 | 
	
		
			
				|  |  | +							totalMinutes -= signClassMinutes;
 | 
	
		
			
				|  |  | +							if(totalMinutes >= 0){
 | 
	
		
			
				|  |  | +								//补充签到签退时间
 | 
	
		
			
				|  |  | +								courseClassDate = DateUtil.format(e.getClassDate(), DateUtil.DEFAULT_PATTERN);
 | 
	
		
			
				|  |  | +								courseStartDateTime = DateUtil.format(e.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
 | 
	
		
			
				|  |  | +								courseEndDateTime = DateUtil.format(e.getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
 | 
	
		
			
				|  |  | +								Date startDateTime = DateUtil.stringToDate(courseClassDate + " " + courseStartDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 | 
	
		
			
				|  |  | +								Date endDateTime = DateUtil.stringToDate(courseClassDate + " " + courseEndDateTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
 | 
	
		
			
				|  |  | +								StudentAttendance byStatusAndCourseScheduleId = studentAttendanceDao.findByStatusAndCourseScheduleId(userId, e.getId().intValue());
 | 
	
		
			
				|  |  | +								if(byStatusAndCourseScheduleId != null){
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setSignOutTime(date);
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setStatus(statusEnum);
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setUpdateTime(date);
 | 
	
		
			
				|  |  | +									studentAttendanceDao.update(byStatusAndCourseScheduleId);
 | 
	
		
			
				|  |  | +								}else {
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId = new StudentAttendance();
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setSignOutTime(endDateTime);
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setStatus(statusEnum);
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setSignInTime(startDateTime);
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setUpdateTime(date);
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setUserId(userId);
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setTeacherId(courseSchedule.getActualTeacherId());
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setClassGroupId(e.getClassGroupId());
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setCourseScheduleId(e.getId());
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setMusicGroupId(e.getMusicGroupId());
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setGroupType(e.getGroupType());
 | 
	
		
			
				|  |  | +									byStatusAndCourseScheduleId.setCurrentClassTimes(classGroup.getCurrentClassTimes() + 1);
 | 
	
		
			
				|  |  | +									studentAttendanceDao.insert(byStatusAndCourseScheduleId);
 | 
	
		
			
				|  |  | +								}
 | 
	
		
			
				|  |  |  							}else {
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId = new StudentAttendance();
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setSignOutTime(endDateTime);
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setStatus(statusEnum);
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setSignInTime(startDateTime);
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setUpdateTime(date);
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setUserId(userId);
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setTeacherId(courseSchedule.getActualTeacherId());
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setClassGroupId(e.getClassGroupId());
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setCourseScheduleId(e.getId());
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setMusicGroupId(e.getMusicGroupId());
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setGroupType(e.getGroupType());
 | 
	
		
			
				|  |  | -								byStatusAndCourseScheduleId.setCurrentClassTimes(classGroup.getCurrentClassTimes() + 1);
 | 
	
		
			
				|  |  | -								studentAttendanceDao.insert(byStatusAndCourseScheduleId);
 | 
	
		
			
				|  |  | -							}
 | 
	
		
			
				|  |  | -							if(!date.before(endDateTime)){
 | 
	
		
			
				|  |  |  								break;
 | 
	
		
			
				|  |  |  							}
 | 
	
		
			
				|  |  |  						}
 |