From 068fc7f2e81178e55fa191a13709af64b1a163f6 Mon Sep 17 00:00:00 2001 From: EricsHu <hrr145632> Date: 星期一, 05 十二月 2022 14:27:43 +0800 Subject: [PATCH] 处理编码 --- src/main/java/com/qxueyou/scc/school/service/impl/LessonService.java | 146 ++++++++++++++++++++++++------------------------ 1 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/main/java/com/qxueyou/scc/school/service/impl/LessonService.java b/src/main/java/com/qxueyou/scc/school/service/impl/LessonService.java index 0e78001..1606433 100644 --- a/src/main/java/com/qxueyou/scc/school/service/impl/LessonService.java +++ b/src/main/java/com/qxueyou/scc/school/service/impl/LessonService.java @@ -40,9 +40,9 @@ import com.qxueyou.scc.teach.subject.model.SubjectChapter; /** - * 课程服务 + * 璇剧▼鏈嶅姟 * - * @author 德虎 + * @author 寰疯檸 * */ @Service @@ -74,7 +74,7 @@ private static final String OPERATE_TYPE_STOP = "Stop"; /** - * 依赖注入 + * 渚濊禆娉ㄥ叆 * * @param lessonDAO */ @@ -88,31 +88,31 @@ } /** - * 定时发布、停用 + * 瀹氭椂鍙戝竷銆佸仠鐢� */ @Override public Result doVideoIssueStop() { - doVideoIssue(); // 发布未发布的视频 - //doVideoStop(); // 停用已过期的视频 + doVideoIssue(); // 鍙戝竷鏈彂甯冪殑瑙嗛 + //doVideoStop(); // 鍋滅敤宸茶繃鏈熺殑瑙嗛 return new Result(true); } /** - * 定时发布 + * 瀹氭椂鍙戝竷 */ @SuppressWarnings("unused") public Result doVideoIssue() { Date now = new Date(); - // 查询未发布的视频 ---- 只有草稿状态的视频才能发布 + // 鏌ヨ鏈彂甯冪殑瑙嗛 ---- 鍙湁鑽夌鐘舵�佺殑瑙嗛鎵嶈兘鍙戝竷 String hql = "from MediaVideo where deleteFlag is false and status = ? and startTime <= ? and endTime > ? "; List<MediaVideo> mediaLst = this.find(hql, CollectionUtils.newList(MediaVideo.STATUS_DRAFT,now,now), MediaVideo.class); // for (MediaVideo mediaVideo : mediaLst) { -// // 发送消息 发布视频 +// // 鍙戦�佹秷鎭� 鍙戝竷瑙嗛 // sendMsgVideoIssueStop(OPERATE_TYPE_ISSUE, mediaVideo.getVideoId()); // } // @@ -124,12 +124,12 @@ Date now = new Date(); - // 查询已过期的视频 ---- 只有已发布的视频才能停用 + // 鏌ヨ宸茶繃鏈熺殑瑙嗛 ---- 鍙湁宸插彂甯冪殑瑙嗛鎵嶈兘鍋滅敤 String hql = "from MediaVideo where deleteFlag is false and status = ? and endTime <= ?"; List<MediaVideo> mediaLst = this.find(hql, CollectionUtils.newList(MediaVideo.STATUS_PUBLISHED,now), MediaVideo.class); // for (MediaVideo mediaVideo : mediaLst) { -// // 发送消息 停用视频 +// // 鍙戦�佹秷鎭� 鍋滅敤瑙嗛 // sendMsgVideoIssueStop(OPERATE_TYPE_STOP, mediaVideo.getVideoId()); // } return new Result(true); @@ -138,15 +138,15 @@ /** - * 单个处理视频发布与上传 + * 鍗曚釜澶勭悊瑙嗛鍙戝竷涓庝笂浼� */ @SuppressWarnings("unused") @Override public Result doSingleVideoIssueStop(String videoId,String operateType) { MediaVideo video = read(MediaVideo.class, videoId); - if(OPERATE_TYPE_ISSUE.equals(operateType)){ // 发布 - log.info("发布"); + if(OPERATE_TYPE_ISSUE.equals(operateType)){ // 鍙戝竷 + log.info("鍙戝竷"); bulkUpdateInLoop("update MediaVideo set status = " + MediaVideo.STATUS_PUBLISHED + " where videoId = ? " ,new Object[] { videoId }); bulkUpdateInLoop("update SchCourseware set status = " + MediaVideo.STATUS_PUBLISHED + " where id = ? " ,new Object[] { videoId }); @@ -160,8 +160,8 @@ // log.error("Lesson.sendMsg.videoId: " + video.getVideoId(), e); // } - }else if(OPERATE_TYPE_STOP.equals(operateType)){ // 停用 - log.info("停用"); + }else if(OPERATE_TYPE_STOP.equals(operateType)){ // 鍋滅敤 + log.info("鍋滅敤"); bulkUpdateInLoop("update MediaVideo set status = " + MediaVideo.STATUS_TAKEOFF + " where videoId = ? " ,new Object[] { videoId }); } @@ -169,24 +169,24 @@ } /** - * 添加视频 + * 娣诲姞瑙嗛 */ @Override public Result insertVideo(MediaVideo video, String lessonId, boolean isCopy) { this.insertVideoSingle(video, lessonId, isCopy); - // 将数据插入转码队列 + // 灏嗘暟鎹彃鍏ヨ浆鐮侀槦鍒� mediaVideoService.insertVideoConverTask(video); - // 调用本地转码服务 + // 璋冪敤鏈湴杞爜鏈嶅姟 //mediaVideoService.doFfmpegMediaTrascode(video.getVideoId(), video.getName()); return new Result(true, video.getVideoId()); } /** - * 添加视频,不调用转码 + * 娣诲姞瑙嗛锛屼笉璋冪敤杞爜 */ @Override public Result insertVideoSingle(MediaVideo video, String lessonId, boolean isCopy) { @@ -200,12 +200,12 @@ if(isCopy){ video.setStatus(video.getStatus() == MediaVideo.STATUS_PUBLISHED ?MediaVideo.STATUS_DRAFT: video.getStatus()); }else{ - //jgw 暂时直接修改为 + //jgw 鏆傛椂鐩存帴淇敼涓� // video.setStatus(MediaVideo.STATUS_LINEUP); video.setStatus(MediaVideo.STATUS_PUBLISHED); } - // 序号 + // 搴忓彿 String hql = "select MAX(c.videoOrder) from MediaVideo c where c.deleteFlag is false and c.classId = ? "; Integer iMax = this.findUnique(hql, CollectionUtils.newList(ClientUtils.getClassId()), Integer.class); @@ -218,7 +218,7 @@ this.mediaVideoService.saveVideo(video); - // 保存OrgText —— 视频详情 + // 淇濆瓨OrgText 鈥斺�� 瑙嗛璇︽儏 orgTextService.doSaveOrgText(video.getVideoId(), OrgText.TABLE_NAME_VIDEO, video.getRemark()); if(StringUtils.isNotBlank(lessonId)){ @@ -230,7 +230,7 @@ this.save(re); } - //标记班级有视频 + //鏍囪鐝骇鏈夎棰� ClsClass cls = read(ClsClass.class, ClientUtils.getClassId()); if(cls!=null&&cls.getHaveVideo()==ClsClass.NOT_HAVE_VIDEO){ cls.setHaveVideo(ClsClass.HAVE_VIDEO); @@ -241,13 +241,13 @@ } /** - * 批量发布视频 + * 鎵归噺鍙戝竷瑙嗛 */ @Override public Result doStartVideos(String videoIds) { if(StringUtils.isEmpty(videoIds)){ - return new Result(false, "参数错误"); + return new Result(false, "鍙傛暟閿欒"); } String[] ids = videoIds.split(","); boolean resultFlag = false; @@ -258,7 +258,7 @@ } } -// // 发送消息 +// // 鍙戦�佹秷鎭� // ONSMsg msg = new ONSMsg(onsProducer.getTopic()); // msg.put("msgType", "VIDEO_PUBLISH"); // msg.put("videoIds", videoIds); @@ -273,13 +273,13 @@ } /** - * 发布视频 + * 鍙戝竷瑙嗛 */ public Result doStartVideo(String videoId) { MediaVideo video = read(MediaVideo.class, videoId); - if( video.getStatus() == MediaVideo.STATUS_DRAFT || video.getStatus() == MediaVideo.STATUS_TAKEOFF || video.getStatus() == MediaVideo.STATUS_PUBLISHED){ // 草稿、已下架 + if( video.getStatus() == MediaVideo.STATUS_DRAFT || video.getStatus() == MediaVideo.STATUS_TAKEOFF || video.getStatus() == MediaVideo.STATUS_PUBLISHED){ // 鑽夌銆佸凡涓嬫灦 TraceUtils.setUpdateTrace(video); video.setStatus(MediaVideo.STATUS_PUBLISHED); @@ -294,12 +294,12 @@ } /** - * 批量停用视频 + * 鎵归噺鍋滅敤瑙嗛 */ @Override public Result doStopVideos(String videoIds) { if(StringUtils.isEmpty(videoIds)){ - return new Result(false, "参数错误"); + return new Result(false, "鍙傛暟閿欒"); } boolean resultFlag = false; @@ -316,13 +316,13 @@ } /** - * 停用视频 + * 鍋滅敤瑙嗛 */ public Result doStopVideo(String videoId) { MediaVideo video = read(MediaVideo.class, videoId); - if(video.getStatus() == MediaVideo.STATUS_PUBLISHED){ // 已发布 + if(video.getStatus() == MediaVideo.STATUS_PUBLISHED){ // 宸插彂甯� TraceUtils.setUpdateTrace(video); video.setStatus(MediaVideo.STATUS_TAKEOFF); @@ -332,12 +332,12 @@ return new Result(true); }else{ - return new Result(false,"视频已发布状态才能停用视频"); + return new Result(false,"瑙嗛宸插彂甯冪姸鎬佹墠鑳藉仠鐢ㄨ棰�"); } } /** - * 添加视频 + * 娣诲姞瑙嗛 */ @Override public Result insertOrgVideo(MediaVideo video, String collegeCourseId, boolean isCopy) { @@ -361,10 +361,10 @@ video.setOriginVideoId(video.getVideoId()); mediaVideoService.saveVideo(video); - // 保存OrgText —— 视频详情 + // 淇濆瓨OrgText 鈥斺�� 瑙嗛璇︽儏 orgTextService.doSaveOrgText(video.getVideoId(), OrgText.TABLE_NAME_VIDEO, video.getRemark()); - // 序号 + // 搴忓彿 hql = "select MAX(c.videoOrder) from MediaVideoReCourse c where c.deleteFlag is false and c.collegeCourseId = ? "; Integer iMax = this.findUnique(hql, CollectionUtils.newList(collegeCourseId), Integer.class); @@ -384,10 +384,10 @@ save(course); //mediaVideoService.doFfmpegMediaTrascode(video.getVideoId(), video.getName()); - // 将数据插入转码队列 + // 灏嗘暟鎹彃鍏ヨ浆鐮侀槦鍒� mediaVideoService.insertVideoConverTask(video); - // TODO 不自动指定给自己 + // TODO 涓嶈嚜鍔ㄦ寚瀹氱粰鑷繁 // insertAppointSelfOrg(video.getVideoId(), ClientUtils.getOrgId(),collegeCourseId); Result result = new Result(true,video.getVideoId()); result.addData("count", count+1); @@ -396,9 +396,9 @@ public Result insertAppointOrgVideo(String videoIds[], String orgIds[], String classIds[]) { if(videoIds.length == 0){ - return new Result(false,"参数错误"); + return new Result(false,"鍙傛暟閿欒"); } - //预先按videoId和OrgId查询mediavideoreCourse表,需要把当前机构ID也放进lstOrgIds一起查 + //棰勫厛鎸塿ideoId鍜孫rgId鏌ヨmediavideoreCourse琛紝闇�瑕佹妸褰撳墠鏈烘瀯ID涔熸斁杩沴stOrgIds涓�璧锋煡 List<String> lstOrgIds0 = Arrays.asList(orgIds); List<String> lstOrgIds = new ArrayList<String>(); lstOrgIds.addAll(lstOrgIds0); @@ -412,10 +412,10 @@ for (MediaVideoReCourse mediaVideoReCourse : lstMediaCourse) { videoOrgCourseMap.put(mediaVideoReCourse.getVideoId()+mediaVideoReCourse.getOrgId(), mediaVideoReCourse); } - if(orgIds.length!=0){ // 添加管理员视频 + if(orgIds.length!=0){ // 娣诲姞绠$悊鍛樿棰� insertOrgVideo(videoIds,orgIds,videoOrgCourseMap); } - if(classIds.length!=0){ // 添加班级视频 + if(classIds.length!=0){ // 娣诲姞鐝骇瑙嗛 insertClassVideo(videoIds,classIds,ClientUtils.getOrgId(),videoOrgCourseMap); } @@ -462,7 +462,7 @@ Map<String,MediaVideo> videoMap = new HashMap<String, MediaVideo>(); Map<String,MediaVideo> originVideoMap = new HashMap<String, MediaVideo>(); Map<String,SchClassSubject> origSubjectMap = new HashMap<String, SchClassSubject>(); - //章节id + //绔犺妭id List<String> lstCharpteIds = new ArrayList<String>(); Map<String,SubjectChapter> origChapterMap = new HashMap<String, SubjectChapter>(); List<String> keys = new ArrayList<String>(); @@ -478,7 +478,7 @@ } keys.add(mediaVideo.getVideoId()); } - //查询所有originVideoId对应的mediaVideo + //鏌ヨ鎵�鏈塷riginVideoId瀵瑰簲鐨刴ediaVideo hql = " from MediaVideo where originVideoId in (:originVideoIds) and deleteFlag is false and classId in (:classIds)"; args = new HashMap<String, Object>(); args.put("originVideoIds", lstOriginVideoIds.toArray()); @@ -502,7 +502,7 @@ for (String clsId : classIds) { for (String videoId : videoIds) { MediaVideo video = videoMap.get(videoId); - MediaVideo mv = originVideoMap.get(video.getOriginVideoId()+clsId); // 判断当前班级有没有这个视频 + MediaVideo mv = originVideoMap.get(video.getOriginVideoId()+clsId); // 鍒ゆ柇褰撳墠鐝骇鏈夋病鏈夎繖涓棰� if (mv == null) { SchClassSubject clsSubject = origSubjectMap.get(clsId+video.getSubjectId()); mv = new MediaVideo(); @@ -527,16 +527,16 @@ mv.setChapterId(null); } } catch (Exception e) { - log.error("视频下发到班级BeanUtils.copyProperties()方法copy失败", e); + log.error("瑙嗛涓嬪彂鍒扮彮绾eanUtils.copyProperties()鏂规硶copy澶辫触", e); } TraceUtils.setCreateTrace(mv); this.mediaVideoService.saveVideo(mv); - OrgText oldOrgText = (OrgText) orgTextMap.get(video.getVideoId()); // 插入OrgText + OrgText oldOrgText = (OrgText) orgTextMap.get(video.getVideoId()); // 鎻掑叆OrgText orgTextService.doInsertOrgText(mv.getVideoId(), OrgText.TABLE_NAME_VIDEO, oldOrgText != null ? oldOrgText.getContent() : video.getRemark()); } } - //标记班级有视频 + //鏍囪鐝骇鏈夎棰� ClsClass cls = read(ClsClass.class, clsId); if(cls!=null&&cls.getHaveVideo()==ClsClass.NOT_HAVE_VIDEO){ cls.setHaveVideo(ClsClass.HAVE_VIDEO); @@ -548,7 +548,7 @@ @Override public Result deleteVideos(String videoIds) { if(StringUtils.isEmpty(videoIds)){ - return new Result(false, "参数错误"); + return new Result(false, "鍙傛暟閿欒"); } String[] ids = videoIds.split(","); @@ -560,7 +560,7 @@ } } - // 转码记录 + // 杞爜璁板綍 bulkUpdateInLoop("update MediaVideoTrans set deleteFlag = true where videoId = ?", lst.toArray()); this.bulkUpdateInLoop("update SchCourseware set deleteFlag=1 where id=?", lst.toArray()); @@ -595,7 +595,7 @@ if(MediaVideo.STATUS_TAKEOFF == v.getStatus()){ if(null != video.getStartTime() && video.getStartTime().before(new Date()) - && null != video.getEndTime() && !video.getEndTime().before(new Date())){ // video.getStartTime()在new Date()之前返回true,否则返回false + && null != video.getEndTime() && !video.getEndTime().before(new Date())){ // video.getStartTime()鍦╪ew Date()涔嬪墠杩斿洖true锛屽惁鍒欒繑鍥瀎alse v.setStatus(MediaVideo.STATUS_PUBLISHED); } @@ -608,7 +608,7 @@ if(MediaVideo.STATUS_PUBLISHED == v.getStatus()&&null != video.getEndTime() && video.getEndTime().before(new Date()) && null != video.getStartTime() && video.getStartTime().before(new Date())){ - // video.getEndTime()在new Date()之前 + // video.getEndTime()鍦╪ew Date()涔嬪墠 v.setStatus(MediaVideo.STATUS_TAKEOFF); } @@ -624,7 +624,7 @@ v.setTeacherName(video.getTeacherName()); this.mediaVideoService.saveVideo(v); - // 保存OrgText —— 视频详情 + // 淇濆瓨OrgText 鈥斺�� 瑙嗛璇︽儏 orgTextService.doSaveOrgText(v.getVideoId(), OrgText.TABLE_NAME_VIDEO, video.getRemark()); String hql = " from MediaVideo where videoId!=? and deleteFlag is false and originVideoId = ?"; @@ -645,7 +645,7 @@ public Result deleteOrgVideo(String videoId, Integer delAll, String orgIds[], String classIds[]) { if ((orgIds != null && orgIds.length != 0) || (classIds != null && classIds.length != 0)) { - // 删除需要回撤的视频 + // 鍒犻櫎闇�瑕佸洖鎾ょ殑瑙嗛 return deleteAppoint(videoId, orgIds, classIds); } @@ -665,7 +665,7 @@ video.setDeleteFlag(true); this.mediaVideoService.saveVideo(video); }*/ - // 用户选择同时删除下级视频 + // 鐢ㄦ埛閫夋嫨鍚屾椂鍒犻櫎涓嬬骇瑙嗛 if (delAll == 1) { deleteSub(videoId,ClientUtils.getOrgId()); @@ -675,7 +675,7 @@ @SuppressWarnings("unchecked") private void deleteSub(String videoId,String currOrgId) { - // 机构层级视频是没有重新new ,查询出机构下级ID再删关联表 + // 鏈烘瀯灞傜骇瑙嗛鏄病鏈夐噸鏂皀ew 锛屾煡璇㈠嚭鏈烘瀯涓嬬骇ID鍐嶅垹鍏宠仈琛� String sql = " select oa.organization_id from organization as oa,organization ob " + " where " + " ob.ORGANIZATION_ID = ? " + @@ -698,7 +698,7 @@ } MediaVideo video = read(MediaVideo.class, videoId); - // 班主任层面视频指定过后都是new 出来的,通过originVideoId 可以查出所有指定过去的视频 + // 鐝富浠诲眰闈㈣棰戞寚瀹氳繃鍚庨兘鏄痭ew 鍑烘潵鐨勶紝閫氳繃originVideoId 鍙互鏌ュ嚭鎵�鏈夋寚瀹氳繃鍘荤殑瑙嗛 hql = "select classId from ClsClass where orgId in (:orgIds) and deleteFlag is false"; map = new HashMap<String, Object>(); map.put("orgIds", orgIds.toArray()); @@ -720,7 +720,7 @@ } /** - * 删除需要回撤的视频 + * 鍒犻櫎闇�瑕佸洖鎾ょ殑瑙嗛 * * @param videoId * @param orgIds @@ -729,7 +729,7 @@ */ private Result deleteAppoint(String videoId, String orgIds[], String classIds[]) { Map<String, Object> args = new HashMap<String, Object>(); - // 删除需要回撤的机构视频 + // 鍒犻櫎闇�瑕佸洖鎾ょ殑鏈烘瀯瑙嗛 if (orgIds.length != 0) { String hql = " from MediaVideoReCourse where videoId = :videoId and deleteFlag is false and orgId in (:orgIds) and orgId != :currOrgId"; @@ -747,7 +747,7 @@ } } - // 删除需要回撤的班主任视频 + // 鍒犻櫎闇�瑕佸洖鎾ょ殑鐝富浠昏棰� if (classIds.length != 0) { args = new HashMap<String, Object>(); args.put("videoId", videoId); @@ -767,7 +767,7 @@ } /** - * 课程表列表 + * 璇剧▼琛ㄥ垪琛� * * @return */ @@ -807,7 +807,7 @@ } /** - * 根据直播查询讲师 + * 鏍规嵁鐩存挱鏌ヨ璁插笀 * * @param orgTeacherId * @return @@ -817,7 +817,7 @@ } /** - * 分享课程页面的全部课程表 + * 鍒嗕韩璇剧▼椤甸潰鐨勫叏閮ㄨ绋嬭〃 * * @param classId * @return @@ -827,7 +827,7 @@ String hql = " from SchClassSchedule where deleteFlag is false and classId = ? order by startTime"; List<SchClassSchedule> classScheduleLst = find(hql, CollectionUtils.newList(classId), SchClassSchedule.class); - // 组装课表信息内容 + // 缁勮璇捐〃淇℃伅鍐呭 Map<String, Object> nowLesson = new HashMap<String, Object>(5); nowLesson.put("beginWeek", ""); nowLesson.put("lessonCount", classScheduleLst.size()); @@ -835,11 +835,11 @@ nowLesson.put("endTime", cls.getEndTime()); if (!classScheduleLst.isEmpty()) { - // 班级开始时间在课程开始时间之后 + // 鐝骇寮�濮嬫椂闂村湪璇剧▼寮�濮嬫椂闂翠箣鍚� if (cls.getStartTime().compareTo(classScheduleLst.get(0).getStartTime()) > 0) { nowLesson.put("startTime", classScheduleLst.get(0).getStartTime()); } - // 班级结束时间在课程结束时间之前 + // 鐝骇缁撴潫鏃堕棿鍦ㄨ绋嬬粨鏉熸椂闂翠箣鍓� if (cls.getEndTime().compareTo(classScheduleLst.get(classScheduleLst.size() - 1).getEndTime()) < 0) { nowLesson.put("endTime", classScheduleLst.get(classScheduleLst.size() - 1).getEndTime()); } @@ -865,15 +865,15 @@ map.put("teacher", schedule.getTeacher()); map.put("mode", schedule.getMode()); - if (new Date().compareTo(schedule.getEndTime()) > 0) { // 当前时间在结束时间之后 - 已经上过的课 + if (new Date().compareTo(schedule.getEndTime()) > 0) { // 褰撳墠鏃堕棿鍦ㄧ粨鏉熸椂闂翠箣鍚� - 宸茬粡涓婅繃鐨勮 map.put("classStyle", "go-out"); - } else { // 正在上或还没上的课 - if (index == 0) { // 正在上的课 + } else { // 姝e湪涓婃垨杩樻病涓婄殑璇� + if (index == 0) { // 姝e湪涓婄殑璇� map.put("classStyle", "now"); index++; - // 组装课表信息内容 + // 缁勮璇捐〃淇℃伅鍐呭 Calendar cal = Calendar.getInstance(); cal.setTime(schedule.getStartTime()); int begin_week = cal.get(Calendar.DAY_OF_WEEK); @@ -881,7 +881,7 @@ nowLesson.put("beginWeek", str_begin_week); nowLesson.put("beginTime", schedule.getStartTime()); - } else { // 还没上的课 + } else { // 杩樻病涓婄殑璇� map.put("classStyle", "future"); } } @@ -889,7 +889,7 @@ } mv.addObject("nowLesson", nowLesson); mv.addObject("lessons", lstMap); - mv.addObject("mode", newwork>0&&faceToface>0?"线上、线下":newwork>0&&faceToface==0?"线上":"线下"); + mv.addObject("mode", newwork>0&&faceToface>0?"绾夸笂銆佺嚎涓�":newwork>0&&faceToface==0?"绾夸笂":"绾夸笅"); return new Result(true); } } \ No newline at end of file -- Gitblit v1.8.0