Browse Source

酷乐秀优化

zouxuan 4 months ago
parent
commit
3b224b8174

+ 13 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/HomeServiceImpl.java

@@ -495,7 +495,19 @@ public class HomeServiceImpl implements HomeService {
                 DateUtil.strToDate(studentSearch.getEndTime(), DateUtil.DEFAULT_PATTERN)) + 1;
         studentSearch.setIntervalDays(days);
         //获取学员练习汇总
-        return sysMusicCompareRecordService.getDao().getStudentTrainOverViewList(studentIds,studentSearch);
+        List<TeacherIndexWrapper.StudentPracticeSummaryDto> result = sysMusicCompareRecordService.getDao().getStudentTrainOverViewList(studentIds, studentSearch);
+        if(Objects.nonNull(result)){
+            //格式化练习总时长,(将秒转换为时分秒)
+            for (TeacherIndexWrapper.StudentPracticeSummaryDto dto : result) {
+                if(dto.getTotalPracticeTime() > 0){
+                    dto.setTotalPracticeTimeStr(DateUtil.secondToTime(dto.getTotalPracticeTime()));
+                    if (dto.getAveragePracticeTime() > 0){
+                        dto.setAveragePracticeTimeStr(DateUtil.secondToTime(dto.getAveragePracticeTime()));
+                    }
+                }
+            }
+        }
+        return result;
     }
 
 

+ 8 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TeacherIndexWrapper.java

@@ -127,11 +127,17 @@ public class TeacherIndexWrapper {
         @ApiModelProperty("练习总时长")
         private Long totalPracticeTime;
 
+        @ApiModelProperty("练习总时长(格式化)")
+        private String totalPracticeTimeStr;
+
         @ApiModelProperty("练习天数")
         private Integer practiceDays;
 
         @ApiModelProperty("平均练习时长")
         private Long averagePracticeTime;
+
+        @ApiModelProperty("平均练习时长(格式化)")
+        private String averagePracticeTimeStr;
     }
 
     @Data
@@ -147,13 +153,13 @@ public class TeacherIndexWrapper {
         private String subjectName;
 
         @ExcelProperty(value = "练习总时长",index = 2)
-        private Long totalPracticeTime;
+        private String totalPracticeTimeStr;
 
         @ExcelProperty(value = "练习天数",index = 3)
         private Integer practiceDays;
 
         @ExcelProperty(value = "平均练习时长",index = 4)
-        private Long averagePracticeTime;
+        private String averagePracticeTimeStr;
     }
 
     @Data

+ 10 - 0
toolset/utils/src/main/java/com/yonge/toolset/utils/date/DateUtil.java

@@ -1317,6 +1317,16 @@ public class DateUtil {
 		return yearList;
 	}
 
+	public static String secondToTime(Long totalPracticeTime) {
+		if (totalPracticeTime == null) {
+			return "0秒";
+		}
+		long hour = totalPracticeTime / 3600;
+		long minute = (totalPracticeTime % 3600) / 60;
+		long second = totalPracticeTime % 60;
+		return hour + "小时" + minute + "分钟" + second + "秒";
+	}
+
 	/**
 	 * @describe 时间区段辅助类
 	 * @author Joburgess