diff --git a/servers/boe-server-all/src/main/java/com/xboe/module/course/api/CourseFileApi.java b/servers/boe-server-all/src/main/java/com/xboe/module/course/api/CourseFileApi.java index a31a84e4..f59fd1d1 100644 --- a/servers/boe-server-all/src/main/java/com/xboe/module/course/api/CourseFileApi.java +++ b/servers/boe-server-all/src/main/java/com/xboe/module/course/api/CourseFileApi.java @@ -238,20 +238,27 @@ public class CourseFileApi extends ApiBaseController { file.setDeleted(false); file.setDown(true);//默认允许下载 + file.setDuration(0); if (file.getResType() == null) { if ("mp4".indexOf(file.getFileType()) > -1) { file.setResType(10);//以后换成变量 } else if ("jpg,png,gif".indexOf(file.getFileType()) > -1) { file.setResType(30);//以后换成变量 - file.setDuration(file.getDuration()*60); + if (file.getDuration()!=null){ + file.setDuration(file.getDuration()*60); + } } else if ("mp3,wmv".indexOf(file.getFileType()) > -1) { file.setResType(20);//以后换成变量 } else if ("doc,xls,ppt,docx,xlsx,pptx".indexOf(file.getFileType()) > -1) { file.setResType(40);//以后换成变量 - file.setDuration(file.getDuration()*60); + if (file.getDuration()!=null){ + file.setDuration(file.getDuration()*60); + } }else if(file.getFileType().equalsIgnoreCase("zip")) { file.setResType(BoedxCourseFileType.Scrom.getValue());//scorm课件 - file.setDuration(file.getDuration()*60); + if (file.getDuration()!=null){ + file.setDuration(file.getDuration()*60); + } } else { file.setResType(90);//以后换成变量 } @@ -290,17 +297,23 @@ public class CourseFileApi extends ApiBaseController { if(file.getFileType().equalsIgnoreCase("pdf")) { file.setPreviewFilePath(file.getFilePath()); - file.setDuration(file.getDuration()*60); + if (file.getDuration()!=null){ + file.setDuration(file.getDuration()*60); + } file.setConverStatus(0);//代表不需要转化 }else if ("doc,xls,ppt,docx,xlsx,pptx".indexOf(file.getFileType().toLowerCase()) > -1) { file.setConverStatus(1);//转化中 - file.setDuration(file.getDuration()*60); + if (file.getDuration()!=null){ + file.setDuration(file.getDuration()*60); + } }else if(file.getFileType().equalsIgnoreCase("zip")) { //scorm包的内容 try { SCORMParser scormParser=new SCORMParser(); String json = scormParser.parserToJson(fileFullPath); - file.setDuration(file.getDuration()*60); + if (file.getDuration()!=null){ + file.setDuration(file.getDuration()*60); + } file.setContent(json); }catch (Exception e) { log.error("上传的非scorm课件的zip文件", e);