From 3970ced88b5b456f03fe277c254ca761f05492e0 Mon Sep 17 00:00:00 2001 From: yn147 <2270338776@qq.com> Date: 星期四, 26 十月 2023 14:00:12 +0800 Subject: [PATCH] 直播是否发布门户 --- src/main/java/com/qxueyou/scc/teach/live/service/impl/MediaLiveService.java | 56 +++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 41 insertions(+), 15 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 b095a0e..0c9195f 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,8 @@ import java.util.List; import java.util.Map; +import com.qxueyou.scc.sdk.MTCloud; +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,19 +53,21 @@ @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,String portalStatus) { 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); live.setStartTime(startTime); live.setEndTime(endTime); + live.setPortalStatus(portalStatus); live.setStatus(MediaVideoLive.STATUS_LIVE_DRAFT); if(teacher!=null){ @@ -155,14 +159,19 @@ save(live); return Result.SUCCESS; } - + @Override - public Result delete(String[] liveIds) { + public Result delete(String[] liveIds,String [] courseIds) throws Exception { for(String liveId:liveIds) { delete(liveId); + for(String courseId:courseIds) { + MTCloud client = new MTCloud(); + String s = client.courseDelete(courseId); + } } return Result.SUCCESS; } + @Override public Result doIssue(String liveId) { @@ -262,14 +271,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); @@ -324,13 +333,23 @@ return this.findCountByComplexHql(hql.toString(), params); } - - @Override - public List<MediaVideoLive> listOfMine(String keyword, Integer pageNum, Integer pageSize) { - - String hql = "from MediaVideoLive where deleteFlag is false and name like ? and createId=? order by createTime desc"; - return findList(hql, new Pager(pageSize, pageNum), CollectionUtils.newList(keyword + "%",ClientUtils.getUserId()), MediaVideoLive.class); + @Override + public List<MediaVideoLive> listvideo(String status) { + + String hql = "from MediaVideoLive where deleteFlag is false and status=? order by createTime desc"; + + + return find(hql, CollectionUtils.newList(status), MediaVideoLive.class); + } + + @Override + public List<MediaVideoLive> listOfMine(String keyword,String portalStatus, Integer pageNum, Integer pageSize) { + + String hql = "from MediaVideoLive where deleteFlag is false and name like ? and portalStatus = ? order by createTime desc"; + + + return findList(hql, new Pager(pageSize, pageNum), CollectionUtils.newList(keyword + "%",portalStatus), MediaVideoLive.class); } @Override @@ -345,7 +364,14 @@ public MediaVideoLive read(String liveId) { return read(MediaVideoLive.class,liveId); } - + + @Override + public MediaVideoLive revamp(int courseId) { + String hql = "from MediaVideoLive where deleteFlag is false and courseId=?"; + MediaVideoLive unique = findUnique(hql, CollectionUtils.newList(courseId), MediaVideoLive.class); + return unique ; + } + @SuppressWarnings("unchecked") @Override public List<MediaVideoLive> readByStatus(List<String> liveIdLst,short[] status) { -- Gitblit v1.8.0