mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-22 20:02:42 +08:00
代码格式优化
This commit is contained in:
parent
bb619db3c4
commit
b9cb67d8cd
@ -46,6 +46,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
*
|
||||||
* @create 2023/2/19 10:33
|
* @create 2023/2/19 10:33
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@ -53,20 +54,15 @@ import java.util.stream.Collectors;
|
|||||||
@RequestMapping("/backend/v1/department")
|
@RequestMapping("/backend/v1/department")
|
||||||
public class DepartmentController {
|
public class DepartmentController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired private DepartmentService departmentService;
|
||||||
private DepartmentService departmentService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired private UserService userService;
|
||||||
private UserService userService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired private CourseService courseService;
|
||||||
private CourseService courseService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired private UserCourseRecordService userCourseRecordService;
|
||||||
private UserCourseRecordService userCourseRecordService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired private ApplicationContext ctx;
|
||||||
private ApplicationContext ctx;
|
|
||||||
|
|
||||||
@GetMapping("/index")
|
@GetMapping("/index")
|
||||||
public JsonResponse index() {
|
public JsonResponse index() {
|
||||||
@ -214,16 +210,23 @@ public class DepartmentController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 学员的课程学习进度
|
// 学员的课程学习进度
|
||||||
Map<Integer, List<UserCourseRecord>> userCourseRecords = userCourseRecordService
|
Map<Integer, List<UserCourseRecord>> userCourseRecords =
|
||||||
.chunk(
|
userCourseRecordService
|
||||||
users.getData().stream().map(User::getId).toList(),
|
.chunk(
|
||||||
courses.stream().map(Course::getId).toList())
|
users.getData().stream().map(User::getId).toList(),
|
||||||
.stream()
|
courses.stream().map(Course::getId).toList())
|
||||||
.collect(Collectors.groupingBy(UserCourseRecord::getUserId));
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(UserCourseRecord::getUserId));
|
||||||
Map<Integer, Map<Integer, UserCourseRecord>> userCourseRecordsMap = new HashMap<>();
|
Map<Integer, Map<Integer, UserCourseRecord>> userCourseRecordsMap = new HashMap<>();
|
||||||
userCourseRecords.forEach((userId, records) -> {
|
userCourseRecords.forEach(
|
||||||
userCourseRecordsMap.put(userId, records.stream().collect(Collectors.toMap(UserCourseRecord::getCourseId, e -> e)));
|
(userId, records) -> {
|
||||||
});
|
userCourseRecordsMap.put(
|
||||||
|
userId,
|
||||||
|
records.stream()
|
||||||
|
.collect(
|
||||||
|
Collectors.toMap(
|
||||||
|
UserCourseRecord::getCourseId, e -> e)));
|
||||||
|
});
|
||||||
|
|
||||||
HashMap<String, Object> data = new HashMap<>();
|
HashMap<String, Object> data = new HashMap<>();
|
||||||
data.put("data", users.getData());
|
data.put("data", users.getData());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user