From 4c61d5fd5c273cadffe9f20464b5341a23f4e60f Mon Sep 17 00:00:00 2001
From: 胡仁荣 <897853850@qq.com>
Date: 星期五, 07 四月 2023 14:50:26 +0800
Subject: [PATCH] 直播

---
 src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaLiveService.java |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaLiveService.java b/src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaLiveService.java
index 437a80d..4bcd977 100644
--- a/src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaLiveService.java
+++ b/src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaLiveService.java
@@ -7,6 +7,7 @@
 import java.util.List;
 import java.util.Map;
 
+import io.swagger.models.auth.In;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -51,14 +52,15 @@
 	
 	
 	@Override
-	public Result add(String name, String content, String teacherId,String teacherName ,String subjectId,String subjectName,
-			String definition,String imgPath, Date startTime, Date endTime, boolean record,List<String> classIds) {
+	public Result add(String name, String content, String teacherId, String teacherName , String subjectId, String subjectName,
+					  String definition, String imgPath, Date startTime, Date endTime, Integer courseId, boolean record, List<String> classIds) {
 		
 		UserTeacher teacher = teacherService.getTeacherByUserId(ClientUtils.getUserId());
 		
 		MediaVideoLive live = new MediaVideoLive();
 		TraceUtils.setCreateTrace(live);
-		
+
+		live.setCourseId(courseId);
 		live.setName(name);
 		live.setRemark(content);
 		live.setPreviewImgUrl(imgPath);
@@ -84,7 +86,7 @@
 		
 		save(live);
 		
-		//保存直播权限班级
+		//淇濆瓨鐩存挱鏉冮檺鐝骇
 		if(classIds!=null && classIds.size()>0){
 			this.doClearAndAddLiveReClass(live.getVideoLiveId(), classIds.toArray(new String[classIds.size()]));
 		}
@@ -108,7 +110,7 @@
 		
 		save(live);
 		
-		//更新班级课程关联关系
+		//鏇存柊鐝骇璇剧▼鍏宠仈鍏崇郴
 		this.doClearAndAddLiveReClass(live.getVideoLiveId(), classIds!=null?classIds.toArray(new String[classIds.size()]):null);
 		
 		
@@ -118,7 +120,7 @@
 	}
 	
 	/**
-	 * 清理并添加直播权限班级
+	 * 娓呯悊骞舵坊鍔犵洿鎾潈闄愮彮绾�
 	 * @param liveId
 	 * @param classIds
 	 */
@@ -126,7 +128,7 @@
 		List<String>  reIdLst =  this.find("select r.liveReClassId from MediaVideoLiveReClass r where r.liveId=?",
 					CollectionUtils.newList(liveId), String.class);
 
-		//删除关联关系
+		//鍒犻櫎鍏宠仈鍏崇郴
 		if(reIdLst!=null && reIdLst.size()>0){
 			this.bulkUpdateInLoop("delete from MediaVideoLiveReClass  where liveReClassId=?", reIdLst.toArray());  
 		}
@@ -167,13 +169,13 @@
 	@Override
 	public Result doIssue(String liveId) {
 		status(liveId,MediaVideoLive.STATUS_LIVE_ORDER);
-		doSendMsg(liveId,MsgInfo.TYPE_LIVE,"发布了直播");
+		doSendMsg(liveId,MsgInfo.TYPE_LIVE,"鍙戝竷浜嗙洿鎾�");
 		return new Result(true);
 	}
 	
 	private void doSendMsg(String liveId,short type,String msg){
 		MediaVideoLive  liveInfo = this.read(liveId);
-		//查询直播关联的班级
+		//鏌ヨ鐩存挱鍏宠仈鐨勭彮绾�
 		String hql = "select s.userId from MediaVideoLiveReClass m,StuStudent s where m.classId=s.classId and m.liveId=? and m.deleteFlag is false and s.deleteFlag is false";
 		
 		List<String> lstUserIds = this.find(hql, CollectionUtils.newList(liveId),String.class);
@@ -188,7 +190,7 @@
 	
 	@Scheduled(cron = " 0 0/5 * * * ?")
 	protected void doTimer() {
-//		System.out.println("执行直播提醒定时器");
+//		System.out.println("鎵ц鐩存挱鎻愰啋瀹氭椂鍣�");
 		Calendar cal = Calendar.getInstance();
 		cal.add(Calendar.HOUR, 1);
 		Date beginDate = cal.getTime();
@@ -196,13 +198,13 @@
 		cal.add(Calendar.MINUTE, 5);
 		Date endDate = cal.getTime();
 
-		//查询1小时内将开始的直播
+		//鏌ヨ1灏忔椂鍐呭皢寮�濮嬬殑鐩存挱
  		List<MediaVideoLive> lstLives = this.find("from MediaVideoLive where startTime>=? and startTime<? and status=? and deleteFlag is false ", 
  				CollectionUtils.newList(beginDate,endDate,MediaVideoLive.STATUS_LIVE_REVIEW), MediaVideoLive.class);
 		
 		if(lstLives!=null && lstLives.size()>0){
 			for(MediaVideoLive live:lstLives){
-				this.doLiveRemindMsg(live.getVideoLiveId(),MsgInfo.TYPE_REMIND, "直播马上开始了,请做好直播准备");
+				this.doLiveRemindMsg(live.getVideoLiveId(),MsgInfo.TYPE_REMIND, "鐩存挱椹笂寮�濮嬩簡锛岃鍋氬ソ鐩存挱鍑嗗");
 			}
 		}
 	}
@@ -238,7 +240,7 @@
 
 	@Override
 	public Result doStop(String liveId) {
-		//发送生成回放消息
+		//鍙戦�佺敓鎴愬洖鏀炬秷鎭�
 		cacheService.lstRightPush(MediaVideoLivePlayBackService.LIVE_PLAYBACK_LST, liveId);
 		
 		return status(liveId,MediaVideoLive.STATUS_LIVE_DOWNLOAD);
@@ -262,14 +264,14 @@
 	public List<MediaVideoLive> list(String keyword, String [] classIds,String subjectId,Short status,Integer pageNum, Integer pageSize) {
 		StringBuffer hql = new StringBuffer(1000);
 		Map<String,Object> params = new HashMap<String,Object>();
-		hql.append("from MediaVideoLive m left join fetch m.classes c left join fetch m.subject s where m.deleteFlag is false  and m.name like :name ");
+		hql.append("from MediaVideoLive m left join fetch m.classes  c left join fetch m.subject s where m.deleteFlag is false  and m.name like :name ");
 		
 		params.put("name",keyword + "%");
 		
 		if(classIds!=null && classIds.length>0){
-			hql.append(" and (c.classId in(:classIds) or s.type=:subjectType)");
+			hql.append(" and (c.classId in(:classIds) or s.type=:Type)");
 			params.put("classIds", classIds);
-			params.put("subjectType", Subject.TYPE_PUBLIC_SUBJECT);
+			params.put("Type", Subject.TYPE_PUBLIC_SUBJECT);
 		}else{
 			hql.append(" and  s.type=:subjectType");
 			params.put("subjectType", Subject.TYPE_PUBLIC_SUBJECT);

--
Gitblit v1.8.0