|
@@ -1656,29 +1656,22 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
if (CollectionUtils.isNotEmpty(userList)) {
|
|
|
List<CourseScheduleStudentVo> practiceList = userList.stream().filter(s -> s.getType().equals(CourseScheduleEnum.PRACTICE.getCode())).collect(Collectors.toList());
|
|
|
if (CollectionUtils.isNotEmpty(practiceList)) {//陪练课
|
|
|
- //校验评价是否存在
|
|
|
- List<Long> ids = practiceList.stream().map(CourseScheduleStudentVo::getCourseId).collect(Collectors.toList());
|
|
|
- List<CourseScheduleReplied> replieds = repliedDao.selectList(Wrappers.<CourseScheduleReplied>lambdaQuery().in(CourseScheduleReplied::getCourseScheduleId, ids));
|
|
|
- if (CollectionUtils.isNotEmpty(replieds)) {
|
|
|
- List<Long> courseIds = replieds.stream().map(CourseScheduleReplied::getCourseScheduleId).collect(Collectors.toList());
|
|
|
- practiceList = practiceList.stream().filter(s -> !courseIds.contains(s.getCourseId())).collect(Collectors.toList());
|
|
|
- }
|
|
|
+ //老师课酬状态改为待结算
|
|
|
+ courseScheduleTeacherSalaryService.update(null, Wrappers.<CourseScheduleTeacherSalary>lambdaUpdate()
|
|
|
+ .set(CourseScheduleTeacherSalary::getStatus, TeacherSalaryEnum.WAIT.getCode())
|
|
|
+ .in(CourseScheduleTeacherSalary::getCourseScheduleId, practiceList.stream().map(CourseScheduleStudentVo::getCourseId).collect(Collectors.toList())));
|
|
|
+
|
|
|
//创建课程评论
|
|
|
- if (CollectionUtils.isNotEmpty(practiceList)) {
|
|
|
- repliedDao.insertBatch(practiceList);
|
|
|
-
|
|
|
- //老师课酬状态改为已完成
|
|
|
- courseScheduleTeacherSalaryService.update(null, Wrappers.<CourseScheduleTeacherSalary>lambdaUpdate()
|
|
|
- .set(CourseScheduleTeacherSalary::getStatus, TeacherSalaryEnum.WAIT.getCode())
|
|
|
- .in(CourseScheduleTeacherSalary::getCourseScheduleId, practiceList.stream().map(CourseScheduleStudentVo::getCourseId).collect(Collectors.toList())));
|
|
|
-
|
|
|
- //清除缓存
|
|
|
- for (CourseScheduleStudentVo practice : practiceList) {
|
|
|
- //清除学生统计缓存
|
|
|
- redissonClient.getBucket(CacheNameEnum.STUDENT_TOTAL.getRedisKey(practice.getStudentId())).delete();
|
|
|
- //清除老师统计缓存
|
|
|
- redissonClient.getBucket(CacheNameEnum.TEACHER_TOTAL.getRedisKey(practice.getTeacherId())).delete();
|
|
|
- }
|
|
|
+ List<Long> ids = practiceList.stream().map(CourseScheduleStudentVo::getCourseId).collect(Collectors.toList());
|
|
|
+ repliedDao.deleteBatch(ids);
|
|
|
+ repliedDao.insertBatch(practiceList);
|
|
|
+
|
|
|
+ //清除缓存
|
|
|
+ for (CourseScheduleStudentVo practice : practiceList) {
|
|
|
+ //清除学生统计缓存
|
|
|
+ redissonClient.getBucket(CacheNameEnum.STUDENT_TOTAL.getRedisKey(practice.getStudentId())).delete();
|
|
|
+ //清除老师统计缓存
|
|
|
+ redissonClient.getBucket(CacheNameEnum.TEACHER_TOTAL.getRedisKey(practice.getTeacherId())).delete();
|
|
|
}
|
|
|
}
|
|
|
|