hjl
2024-06-21 a9bf1fc6ffb80c2de56e1730595b3abde4910484
ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/service/impl/TUserStudyServiceImpl.java
@@ -50,8 +50,6 @@
        // 游戏难度
        GAME_DIFFICULTY_MAP.put(Constants.ZERO, Constants.ONE);
        GAME_DIFFICULTY_MAP.put(Constants.ONE, Constants.TWO);
        GAME_DIFFICULTY_MAP.put(Constants.TWO, Constants.ZERO);
    }
    @Override
@@ -115,12 +113,20 @@
                userStudyRecord.setAnswer(Constants.ONE_HUNDRED);
                userStudyRecord.setPair(Constants.BURDEN_ONE);
            } else if (Constants.FIVE.equals(type)) {
                userStudyRecord.setPair(Constants.ONE_HUNDRED);
                // type为5并且day为5应该进入游戏日
                Integer nextDay = DAY_MAP.get(String.valueOf(userStudyRecord.getDay()));
                userStudyRecord.setDay(nextDay);
                // type为5并且day为5应该进入游戏日
                if (Constants.FIVE.equals(completeStudy.getDay())) {
                    userStudyRecord.setPair(Constants.ONE_HUNDRED);
                // 游戏难度初始化 0(入门难度)
                userStudyRecord.setGameDifficulty(Constants.ZERO);
                } else {
                    userStudyRecord.setListen(Constants.BURDEN_ONE);
                    userStudyRecord.setLook(Constants.BURDEN_ONE);
                    userStudyRecord.setInduction(Constants.BURDEN_ONE);
                    userStudyRecord.setAnswer(Constants.BURDEN_ONE);
                    userStudyRecord.setPair(Constants.BURDEN_ONE);
                }
                userStudyRecord.setDay(nextDay);
            }
        }
        // 更新学习时长
@@ -160,13 +166,13 @@
            for (int i = 0; i < studyList1.size(); i++) {
                TStudy tStudy = studyList1.get(i);
                if (tStudy.getWeek().equals(userStudy.getWeek())) {
                    if (studyList1.size() == 1 || i + 1 == studyList1.size() - 1) {
                    // 是否为当前季度最后一周目
                    if (i + 1 == studyList1.size() - 1) {
                        List<TStudy> studyList2 = studyMap.get(quarterItem + 1);
                        // 下一季度数据为空
                        if (null != studyList2 && !studyList2.isEmpty()) {
                            TStudy tStudy1 = studyList2.get(Constants.ZERO);
                            tStudy.setWeek(tStudy1.getWeek());
                            userStudy.setWeek(tStudy1.getWeek());
                        }
                    } else {
                        TStudy tStudy1 = studyList1.get(i + 1);
@@ -174,6 +180,13 @@
                    }
                }
            }
            userStudy.setDay(DAY_MAP.get(String.valueOf(userStudy.getDay())));
            userStudy.setLook(Constants.BURDEN_ONE);
            userStudy.setPair(Constants.BURDEN_ONE);
            userStudy.setInduction(Constants.BURDEN_ONE);
            userStudy.setListen(Constants.BURDEN_ONE);
            userStudy.setAnswer(Constants.BURDEN_ONE);
            userStudy.setGameDifficulty(Constants.ZERO);
            this.updateById(userStudy);
        }
    }
@@ -186,7 +199,9 @@
            // 获取用户超级记忆游戏记录
            TUserStudy userStudy = this.lambdaQuery().eq(TUserStudy::getUserId, userid).one();
            // 更新游戏难度学习记录
            if (!Constants.TWO.equals(userStudy.getGameDifficulty())) {
            userStudy.setGameDifficulty(GAME_DIFFICULTY_MAP.get(completeStudy.getDifficulty()));
            }
            this.updateById(userStudy);
        }
    }