shangke 2 年之前
父節點
當前提交
e255b3ba30
共有 1 個文件被更改,包括 19 次插入7 次删除
  1. 19 7
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

+ 19 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -6139,8 +6139,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				updateFlag = false;
 			}
 
+			List<CourseSchedule> newCourseSchedules = Lists.newArrayList();
 			// 直播课关联直播间编号
-			String liveRoomId = getCourseScheduleLiveRoomId(newCourseSchedule, continueCourseTime, Lists.newArrayList(), Lists.newArrayList(), updateFlag);
+			String liveRoomId = getCourseScheduleLiveRoomId(newCourseSchedule, continueCourseTime, newCourseSchedules, Lists.newArrayList(), updateFlag);
 
 			if (StringUtils.isBlank(liveRoomId)) {
 				liveRoomId = item.getLiveRoomId();
@@ -6148,8 +6149,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
 			ImLiveBroadcastRoom liveRoom = imLiveBroadcastRoomService.getByRoomUid(liveRoomId);
 			if (Objects.isNull(liveRoom)) {
-				log.warn("liveRoom sendChatRoomMessage is null, liveRoomId:{}, updateFlag={}", liveRoomId, updateFlag);
-				if (!updateFlag && Optional.ofNullable(item.getContinuousCourse()).orElse(false)) {
+				log.warn("liveRoom sendChatRoomMessage is null, liveRoomId:{}, updateFlag={}, item.liveId={}", liveRoomId,
+						updateFlag, item.getLiveRoomId());
+
+				boolean anyMatch = newCourseSchedules.stream().anyMatch(x -> x.getId().longValue() == x.getId())
+						&& newCourseSchedules.size() > 1;
+				if (!updateFlag && (Optional.ofNullable(item.getContinuousCourse()).orElse(false) || anyMatch)) {
 					throw new BizException("课程信息已变更,请重新操作");
 				}
 				return;
@@ -6611,7 +6616,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
 						int size = beforeCourse.size();
 						collect = beforeCourse.subList(size - 2, size).stream()
-                                .filter(o -> CourseStatusEnum.NOT_START.equals(o.getStatus()))
+                                //.filter(o -> CourseStatusEnum.NOT_START.equals(o.getStatus()))
 								.map(CourseSchedule::getId)
 								.distinct().collect(Collectors.toList());
 						if (CollectionUtils.isNotEmpty(collect)) {
@@ -6623,15 +6628,22 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 					// 课程后连堂状态
 					if (afterCourse.get(0).getContinuousCourse()) {
 						collect = afterCourse.stream()
-                                .filter(o -> CourseStatusEnum.NOT_START.equals(o.getStatus()))
+                                //.filter(o -> CourseStatusEnum.NOT_START.equals(o.getStatus()))
                                 .map(CourseSchedule::getId).distinct().collect(Collectors.toList());
 
 						if (CollectionUtils.isNotEmpty(collect)) {
-							// 关联直播间编号
-							courseScheduleDao.batchUpdateLiveRoomId(collect, "");
 							// 更新连堂课状态
 							courseScheduleDao.batchUpdateContinuousCourse(collect, false);
 						}
+
+						collect = afterCourse.stream()
+								.filter(o -> CourseStatusEnum.NOT_START.equals(o.getStatus()))
+								.map(CourseSchedule::getId).distinct().collect(Collectors.toList());
+
+						if (CollectionUtils.isNotEmpty(collect)) {
+							// 关联直播间编号
+							courseScheduleDao.batchUpdateLiveRoomId(collect, "");
+						}
 					}
 				}