浏览代码

Merge remote-tracking branch 'origin/feature/0529-live' into feature/0529-live

zouxuan 2 年之前
父节点
当前提交
5aef181236

+ 40 - 88
.idea/httpRequests/http-requests-log.http

@@ -1,3 +1,43 @@
+GET http://127.0.0.1:8005/task/closeLiveCourseRoom
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
+Accept-Encoding: br,deflate,gzip,x-gzip
+
+<> 2023-06-08T214126.200.json
+
+###
+
+GET http://127.0.0.1:8005/task/closeLiveCourseRoom
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
+Accept-Encoding: br,deflate,gzip,x-gzip
+
+<> 2023-06-08T210807.200.json
+
+###
+
+GET http://127.0.0.1:9002/teacherCourseSchedule/findCourseAttendanceDetailHeadInfo?courseScheduleId=1701
+authorization: bearer b33a3aed-ca44-4537-b3ae-1fba38c2560a
+Content-Type: application/json
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
+Accept-Encoding: br,deflate,gzip,x-gzip
+
+<> 2023-06-08T194906.200.json
+
+###
+
+GET http://127.0.0.1:9002/teacherCourseSchedule/findCourseAttendanceDetailHeadInfo?courseScheduleId=1701
+authorization: bearer 97fd8e85-bb3c-4967-8a07-47c44957f94a
+Content-Type: application/json
+Connection: Keep-Alive
+User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
+Accept-Encoding: br,deflate,gzip,x-gzip
+
+<> 2023-06-08T194556.200.json
+
+###
+
 GET http://127.0.0.1:9002/teacherCourseSchedule/findCourseAttendanceDetailHeadInfo?courseScheduleId=1701
 authorization: bearer 97fd8e85-bb3c-4967-8a07-47c44957f94a
 Content-Type: application/json
@@ -709,91 +749,3 @@ Accept-Encoding: br,deflate,gzip,x-gzip
 
 ###
 
-POST http://127.0.0.1:8005/studentManage/userPage
-Authorization: bearer b897da27-5a37-47df-8e76-54d80a61a55d
-Content-Type: application/json
-coopId: 25
-Content-Length: 137
-Connection: Keep-Alive
-User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
-Accept-Encoding: br,deflate,gzip,x-gzip
-
-{
-//  "keyword": "一",
-//    "musicGroupId": 23050516201200001,
-  //  "subjectId": 2,
-  //  "vipFlag": true,
-//  "studentId": 2248340
-
-}
-
-<> 2023-06-02T195056.200.json
-
-###
-
-POST http://127.0.0.1:8005/studentManage/userPage
-Authorization: bearer b897da27-5a37-47df-8e76-54d80a61a55d
-Content-Type: application/json
-coopId: 14
-Content-Length: 137
-Connection: Keep-Alive
-User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
-Accept-Encoding: br,deflate,gzip,x-gzip
-
-{
-//  "keyword": "一",
-//    "musicGroupId": 23050516201200001,
-  //  "subjectId": 2,
-  //  "vipFlag": true,
-//  "studentId": 2248340
-
-}
-
-<> 2023-06-02T194927.200.json
-
-###
-
-POST http://127.0.0.1:8005/studentManage/userPage
-Authorization: bearer b897da27-5a37-47df-8e76-54d80a61a55d
-Content-Type: application/json
-coopId: 14
-Content-Length: 137
-Connection: Keep-Alive
-User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
-Accept-Encoding: br,deflate,gzip,x-gzip
-
-{
-//  "keyword": "一",
-//    "musicGroupId": 23050516201200001,
-  //  "subjectId": 2,
-  //  "vipFlag": true,
-//  "studentId": 2248340
-
-}
-
-<> 2023-06-02T194743.200.json
-
-###
-
-POST http://127.0.0.1:8005/studentManage/userPage
-Authorization: bearer b897da27-5a37-47df-8e76-54d80a61a55d
-Content-Type: application/json
-coopId: 14
-Content-Length: 137
-Connection: Keep-Alive
-User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.6)
-Accept-Encoding: br,deflate,gzip,x-gzip
-
-{
-//  "keyword": "一",
-//    "musicGroupId": 23050516201200001,
-  //  "subjectId": 2,
-  //  "vipFlag": true,
-//  "studentId": 2248340
-
-}
-
-<> 2023-06-02T194634.200.json
-
-###
-

