| | |
| | | wrapper.like("type", query.getType()); |
| | | } |
| | | wrapper.eq("state", 1); |
| | | List<TStory> tStories = new ArrayList<>(); |
| | | |
| | | switch (query.getStoryType()) { |
| | | case 2: |
| | | List<TStory> list = storyService.list(wrapper); |
| | | List<TStory> tSubjects = new ArrayList<>(); |
| | | for (TStory tSubject : list) { |
| | | if (!tSubject.getError().isEmpty()) { |
| | | tSubjects.add(tSubject); |
| | | } |
| | | } |
| | | List<TStory> tSubjects = new ArrayList<>(list); |
| | | res.setRecords(tSubjects); |
| | | res.setTotal(tSubjects.size()); |
| | | return R.ok(res); |
| | |
| | | // 查询出error字段不为空的数据 |
| | | wrapper.isNotNull("error"); |
| | | List<TStory> list1 = storyService.list(wrapper); |
| | | res.setRecords(list1); |
| | | res.setTotal(list1.size()); |
| | | for (TStory tStory : list1) { |
| | | if (tStory.getError()!=null && (!tStory.equals(""))){ |
| | | tStories.add(tStory); |
| | | } |
| | | } |
| | | res.setRecords(tStories); |
| | | res.setTotal(tStories.size()); |
| | | return R.ok(res); |
| | | |
| | | } |
| | |
| | | int sum = gameRecordList.stream().map(TGameRecord::getUseTime).mapToInt(Integer::intValue).sum(); |
| | | Integer totalStudy = studyRecord.getTotalStudy(); |
| | | studyRecord.setTotalStudy(Math.round((float) (totalStudy + sum) / 3600)); |
| | | studyRecord = studyService.studySchedule(studyRecord,week); |
| | | } |
| | | return R.ok(studyRecord); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 退出游戏/故事学习 |
| | | */ |
| | | @GetMapping("/exitGameOrStory") |
| | | @ApiOperation(value = "退出游戏/故事学习", tags = {"学习端-题目"}) |
| | | public R<Boolean> exitGameOrStory(@RequestParam Integer studyTime) { |
| | | LoginUserParent loginStudy = tokenService.getLoginUserStudy(); |
| | | if (null == loginStudy) { |
| | | return R.tokenError("登录失效!"); |
| | | } |
| | | Integer userid = loginStudy.getUserid(); |
| | | // 判断当前week和day是否已完成学习 |
| | | TUserStudy userStudy = userStudyService.lambdaQuery().eq(TUserStudy::getUserId, userid) |
| | | .eq(TUserStudy::getDisabled, 0).one(); |
| | | if (null == userStudy) { |
| | | userStudy = createUserStudy(userid); |
| | | } |
| | | // 学习时长更新 |
| | | userStudy.setTotalStudy(userStudy.getTotalStudy() + studyTime); |
| | | userStudy.setTodayStudy(userStudy.getTodayStudy() + studyTime); |
| | | userStudy.setWeekStudy(userStudy.getWeekStudy() + studyTime); |
| | | userStudy.setMonthStudy(userStudy.getMonthStudy() + studyTime); |
| | | return R.ok(userStudyService.updateById(userStudy)); |
| | | } |
| | | |
| | | /** |
| | | * 自主学习1-听音选图 |
| | | * |
| | | * @param week 周目 |