| | |
| | | package com.ots.project.exam.service.impl; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.ots.common.enums.QuestionTypeEnum; |
| | |
| | | import com.ots.project.tool.exam.JsonUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class ExamPaperQuestionCustomerAnswerServiceImpl extends BaseServiceImpl<ExamPaperQuestionCustomerAnswer> implements ExamPaperQuestionCustomerAnswerService { |
| | | |
| | | @Autowired |
| | | private ExamPaperQuestionCustomerAnswerMapper examPaperQuestionCustomerAnswerMapper; |
| | | |
| | | @Autowired |
| | | private ITTextContentService textContentService; |
| | | |
| | | @Autowired |
| | | public ExamPaperQuestionCustomerAnswerServiceImpl(ExamPaperQuestionCustomerAnswerMapper examPaperQuestionCustomerAnswerMapper, ITTextContentService textContentService) { |
| | | super(examPaperQuestionCustomerAnswerMapper); |
| | | this.examPaperQuestionCustomerAnswerMapper = examPaperQuestionCustomerAnswerMapper; |
| | | this.textContentService = textContentService; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVM requestVM) { |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "id desc").doSelectPageInfo(() -> |
| | | examPaperQuestionCustomerAnswerMapper.studentPage(requestVM) |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public List<ExamPaperQuestionCustomerAnswer> selectListByPaperAnswerId(Integer id) { |
| | | return examPaperQuestionCustomerAnswerMapper.selectListByPaperAnswerId(id); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void insertList(List<ExamPaperQuestionCustomerAnswer> examPaperQuestionCustomerAnswers) { |
| | | examPaperQuestionCustomerAnswerMapper.insertList(examPaperQuestionCustomerAnswers); |
| | | } |
| | | |
| | | @Override |
| | | public ExamPaperSubmitItemVM examPaperQuestionCustomerAnswerToVM(ExamPaperQuestionCustomerAnswer qa) { |
| | | ExamPaperSubmitItemVM examPaperSubmitItemVM = new ExamPaperSubmitItemVM(); |
| | |
| | | setSpecialToVM(examPaperSubmitItemVM, qa); |
| | | return examPaperSubmitItemVM; |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectAllCount() { |
| | | return examPaperQuestionCustomerAnswerMapper.selectAllCount(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> selectMothCount() { |
| | | Date startTime = DateTimeUtil.getMonthStartDay(); |
| | |
| | | return null == keyValue ? 0 : keyValue.getValue(); |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | public int updateScore(List<ExamPaperAnswerUpdate> examPaperAnswerUpdates) { |
| | | return examPaperQuestionCustomerAnswerMapper.updateScore(examPaperAnswerUpdates); |
| | | } |
| | | |
| | | private void setSpecialToVM(ExamPaperSubmitItemVM examPaperSubmitItemVM, ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer) { |
| | | QuestionTypeEnum questionTypeEnum = QuestionTypeEnum.fromCode(examPaperQuestionCustomerAnswer.getQuestionType()); |
| | | switch (questionTypeEnum) { |