| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.exception.GlobalException; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.study.domain.*; |
| | | import com.ruoyi.study.dto.StudyWeekDTO; |
| | | import com.ruoyi.study.mapper.TStudyMapper; |
| | |
| | | for (TStudyInduction data : inductionList) { |
| | | List<String> subjectIds = Arrays.stream(data.getSubject().split(",")).collect(Collectors.toList()); |
| | | List<TSubject> subjectLists = new ArrayList<>(); |
| | | for (String id : subjectIds) { |
| | | if (id.startsWith("-")) { |
| | | id = id.replace("-", ""); |
| | | } |
| | | // 第一组题 固定下标为0,1,2的题 |
| | | for (int i = 0; i < Constants.THREE; i++) { |
| | | String id = subjectIds.get(i); |
| | | if (!id.startsWith("-")) { |
| | | subjectLists.add(subjectService.getById(id)); |
| | | } |
| | | } |
| | | for (int i = 0; i < Constants.THREE; i++) { |
| | | String id = subjectIds.get(i); |
| | | if (id.startsWith("-")) { |
| | | id = id.replace("-",""); |
| | | subjectLists.add(subjectService.getById(id)); |
| | | } |
| | | } |
| | | // 第二组题,固定下标为3,4的题 |
| | | for (int i = Constants.THREE; i < Constants.FIVE; i++) { |
| | | String id = subjectIds.get(i); |
| | | if (!id.startsWith("-")) { |
| | | subjectLists.add(subjectService.getById(id)); |
| | | } |
| | | } |
| | | for (int i = Constants.THREE; i < Constants.FIVE; i++) { |
| | | String id = subjectIds.get(i); |
| | | if (id.startsWith("-")) { |
| | | id = id.replace("-",""); |
| | | subjectLists.add(subjectService.getById(id)); |
| | | } |
| | | } |
| | | subjectLists.add(subjectService.getById(subjectIds.get(subjectIds.size() - 1).replace("-",""))); |
| | | subjectList.add(subjectLists); |
| | | } |
| | | return new StudyInductionResultVO(learnStudy, subjectList); |
| | |
| | | QuestionsAnswersSubjectVO oneVO = new QuestionsAnswersSubjectVO(); |
| | | TSubject one1 = subjectService.lambdaQuery().eq(TSubject::getId, subject) |
| | | .eq(TSubject::getDisabled, 0).one(); |
| | | BeanUtils.copyProperties(one1, oneVO); |
| | | copyProperties(one1, oneVO); |
| | | // 回答题目信息 |
| | | QuestionsAnswersSubjectVO twoVO = new QuestionsAnswersSubjectVO(); |
| | | TSubject two1 = subjectService.lambdaQuery().eq(TSubject::getId, answerSubject) |
| | | .eq(TSubject::getDisabled, 0).one(); |
| | | BeanUtils.copyProperties(two1, twoVO); |
| | | copyProperties(two1, twoVO); |
| | | // 判断第一组题目的问题题目及回答题目,哪个是答案 |
| | | if (Constants.ZERO.equals(one.getIsAnswer())) { |
| | | oneVO.setIsQuestion(0); |
| | |
| | | voList.add(twoVO); |
| | | } |
| | | |
| | | private void copyProperties(TSubject subject, QuestionsAnswersSubjectVO vo) { |
| | | vo.setId(subject.getId()); |
| | | vo.setName(subject.getName()); |
| | | vo.setEnglish(subject.getEnglish()); |
| | | vo.setType(subject.getType()); |
| | | vo.setState(subject.getState()); |
| | | vo.setImg(subject.getImg()); |
| | | vo.setCorrect(subject.getCorrect()); |
| | | vo.setError(subject.getError()); |
| | | vo.setSort(subject.getSort()); |
| | | } |
| | | |
| | | @Override |
| | | public StudyPairResultVO pictureMateVoice(Integer week, Integer day, List<TStudyPair> pair) { |
| | | if (pair.isEmpty()) { |