| 
					
				 | 
			
			
				@@ -8,10 +8,7 @@ import com.ym.mec.biz.dal.entity.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 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.biz.service.TeacherAttendanceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.biz.service.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.common.dal.BaseDAO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.common.exception.BizException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.common.page.PageInfo; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -58,6 +55,14 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private SysConfigDao sysConfigDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private TeacherAttendanceService teacherAttendanceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private SchoolDao schoolDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private SysConfigService sysConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private CourseScheduleService courseScheduleService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private TeacherAttendanceDao teacherAttendanceDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public BaseDAO<Long, StudentAttendance> getDAO() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -66,7 +71,7 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public Map addStudentAttendances(StudentAttendanceDto studentAttendanceInfos) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public void addStudentAttendances(StudentAttendanceDto studentAttendanceInfos) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		List<StudentAttendance> studentAttendances=studentAttendanceInfos.getStudentAttendances(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		SysUser sysUser = sysUserFeignService.queryUserInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(Objects.isNull(sysUser)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -135,13 +140,58 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		courseSchedule.setLeaveStudentNum(leaveStudentNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		courseScheduleDao.update(courseSchedule); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		TeacherSignOutDto teacherSignOutDto=new TeacherSignOutDto(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		TeacherAttendance teacherAttendance = new TeacherAttendance(courseSchedule.getId(), 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		teacherAttendance.setSignInLongitudeLatitude(studentAttendanceInfos.getSignInLongitudeLatitude()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		teacherAttendance.setUpdate(studentAttendanceInfos.getUpdate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		teacherSignOutDto.setTeacherAttendanceInfo(teacherAttendance); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		teacherSignOutDto.setNotRturnErrorInfo(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		return teacherAttendanceService.addTeacherAttendanceRecord(teacherSignOutDto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(StringUtils.isBlank(studentAttendanceInfos.getSignInLongitudeLatitude())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			throw new BizException("未获取到您的位置"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		School school = schoolDao.get(courseSchedule.getSchoolId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//是否在范围内 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		boolean isInScore = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(StringUtils.isBlank(school.getLongitudeLatitude())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(studentAttendanceInfos.getUpdate().equals(YesOrNoEnum.YES.getCode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				school.setLongitudeLatitude(studentAttendanceInfos.getSignInLongitudeLatitude()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				schoolDao.update(school); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ATTENDANCE_RANGE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			double attendanceRange = Double.valueOf(sysConfig.getParanValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			double distance = MapUtil.distance(studentAttendanceInfos.getSignInLongitudeLatitude(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					school.getLongitudeLatitude()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(distance>attendanceRange){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				isInScore=false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		TeacherAttendance teacherAttendance=teacherAttendanceDao.findByTeacherAttendanceInfo(sysUser.getId().longValue(),courseSchedule.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Date date = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(Objects.isNull(teacherAttendance)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			teacherAttendance= new TeacherAttendance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			teacherAttendance.setTeacherId(sysUser.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			teacherAttendance.setCreateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}else if(teacherAttendance.getSignInTime() != null && teacherAttendance.getSignOutTime() != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		YesOrNoEnum yesOrNoEnum = courseScheduleService.enableOnlyNormalAttendance(courseSchedule.getStartClassTime(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUser.getId().longValue(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				courseSchedule.getSchoolId().intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		teacherAttendance.setSignInTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		teacherAttendance.setSignInStatus(YesOrNoEnum.YES); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		teacherAttendance.setSignOutTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		teacherAttendance.setSignOutStatus(YesOrNoEnum.YES); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(yesOrNoEnum != YesOrNoEnum.YES&&courseSchedule.getStartClassTime().before(date)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			teacherAttendance.setSignInStatus(YesOrNoEnum.NO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			teacherAttendance.setSignOutStatus(YesOrNoEnum.NO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(Objects.nonNull(teacherAttendance.getId())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			teacherAttendanceDao.update(teacherAttendance); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			teacherAttendanceDao.insert(teacherAttendance); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 |