| 
					
				 | 
			
			
				@@ -102,6 +102,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private CourseScheduleRecordDao recordDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private ImGroupService imGroupService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private ImUserFriendService imUserFriendService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public CourseScheduleDao getDao() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -763,7 +765,6 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1028,6 +1029,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal practiceServiceRate = new BigDecimal(practiceServiceRateStr).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //写course_schedule_teacher_salary 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long teacherId = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long studentId = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date now = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<CourseScheduleTeacherSalary> teacherSalaryList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (CourseScheduleStudentPaymentVo payment : paymentList) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1048,10 +1051,22 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             teacherSalary.setStatus(TeacherSalaryEnum.NOT_START.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             teacherSalaryList.add(teacherSalary); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             teacherSalary.setCreateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            teacherId=payment.getTeacherId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            studentId=payment.getUserId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         courseScheduleTeacherSalaryService.getDao().insertBatch(teacherSalaryList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log.info("buyPracticeCourseSuccess ok"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Set<Long> studentIds=new HashSet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentIds.add(studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            imUserFriendService.saveUserFriend(teacherId,studentIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.info("保存用户通讯录成功,teacherId:{},studentIds:{}",teacherId,studentIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.error("保存用户通讯录失败,teacherId:{},studentIds:{},e:{}",teacherId,studentIds,e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //消息推送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             practiceSend(paymentList.get(0).getTeacherId(), orderParam.getUserId(), paymentList.size() + "", orderNo); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1098,7 +1113,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date endTime = adjustVo.getEndTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date now = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //校验时间是否为未来时刻 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (classDate.before(now) || startTime.before(now) || endTime.before(now)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (startTime.before(now) || endTime.before(now)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("排课日期必须大于当前日期"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!(DateUtil.dateToString(classDate).equals(DateUtil.dateToString(startTime))) || 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1581,7 +1596,15 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @Date: 2022/5/27 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public PianoRoomTimeVo selectRemainTime(Long teacherId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return pianoRoomTimeDao.selectRemainTime(teacherId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        PianoRoomTimeVo roomTimeVo = pianoRoomTimeDao.selectRemainTime(teacherId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (roomTimeVo != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return roomTimeVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            PianoRoomTimeVo pianoRoomTimeVo = new PianoRoomTimeVo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            pianoRoomTimeVo.setTeacherId(teacherId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            pianoRoomTimeVo.setStudentCount(pianoRoomTimeDao.countStudent(teacherId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return pianoRoomTimeVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1619,8 +1642,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer consumeTime = arrangeCourseVo.getConsumeTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer configValue = Integer.valueOf(sysConfigService.findConfigValue(SysConfigConstant.PIANO_ROOM_MAX_STUDENTS)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (studentIds.size()>configValue){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            throw new BizException("成课学员人数超过房间最大容量{}",configValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (studentIds.size() > configValue) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BizException("成课学员人数超过房间最大容量{}", configValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //校验课时 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1635,7 +1658,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //校验上下课时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (int i = 0; i < timeList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (timeList.get(i).getStartTime().before(new Date())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (timeList.get(i).getStartTime().before(new Date())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new BizException("上课时间必须大于当前时间"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!DateUtil.offsetMinute(timeList.get(i).getStartTime(), singleClssTime).equals(timeList.get(i).getEndTime())) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1739,9 +1762,9 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //创建群聊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            imGroupService.autoCreate(courseGroup.getId(),CourseScheduleEnum.PIANO_ROOM_CLASS.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            imGroupService.autoCreate(courseGroup.getId(), CourseScheduleEnum.PIANO_ROOM_CLASS.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            log.error("琴房课程组id:{},创建群聊失败:{}",courseGroup.getId(),e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.error("琴房课程组id:{},创建群聊失败:{}", courseGroup.getId(), e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1769,6 +1792,17 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @Description: 琴房课列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @Author: cy 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @Date: 2022/6/7 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public PageInfo<CourseScheduleRecordVo> selectCourseList(Map<String, Object> param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        param.put("type", CourseScheduleEnum.PIANO_ROOM_CLASS.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return PageUtil.pageInfo(recordDao.selectCourseList(PageUtil.getPageInfo(param), param)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @Description: 排课推送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @Author: cy 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @Date: 2022/5/31 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1847,7 +1881,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 imGroupService.dismiss(String.valueOf(groupId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                log.error("琴房课程组id:{},关闭群聊失败:{}",groupId,e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.error("琴房课程组id:{},关闭群聊失败:{}", groupId, e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             courseGroupService.update(null, Wrappers.<CourseGroup>lambdaUpdate() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1875,7 +1909,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         courseTime.setEndTime(endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<CourseTimeEntity> timeList = Arrays.asList(courseTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (startTime.before(new Date())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (startTime.before(new Date())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("上课时间必须大于当前时间"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1928,8 +1962,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Long> studentIds = JSONArray.parseArray(studentIdsList.toString(), Long.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer configValue = Integer.valueOf(sysConfigService.findConfigValue(SysConfigConstant.PIANO_ROOM_MAX_STUDENTS)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (studentIds.size()>configValue){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            throw new BizException("成课学员人数超过房间最大容量{}",configValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (studentIds.size() > configValue) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BizException("成课学员人数超过房间最大容量{}", configValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (CollectionUtils.isEmpty(studentIds)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1997,7 +2031,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         courseTime.setEndTime(courseSchedule.getEndTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<CourseTimeEntity> timeList = Arrays.asList(courseTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //批量检查老师课时在数据库是否重复 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.batchCheckTeacherCourseTime(teacherId, timeList, CourseTimeEntity::getStartTime, CourseTimeEntity::getEndTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        this.batchCheckTeacherCourseTime(teacherId, timeList, CourseTimeEntity::getStartTime, CourseTimeEntity::getEndTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<CourseScheduleStudentPayment> payments = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (Long studentId : studentIds) { 
			 |