mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-23 12:32:41 +08:00
优化代码
This commit is contained in:
parent
54a15b59a5
commit
51db585796
@ -398,7 +398,7 @@ public class UserController {
|
||||
.map(UserCourseHourRecord::getHourId)
|
||||
.toList())
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(CourseHour::getId)));
|
||||
.collect(Collectors.toMap(CourseHour::getId, e -> e)));
|
||||
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
@ -450,11 +450,11 @@ public class UserController {
|
||||
|
||||
List<UserLearnDurationStats> monthRecords =
|
||||
userLearnDurationStatsService.dateBetween(id, startDateStr, todayStr);
|
||||
Map<Date, Long> date2duration =
|
||||
Map<String, Long> date2duration =
|
||||
monthRecords.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
UserLearnDurationStats::getCreatedDate,
|
||||
e -> DateTime.of(e.getCreatedDate()).toDateStr(),
|
||||
UserLearnDurationStats::getDuration));
|
||||
|
||||
@Data
|
||||
@ -467,11 +467,10 @@ public class UserController {
|
||||
|
||||
while (startTime <= endTime) {
|
||||
String dateKey = DateTime.of(startTime).toDateStr();
|
||||
Date tmpDate = new Date(startTime);
|
||||
|
||||
Long duration = 0L;
|
||||
if (date2duration.get(tmpDate) != null) {
|
||||
duration = date2duration.get(tmpDate);
|
||||
if (date2duration.get(dateKey) != null) {
|
||||
duration = date2duration.get(dateKey);
|
||||
}
|
||||
|
||||
StatsItem tmpItem = new StatsItem();
|
||||
|
Loading…
x
Reference in New Issue
Block a user