From 93af1c6ffb9ae0e894689ad3a37b548e57d54cff Mon Sep 17 00:00:00 2001 From: linzhijie <19970921lzj> Date: 星期四, 11 三月 2021 19:10:07 +0800 Subject: [PATCH] 有注释的测评系统业务代码 --- src/main/java/com/ots/project/exam/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/ots/project/exam/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java b/src/main/java/com/ots/project/exam/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java index b871e0b..80d5ea2 100644 --- a/src/main/java/com/ots/project/exam/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java +++ b/src/main/java/com/ots/project/exam/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java @@ -1,4 +1,5 @@ package com.ots.project.exam.service.impl; + import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.ots.common.enums.QuestionTypeEnum; @@ -16,35 +17,46 @@ 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(); @@ -57,10 +69,12 @@ setSpecialToVM(examPaperSubmitItemVM, qa); return examPaperSubmitItemVM; } + @Override public Integer selectAllCount() { return examPaperQuestionCustomerAnswerMapper.selectAllCount(); } + @Override public List<Integer> selectMothCount() { Date startTime = DateTimeUtil.getMonthStartDay(); @@ -72,10 +86,12 @@ 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) { -- Gitblit v1.9.1