44323
2024-05-22 b45c2583b4764edb95efe9880c4abfddb8a1ec21
ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/controller/TStudyController.java
@@ -352,8 +352,8 @@
                .eq("type", 1));
        studyListVO.setWeeks(count.size());
        // todo 补充开始学习人数
        studyListVO.setCount(0);
        List<TUserStudy> list7 = userStudyService.list(new QueryWrapper<TUserStudy>());
        studyListVO.setCount(list7.size());
        studyListVO.setName("听");
        // 查询听类型有多少周目
        res.add(studyListVO);
@@ -391,6 +391,7 @@
        return R.ok(res);
    }
    /**
     * 通过类型、周目、day查询学习配置
     *
@@ -399,11 +400,19 @@
    @PostMapping("/getStudySet")
    public R<StudyVO> getStudySet(@RequestBody StudyDTO dto) {
        StudyVO res = new StudyVO();
        // todo 开始学习人数后续补充
        res.setCount(0);
        List<TUserStudy> list7 = userStudyService.list(new QueryWrapper<TUserStudy>());
        res.setCount(list7.size());
        // 查询已有周目数量
        int type = studyService.list(new QueryWrapper<TStudy>()
                .eq("type", dto.getType())).size();
        res.setWeeks(type);
        List<TStudy> list8 = studyService.list(new QueryWrapper<TStudy>()
                .eq("type", dto.getType())
                .eq("week", dto.getWeek()));
        if (!list8.isEmpty()){
            res.setQuarter(list8.get(0).getQuarter());
            res.setTitle(list8.get(0).getTitle());
        }
        List<StudyListenVO> listenVOS = new ArrayList<>();
        List<GameVO> gameVOS = new ArrayList<>();
        List<StoryVO> storyVOS = new ArrayList<>();
@@ -535,6 +544,8 @@
                .eq("week", week));
        for (TStoryListen tStory : list6) {
            StoryVO storyVO = new StoryVO();
            storyVO.setStory(tStory.getStory());
            storyVO.setLookStory(tStory.getLookStory());
            StringBuilder names = new StringBuilder();
            StringBuilder names1 = new StringBuilder();
            StringBuilder sort = new StringBuilder();
@@ -556,38 +567,12 @@
            storyVO.setName(names.substring(0, names.length() - 1));
            storyVO.setSort(sort.substring(0, sort.length() - 1));
            storyVO.setIntegral(tStory.getIntegral());
            storyVO.setLookName(names1.substring(0, names.length() - 1));
            storyVO.setLookSort(sort1.substring(0, sort.length() - 1));
            storyVO.setLookName(names1.substring(0, names1.length() - 1));
            storyVO.setLookSort(sort1.substring(0, sort1.length() - 1));
            storyVO.setLookIntegral(tStory.getLookIntegral());
            storyVOS.add(storyVO);
        }
        int temp = 0;
        if (!list.isEmpty()) {
            temp = list.get(0).getStudyId();
        }
        if (!list1.isEmpty()) {
            temp = list1.get(0).getStudyId();
        }
        if (!list2.isEmpty()) {
            temp = list2.get(0).getStudyId();
        }
        if (!list3.isEmpty()) {
            temp = list3.get(0).getStudyId();
        }
        if (!list4.isEmpty()) {
            temp = list4.get(0).getStudyId();
        }
        if (!list5.isEmpty()) {
            temp = list5.get(0).getStudyId();
        }
        if (!list6.isEmpty()) {
            temp = list6.get(0).getStudyId();
        }
        if (temp == 0) {
            res.setTitle("");
        } else {
            res.setTitle(studyService.getById(temp).getTitle());
        }
        res.setAnswer(answerVOS);
        res.setPair(pairVOS);
        res.setListen(listenVOS);