hjl
2024-07-19 c832cae4de3ff53e3b80cad317fbdd84de46c02d
fix: 学习端bug
1个文件已修改
113 ■■■■ 已修改文件
ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TStudyController.java 113 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TStudyController.java
@@ -1011,76 +1011,85 @@
            Integer type = exitLearn.getType();
            // 更新用户学习完成率
            if (Constants.ONE.equals(type)) {
                if (1 == exitLearn.getSchedule()) {
                    userStudy.setListen(Constants.BURDEN_ONE);
                } else {
                    // 听音选图
                    List<TStudyListen> studyListens = studyListenService.listenSelectPicture(quarter, week, day);
                    int item = 0;
                    for (TStudyListen studyListen : studyListens) {
                        item += studyListen.getSubject().split(",").length;
                    }
                    int i = (int) (((double) schedule / item) * 100);
                    if (i > userStudy.getListen()) {
                        userStudy.setListen(i);
                if (userStudy.getListen() != 100) {
                    if (1 == exitLearn.getSchedule()) {
                        userStudy.setListen(Constants.BURDEN_ONE);
                    } else {
                        // 听音选图
                        List<TStudyListen> studyListens = studyListenService.listenSelectPicture(quarter, week, day);
                        int item = 0;
                        for (TStudyListen studyListen : studyListens) {
                            item += studyListen.getSubject().split(",").length;
                        }
                        int i = (int) (((double) schedule / item) * 100);
                        if (i > userStudy.getListen()) {
                            userStudy.setListen(i);
                        }
                    }
                }
            } else if (Constants.TWO.equals(type)) {
                if (1 == exitLearn.getSchedule()) {
                    userStudy.setLook(Constants.BURDEN_ONE);
                } else {
                    // 看图选音
                    List<TStudyLook> lookList = studyLookService.pictureSelectVoice(quarter, week, day);
                    if (!lookList.isEmpty()) {
                        int item = lookList.size();
                        int i = (int) (((double) schedule / item) * 100);
                        if (i > userStudy.getLook()) {
                            userStudy.setLook(i);
                if (userStudy.getLook() != 100) {
                    if (1 == exitLearn.getSchedule()) {
                        userStudy.setLook(Constants.BURDEN_ONE);
                    } else {
                        // 看图选音
                        List<TStudyLook> lookList = studyLookService.pictureSelectVoice(quarter, week, day);
                        if (!lookList.isEmpty()) {
                            int item = lookList.size();
                            int i = (int) (((double) schedule / item) * 100);
                            if (i > userStudy.getLook()) {
                                userStudy.setLook(i);
                            }
                        }
                    }
                }
            } else if (Constants.THREE.equals(type)) {
                if (1 == exitLearn.getSchedule()) {
                    userStudy.setInduction(Constants.BURDEN_ONE);
                } else {
                    // 归纳排除
                    List<TStudyInduction> inductionList = studyInductionService.induceExclude(quarter, week, day);
                    if (!inductionList.isEmpty()) {
                        int item = inductionList.size();
                        int i = (int) (((double) schedule / item) * 100);
                        if (i > userStudy.getInduction()) {
                            userStudy.setInduction(i);
                if (userStudy.getInduction() != 100) {
                    if (1 == exitLearn.getSchedule()) {
                        userStudy.setInduction(Constants.BURDEN_ONE);
                    } else {
                        // 归纳排除
                        List<TStudyInduction> inductionList = studyInductionService.induceExclude(quarter, week, day);
                        if (!inductionList.isEmpty()) {
                            int item = inductionList.size();
                            int i = (int) (((double) schedule / item) * 100);
                            if (i > userStudy.getInduction()) {
                                userStudy.setInduction(i);
                            }
                        }
                    }
                }
            } else if (Constants.FOUR.equals(type)) {
                if (1 == exitLearn.getSchedule()) {
                    userStudy.setAnswer(Constants.BURDEN_ONE);
                } else {
                    // 有问有答
                    List<TStudyAnswer> answerList = studyAnswerService.questionsAndAnswers(quarter, week, day);
                    if (answerList.size() % Constants.TWO == Constants.ZERO) {
                        int i = (int) (((double) schedule / (answerList.size() / 2)) * 100);
                        if (i > userStudy.getAnswer()) {
                            userStudy.setAnswer(i);
                if (userStudy.getAnswer() != 100) {
                    if (1 == exitLearn.getSchedule()) {
                        userStudy.setAnswer(Constants.BURDEN_ONE);
                    } else {
                        // 有问有答
                        List<TStudyAnswer> answerList = studyAnswerService.questionsAndAnswers(quarter, week, day);
                        if (answerList.size() % Constants.TWO == Constants.ZERO) {
                            int i = (int) (((double) schedule / (answerList.size() / 2)) * 100);
                            if (i > userStudy.getAnswer()) {
                                userStudy.setAnswer(i);
                            }
                        }
                    }
                }
            } else if (Constants.FIVE.equals(type)) {
                if (1 == exitLearn.getSchedule()) {
                    userStudy.setPair(Constants.BURDEN_ONE);
                } else {
                    // 音图相配
                    List<TStudyPair> pairList = studyPairService.pictureMateVoice(quarter, week, day);
                    if (!pairList.isEmpty()) {
                        int item = pairList.size();
                        int i = (int) (((double) schedule / item) * 100);
                        if (i > userStudy.getPair()) {
                            userStudy.setPair(i);
                if (userStudy.getPair() != 100) {
                    if (1 == exitLearn.getSchedule()) {
                        userStudy.setPair(Constants.BURDEN_ONE);
                    } else {
                        // 音图相配
                        List<TStudyPair> pairList = studyPairService.pictureMateVoice(quarter, week, day);
                        if (!pairList.isEmpty()) {
                            int item = pairList.size();
                            int i = (int) (((double) schedule / item) * 100);
                            if (i > userStudy.getPair()) {
                                userStudy.setPair(i);
                            }
                        }
                    }
                }
            }
        }
        // 学习时长更新