|  | @@ -12,7 +12,9 @@ import com.ym.dao.WhiteboardDao;
 | 
	
		
			
				|  |  |  import com.ym.job.ScheduleManager;
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.TeacherDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.CourseSchedule;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.Teacher;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.enums.SignStatusEnum;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
 | 
	
	
		
			
				|  | @@ -71,6 +73,9 @@ public class RoomServiceImpl implements RoomService {
 | 
	
		
			
				|  |  |      private TeacherDao teacherDao;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | +    private CourseScheduleDao courseScheduleDao;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  |      private TeacherAttendanceService teacherAttendanceService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
	
		
			
				|  | @@ -92,11 +97,12 @@ public class RoomServiceImpl implements RoomService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          String userId = sysUserFeignService.queryUserInfo().getId().toString();
 | 
	
		
			
				|  |  |          Teacher teacher = teacherDao.get(Integer.parseInt(userId));
 | 
	
		
			
				|  |  | +        CourseSchedule courseSchedule = courseScheduleDao.get(Long.parseLong(roomId));
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  | -            if(teacher == null){
 | 
	
		
			
				|  |  | -                studentAttendanceService.addStudentAttendanceRecord(Integer.parseInt(roomId),Integer.parseInt(userId), StudentAttendanceStatusEnum.NORMAL);
 | 
	
		
			
				|  |  | -            }else {
 | 
	
		
			
				|  |  | +            if(teacher != null && teacher.getId().equals(courseSchedule.getActualTeacherId())){
 | 
	
		
			
				|  |  |                  teacherAttendanceService.addTeacherAttendanceRecord(Integer.parseInt(roomId),Integer.parseInt(userId), SignStatusEnum.SIGN_IN,true);
 | 
	
		
			
				|  |  | +            }else {
 | 
	
		
			
				|  |  | +                studentAttendanceService.addStudentAttendanceRecord(Integer.parseInt(roomId),Integer.parseInt(userId), StudentAttendanceStatusEnum.NORMAL);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }catch (Exception e){
 | 
	
		
			
				|  |  |              e.printStackTrace();
 | 
	
	
		
			
				|  | @@ -142,10 +148,10 @@ public class RoomServiceImpl implements RoomService {
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                  roleEnum = RoleEnum.RoleAudience;
 | 
	
		
			
				|  |  |              }*/
 | 
	
		
			
				|  |  | -            if(teacher == null){
 | 
	
		
			
				|  |  | -                roleEnum = RoleEnum.RoleStudent;
 | 
	
		
			
				|  |  | -            }else {
 | 
	
		
			
				|  |  | +            if(teacher != null && teacher.getId().equals(courseSchedule.getActualTeacherId())){
 | 
	
		
			
				|  |  |                  roleEnum = RoleEnum.RoleTeacher;
 | 
	
		
			
				|  |  | +            }else {
 | 
	
		
			
				|  |  | +                roleEnum = RoleEnum.RoleStudent;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              saveRoomMember(userId, userName, roomId, roleEnum.getValue(), !isDisableCamera, curTime);
 | 
	
		
			
				|  |  |              IMApiResultInfo resultInfo = imHelper.joinGroup(new String[]{userId}, roomId, roomId);
 | 
	
	
		
			
				|  | @@ -236,14 +242,14 @@ public class RoomServiceImpl implements RoomService {
 | 
	
		
			
				|  |  |          SysUser user = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  |          String userId = user.getId().toString();
 | 
	
		
			
				|  |  |          Teacher teacher = teacherDao.get(user.getId());
 | 
	
		
			
				|  |  | -        if(teacher != null){
 | 
	
		
			
				|  |  | -            try {
 | 
	
		
			
				|  |  | +        CourseSchedule courseSchedule = courseScheduleDao.get(Long.parseLong(roomId.substring(4)));
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            if(teacher != null && teacher.getId().equals(courseSchedule.getActualTeacherId())){
 | 
	
		
			
				|  |  |                  teacherAttendanceService.addTeacherAttendanceRecord(Integer.parseInt(roomId.substring(4)),user.getId(), SignStatusEnum.SIGN_OUT,true);
 | 
	
		
			
				|  |  | -            }catch (Exception e){
 | 
	
		
			
				|  |  | -                e.printStackTrace();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +        }catch (Exception e){
 | 
	
		
			
				|  |  | +            e.printStackTrace();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        
 | 
	
		
			
				|  |  |          CheckUtils.checkArgument(user != null, "user must't be null");
 | 
	
		
			
				|  |  |          CheckUtils.checkArgument(roomId != null, "roomId must't be null");
 | 
	
		
			
				|  |  |          List<Room> roomList = roomDao.findByRid(roomId);
 | 
	
	
		
			
				|  | @@ -1133,12 +1139,13 @@ public class RoomServiceImpl implements RoomService {
 | 
	
		
			
				|  |  |          if(byRidAndUid.size() > 0){
 | 
	
		
			
				|  |  |              SysUser sysUser = sysUserFeignService.queryUserById(Integer.parseInt(userId));
 | 
	
		
			
				|  |  |              Teacher teacher = teacherDao.get(sysUser.getId());
 | 
	
		
			
				|  |  | -            if(teacher != null){
 | 
	
		
			
				|  |  | -                try {
 | 
	
		
			
				|  |  | -                    teacherAttendanceService.addTeacherAttendanceRecord(Integer.parseInt(roomId.substring(4)),sysUser.getId(), SignStatusEnum.SIGN_OUT,true);
 | 
	
		
			
				|  |  | -                }catch (Exception e){
 | 
	
		
			
				|  |  | -                    e.printStackTrace();
 | 
	
		
			
				|  |  | +            CourseSchedule courseSchedule = courseScheduleDao.get(Long.parseLong(roomId));
 | 
	
		
			
				|  |  | +            try {
 | 
	
		
			
				|  |  | +                if(teacher != null && teacher.getId().equals(courseSchedule.getActualTeacherId())){
 | 
	
		
			
				|  |  | +                    teacherAttendanceService.addTeacherAttendanceRecord(Integer.parseInt(roomId.substring(4)),Integer.parseInt(userId), SignStatusEnum.SIGN_OUT,true);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +            }catch (Exception e){
 | 
	
		
			
				|  |  | +                e.printStackTrace();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              List<Room> roomList = roomDao.findByRid(roomId);
 | 
	
		
			
				|  |  |              if (roomList.size() == 0) {
 |