| | |
| | | package com.ruoyi.study.controller; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | 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.*; |
| | |
| | | private ITUserPresentRecordService userPresentRecordService; |
| | | |
| | | @PostMapping("/testAddData") |
| | | @ApiOperation(value = "测试分片", tags = {"测试分片"}) |
| | | @ApiOperation(value = "测试分片", tags = {"测试分片"}) |
| | | public R<Object> testAddData() { |
| | | TIntegralRecord tIntegralRecord = new TIntegralRecord(); |
| | | tIntegralRecord.setIntegral("1"); |
| | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/storyList") |
| | | // @ApiOperation(value = "配置学习类型选择故事", tags = {"题目管理"}) |
| | | public R<PageInfo<TStory>> storyList(@RequestBody ChoiceStory query) { |
| | |
| | | @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)); |
| | | } |
| | | |
| | | /** |
| | |
| | | .eq(TGameRecord::getDisabled, 0) |
| | | .orderByDesc(TGameRecord::getCreateTime) |
| | | .list(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | if (null != studyRecord) { |
| | | // 学习时长格式转换 |
| | | Integer todayStudy = studyRecord.getTodayStudy(); |
| | |
| | | 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) |
| | |
| | | @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(); |