无关风月
2024-07-03 1ab3022a08c32087cbc131fd00e25affacbb5eff
ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TStudyController.java
@@ -26,6 +26,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -1702,6 +1703,7 @@
                .eq(TGameRecord::getDisabled, 0)
                .orderByDesc(TGameRecord::getCreateTime)
                .list();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm");
        if (null != studyRecord) {
            // 学习时长格式转换
            Integer todayStudy = studyRecord.getTodayStudy();
@@ -1712,6 +1714,9 @@
            studyRecord.setMonthStudy(Math.round((float) monthStudy / 3600));
            // 游戏总时长
            int sum = gameRecordList.stream().map(TGameRecord::getUseTime).mapToInt(Integer::intValue).sum();
            for (TGameRecord tGameRecord : gameRecordList) {
                tGameRecord.setTime(simpleDateFormat.format(tGameRecord.getCreateTime()));
            }
            Integer totalStudy = studyRecord.getTotalStudy();
            studyRecord.setTotalStudy(Math.round((float) (totalStudy + sum) / 3600));
            // 剩余周目