From 9c417afa127156025810f8637a6eb99f9233469f Mon Sep 17 00:00:00 2001 From: hjl <1657978663@qq.com> Date: 星期四, 18 七月 2024 18:01:32 +0800 Subject: [PATCH] fix: 学习端bug --- ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TStudyController.java | 27 +++++++++++++++++++++++---- 1 files changed, 23 insertions(+), 4 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 32d01c0..dad22e8 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 @@ -1,5 +1,4 @@ package com.ruoyi.study.controller; -import java.util.Date; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -22,7 +21,6 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import org.jetbrains.annotations.TestOnly; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; @@ -86,7 +84,7 @@ private ITUserPresentRecordService userPresentRecordService; @PostMapping("/testAddData") - @ApiOperation(value = "测试分片", tags = {"测试分片"}) + @ApiOperation(value = "测试分片", tags = {"测试分片"}) public R<Object> testAddData() { TIntegralRecord tIntegralRecord = new TIntegralRecord(); tIntegralRecord.setIntegral("1"); @@ -146,6 +144,7 @@ return R.ok(); } + @PostMapping("/storyList") // @ApiOperation(value = "配置学习类型选择故事", tags = {"题目管理"}) public R<PageInfo<TStory>> storyList(@RequestBody ChoiceStory query) { @@ -765,6 +764,22 @@ @ApiOperation(value = "获取正确及错误提示音效", tags = {"学习端-首页"}) public R<TSysSet> promptVoice() { return R.ok(managementClient.promptVoice().getData()); + } + + /** + * 获取当前季度游戏难度 + */ + @GetMapping("/userGameDifficulty") + @ApiOperation(value = "获取当前季度游戏难度", tags = {"学习端-首页"}) + public R<Integer> userGameDifficulty(@RequestParam Integer week) { + LoginUserParent loginStudy = tokenService.getLoginUserStudy(); + if (null == loginStudy) { + return R.tokenError("登录失效!"); + } + Integer userid = loginStudy.getUserid(); + TUserStudy studyRecord = userStudyService.lambdaQuery().eq(TUserStudy::getUserId, userid) + .eq(TUserStudy::getDisabled, 0).one(); + return R.ok(studyService.userGameDifficulty(studyRecord, week)); } /** @@ -1794,6 +1809,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(); @@ -1806,6 +1822,9 @@ int sum = gameRecordList.stream().map(TGameRecord::getUseTime).mapToInt(Integer::intValue).sum(); Integer totalStudy = studyRecord.getTotalStudy(); studyRecord.setTotalStudy(Math.round((float) (totalStudy) / 3600)); + for (TGameRecord tGameRecord : gameRecordList) { + tGameRecord.setTime(simpleDateFormat.format(tGameRecord.getCreateTime())); + } // 剩余周目 List<TStudy> studyList = studyService.lambdaQuery().eq(TStudy::getDisabled, 0) .eq(TStudy::getType, Constants.ONE) @@ -1902,7 +1921,7 @@ @GetMapping("/getIntegral") @ApiOperation(value = "获取剩余积分", tags = {"家长端-获取剩余积分"}) public R<Integer> getIntegral() { - if (tokenService.getLoginUser1() == null){ + if (tokenService.getLoginUser1() == null) { return R.tokenError("登录失效"); } Integer userId = tokenService.getLoginUser1().getUserid(); -- Gitblit v1.7.1