|  | @@ -9,13 +9,17 @@ import com.ym.mec.biz.dal.enums.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.CourseHomeworkQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.StudentAttendanceQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.StudentAttendanceService;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.SysConfigService;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.SysMessageService;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.dal.BaseDAO;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.exception.BizException;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.page.PageInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.page.QueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.service.impl.BaseServiceImpl;
 | 
	
		
			
				|  |  | +import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.collection.MapUtil;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.date.DateUtil;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
	
		
			
				|  | @@ -47,6 +51,8 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 | 
	
		
			
				|  |  |  	private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
 | 
	
		
			
				|  |  |  	@Autowired
 | 
	
		
			
				|  |  |  	private MusicGroupQuitDao musicGroupQuitDao;
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private SysMessageService sysMessageService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	@Override
 | 
	
		
			
				|  |  |  	public BaseDAO<Long, StudentAttendance> getDAO() {
 | 
	
	
		
			
				|  | @@ -168,6 +174,10 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 | 
	
		
			
				|  |  |  		if(courseSchedule.getStatus() == CourseStatusEnum.OVER){
 | 
	
		
			
				|  |  |  			throw new BizException("课程已结束");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		if(StringUtils.length(remark)>150){
 | 
	
		
			
				|  |  | +			throw new BizException("字符长度超限");
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		Date date = new Date();
 | 
	
		
			
				|  |  |  		
 | 
	
	
		
			
				|  | @@ -302,6 +312,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 | 
	
		
			
				|  |  |  			studentAttendance = new StudentAttendance();
 | 
	
		
			
				|  |  |  			ClassGroup classGroup = classGroupDao.findByCourseSchedule(courseScheduleId);
 | 
	
		
			
				|  |  |  			CourseSchedule courseSchedule = courseScheduleDao.get(courseScheduleId.longValue());
 | 
	
		
			
				|  |  | +			Date date = new Date();
 | 
	
		
			
				|  |  |  			if(classGroup != null && courseSchedule != null){
 | 
	
		
			
				|  |  |  				studentAttendance.setClassGroupId(classGroup.getId());
 | 
	
		
			
				|  |  |  				studentAttendance.setCourseScheduleId(courseScheduleId.longValue());
 | 
	
	
		
			
				|  | @@ -310,10 +321,32 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
 | 
	
		
			
				|  |  |  				studentAttendance.setStatus(statusEnum);
 | 
	
		
			
				|  |  |  				studentAttendance.setUserId(userId);
 | 
	
		
			
				|  |  |  				studentAttendance.setTeacherId(courseSchedule.getActualTeacherId());
 | 
	
		
			
				|  |  | -				studentAttendance.setRemark(statusEnum==StudentAttendanceStatusEnum.NORMAL?"":"课程结束后学生未到");
 | 
	
		
			
				|  |  | +//				studentAttendance.setRemark(statusEnum==StudentAttendanceStatusEnum.NORMAL?"":"课程结束后学生未到");
 | 
	
		
			
				|  |  |  				studentAttendanceDao.insert(studentAttendance);
 | 
	
		
			
				|  |  | +				//点名完成推送
 | 
	
		
			
				|  |  | +				Map<Integer, String> receivers = new HashMap<Integer, String>(1);
 | 
	
		
			
				|  |  | +				receivers.put(userId, userId.toString());
 | 
	
		
			
				|  |  | +				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_NAMES_ACHIEVE, receivers, null, 0, "",
 | 
	
		
			
				|  |  | +						DateUtil.format(date,DateUtil.DATE_FORMAT_MIN));
 | 
	
		
			
				|  |  | +				//修改课程状态(如果是学生签到,并且课程未开始)
 | 
	
		
			
				|  |  | +				/*if(StudentAttendanceStatusEnum.NORMAL == statusEnum && courseSchedule.getStatus() == CourseStatusEnum.NOT_START){
 | 
	
		
			
				|  |  | +					courseSchedule.setStatus(CourseStatusEnum.UNDERWAY);
 | 
	
		
			
				|  |  | +					courseSchedule.setUpdateTime(date);
 | 
	
		
			
				|  |  | +					courseScheduleDao.update(courseSchedule);
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +				if(StudentAttendanceStatusEnum.TRUANT == statusEnum && courseSchedule.getStatus() == CourseStatusEnum.UNDERWAY){
 | 
	
		
			
				|  |  | +					String classDate = DateUtil.getDate(courseSchedule.getClassDate());
 | 
	
		
			
				|  |  | +					String classTime = DateUtil.getTime(courseSchedule.getEndClassTime());
 | 
	
		
			
				|  |  | +					Date stringToDate = DateUtil.stringToDate(classDate + " " + classTime);
 | 
	
		
			
				|  |  | +					//当前课程已结束
 | 
	
		
			
				|  |  | +					if(DateUtil.minutesBetween(stringToDate,date) > 0){
 | 
	
		
			
				|  |  | +						courseSchedule.setStatus(CourseStatusEnum.OVER);
 | 
	
		
			
				|  |  | +						courseSchedule.setUpdateTime(date);
 | 
	
		
			
				|  |  | +						courseScheduleDao.update(courseSchedule);
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +				}*/
 | 
	
		
			
				|  |  |  			}else {
 | 
	
		
			
				|  |  | -				throw new BizException("学员签到数据异常");
 | 
	
		
			
				|  |  | +				throw new BizException("学员班级或课程信息异常");
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  	}
 |