| | |
| | | if (null == userStudy) { |
| | | userStudy = createUserStudy(userid); |
| | | } |
| | | Integer quarter = exitLearn.getQuarter(); |
| | | Integer week = exitLearn.getWeek(); |
| | | Integer day = exitLearn.getDay(); |
| | | if (userStudy.getWeek().equals(exitLearn.getWeek()) && userStudy.getDay().equals(exitLearn.getDay())) { |
| | | // 计算完成率 |
| | | int completionRate = exitLearn.getTopicIds().split(",").length * 5; |
| | | List<String> teamList = Arrays.stream(exitLearn.getTeamIds().split(",")).collect(Collectors.toList()); |
| | | Integer type = exitLearn.getType(); |
| | | // 更新用户学习完成率 |
| | | if (Constants.ONE.equals(type) && userStudy.getListen() < completionRate) { |
| | | if (Constants.ONE.equals(type)) { |
| | | // 听音选图 |
| | | userStudy.setListen(completionRate); |
| | | } else if (Constants.TWO.equals(type) && userStudy.getLook() < completionRate) { |
| | | List<TStudyListen> studyListens = studyListenService.listenSelectPicture(quarter, week, day); |
| | | int item = 0; |
| | | for (TStudyListen studyListen : studyListens) { |
| | | item += studyListen.getSubject().split(",").length; |
| | | } |
| | | int i = exitLearn.getTopicIds().split(",").length / item; |
| | | if (i > userStudy.getListen()) { |
| | | userStudy.setListen(100 - i); |
| | | } |
| | | } else if (Constants.TWO.equals(type)) { |
| | | // 看图选音 |
| | | userStudy.setLook(completionRate); |
| | | } else if (Constants.THREE.equals(type) && userStudy.getInduction() < completionRate) { |
| | | List<TStudyLook> lookList = studyLookService.pictureSelectVoice(quarter, week, day); |
| | | if (!lookList.isEmpty()) { |
| | | int item = lookList.size(); |
| | | int i = exitLearn.getSchedule() / item; |
| | | if (i > userStudy.getLook()) { |
| | | userStudy.setLook(100 - i); |
| | | } |
| | | } |
| | | } else if (Constants.THREE.equals(type)) { |
| | | // 归纳排除 |
| | | userStudy.setInduction(completionRate); |
| | | } else if (Constants.FOUR.equals(type) && userStudy.getAnswer() < completionRate) { |
| | | List<TStudyInduction> inductionList = studyInductionService.induceExclude(quarter, week, day); |
| | | if (!inductionList.isEmpty()) { |
| | | int item = inductionList.size(); |
| | | int i = exitLearn.getSchedule() / item; |
| | | if (i > userStudy.getInduction()) { |
| | | userStudy.setInduction(100 - i); |
| | | } |
| | | } |
| | | } else if (Constants.FOUR.equals(type)) { |
| | | // 有问有答 |
| | | userStudy.setAnswer(completionRate); |
| | | } else if (Constants.FIVE.equals(type) && userStudy.getPair() < completionRate) { |
| | | List<TStudyAnswer> answerList = studyAnswerService.questionsAndAnswers(quarter, week, day); |
| | | if (answerList.size() % Constants.TWO == Constants.ZERO) { |
| | | int i = exitLearn.getSchedule() / (answerList.size() / 2); |
| | | if (i > userStudy.getAnswer()) { |
| | | userStudy.setAnswer(100 - i); |
| | | } |
| | | } |
| | | } else if (Constants.FIVE.equals(type)) { |
| | | // 音图相配 |
| | | userStudy.setPair(completionRate); |
| | | List<TStudyPair> pairList = studyPairService.pictureMateVoice(quarter, week, day); |
| | | int item = pairList.size(); |
| | | int i = exitLearn.getSchedule() / item; |
| | | if (i > userStudy.getPair()) { |
| | | userStudy.setPair(100 - i); |
| | | } |
| | | } |
| | | } |
| | | // 学习时长更新 |