Explorar el Código

Merge remote-tracking branch 'origin/master'

liweifan hace 3 años
padre
commit
8c8fa22613

+ 7 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -1626,6 +1626,13 @@ 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());
+                }
                 //创建课程评论
                 repliedDao.insertBatch(practiceList);