mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-23 04:22:43 +08:00
返回已完成线上课的数量字段c
This commit is contained in:
parent
0f62699fd5
commit
e0d80ca127
@ -68,11 +68,8 @@ public class HourController {
|
|||||||
return JsonResponse.error("duration参数错误");
|
return JsonResponse.error("duration参数错误");
|
||||||
}
|
}
|
||||||
User user = FCtx.getUser();
|
User user = FCtx.getUser();
|
||||||
// 线上课检测
|
|
||||||
Course course = courseCache.findOrFail(courseId);
|
Course course = courseCache.findOrFail(courseId);
|
||||||
// 权限校验
|
|
||||||
userCanSeeCourseCache.check(user, course, true);
|
userCanSeeCourseCache.check(user, course, true);
|
||||||
// 课时检测
|
|
||||||
CourseHour hour = hourService.findOrFail(id, courseId);
|
CourseHour hour = hourService.findOrFail(id, courseId);
|
||||||
|
|
||||||
userCourseHourRecordService.storeOrUpdate(user.getId(), course.getId(), hour.getId(), duration, hour.getDuration());
|
userCourseHourRecordService.storeOrUpdate(user.getId(), course.getId(), hour.getId(), duration, hour.getDuration());
|
||||||
|
@ -128,12 +128,14 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
data.put("learn_course_records", learnCourseRecords);
|
data.put("learn_course_records", learnCourseRecords);
|
||||||
|
|
||||||
Integer requiredHourCount = 0;//必修课时
|
int requiredHourCount = 0;//必修课时
|
||||||
Integer nunRequiredHourCount = 0;//选修课时
|
int nunRequiredHourCount = 0;//选修课时
|
||||||
Integer requiredFinishedHourCount = 0;//已完成必修课时
|
int requiredFinishedCourseCount = 0;//已完成必修课
|
||||||
Integer nunRequiredFinishedHourCount = 0;//已完成选修课时
|
int nunRequiredFinishedCourseCount = 0;//已完成选修课
|
||||||
Integer todayLearnDuration = userLearnDurationStatsService.todayUserDuration(FCtx.getId());//今日学习时长
|
int requiredFinishedHourCount = 0;//已完成必修课时
|
||||||
Integer learnDuration = userLearnDurationStatsService.userDuration(FCtx.getId());//学习总时长
|
int nunRequiredFinishedHourCount = 0;//已完成选修课时
|
||||||
|
int todayLearnDuration = userLearnDurationStatsService.todayUserDuration(FCtx.getId());//今日学习时长
|
||||||
|
int learnDuration = userLearnDurationStatsService.userDuration(FCtx.getId());//学习总时长
|
||||||
|
|
||||||
// -------- 学习数据统计 ----------
|
// -------- 学习数据统计 ----------
|
||||||
if (courses.size() > 0) {
|
if (courses.size() > 0) {
|
||||||
@ -149,14 +151,22 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
if (courseItem.getIsRequired() == 1) {
|
if (courseItem.getIsRequired() == 1) {
|
||||||
requiredFinishedHourCount += learnRecord.getFinishedCount();
|
requiredFinishedHourCount += learnRecord.getFinishedCount();
|
||||||
|
if (learnRecord.getIsFinished() == 1) {
|
||||||
|
requiredFinishedCourseCount++;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
nunRequiredFinishedHourCount += learnRecord.getFinishedCount();
|
nunRequiredFinishedHourCount += learnRecord.getFinishedCount();
|
||||||
|
if (learnRecord.getIsFinished() == 1) {
|
||||||
|
nunRequiredFinishedCourseCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HashMap<String, Integer> stats = new HashMap<>();
|
HashMap<String, Integer> stats = new HashMap<>();
|
||||||
stats.put("required_hour_count", requiredHourCount);
|
stats.put("required_hour_count", requiredHourCount);
|
||||||
stats.put("nun_required_hour_count", nunRequiredHourCount);
|
stats.put("nun_required_hour_count", nunRequiredHourCount);
|
||||||
|
stats.put("required_finished_course_count", requiredFinishedCourseCount);
|
||||||
|
stats.put("nun_required_finished_course_count", nunRequiredFinishedCourseCount);
|
||||||
stats.put("required_finished_hour_count", requiredFinishedHourCount);
|
stats.put("required_finished_hour_count", requiredFinishedHourCount);
|
||||||
stats.put("nun_required_finished_hour_count", nunRequiredFinishedHourCount);
|
stats.put("nun_required_finished_hour_count", nunRequiredFinishedHourCount);
|
||||||
stats.put("today_learn_duration", todayLearnDuration);
|
stats.put("today_learn_duration", todayLearnDuration);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user