mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 03:16:48 +08:00
查询课程和修改课程学习上报进度,增加视频播放进度的处理
This commit is contained in:
@@ -264,8 +264,10 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
Map<String, CourseContent> contentMap = cclist.stream().collect(Collectors.toMap(CourseContent::getId, Function.identity()));
|
||||
for (StudyCourseItem item : items) {
|
||||
CourseContent content = contentMap.get(item.getContentId());
|
||||
if(item.getContentId().equals(content.getId())){
|
||||
// 计算学习进度item.getLastStudyTime() /content.getDuration()
|
||||
if(null == content){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(null==item.getLastStudyTime()
|
||||
|| item.getLastStudyTime()<=0
|
||||
|| null==content.getDuration()
|
||||
@@ -276,7 +278,6 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
BigDecimal lastStudyTime = new BigDecimal(item.getLastStudyTime());
|
||||
BigDecimal duration = new BigDecimal(content.getDuration());
|
||||
BigDecimal progress = lastStudyTime.divide(duration, 10, RoundingMode.HALF_UP);
|
||||
// 如果progress<0则为0,如果progress>1则为1
|
||||
if(progress.compareTo(BigDecimal.ZERO) < 0){
|
||||
progress = BigDecimal.ZERO;
|
||||
}else if(progress.compareTo(BigDecimal.ONE) > 0){
|
||||
@@ -286,7 +287,6 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
item.setProgressVideo(progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rs.put("contentStudys",items);//学习的内容
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user