+ 19 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -2045,7 +2045,9 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      *
      * @return
      */
-    List<CourseSchedule> getCloseLiveCourseRoom(@Param("studentRemindTime") Integer studentRemindTime, @Param("closeTime") Integer closeTime);
+    List<CourseSchedule> getCloseLiveCourseRoom(@Param("studentRemindTime") Integer studentRemindTime,
+                                                @Param("closeTime") Integer closeTime,
+                                                @Param("tenantId") Integer tenantId);
 
     /**
      * 更新通知状态
@@ -2056,6 +2058,22 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     void updateLiveRemind(@Param("courseScheduleId") Long courseScheduleId, @Param("liveRemind") int liveRemind);
 
     /**
+     * 更新课程关联直播间编号
+     *
+     * @param courseScheduleIds 课程ID
+     * @param liveRoomId 直播间编号
+     */
+    void batchUpdateLiveRoomId(@Param("courseScheduleIds") List<Long> courseScheduleIds, @Param("liveRoomId") String liveRoomId);
+
+    /**
+     * 更新课程关联直播间编号
+     *
+     * @param courseScheduleIds 课程ID
+     * @param continuousCourse 连堂课状态
+     */
+    void batchUpdateContinuousCourse(@Param("courseScheduleIds") List<Long> courseScheduleIds, @Param("continuousCourse") Boolean continuousCourse);
+
+    /**
      * 获取下一次连堂课
      *
      * @param classGroupId 班级编号

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseAttendanceDetailHeadInfoDto.java

@@ -50,6 +50,18 @@ public class CourseAttendanceDetailHeadInfoDto {
     @ApiModelProperty(value = "旷课人数")
     private Integer truantStudentNum;
 
+
+    @ApiModelProperty(value = "迟到人数")
+    private Integer lateStudentNum;
+
+    public Integer getLateStudentNum() {
+        return lateStudentNum;
+    }
+
+    public void setLateStudentNum(Integer lateStudentNum) {
+        this.lateStudentNum = lateStudentNum;
+    }
+
     public Integer getTruantStudentNum() {
         return truantStudentNum;
     }

+ 151 - 25
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -66,6 +66,7 @@ import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.TemporalAdjusters;
 import java.util.*;
+import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 
 import static com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType.MUSIC_NETWORK;
@@ -3925,6 +3926,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         courseAttendanceDetailHeadInfoDto.setLatestAttendanceTime(studentAttendanceDao.findLatestAttendanceDate(courseScheduleId));
         courseAttendanceDetailHeadInfoDto.setLeaveStudentNum(studentAttendanceDao.getStudentNumByStatus(courseScheduleId, StudentAttendanceStatusEnum.LEAVE));
         courseAttendanceDetailHeadInfoDto.setTruantStudentNum(studentAttendanceDao.getStudentNumByStatus(courseScheduleId, StudentAttendanceStatusEnum.TRUANT));
+        courseAttendanceDetailHeadInfoDto.setLateStudentNum(studentAttendanceDao.getStudentNumByStatus(courseScheduleId, StudentAttendanceStatusEnum.LATE));
         return courseAttendanceDetailHeadInfoDto;
     }
 
@@ -5982,12 +5984,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		if (courseSchedule.getTeachMode() == TeachModeEnum.OFFLINE) {
 			throw new BizException("请前往线下教室");
 		}
-
-		List<CourseScheduleWrapper.CourseScheduleTime> courseScheduleTimes = Lists.newArrayList();
-		courseScheduleTimes.add(CourseScheduleWrapper.CourseScheduleTime.builder()
-				.startTime(getDateTime(courseSchedule.getClassDate(), courseSchedule.getStartClassTime()).getMillis())
-				.endTime(getDateTime(courseSchedule.getClassDate(), courseSchedule.getEndClassTime()).getMillis())
-				.build());
+		// 课程开始时间
+		courseSchedule.setStartClassTime(getDateTime(courseSchedule.getClassDate(), courseSchedule.getStartClassTime()).toDate());
+		// 课程结束时间
+		courseSchedule.setEndClassTime(getDateTime(courseSchedule.getClassDate(), courseSchedule.getEndClassTime()).toDate());
 
 		// 是否是连堂课
 		String continueCourseTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME, courseSchedule.getTenantId());
@@ -5996,36 +5996,129 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		}
 
 		// 连堂课标准:同一个老师,同一天,同一课程组,连续上课
+		List<CourseSchedule> continuousCourse = courseScheduleDao.getTeacherContinuousCourse(courseSchedule.getClassGroupId(),
+				courseSchedule.getClassDate(), courseSchedule.getActualTeacherId());
+		for (CourseSchedule item : continuousCourse) {
+			// 设置开始时间
+			item.setStartClassTime(getDateTime(item.getClassDate(), item.getStartClassTime()).toDate());
+			// 设置结束时间
+			item.setEndClassTime(getDateTime(item.getClassDate(), item.getEndClassTime()).toDate());
+		}
+
+		// 课程按开始时间排序
+		continuousCourse = continuousCourse.stream()
+				.sorted(Comparator.comparing(CourseSchedule::getStartClassTime))
+				.collect(Collectors.toList());
 
+		// 以当前课程为分界线,分为两个集合
+		List<CourseSchedule> beforeCourse = Lists.newArrayList();
+		List<CourseSchedule> afterCourse = Lists.newArrayList();
 
+		CourseSchedule schedule;
+		for (CourseSchedule item : continuousCourse) {
+			if (item.getId().longValue() == courseSchedule.getId()) {
+				continue;
+			}
 
-		CourseSchedule schedule = courseSchedule;
-		// 如果当前课程是连堂课,那么获取第一节课的课程编号
-		while (true) {
-			String classDate = DateUtil.format(schedule.getClassDate(), DateUtil.DEFAULT_PATTERN);
-			String startClassTime = DateUtil.format(schedule.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
-			schedule = courseScheduleDao.getFirstCourse(schedule.getClassGroupId(), classDate + " " + startClassTime, schedule.getActualTeacherId(), continueCourseTime);
-			if (schedule != null) {
-				courseScheduleTimes.add(CourseScheduleWrapper.CourseScheduleTime.builder()
-						.startTime(getDateTime(schedule.getClassDate(), schedule.getStartClassTime()).getMillis())
-						.endTime(getDateTime(schedule.getClassDate(), schedule.getEndClassTime()).getMillis())
-						.build());
-			} else {
-				break;
+			schedule = JSON.parseObject(JSON.toJSONString(item), CourseSchedule.class);
+			if (item.getEndClassTime().getTime() <= courseSchedule.getStartClassTime().getTime()) {
+				beforeCourse.add(schedule);
+			}
+
+			if (courseSchedule.getEndClassTime().getTime() <= item.getStartClassTime().getTime()) {
+				afterCourse.add(schedule);
 			}
 		}
 
-		if (courseScheduleTimes.size() <= 1) {
+		// 当前课程之前连堂课
+		beforeCourse.add(JSON.parseObject(JSON.toJSONString(courseSchedule), CourseSchedule.class));
+		// 当前课程之后连堂课
+		afterCourse.add(0, JSON.parseObject(JSON.toJSONString(courseSchedule), CourseSchedule.class));
 
-			// 定时任务更新课程状态为进行中,判断当前课程状态是否匹配
-			if (CourseStatusEnum.NOT_START == courseSchedule.getStatus()) {
-				throw new BizException("直播课暂未开启,请稍后重试");
+		// 课程前连堂状态
+		updateContinuousCourseStatus(continueCourseTime, beforeCourse);
+
+		List<CourseSchedule> newCourseSchedules = Lists.newArrayList();
+		// 课程连堂状态
+		if (beforeCourse.get(beforeCourse.size() - 1).getContinuousCourse()) {
+			List<CourseSchedule> collect = beforeCourse.stream()
+					.filter(CourseSchedule::getContinuousCourse)
+					.collect(Collectors.toList());
+			if (CollectionUtils.isNotEmpty(collect)) {
+				newCourseSchedules.addAll(collect);
 			}
-			if (CourseStatusEnum.OVER == courseSchedule.getStatus()) {
-				throw new BizException("直播课已结束");
+		}
+
+		// 课程后连堂状态
+		updateContinuousCourseStatus(continueCourseTime, afterCourse);
+		if (afterCourse.get(0).getContinuousCourse()) {
+			List<CourseSchedule> collect = afterCourse.stream()
+					.filter(CourseSchedule::getContinuousCourse)
+					.collect(Collectors.toList());
+			if (CollectionUtils.isNotEmpty(collect)) {
+
+				if (CollectionUtils.isEmpty(newCourseSchedules)) {
+					newCourseSchedules.addAll(collect);
+				} else {
+					newCourseSchedules.addAll(collect.subList(1, collect.size()));
+				}
 			}
 		}
 
+		List<CourseScheduleWrapper.CourseScheduleTime> courseScheduleTimes = Lists.newArrayList();
+		if (CollectionUtils.isNotEmpty(newCourseSchedules)) {
+
+			// 连党课程信息
+			for (CourseSchedule item : newCourseSchedules) {
+				courseScheduleTimes.add(CourseScheduleWrapper.CourseScheduleTime.builder()
+						.startTime(item.getStartClassTime().getTime())
+						.endTime(item.getEndClassTime().getTime())
+						.build());
+			}
+
+			// 获取连堂课第一节信息
+			courseSchedule = newCourseSchedules.get(0);
+
+			CourseSchedule finalCourseSchedule = courseSchedule;
+			CompletableFuture.runAsync(() -> {
+
+				List<Long> collect = newCourseSchedules.stream()
+						.map(CourseSchedule::getId)
+						.distinct().collect(Collectors.toList());
+				try {
+
+					// 关联直播间编号
+					courseScheduleDao.batchUpdateLiveRoomId(collect, finalCourseSchedule.getLiveRoomId());
+
+					collect = newCourseSchedules.subList(0, newCourseSchedules.size() - 1).stream()
+							.map(CourseSchedule::getId)
+							.distinct().collect(Collectors.toList());
+					// 更新连堂课状态
+					courseScheduleDao.batchUpdateContinuousCourse(collect, true);
+
+				} catch (Exception e) {
+				    log.error("getLiveCourseScheduleTime courseScheduleIds={}", collect, e);
+				}
+
+			});
+
+		} else {
+
+			// 当前课程信息
+			courseScheduleTimes.add(CourseScheduleWrapper.CourseScheduleTime.builder()
+					.startTime(courseSchedule.getStartClassTime().getTime())
+					.endTime(courseSchedule.getEndClassTime().getTime())
+					.build());
+		}
+
+		// 定时任务更新课程状态为进行中,判断当前课程状态是否匹配
+		if (CourseStatusEnum.NOT_START == courseSchedule.getStatus()) {
+			throw new BizException("直播课暂未开启,请稍后重试");
+		}
+		if (CourseStatusEnum.OVER == courseSchedule.getStatus()) {
+			throw new BizException("直播课已结束");
+		}
+
 		// 直播间配置
 		ImLiveBroadcastRoom liveBroadcastRoom = imLiveBroadcastRoomService.lambdaQuery()
 				.eq(ImLiveBroadcastRoom::getRoomUid, courseSchedule.getLiveRoomId())
@@ -6050,6 +6143,39 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	}
 
 	/**
+	 * 更新当前课程连堂状态
+	 * @param continueCourseTime 连堂时间间隔
+	 * @param continuousCourse 连堂课程
+	 */
+	private void updateContinuousCourseStatus(String continueCourseTime, List<CourseSchedule> continuousCourse) {
+
+		// continuousCourse对象相邻两个时间比较,如果时间间隔小于5分钟,那么合并为连堂课
+		DateTime startTime;
+		DateTime endTime;
+		for (int i = 0; i < continuousCourse.size(); i++) {
+			CourseSchedule current = continuousCourse.get(i);
+			CourseSchedule next = null;
+			if (i + 1 < continuousCourse.size()) {
+				next = continuousCourse.get(i + 1);
+			}
+			if (next != null) {
+
+				startTime = getDateTime(current.getClassDate(), current.getEndClassTime());
+				endTime = getDateTime(next.getClassDate(), next.getStartClassTime());
+				// 如果当前课程结束时间和下一节课开始时间间隔小于5分钟,那么合并时间
+				if (startTime.isBefore(endTime)
+						&& startTime.plusMinutes(Integer.parseInt(continueCourseTime) + 1).isAfter(endTime)) {
+					// 上节连堂状态
+					current.setContinuousCourse(true);
+					// 下节连堂状态
+					next.setContinuousCourse(true);
+				}
+			}
+		}
+
+	}
+
+	/**
 	 * 课程开始时间
 	 * @param day 开始天
 	 * @param time 开始时间

+ 2 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImLiveBroadcastRoomServiceImpl.java

@@ -362,15 +362,14 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
      */
     @Override
     public PageInfo<ImLiveBroadcastRoomVo> queryPage(Map<String, Object> param) {
+        param.put("groupType", "NORMAL");
         String os = WrapperUtil.toStr(param, "os");
         if (StringUtils.isNotBlank(os) && os.toUpperCase(Locale.ROOT).equals("TEACHER")) {
             param.put("speakerId", getSysUser().getId());
             param.put("clientType", SysUserType.TEACHER.getCode());
-            param.put("groupType", "NORMAL");
         } else if (StringUtils.isNotBlank(os) && os.toUpperCase(Locale.ROOT).equals("EDUCATION")) {
             param.put("clientType", SysUserType.EDUCATION.getCode());
             param.put("speakerId", getSysUser().getId());
-            param.put("groupType", "NORMAL");
         }
         Page<ImLiveBroadcastRoomVo> pageInfo = PageUtil.concatTimePage(param, "startTime", "endTime");
         // pageInfo.setDesc("a.created_time_");
@@ -725,7 +724,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
         message.setToChatRoomId(room.getRoomUid());
         message.setObjectName(ImRoomMessage.FORCED_OFFLINE);
 
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        SysUser sysUser = sysUserFeignService.queryUserById(room.getSpeakerId());
         if (Objects.nonNull(sysUser)) {
 
             // 发送用户信息

+ 44 - 20
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -201,6 +201,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     @Autowired
     private SysMessageConfigDao sysMessageConfigDao;
 
+    @Autowired
+    private TenantInfoService tenantInfoService;
+
     private static final Logger LOGGER = LoggerFactory.getLogger(VipGroup.class);
 
     @Override
@@ -465,13 +468,18 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                 courseSchedule.setTeachingContent(schedule.getTeachingContent());
                 courseSchedule.setTeachingPoint(schedule.getTeachingPoint());
             });
