mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 03:46:50 +08:00
优化在线课时长添加
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user