| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | } else { |
| | | result = null; |
| | | } |
| | | subjectRecordService.lambdaUpdate().set(TSubjectRecord::getDisabled, 0) |
| | | .eq(TSubjectRecord::getUserId, loginStudy.getUserid()).update(); |
| | | return R.ok(result); |
| | | } |
| | | |
| | |
| | | */ |
| | | @GetMapping("/exitGameOrStory") |
| | | @ApiOperation(value = "退出游戏/故事学习", tags = {"学习端-题目"}) |
| | | public R<Boolean> exitGameOrStory(@RequestParam Integer studyTime) { |
| | | public R<Boolean> exitGameOrStory(@RequestParam("studyTime") Integer studyTime) { |
| | | LoginUserParent loginStudy = tokenService.getLoginUserStudy(); |
| | | if (null == loginStudy) { |
| | | return R.tokenError("登录失效!"); |
| | |
| | | // 游戏总时长 |
| | | int sum = gameRecordList.stream().map(TGameRecord::getUseTime).mapToInt(Integer::intValue).sum(); |
| | | Integer totalStudy = studyRecord.getTotalStudy(); |
| | | studyRecord.setTotalStudy(Math.round((float) (totalStudy + sum) / 3600)); |
| | | studyRecord.setTotalStudy(Math.round((float) (totalStudy) / 3600)); |
| | | // 剩余周目 |
| | | List<TStudy> studyList = studyService.lambdaQuery().eq(TStudy::getDisabled, 0) |
| | | .eq(TStudy::getType, Constants.ONE) |
| | |
| | | .eq(TGameRecord::getDisabled, 0) |
| | | .orderByDesc(TGameRecord::getCreateTime) |
| | | .list(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | if (null != studyRecord) { |
| | | // 学习时长格式转换 |
| | | Integer todayStudy = studyRecord.getTodayStudy(); |
| | |
| | | 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)); |
| | | // 剩余周目 |
| | |
| | | public R<IPage<TIntegralRecord>> integralDetailParent(String time, |
| | | @RequestParam("pageNum") Integer pageNum, |
| | | @RequestParam("pageSize") Integer pageSize) { |
| | | System.err.println("页码" + pageNum); |
| | | System.err.println("页数" + pageSize); |
| | | if (tokenService.getLoginUser1() == null) { |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | return R.ok(integralRecordService.integralDetail(new Page<>(pageNum, pageSize), tokenService.getLoginUser1().getUserid(), time)); |
| | | IPage<TIntegralRecord> page = integralRecordService.integralDetail(new Page<>(pageNum, pageSize), |
| | | tokenService.getLoginUser1().getUserid(), time); |
| | | for (TIntegralRecord record : page.getRecords()) { |
| | | if (!record.getIntegral().startsWith("-")) { |
| | | record.setIntegral("+" + record.getIntegral()); |
| | | } |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | | /** |