-            courseScheduleDao.batchUpdate(scheduleList);
+            if (scheduleList.size() > 0) {
+                courseScheduleDao.batchUpdate(scheduleList);
+            }
 
             // 直播间ID
             List<String> list = scheduleList.stream().map(CourseSchedule::getLiveRoomId).filter(Objects::nonNull).collect(Collectors.toList());
             if (list.size() > 0) {
                 imLiveBroadcastRoomService.batchUpdateLiveRoomTitle(list, vipGroup.getLiveBroadcastRoom().getRoomTitle(),vipGroup.getLiveBroadcastRoom().getLiveRemark());
             }
+            // 加入群组
+            imGroupMemberService.join(classGroup.getId().toString(), vipGroup.getLiveBroadcastRoom().getSpeakerId(),EFriendRoleType.ORCHESTRA_TEACHER.getMsg(),false);
+            imGroupMemberService.join(classGroup.getId().toString(), vipGroup.getVipGroupApplyBaseInfo().getEducationalTeacherId(),EFriendRoleType.ORCHESTRA_MANAGER.getMsg(),false);
         }
 
         if (!vipGroup1.getStatus().equals(VipGroupStatusEnum.PROGRESS)) {
@@ -5050,6 +5058,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         liveRoom.setRoomUid(roomUid);
         //liveRoom.setRoomConfig(liveRoom.getRoomConfig());
         liveRoom.setLiveState(1);
+        liveRoom.setSpeakerId(courseSchedule.getActualTeacherId());
         liveRoom.setRoomState(0);
         liveRoom.setGroupType("LIVE");
         liveRoom.setCreatedBy(liveRoom.getSpeakerId());
@@ -5092,35 +5101,48 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     @Override
     public void closeLiveCourseRoom() {
 
+        List<TenantInfo> list = tenantInfoService.list();
+
         Integer studentRemindTime = Integer.parseInt(sysConfigService.findByParamName(SysConfigService.liveClassStudentRemindTime).getParanValue());
 
         Integer closeTime = Integer.parseInt(sysConfigService.findByParamName(SysConfigService.closeClassStudentRemindTime).getParanValue());
-        // 查询非连堂课  且  已经结束的课程
-        List<CourseSchedule> scheduleList = courseScheduleDao.getCloseLiveCourseRoom(studentRemindTime, null);
 
-        // 通知学生退出直播间
+        for (TenantInfo tenantInfo : list) {
+            // 是否是连堂课
+            String continueCourseTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.ONLINE_CONTINUE_COURSE_TIME, tenantInfo.getId());
+            if (StringUtils.isEmpty(continueCourseTime)) {
+                continueCourseTime = "5";
+            }
+            Integer messageTime = Integer.parseInt(continueCourseTime) + studentRemindTime;
 
-        scheduleList.forEach(data -> {
-            ImLiveBroadcastRoom imLiveBroadcastRoomVo = imLiveBroadcastRoomService.getByRoomUid(data.getLiveRoomId());
-            if (!Objects.isNull(imLiveBroadcastRoomVo) ) {
-                if(imLiveBroadcastRoomVo.getLiveState() == 1) {
 
-                    try {
-                        imLiveBroadcastRoomService.sendForcedOffline(imLiveBroadcastRoomVo);
+            // 查询非连堂课  且  已经结束的课程
+            List<CourseSchedule> scheduleList = courseScheduleDao.getCloseLiveCourseRoom(messageTime, null, tenantInfo.getId());
 
-                        courseScheduleDao.updateLiveRemind(data.getId(), 1);
-                    } catch (Exception e) {
-                        log.error("发送直播间退出消息失败", e);
+            // 通知学生退出直播间
+
+            scheduleList.forEach(data -> {
+                ImLiveBroadcastRoom imLiveBroadcastRoomVo = imLiveBroadcastRoomService.getByRoomUid(data.getLiveRoomId());
+                if (!Objects.isNull(imLiveBroadcastRoomVo)) {
+                    if (imLiveBroadcastRoomVo.getLiveState() == 1) {
+
+                        try {
+                            imLiveBroadcastRoomService.sendForcedOffline(imLiveBroadcastRoomVo);
+
+                            courseScheduleDao.updateLiveRemind(data.getId(), 1);
+                        } catch (Exception e) {
+                            log.error("发送直播间退出消息失败", e);
+                        }
+                    } else if (imLiveBroadcastRoomVo.getLiveState() == 2) {
+                        // 直播未开始 设置通知状态
+                        courseScheduleDao.updateLiveRemind(data.getId(), 2);
                     }
-                } else if (imLiveBroadcastRoomVo.getLiveState() == 2) {
-                    // 直播未开始 设置通知状态
-                    courseScheduleDao.updateLiveRemind(data.getId(), 2);
                 }
-            }
-        });
+            });
+        }
 
         // 没有直播流 关闭直播间
-        scheduleList = courseScheduleDao.getCloseLiveCourseRoom(null, closeTime);
+        List<CourseSchedule> scheduleList = courseScheduleDao.getCloseLiveCourseRoom(null, closeTime,null);
 
         // 检测直播间是否有直播流
         scheduleList.forEach(data -> {
@@ -5144,6 +5166,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             }
 
         });
-
     }
+
+
 }
