| | |
| | | |
| | | @PostMapping("/subjectList") |
| | | // @ApiOperation(value = "配置学习类型选择题目", tags = {"题目管理"}) |
| | | public R<PageInfo<TSubject>> subjectList(@RequestBody ChoiceSubject query) { |
| | | PageInfo<TSubject> res = new PageInfo<>(query.getPageNumber(), query.getPageSize()); |
| | | QueryWrapper<TSubject> wrapper = new QueryWrapper<>(); |
| | | public R<IPage<TSubject>> subjectList(@RequestBody ChoiceSubject query) { |
| | | // 创建分页对象,传入当前页和每页显示条数 |
| | | IPage<TSubject> page = new Page<>(query.getPageNumber(), query.getPageSize()); QueryWrapper<TSubject> wrapper = new QueryWrapper<>(); |
| | | if (StringUtils.hasLength(query.getName())) { |
| | | wrapper.like("name", query.getName()); |
| | | } |
| | |
| | | } |
| | | List<TCategory> list5 = categoryService.list(); |
| | | wrapper.eq("state", 1); |
| | | List<TSubject> list = subjectService.list(wrapper); |
| | | // 执行分页查询 |
| | | IPage<TSubject> res = subjectService.page(page, wrapper); |
| | | List<TSubject> list = res.getRecords(); |
| | | |
| | | switch (query.getStudyType()) { |
| | | case 1: |
| | |
| | | } |
| | | } |
| | | res.setRecords(list); |
| | | res.setTotal(list.size()); |
| | | return R.ok(res); |
| | | case 2: |
| | | // 查询出error字段不为空的数据 |
| | |
| | | } |
| | | } |
| | | res.setRecords(tSubjects); |
| | | res.setTotal(tSubjects.size()); |
| | | return R.ok(res); |
| | | case 3: |
| | | List<TSubject> list2 = subjectService.list(wrapper); |
| | |
| | | } |
| | | } |
| | | res.setRecords(list2); |
| | | res.setTotal(list2.size()); |
| | | return R.ok(res); |
| | | case 4: |
| | | // 查询出error字段不为空的数据 |
| | |
| | | } |
| | | } |
| | | res.setRecords(tSubjects3); |
| | | res.setTotal(tSubjects3.size()); |
| | | return R.ok(res); |
| | | case 5: |
| | | List<TSubject> list4 = subjectService.list(wrapper); |
| | |
| | | } |
| | | } |
| | | res.setRecords(list4); |
| | | res.setTotal(list4.size()); |
| | | return R.ok(res); |
| | | } |
| | | List<TSubject> objects = new ArrayList<>(); |
| | |
| | | tStudyListen.setWeek(week); |
| | | tStudyListen.setIsVip(studyListenDTO.getIsVip()); |
| | | tStudyListen.setRate(dto.getListenRate()); |
| | | tStudyListen.setStudySort(studyListenDTO.getStudySort()); |
| | | tStudyListen.setType(studyListenDTO.getType()); |
| | | tStudyListen.setSort(studyListenDTO.getSort()); |
| | | studyListenService.save(tStudyListen); |
| | | } |
| | | List<Integer> ids1 = studyLookService.lambdaQuery().eq(TStudyLook::getId, one.getId()) |
| | |
| | | tStudyLook.setWeek(week); |
| | | tStudyLook.setIsVip(studyLookDTO.getIsVip()); |
| | | tStudyLook.setRate(dto.getLookRate()); |
| | | |
| | | tStudyLook.setStudySort(studyLookDTO.getStudySort()); |
| | | studyLookService.save(tStudyLook); |
| | | } |
| | | List<Integer> ids2 = studyInductionService.lambdaQuery().eq(TStudyInduction::getId, one.getId()) |
| | |
| | | tStudyInduction.setIntegral(studyInductionDTO.getIntegral()); |
| | | tStudyInduction.setWeek(week); |
| | | tStudyInduction.setRate(dto.getInductionRate()); |
| | | |
| | | tStudyInduction.setIsVip(studyInductionDTO.getIsVip()); |
| | | tStudyInduction.setStudySort(studyInductionDTO.getStudySort()); |
| | | |
| | | studyInductionService.save(tStudyInduction); |
| | | } |
| | | List<Integer> ids3 = studyAnswerService.lambdaQuery().eq(TStudyAnswer::getId, one.getId()) |
| | |
| | | tStudyAnswer.setWeek(week); |
| | | tStudyAnswer.setRate(dto.getAnswerRate()); |
| | | tStudyAnswer.setIsVip(studyAnswerDTO.getIsVip()); |
| | | tStudyAnswer.setStudySort(studyAnswerDTO.getStudySort()); |
| | | |
| | | |
| | | studyAnswerService.save(tStudyAnswer); |
| | | } |
| | | List<Integer> ids4 = studyPairService.lambdaQuery().eq(TStudyPair::getId, one.getId()) |
| | |
| | | tStudyPair.setWeek(week); |
| | | tStudyPair.setRate(dto.getPairRate()); |
| | | tStudyPair.setIsVip(studyPairDTO.getIsVip()); |
| | | tStudyPair.setStudySort(studyPairDTO.getStudySort()); |
| | | tStudyPair.setSort(studyPairDTO.getSort()); |
| | | studyPairService.save(tStudyPair); |
| | | } |
| | | } |
| | |
| | | // 听音选图 |
| | | List<TStudyListen> list = studyListenService.list(new QueryWrapper<TStudyListen>() |
| | | .eq("week", week) |
| | | .eq("day", day)); |
| | | // studySort 会有重复值,追加 id 升序作为二级排序,保证与提交数组顺序一致 |
| | | .eq("day", day).orderByAsc("studySort").orderByAsc("id")); |
| | | List<TSubject> list9 = subjectService.list(); |
| | | |
| | | for (TStudyListen tStudyListen : list) { |
| | |
| | | for (String s : tStudyListen.getSubject().split(",")) { |
| | | TSubject byId = list9.stream().filter(e -> e.getId().equals(Integer.valueOf(s))).findFirst().orElse(null); |
| | | if (byId != null) { |
| | | temp.append(byId.getName()).append(","); |
| | | temp.append(byId.getName()).append("#"); |
| | | } |
| | | } |
| | | String string = temp.toString(); |
| | |
| | | studyListenVO.setIntegral(tStudyListen.getIntegral()); |
| | | studyListenVO.setSubject(tStudyListen.getSubject()); |
| | | studyListenVO.setIsVip(tStudyListen.getIsVip()); |
| | | studyListenVO.setId(tStudyListen.getId()); |
| | | studyListenVO.setType(tStudyListen.getType()); |
| | | studyListenVO.setSort(tStudyListen.getSort()); |
| | | listenVOS.add(studyListenVO); |
| | | } |
| | | res.setListenRate(tStudyListen.getRate()); |
| | |
| | | // 看音选图 |
| | | List<TStudyLook> list1 = studyLookService.list(new QueryWrapper<TStudyLook>() |
| | | .eq("week", week) |
| | | .eq("day", day) |
| | | .eq("day", day).orderByAsc("studySort").orderByAsc("id") |
| | | ); |
| | | for (TStudyLook tStudyLook : list1) { |
| | | int index = 0; |
| | |
| | | for (String s : tStudyLook.getSubject().split(",")) { |
| | | TSubject byId = list9.stream().filter(e -> e.getId().equals(Integer.valueOf(s))).findFirst().orElse(null); |
| | | if (byId != null) { |
| | | names.append(byId.getName()).append(","); |
| | | names.append(byId.getName()).append("#"); |
| | | } |
| | | String[] split = tStudyLook.getSort().split(","); |
| | | String s1 = split[index]; |
| | |
| | | studyLookVO1.setIntegral(tStudyLook.getIntegral()); |
| | | studyLookVO1.setSubject(tStudyLook.getSubject()); |
| | | studyLookVO1.setIsVip(tStudyLook.getIsVip()); |
| | | studyLookVO1.setId(tStudyLook.getId()); |
| | | |
| | | lookVOS.add(studyLookVO1); |
| | | } |
| | | res.setLookRate(tStudyLook.getRate()); |
| | |
| | | // 归纳排除 |
| | | List<TStudyInduction> list2 = studyInductionService.list(new QueryWrapper<TStudyInduction>() |
| | | .eq("week", week) |
| | | .eq("day", day) |
| | | .eq("day", day).orderByAsc("studySort").orderByAsc("id") |
| | | ); |
| | | for (TStudyInduction tStudyInduction : list2) { |
| | | StringBuilder names = new StringBuilder(); |
| | |
| | | String replace = s.replace("-", ""); |
| | | TSubject byId = list9.stream().filter(e -> e.getId().equals(Integer.valueOf(replace))).findFirst().orElse(null); |
| | | if (byId != null) { |
| | | names.append(byId.getName()).append(","); |
| | | names.append(byId.getName()).append("#"); |
| | | } |
| | | } |
| | | String string = names.toString(); |
| | |
| | | studyInductionVO.setIntegral(tStudyInduction.getIntegral()); |
| | | studyInductionVO.setSubject(tStudyInduction.getSubject()); |
| | | studyInductionVO.setIsVip(tStudyInduction.getIsVip()); |
| | | studyInductionVO.setId(tStudyInduction.getId()); |
| | | |
| | | inductionVOS.add(studyInductionVO); |
| | | } |
| | | res.setInductionRate(tStudyInduction.getRate()); |
| | |
| | | // 有问有答 |
| | | List<TStudyAnswer> list3 = studyAnswerService.list(new QueryWrapper<TStudyAnswer>() |
| | | .eq("week", week) |
| | | .eq("day", day)); |
| | | .eq("day", day).orderByAsc("studySort").orderByAsc("id")); |
| | | for (TStudyAnswer tStudyAnswer : list3) { |
| | | StringBuilder names = new StringBuilder(); |
| | | StudyAnswerVO studyAnswerVO = new StudyAnswerVO(); |
| | |
| | | |
| | | TSubject byId = list9.stream().filter(e -> e.getId().equals(tStudyAnswer.getSubject())).findFirst().orElse(null); |
| | | if (byId != null) { |
| | | names.append(byId.getName()).append(","); |
| | | names.append(byId.getName()).append("#"); |
| | | } |
| | | } |
| | | if (tStudyAnswer.getAnswerSubject() != null) { |
| | | |
| | | TSubject byId1 = list9.stream().filter(e -> e.getId().equals(tStudyAnswer.getAnswerSubject())).findFirst().orElse(null); |
| | | if (byId1 != null) { |
| | | names.append(byId1.getName()).append(","); |
| | | names.append(byId1.getName()).append("#"); |
| | | } |
| | | } |
| | | } else { |
| | | if (tStudyAnswer.getSubject() != null) { |
| | | TSubject byId = list9.stream().filter(e -> e.getId().equals(tStudyAnswer.getSubject())).findFirst().orElse(null); |
| | | if (byId != null) { |
| | | names.append(byId.getName()).append(","); |
| | | names.append(byId.getName()).append("#"); |
| | | } |
| | | } |
| | | if (tStudyAnswer.getAnswerSubject() != null) { |
| | | TSubject byId1 = list9.stream().filter(e -> e.getId().equals(tStudyAnswer.getAnswerSubject())).findFirst().orElse(null); |
| | | if (byId1 != null) { |
| | | names.append(byId1.getName()).append(","); |
| | | names.append(byId1.getName()).append("#"); |
| | | } |
| | | } |
| | | } |
| | |
| | | studyAnswerVO.setIsVip(tStudyAnswer.getIsVip()); |
| | | studyAnswerVO.setIsAnswer(tStudyAnswer.getIsAnswer()); |
| | | studyAnswerVO.setSubject(tStudyAnswer.getSubject() + "," + tStudyAnswer.getAnswerSubject()); |
| | | studyAnswerVO.setId(tStudyAnswer.getId()); |
| | | |
| | | answerVOS.add(studyAnswerVO); |
| | | res.setAnswerRate(tStudyAnswer.getRate()); |
| | | |
| | |
| | | // 音图相配 |
| | | List<TStudyPair> list4 = studyPairService.list(new QueryWrapper<TStudyPair>() |
| | | .eq("week", week) |
| | | .eq("day", day) |
| | | .eq("day", day).orderByAsc("studySort").orderByAsc("id") |
| | | ); |
| | | for (TStudyPair tStudyPair : list4) { |
| | | StringBuilder names = new StringBuilder(); |
| | |
| | | |
| | | TSubject byId = list9.stream().filter(e -> e.getId().equals(Integer.valueOf(s))).findFirst().orElse(null); |
| | | if (byId != null) { |
| | | names.append(byId.getName()).append(","); |
| | | names.append(byId.getName()).append("#"); |
| | | } |
| | | } |
| | | String string = names.toString(); |
| | |
| | | studyPairVO.setIntegral(tStudyPair.getIntegral()); |
| | | studyPairVO.setSubject(tStudyPair.getSubject()); |
| | | studyPairVO.setIsVip(tStudyPair.getIsVip()); |
| | | studyPairVO.setId(tStudyPair.getId()); |
| | | studyPairVO.setSort(tStudyPair.getSort()); |
| | | pairVOS.add(studyPairVO); |
| | | } |
| | | res.setPairRate(tStudyPair.getRate()); |
| | |
| | | for (String s : tStory.getStory().split(",")) { |
| | | TStory byId = list10.stream().filter(e -> e.getId().equals(Integer.valueOf(s))).findFirst().orElse(null); |
| | | if (byId != null) { |
| | | names.append(byId.getName()).append(","); |
| | | names.append(byId.getName()).append("#"); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | TStory byId = list10.stream().filter(e -> e.getId().equals(Integer.valueOf(s))).findFirst().orElse(null); |
| | | if (byId != null) { |
| | | names1.append(byId.getName()).append(","); |
| | | names1.append(byId.getName()).append("#"); |
| | | } |
| | | } |
| | | } |
| | |
| | | // 非会员只能查看非会员题目,会员可以查看所有题目 |
| | | List<TStudyListen> studyListens = studyListenService.listenSelectPicture(quarter, week, day); |
| | | for (TStudyListen studyListen : studyListens) { |
| | | if(studyListen.getType()==null || studyListen.getType()==1){ |
| | | String sort = studyListen.getSort(); |
| | | if(sort!=null){ |
| | | String subject = studyListen.getSubject(); |
| | | String[] split = sort.split(","); |
| | | String[] subjectIds = subject.split(","); |
| | | ArrayList<Map<String, String>> maps = new ArrayList<>(); |
| | | for (int i = 0; i < split.length; i++) { |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sort", split[i]); |
| | | map.put("subject", subjectIds[i]); |
| | | maps.add(map); |
| | | } |
| | | List<Map<String, String>> sort1 = maps.stream().sorted(Comparator.comparingInt(o -> Integer.parseInt(o.get("sort")))).collect(Collectors.toList()); |
| | | ArrayList<String> strings = new ArrayList<>(); |
| | | for (Map<String, String> stringStringMap : sort1) { |
| | | String s = stringStringMap.get("subject"); |
| | | strings.add(s); |
| | | } |
| | | subject = strings.stream().collect(Collectors.joining(",")); |
| | | studyListen.setSubject(subject); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | System.out.println("数据2!!"+studyListens); |
| | | |
| | | for (TStudyListen studyListen : studyListens) { |
| | | if (studyListen.getIsVip() == 0) { |
| | | // 需要会员查看 |
| | | if (!isVip) { |
| | |
| | | Boolean isVip = userService.isVip(); |
| | | // 非会员只能查看非会员题目,会员可以查看所有题目 |
| | | List<TStudyPair> pairList = studyPairService.pictureMateVoice(quarter, week, day); |
| | | |
| | | |
| | | for (TStudyPair pair : pairList) { |
| | | if (pair.getIsVip() == 0) { |
| | | // 需要会员查看 |
| | |
| | | return R.vipError("以下内容仅限会员查看,请通过家长端成为会员!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | String sort = pair.getSort(); |
| | | if(sort!=null){ |
| | | String subject = pair.getSubject(); |
| | | String[] split = sort.split(","); |
| | | String[] subjectIds = subject.split(","); |
| | | ArrayList<Map<String, String>> maps = new ArrayList<>(); |
| | | for (int i = 0; i < split.length; i++) { |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sort", split[i]); |
| | | map.put("subject", subjectIds[i]); |
| | | maps.add(map); |
| | | } |
| | | List<Map<String, String>> sort1 = maps.stream().sorted(Comparator.comparingInt(o -> Integer.parseInt(o.get("sort")))).collect(Collectors.toList()); |
| | | ArrayList<String> strings = new ArrayList<>(); |
| | | for (Map<String, String> stringStringMap : sort1) { |
| | | String s = stringStringMap.get("subject"); |
| | | strings.add(s); |
| | | } |
| | | subject = strings.stream().collect(Collectors.joining(",")); |
| | | pair.setSubject(subject); |
| | | } |
| | | |
| | | } |
| | | return studyService.pictureMateVoice(week, day, pairList, tokenService.getLoginUserStudy().getUserid()); |
| | | } |
| | |
| | | } |
| | | System.err.println("答题DTO"+answerQuestionDTO); |
| | | TSubjectRecordDetail byId = subjectRecordDetailService.getById(answerQuestionDTO.getId()); |
| | | byId.setUserId(null); |
| | | byId.setStatus(answerQuestionDTO.getStatus()); |
| | | subjectRecordDetailService.updateById(byId); |
| | | if(byId.getStatus()==1){ |
| | | byId.setUserId(null); |
| | | byId.setStatus(answerQuestionDTO.getStatus()); |
| | | subjectRecordDetailService.updateById(byId); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | return R.ok(update); |
| | | } |
| | | |
| | | /** |
| | | * 设置题组类型 常规 示例 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @PostMapping("/setStudyType") |
| | | public R<Object> setStudyType(@RequestBody SetStudyTypeDto dto){ |
| | | TStudyListen studyListen = studyListenService.getById(dto.getId()); |
| | | studyListen.setType(dto.getType()); |
| | | studyListen.setSubject(dto.getSubject()); |
| | | return R.ok(studyListenService.updateById(studyListen)); |
| | | |
| | | } |
| | | |
| | | } |
| | | |