| | |
| | | package com.ycl.jxkg.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.jxkg.context.WebContext; |
| | | import com.ycl.jxkg.domain.entity.TextContent; |
| | | import com.ycl.jxkg.domain.enums.ExamPaperTypeEnum; |
| | | import com.ycl.jxkg.enums.ExamPaperTypeEnum; |
| | | import com.ycl.jxkg.domain.exam.ExamPaperQuestionItemObject; |
| | | import com.ycl.jxkg.domain.exam.ExamPaperTitleItemObject; |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.enums.VisibilityEnum; |
| | | import com.ycl.jxkg.mapper.ExamPaperMapper; |
| | | import com.ycl.jxkg.mapper.QuestionMapper; |
| | | import com.ycl.jxkg.service.ExamPaperService; |
| | |
| | | import com.ycl.jxkg.service.enums.ActionEnum; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.utils.JsonUtil; |
| | | import com.ycl.jxkg.utils.ExamUtil; |
| | | import com.ycl.jxkg.domain.vo.admin.exam.ExamPaperEditRequestVO; |
| | | import com.ycl.jxkg.domain.vo.admin.exam.ExamPaperPageRequestVO; |
| | | import com.ycl.jxkg.domain.vo.admin.exam.ExamPaperTitleItemVO; |
| | | import com.ycl.jxkg.domain.vo.admin.question.QuestionEditRequestVO; |
| | | import com.ycl.jxkg.domain.vo.student.dashboard.PaperFilter; |
| | | import com.ycl.jxkg.domain.vo.student.dashboard.PaperInfo; |
| | | import com.ycl.jxkg.domain.vo.student.exam.ExamPaperPageVO; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.ycl.jxkg.domain.entity.ExamPaper; |
| | | import com.ycl.jxkg.domain.entity.Question; |
| | | import com.ycl.jxkg.domain.entity.User; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private final TextContentService textContentService; |
| | | private final QuestionService questionService; |
| | | private final SubjectService subjectService; |
| | | private final WebContext webContext; |
| | | |
| | | |
| | | @Override |
| | |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<ExamPaper> myExamPaper(Integer paperType) { |
| | | Integer userId = webContext.getCurrentUser().getId(); |
| | | List<ExamPaper> list = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .select(ExamPaper::getId, ExamPaper::getName, ExamPaper::getVisibility) |
| | | .eq(ExamPaper::getCreateUser, userId) |
| | | .eq(Objects.nonNull(paperType), ExamPaper::getPaperType, paperType) |
| | | .or() |
| | | .eq(ExamPaper::getVisibility, VisibilityEnum.Public.getName()) |
| | | .eq(Objects.nonNull(paperType), ExamPaper::getPaperType, paperType) |
| | | .list(); |
| | | list.stream().forEach(item -> { |
| | | if (VisibilityEnum.Public.getName().equals(item.getVisibility())) { |
| | | item.setName(item.getName() + " (公开)"); |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | } |