mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 19:06:49 +08:00
提交调整
This commit is contained in:
@@ -10,8 +10,8 @@ public interface IScormFileHandle {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据传入的id获到scorm文件的目录信息
|
* 根据传入的id获到scorm文件的目录信息
|
||||||
* @param id
|
* @param scormId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ScormFile getById(String id);
|
ScormFile getById(String scormId)throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.xboe.module.scorm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程学习回调。
|
||||||
|
* 开始学习时触发回调事件,学习sco完成的回调事件
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IScormStudyCallback {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学习完成回调
|
||||||
|
* @param studyId
|
||||||
|
* @param studyId
|
||||||
|
* @param studyId
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 学习完成回调
|
||||||
|
* @param studyId 初始化时传入的学习id
|
||||||
|
* @param courseId 初始化时传入的课程id
|
||||||
|
* @param contentId 初始化时传入的课程内容id
|
||||||
|
* @param studentId 学生id
|
||||||
|
* @param studentName 学习姓名
|
||||||
|
* @param scormId scorm课程的id
|
||||||
|
* @param scoId sco的id
|
||||||
|
*/
|
||||||
|
void finishCallback(String studyId,String courseId,String contentId,String studentId,String studentName,String scormId,String scoId);
|
||||||
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
package com.xboe.module.scorm;
|
package com.xboe.module.scorm;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -16,6 +14,7 @@ import com.xboe.module.scorm.cam.model.Organization;
|
|||||||
import com.xboe.module.scorm.cam.model.Resource;
|
import com.xboe.module.scorm.cam.model.Resource;
|
||||||
import com.xboe.module.scorm.cam.model.datatype.IDRef;
|
import com.xboe.module.scorm.cam.model.datatype.IDRef;
|
||||||
import com.xboe.module.scorm.data.ScoItem;
|
import com.xboe.module.scorm.data.ScoItem;
|
||||||
|
import com.xboe.module.scorm.data.ScormData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析程序,转化为课程存储的json
|
* 解析程序,转化为课程存储的json
|
||||||
@@ -24,12 +23,12 @@ public class SCORMParser {
|
|||||||
|
|
||||||
public String parserToJson(String path) throws Exception {
|
public String parserToJson(String path) throws Exception {
|
||||||
// System.out.println("test");
|
// System.out.println("test");
|
||||||
Map<String,Object> jsonMap=new HashMap<String,Object>();
|
ContentPackage cp=SCORMPackageManager.getInstance().loadSCORMContentPackageFromZipFile("1", path);
|
||||||
ContentPackage cp=SCORMPackageManager.getInstance().loadSCORMContentPackageFromZipFile("1", path);
|
|
||||||
Manifest manifest= cp.getManifest();
|
Manifest manifest= cp.getManifest();
|
||||||
// System.out.println(cp.getManifest().getIdentifier());
|
// System.out.println(cp.getManifest().getIdentifier());
|
||||||
// System.out.println(cp.getContent());
|
// System.out.println(cp.getContent());
|
||||||
|
|
||||||
|
ScormData data=new ScormData();
|
||||||
List<ScoItem> scoItems=new ArrayList<ScoItem>();
|
List<ScoItem> scoItems=new ArrayList<ScoItem>();
|
||||||
|
|
||||||
// System.out.println("title="+cp.getManifest().getOrganizations().getOrganizationList().get(0).getTitle());
|
// System.out.println("title="+cp.getManifest().getOrganizations().getOrganizationList().get(0).getTitle());
|
||||||
@@ -39,7 +38,7 @@ public class SCORMParser {
|
|||||||
//提取组织菜单
|
//提取组织菜单
|
||||||
IDRef ref = manifest.getOrganizations().getDefaultOrganizationID();
|
IDRef ref = manifest.getOrganizations().getDefaultOrganizationID();
|
||||||
if(ref!=null){
|
if(ref!=null){
|
||||||
jsonMap.put("defaultId", ref.getValue());//如果有多个组织目录,默认是的哪个
|
data.setDefaultId(ref.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Organization> orgList = manifest.getOrganizations().getOrganizationList();
|
List<Organization> orgList = manifest.getOrganizations().getOrganizationList();
|
||||||
@@ -52,7 +51,7 @@ public class SCORMParser {
|
|||||||
ScoItem sco=new ScoItem();
|
ScoItem sco=new ScoItem();
|
||||||
sco.setId(item.getIdentifier().getValue());
|
sco.setId(item.getIdentifier().getValue());
|
||||||
sco.setTitle(item.getTitle());
|
sco.setTitle(item.getTitle());
|
||||||
sco.setScoId(res.getIdentifier().getValue());
|
//sco.setScoId(res.getIdentifier().getValue());
|
||||||
sco.setScoUrl(res.getHref());
|
sco.setScoUrl(res.getHref());
|
||||||
sco.setScoType(res.getScormType());
|
sco.setScoType(res.getScormType());
|
||||||
scoItems.add(sco);
|
scoItems.add(sco);
|
||||||
@@ -67,7 +66,7 @@ public class SCORMParser {
|
|||||||
ScoItem sco=new ScoItem();
|
ScoItem sco=new ScoItem();
|
||||||
sco.setId(item.getIdentifier().getValue());
|
sco.setId(item.getIdentifier().getValue());
|
||||||
sco.setTitle(item.getTitle());
|
sco.setTitle(item.getTitle());
|
||||||
sco.setScoId(res.getIdentifier().getValue());
|
//sco.setScoId(res.getIdentifier().getValue());
|
||||||
sco.setScoUrl(res.getHref());
|
sco.setScoUrl(res.getHref());
|
||||||
sco.setScoType(res.getScormType());
|
sco.setScoType(res.getScormType());
|
||||||
scoItems.add(sco);
|
scoItems.add(sco);
|
||||||
@@ -82,18 +81,18 @@ public class SCORMParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//scorm的版本
|
//scorm的版本
|
||||||
jsonMap.put("schema",manifest.getMetadata().getSchema());
|
data.setSchema(manifest.getMetadata().getSchema());
|
||||||
jsonMap.put("version",manifest.getMetadata().getSchemaVersion());
|
data.setVersion(manifest.getMetadata().getSchemaVersion());
|
||||||
jsonMap.put("items", scoItems);//sco共有多少个
|
data.setScoItems(scoItems);//sco共有多少个
|
||||||
if(scoItems.size()>0 && scoItems.get(0).getScoUrl()!=null) {
|
if(scoItems.size()>0 && scoItems.get(0).getScoUrl()!=null) {
|
||||||
jsonMap.put("index",scoItems.get(0).getScoUrl());//打开播放时进入的第一个sco
|
data.setIndex(scoItems.get(0).getScoUrl());//打开播放时进入的第一个sco
|
||||||
}else {
|
}else {
|
||||||
jsonMap.put("index","");//无首页地址
|
data.setIndex("");//无首页地址
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ObjectMapper om=new ObjectMapper();
|
ObjectMapper om=new ObjectMapper();
|
||||||
String json=om.writeValueAsString(jsonMap);
|
String json=om.writeValueAsString(data);
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ public class ScoItem {
|
|||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
private String scoId;
|
|
||||||
|
|
||||||
private String scoType;
|
private String scoType;
|
||||||
|
|
||||||
private String scoUrl;
|
private String scoUrl;
|
||||||
@@ -36,13 +34,6 @@ public class ScoItem {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getScoId() {
|
|
||||||
return scoId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScoId(String scoId) {
|
|
||||||
this.scoId = scoId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getScoType() {
|
public String getScoType() {
|
||||||
return scoType;
|
return scoType;
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.xboe.module.scorm.data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* scorm数据信息,简化后的,只是记录需要的,其它的不需要
|
||||||
|
* @author seastar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ScormData {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认就是 “ADL SCORM”
|
||||||
|
*/
|
||||||
|
private String schema="ADL SCORM";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对应的 schema version
|
||||||
|
*/
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
private String defaultId;//默认的组织id
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认的页面
|
||||||
|
*/
|
||||||
|
private String index;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对应的学习内容的页面数据
|
||||||
|
*/
|
||||||
|
private List<ScoItem> scoItems;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -20,5 +20,9 @@ public class ScormFile {
|
|||||||
*/
|
*/
|
||||||
private String zipName;
|
private String zipName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* scorm的数据
|
||||||
|
*/
|
||||||
|
private ScormData data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user