代码格式化

This commit is contained in:
none
2023-04-07 10:03:45 +08:00
parent fc8ff14a24
commit f437b3ad4d
252 changed files with 7467 additions and 5770 deletions

View File

@@ -1,14 +1,19 @@
/**
* This file is part of the PlayEdu.
* (c) 杭州白书科技有限公司
*/
package xyz.playedu.api.controller.frontend;
import lombok.SneakyThrows;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.FCtx;
import xyz.playedu.api.domain.Course;
import xyz.playedu.api.domain.CourseHour;
import xyz.playedu.api.domain.UserCourseHourRecord;
import xyz.playedu.api.exception.NotFoundException;
import xyz.playedu.api.service.*;
import xyz.playedu.api.types.JsonResponse;
import xyz.playedu.api.types.paginate.CoursePaginateFiler;
@@ -19,26 +24,22 @@ import java.util.stream.Collectors;
/**
* @Author 杭州白书科技有限公司
*
* @create 2023/3/13 16:25
*/
@RestController
@RequestMapping("/api/v1/course")
public class CourseController {
@Autowired
private CourseService courseService;
@Autowired private CourseService courseService;
@Autowired
private CourseChapterService chapterService;
@Autowired private CourseChapterService chapterService;
@Autowired
private CourseHourService hourService;
@Autowired private CourseHourService hourService;
@Autowired
private UserCourseRecordService userCourseRecordService;
@Autowired private UserCourseRecordService userCourseRecordService;
@Autowired
private UserCourseHourRecordService userCourseHourRecordService;
@Autowired private UserCourseHourRecordService userCourseHourRecordService;
@GetMapping("/index")
public JsonResponse index(@RequestParam HashMap<String, Object> params) {
@@ -63,11 +64,16 @@ public class CourseController {
HashMap<String, Object> data = new HashMap<>();
data.put("course", course);
data.put("chapters", chapterService.getChaptersByCourseId(course.getId()));
data.put("hours", hourService.getHoursByCourseId(course.getId()).stream().collect(Collectors.groupingBy(CourseHour::getChapterId)));
data.put(
"hours",
hourService.getHoursByCourseId(course.getId()).stream()
.collect(Collectors.groupingBy(CourseHour::getChapterId)));
data.put("learn_record", userCourseRecordService.find(FCtx.getId(), course.getId()));
data.put("learn_hour_records", userCourseHourRecordService.getRecords(FCtx.getId(), course.getId()).stream().collect(Collectors.toMap(UserCourseHourRecord::getHourId, e -> e)));
data.put(
"learn_hour_records",
userCourseHourRecordService.getRecords(FCtx.getId(), course.getId()).stream()
.collect(Collectors.toMap(UserCourseHourRecord::getHourId, e -> e)));
return JsonResponse.data(data);
}
}