mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 11:26:50 +08:00
提交scorm的中增加的修改内容
This commit is contained in:
@@ -200,34 +200,6 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
return success(rs);
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 检查是否有相应的课程学习
|
||||
// * @param cid
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value="/has",method = {RequestMethod.GET,RequestMethod.POST})
|
||||
// public JsonResponse<Map<String,Object>> has(String cid){
|
||||
// if(StringUtils.isBlank(cid)){
|
||||
// return error("无课程信息");
|
||||
// }
|
||||
// String aid=getCurrent().getAccountId();
|
||||
// StudyCourse sc=service.findByCourseIdAndAid(cid, aid);
|
||||
//
|
||||
// Map<String,Object> rs=new HashMap<String,Object>();
|
||||
// if(sc==null) {
|
||||
// //查询是否已报名,自主报名直接通过,所以此查询主要针对于报名待审核的
|
||||
// rs.put("signup",false);
|
||||
// }else {
|
||||
// rs.put("signup",true);
|
||||
// rs.put("studyId", sc.getId());//学习id
|
||||
// //查询上次学习的是什么资源。查询用户的学习情况
|
||||
// List<StudyCourseItem> items=studyService.findByStudyId(sc.getId());
|
||||
// rs.put("contents",items);
|
||||
// }
|
||||
// return success(rs);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 在打开课程详细页面的时候,调用此接口,返回学习课程信息,上次学习的位置。<br/>
|
||||
* 如果没有就返回空<br>
|
||||
@@ -318,6 +290,60 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 学习完成一项课程内容,针对于所有课程内容,不只是音视频,还有scorm及其它的内容
|
||||
* @param sci
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/study-content-finish")
|
||||
public JsonResponse<String> studyContentFinish(@RequestBody StudyContentDto sci){
|
||||
|
||||
if(StringUtils.isBlank(sci.getStudyId())){
|
||||
return error("参数错误");
|
||||
}
|
||||
if(StringUtils.isBlank(sci.getContentId())){
|
||||
return error("参数错误:内容");
|
||||
}
|
||||
LocalDateTime now=LocalDateTime.now();
|
||||
CurrentUser cuser=getCurrent();
|
||||
|
||||
//下面的学习时长应该去掉了,不需要
|
||||
StudyTime st=new StudyTime();
|
||||
st.setContentId(sci.getContentId());
|
||||
st.setCourseId(sci.getCourseId());
|
||||
st.setDuration(5);//增加5秒的学习时长
|
||||
st.setEndTime(now);
|
||||
st.setStartTime(now);
|
||||
st.setStudentId(cuser.getAccountId());
|
||||
st.setStudentName(cuser.getName());
|
||||
st.setStudyId(sci.getStudyId());
|
||||
|
||||
//检查是否已存在
|
||||
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
||||
if(item!=null) {
|
||||
//如果记录存在,但是进度不到100,未完成情况,就更新进度,一期不会有这种情况
|
||||
if(item.getProgress()<100 && sci.getProgress()>item.getProgress()) {
|
||||
studyService.updateProcess(item.getId(),sci.getStudyId(),sci.getCourseId(), sci.getContentTotal(),sci.getProgress());
|
||||
}
|
||||
//追加学习时长
|
||||
studyService.appendStudyDuration(st);
|
||||
return success(item.getId());
|
||||
}
|
||||
|
||||
try {
|
||||
sci.setAid(cuser.getAccountId());
|
||||
sci.setAname(cuser.getName());
|
||||
studyService.saveStudyInfo(sci);
|
||||
//学习记录成功后处理
|
||||
studyService.appendStudyDuration(st);
|
||||
return success(sci.getStudyItemId());
|
||||
}catch(Exception e) {
|
||||
log.error("记录学习课程内容完成错误",e);
|
||||
return error("记录学习课程内容完成失败",e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 音视频学习保存,初始化保存学习记录.
|
||||
* 如果已经保存,就不要再保存第二次了,前端注意控制
|
||||
|
||||
Reference in New Issue
Block a user