| | |
| | | |
| | | live.setSubjectId(subjectId); |
| | | live.setSubjectName(subjectName); |
| | | |
| | | live.setCreateId(teacher.getTeacherId()); |
| | | live.setCreateTime(new Date()); |
| | | String uuid = UUIDUtils.UUID(); |
| | | live.setWyLiveNumber(uuid); |
| | | live.setPushUrl(cfg.getRtmpService().concat(uuid)); |
| | |
| | | live.setEndTime(endTime); |
| | | live.setSubjectId(subjectId); |
| | | live.setSubjectName(subjectName); |
| | | |
| | | live.setCreateTime(new Date()); |
| | | save(live); |
| | | |
| | | //更新班级课程关联关系 |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = " 0 0/5 * * * ?") |
| | | protected void doTimer() { |
| | | // System.out.println("执行直播提醒定时器"); |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.add(Calendar.HOUR, 1); |
| | | Date beginDate = cal.getTime(); |
| | | |
| | | cal.add(Calendar.MINUTE, 5); |
| | | Date endDate = cal.getTime(); |
| | | |
| | | //查询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, "直播马上开始了,请做好直播准备"); |
| | | } |
| | | } |
| | | } |
| | | // @Scheduled(cron = " 0 0/5 * * * ?") |
| | | // protected void doTimer() { |
| | | //// System.out.println("执行直播提醒定时器"); |
| | | // Calendar cal = Calendar.getInstance(); |
| | | // cal.add(Calendar.HOUR, 1); |
| | | // Date beginDate = cal.getTime(); |
| | | // |
| | | // cal.add(Calendar.MINUTE, 5); |
| | | // Date endDate = cal.getTime(); |
| | | // |
| | | // //查询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, "直播马上开始了,请做好直播准备"); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | private void doLiveRemindMsg(String liveId,short type,String msg){ |
| | | MediaVideoLive liveInfo = this.read(liveId); |
| | |
| | | |
| | | @Override |
| | | public List<MediaVideoLive> listvideo(String status) { |
| | | |
| | | String hql = "from MediaVideoLive where deleteFlag is false and status=? order by createTime desc"; |
| | | //是否是老师 |
| | | String teacherId = ClientUtils.isAdmin() ? null : teacherService.getTeacherIdByUserId(ClientUtils.getUserId()); |
| | | String hql = "from MediaVideoLive where deleteFlag is false and status=? "; |
| | | List<Object> args =CollectionUtils.newList(status); |
| | | if (StringUtils.isNotBlank(teacherId)) { |
| | | hql.concat(" and createId=?"); |
| | | args.add(teacherId); |
| | | } |
| | | hql.concat(" order by createTime desc"); |
| | | |
| | | |
| | | return find(hql, CollectionUtils.newList(status), MediaVideoLive.class); |
| | | |
| | | return find(hql, args, MediaVideoLive.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<MediaVideoLive> listOfMine(String keyword,String portalStatus, Integer pageNum, Integer pageSize) { |
| | | |
| | | //是否是老师 |
| | | String teacherId = ClientUtils.isAdmin() ? null : teacherService.getTeacherIdByUserId(ClientUtils.getUserId()); |
| | | StringBuffer hql = new StringBuffer("from MediaVideoLive where deleteFlag is false and name like ? "); |
| | | List<Object> args =CollectionUtils.newList(keyword + "%"); |
| | | if(portalStatus != ""){ |
| | | hql.append(" and portalStatus = ?"); |
| | | args.add(portalStatus); |
| | | } |
| | | if (StringUtils.isNotBlank(teacherId)) { |
| | | hql.append(" and createId=?"); |
| | | args.add(teacherId); |
| | | } |
| | | hql.append(" order by createTime desc"); |
| | | return findList(hql.toString(), new Pager(pageSize, pageNum),args , MediaVideoLive.class); |
| | | } |