From 4712c04afe2aedeed20ddc5b1a3b0ba66b89cb9b Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期一, 01 七月 2024 17:43:22 +0800 Subject: [PATCH] bug修改 --- ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TStudyController.java | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TStudyController.java b/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TStudyController.java index e5bbfb6..870f4eb 100644 --- a/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TStudyController.java +++ b/ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TStudyController.java @@ -1697,6 +1697,43 @@ studyRecord.setTotalStudy(Math.round((float) (totalStudy + sum) / 3600)); return R.ok(new StudyRecordResultVO(studyRecord, gameRecordList)); } + @PostMapping("/recordManagement/{id}") + @ApiOperation(value = "游戏测试成绩", tags = {"管理后台-查看用户详情"}) + public R<StudyRecordResultVO> recordManagement(@PathVariable("id")Integer id) { + // 学习记录 + TUserStudy studyRecord = userStudyService.lambdaQuery().eq(TUserStudy::getUserId, id) + .eq(TUserStudy::getDisabled, 0).one(); + // 查询剩余周目 + if (studyRecord != null) { + int size = studyService.list(new QueryWrapper<TStudy>() + .eq("type", 1)).size(); + studyRecord.setSurplus(size - studyRecord.getWeek()); + } else { + TUserStudy tUserStudy = new TUserStudy(); + tUserStudy.setSurplus(studyService.list(new QueryWrapper<TStudy>() + .eq("type", 1)).size()); + tUserStudy.setTodayStudy(Constants.ZERO); + tUserStudy.setTotalStudy(Constants.ZERO); + tUserStudy.setWeekStudy(Constants.ZERO); + tUserStudy.setMonthStudy(Constants.ZERO); + studyRecord = tUserStudy; + } + // 学习时长格式转换 + Integer todayStudy = studyRecord.getTodayStudy(); + studyRecord.setTodayStudy(Math.round((float) todayStudy / 3600)); + Integer weekStudy = studyRecord.getWeekStudy(); + studyRecord.setWeekStudy(Math.round((float) weekStudy / 3600)); + Integer monthStudy = studyRecord.getMonthStudy(); + studyRecord.setMonthStudy(Math.round((float) monthStudy / 3600)); + // 总时长还需计算上游戏测试成绩时长 + List<TGameRecord> gameRecordList = gameRecordService.lambdaQuery().eq(TGameRecord::getUserId, id) + .eq(TGameRecord::getDisabled, 0).list(); + int sum = gameRecordList.stream().map(TGameRecord::getUseTime).mapToInt(Integer::intValue).sum(); + Integer totalStudy = studyRecord.getTotalStudy(); + studyRecord.setTotalStudy(Math.round((float) (totalStudy + sum) / 3600)); + StudyRecordResultVO studyRecordResultVO = new StudyRecordResultVO(studyRecord, gameRecordList); + return R.ok(studyRecordResultVO); + } @GetMapping("/getIntegral") @ApiOperation(value = "获取剩余积分", tags = {"家长端-获取剩余积分"}) -- Gitblit v1.7.1