From 51db585796260ffc5298e6a4be6eebb490a62e8f Mon Sep 17 00:00:00 2001 From: none Date: Wed, 19 Apr 2023 10:56:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/backend/UserController.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/xyz/playedu/api/controller/backend/UserController.java b/src/main/java/xyz/playedu/api/controller/backend/UserController.java index e241ff4..6c9608b 100644 --- a/src/main/java/xyz/playedu/api/controller/backend/UserController.java +++ b/src/main/java/xyz/playedu/api/controller/backend/UserController.java @@ -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 monthRecords = userLearnDurationStatsService.dateBetween(id, startDateStr, todayStr); - Map date2duration = + Map 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();