| | |
| | | @ApiImplicitParam(value = "季度 首次进入季度quarter默认传1", name = "quarter", dataType = "Integer", required = true) |
| | | }) |
| | | public R<List<StudyWeekDTO>> weekList(@RequestParam(defaultValue = "1") Integer type, @RequestParam Integer quarter) { |
| | | List<StudyWeekDTO> result = studyService.weekList(type, quarter); |
| | | LoginUserParent loginUserStudy = tokenService.getLoginUserStudy(); |
| | | if (null == loginUserStudy) { |
| | | return R.tokenError("登录失效!"); |
| | | } |
| | | List<StudyWeekDTO> result = studyService.weekList(type, quarter,loginUserStudy.getUserid()); |
| | | return R.ok(result); |
| | | } |
| | | |
| | |
| | | Integer day = exitLearn.getDay(); |
| | | if (userStudy.getWeek().equals(exitLearn.getWeek()) && userStudy.getDay().equals(exitLearn.getDay())) { |
| | | // 计算完成率 |
| | | List<String> teamList = Arrays.stream(exitLearn.getTeamIds().split(",")).collect(Collectors.toList()); |
| | | Integer type = exitLearn.getType(); |
| | | // 更新用户学习完成率 |
| | | if (Constants.ONE.equals(type)) { |
| | |
| | | for (TStudyListen studyListen : studyListens) { |
| | | item += studyListen.getSubject().split(",").length; |
| | | } |
| | | int i = exitLearn.getTopicIds().split(",").length / item; |
| | | int i = (int) ((double) (exitLearn.getTopicIds().split(",").length / item) * 100); |
| | | if (i > userStudy.getListen()) { |
| | | userStudy.setListen(100 - i); |
| | | } |
| | |
| | | List<TStudyLook> lookList = studyLookService.pictureSelectVoice(quarter, week, day); |
| | | if (!lookList.isEmpty()) { |
| | | int item = lookList.size(); |
| | | int i = exitLearn.getSchedule() / item; |
| | | int i = (int) ((double) (exitLearn.getSchedule() / item)) * 100; |
| | | if (i > userStudy.getLook()) { |
| | | userStudy.setLook(100 - i); |
| | | } |
| | |
| | | List<TStudyInduction> inductionList = studyInductionService.induceExclude(quarter, week, day); |
| | | if (!inductionList.isEmpty()) { |
| | | int item = inductionList.size(); |
| | | int i = exitLearn.getSchedule() / item; |
| | | int i = (int) ((double) (exitLearn.getSchedule() / item)) * 100; |
| | | if (i > userStudy.getInduction()) { |
| | | userStudy.setInduction(100 - i); |
| | | } |
| | |
| | | // 有问有答 |
| | | List<TStudyAnswer> answerList = studyAnswerService.questionsAndAnswers(quarter, week, day); |
| | | if (answerList.size() % Constants.TWO == Constants.ZERO) { |
| | | int i = exitLearn.getSchedule() / (answerList.size() / 2); |
| | | int i = (int) ((double) (exitLearn.getSchedule() / (answerList.size() / 2))) * 100; |
| | | if (i > userStudy.getAnswer()) { |
| | | userStudy.setAnswer(100 - i); |
| | | } |
| | |
| | | // 音图相配 |
| | | List<TStudyPair> pairList = studyPairService.pictureMateVoice(quarter, week, day); |
| | | int item = pairList.size(); |
| | | int i = exitLearn.getSchedule() / item; |
| | | int i = (int) ((double) (exitLearn.getSchedule() / item)) * 100; |
| | | if (i > userStudy.getPair()) { |
| | | userStudy.setPair(100 - i); |
| | | } |
| | |
| | | // 非会员只能查看非会员题目,会员可以查看所有题目 |
| | | List<TStudyListen> studyListens = studyListenService.listenSelectPicture(quarter, week, day); |
| | | for (TStudyListen studyListen : studyListens) { |
| | | if (studyListen.getIsVip() == 1) { |
| | | if (studyListen.getIsVip() == 0) { |
| | | // 需要会员查看 |
| | | if (!isVip) { |
| | | // 不是会员 |
| | |
| | | // 非会员只能查看非会员题目,会员可以查看所有题目 |
| | | List<TStudyLook> lookList = studyLookService.pictureSelectVoice(quarter, week, day); |
| | | for (TStudyLook studyListen : lookList) { |
| | | if (studyListen.getIsVip() == 1) { |
| | | if (studyListen.getIsVip() == 0) { |
| | | // 需要会员查看 |
| | | if (!isVip) { |
| | | // 不是会员 |
| | |
| | | // 非会员只能查看非会员题目,会员可以查看所有题目 |
| | | List<TStudyInduction> inductionList = studyInductionService.induceExclude(quarter, week, day); |
| | | for (TStudyInduction studyListen : inductionList) { |
| | | if (studyListen.getIsVip() == 1) { |
| | | if (studyListen.getIsVip() == 0) { |
| | | // 需要会员查看 |
| | | if (!isVip) { |
| | | // 不是会员 |
| | |
| | | // 非会员只能查看非会员题目,会员可以查看所有题目 |
| | | List<TStudyAnswer> answerList = studyAnswerService.questionsAndAnswers(quarter, week, day); |
| | | for (TStudyAnswer studyListen : answerList) { |
| | | if (studyListen.getIsVip() == 1) { |
| | | if (studyListen.getIsVip() == 0) { |
| | | // 需要会员查看 |
| | | if (!isVip) { |
| | | // 不是会员 |
| | |
| | | // 非会员只能查看非会员题目,会员可以查看所有题目 |
| | | List<TStudyPair> pairList = studyPairService.pictureMateVoice(quarter, week, day); |
| | | for (TStudyPair pair : pairList) { |
| | | if (pair.getIsVip() == 1) { |
| | | if (pair.getIsVip() == 0) { |
| | | // 需要会员查看 |
| | | if (!isVip) { |
| | | // 不是会员 |
| | |
| | | user.setIntegral(user.getIntegral() + availableIntegral); |
| | | add = add && userService.updateById(user); |
| | | } |
| | | // 学习时长更新 |
| | | TUserStudy userStudy = userStudyService.lambdaQuery().eq(TUserStudy::getUserId, userid) |
| | | .eq(TUserStudy::getDisabled, 0).one(); |
| | | if (null == userStudy) { |
| | | userStudy = createUserStudy(userid); |
| | | userStudy.setTotalStudy(userStudy.getTotalStudy() + completeStudy.getUseTime()); |
| | | userStudy.setTodayStudy(userStudy.getTodayStudy() + completeStudy.getUseTime()); |
| | | userStudy.setWeekStudy(userStudy.getWeekStudy() + completeStudy.getUseTime()); |
| | | userStudy.setMonthStudy(userStudy.getMonthStudy() + completeStudy.getUseTime()); |
| | | } |
| | | boolean update = userStudyService.updateById(userStudy); |
| | | // 超级记忆逻辑 |
| | | if (Constants.MEMORY.equals(completeStudy.getGameName())) { |
| | | // 学习配置列表 |
| | |
| | | String rate = game.getRate().split(",")[completeStudy.getDifficulty()]; |
| | | add = add && completeStudy.getAccuracy() >= Integer.parseInt(rate); |
| | | } |
| | | // 学习时长更新 |
| | | TUserStudy userStudy = userStudyService.lambdaQuery().eq(TUserStudy::getUserId, userid) |
| | | .eq(TUserStudy::getDisabled, 0).one(); |
| | | if (null == userStudy) { |
| | | userStudy = createUserStudy(userid); |
| | | userStudy.setTotalStudy(userStudy.getTotalStudy() + completeStudy.getUseTime()); |
| | | userStudy.setTodayStudy(userStudy.getTodayStudy() + completeStudy.getUseTime()); |
| | | userStudy.setWeekStudy(userStudy.getWeekStudy() + completeStudy.getUseTime()); |
| | | userStudy.setMonthStudy(userStudy.getMonthStudy() + completeStudy.getUseTime()); |
| | | } |
| | | boolean update = userStudyService.updateById(userStudy); |
| | | return R.ok(add && update); |
| | | } |
| | | |