|
|
@@ -90,19 +90,21 @@ public class CourseStudentBurialpointController {
|
|
|
String userId =StpLoginUserUtil.getLoginUser().getId();
|
|
|
courseStudentBurialpoint.setUserId(userId);
|
|
|
//进度不能覆盖,查询该学生该课程上一次的学习进度,如果本次进度不大于最高的进度,就只存最高的进度
|
|
|
- param.put("userId", userId);
|
|
|
- param.put("hourId", courseStudentBurialpoint.getHourId());
|
|
|
- param.put("funcType", courseStudentBurialpoint.getFuncType());
|
|
|
- param.put("type", courseStudentBurialpoint.getType());
|
|
|
- List<CourseStudentBurialpoint> alreadyList= courseStudentBurialpointService.wrapperList(param);
|
|
|
- List<String> alreadyProgressList=CollStreamUtil.toList(alreadyList, CourseStudentBurialpoint::getProgress);
|
|
|
- //将String转为Long
|
|
|
- List<Long> alreadyProgressLongList=alreadyProgressList.stream().map(Long::parseLong).collect(Collectors.toList());
|
|
|
- //取出最大的进度
|
|
|
- Long maxProgress=alreadyProgressLongList.stream().max(Long::compareTo).orElse(0L);
|
|
|
- if(Long.valueOf(courseStudentProgressAddParam.getProgress()).longValue()<maxProgress.longValue())
|
|
|
- courseStudentBurialpoint.setProgress(String.valueOf(maxProgress));
|
|
|
-
|
|
|
+ if("1".equals(courseStudentBurialpoint.getType())){
|
|
|
+ param.put("userId", userId);
|
|
|
+ param.put("hourId", courseStudentBurialpoint.getHourId());
|
|
|
+ param.put("funcType", courseStudentBurialpoint.getFuncType());
|
|
|
+ param.put("type", courseStudentBurialpoint.getType());
|
|
|
+ List<CourseStudentBurialpoint> alreadyList= courseStudentBurialpointService.wrapperList(param);
|
|
|
+ List<String> alreadyProgressList=CollStreamUtil.toList(alreadyList, CourseStudentBurialpoint::getProgress);
|
|
|
+ //将String转为Long
|
|
|
+ List<Long> alreadyProgressLongList=alreadyProgressList.stream().map(Long::parseLong).collect(Collectors.toList());
|
|
|
+ //取出最大的进度
|
|
|
+ Long maxProgress=alreadyProgressLongList.stream().max(Long::compareTo).orElse(0L);
|
|
|
+ if(Long.valueOf(courseStudentProgressAddParam.getProgress()).longValue()<maxProgress.longValue()){
|
|
|
+ courseStudentBurialpoint.setProgress(String.valueOf(maxProgress));
|
|
|
+ }
|
|
|
+ }
|
|
|
courseStudentBurialpointService.addOne(courseStudentBurialpoint);
|
|
|
return CommonResult.ok();
|
|
|
}
|