+

+ 10 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -4372,16 +4372,25 @@
             and CONCAT(class_date_,' ',end_class_time_) &lt;= date_format(date_add(now(),interval -#{closeTime} minute),'%Y-%m-%d %H:%i:%s')
             and live_remind_ = 1
         </if>
+        <if test="tenantId != null">
+            and tenant_id_ = #{tenantId}
+        </if>
     </select>
 
     <update id="updateLiveRemind">
         update course_schedule set live_remind_ = #{liveRemind} where id_ = #{courseScheduleId}
     </update>
+    <update id="batchUpdateLiveRoomId">
+        update course_schedule set live_room_id_ = #{liveRoomId} where id_ IN (<foreach collection="courseScheduleIds" separator="," item="item">#{item}</foreach>)
+    </update>
+    <update id="batchUpdateContinuousCourse">
+        update course_schedule set continuous_course_ = #{continuousCourse} where id_ IN (<foreach collection="courseScheduleIds" separator="," item="item">#{item}</foreach>)
+    </update>
 
     <select id="getTeacherContinuousCourse" resultMap="CourseSchedule">
         SELECT <include refid="resultSql"/> FROM course_schedule cs
         WHERE cs.class_group_id_ = #{classGroupId}
-        AND cs.actual_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ = 0
+        AND cs.actual_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ = 0 AND cs.class_date_ = #{classDate}
         ORDER BY cs.class_date_ DESC,cs.end_class_time_ DESC
     </select>
 </mapper>