From 05d651ca0168025ec451702f1df88dab4f2a9559 Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期五, 10 五月 2024 17:58:19 +0800 Subject: [PATCH] feat:新增补考按钮 --- src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java | 32 ++++++++++++++++++++++++-------- 1 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java b/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java index 2f54f3a..8db064e 100644 --- a/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java +++ b/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java @@ -1,39 +1,38 @@ package com.mindskip.xzs.service.impl; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.mindskip.xzs.configuration.spring.exception.QuestionException; import com.mindskip.xzs.domain.*; -import com.mindskip.xzs.domain.TextContent; import com.mindskip.xzs.domain.enums.ExamPaperTypeEnum; import com.mindskip.xzs.domain.enums.QuestionTypeEnum; import com.mindskip.xzs.domain.exam.ExamPaperQuestionItemObject; import com.mindskip.xzs.domain.exam.ExamPaperTitleItemObject; import com.mindskip.xzs.domain.other.KeyValue; import com.mindskip.xzs.domain.vo.PaperExcelVO; +import com.mindskip.xzs.repository.ExamPaperAnswerMapper; import com.mindskip.xzs.repository.ExamPaperMapper; import com.mindskip.xzs.repository.QuestionMapper; import com.mindskip.xzs.repository.UserDepartmentMapper; import com.mindskip.xzs.service.*; import com.mindskip.xzs.service.enums.ActionEnum; import com.mindskip.xzs.utility.DateTimeUtil; +import com.mindskip.xzs.utility.ExamUtil; import com.mindskip.xzs.utility.JsonUtil; import com.mindskip.xzs.utility.ModelMapperSingle; -import com.mindskip.xzs.utility.ExamUtil; import com.mindskip.xzs.viewmodel.admin.exam.*; import com.mindskip.xzs.viewmodel.admin.question.ExamQuestionVO; import com.mindskip.xzs.viewmodel.admin.question.QuestionEditRequestVM; import com.mindskip.xzs.viewmodel.student.dashboard.PaperFilter; import com.mindskip.xzs.viewmodel.student.dashboard.PaperInfo; import com.mindskip.xzs.viewmodel.student.exam.ExamPaperPageVM; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.mindskip.xzs.domain.ExamPaper; -import com.mindskip.xzs.domain.Question; -import com.mindskip.xzs.domain.User; +import org.apache.commons.lang3.ObjectUtils; import org.modelmapper.ModelMapper; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; @@ -44,6 +43,7 @@ protected final static ModelMapper modelMapper = ModelMapperSingle.Instance(); private final ExamPaperMapper examPaperMapper; + private final ExamPaperAnswerMapper examPaperAnswerMapper; private final QuestionMapper questionMapper; private final TextContentService textContentService; private final QuestionService questionService; @@ -59,9 +59,10 @@ @Autowired - public ExamPaperServiceImpl(ExamPaperMapper examPaperMapper, QuestionMapper questionMapper, TextContentService textContentService, QuestionService questionService, SubjectService subjectService, ExamPaperDepartmentService examPaperDepartmentService, ExamPaperSubjectService examPaperSubjectService, QuestionSubjectService questionSubjectService, ExamPaperUserService examPaperUserService, UserService userService, UserDepartmentMapper userDepartmentMapper, DepartmentService departmentService) { + public ExamPaperServiceImpl(ExamPaperMapper examPaperMapper, ExamPaperAnswerMapper examPaperAnswerMapper, QuestionMapper questionMapper, TextContentService textContentService, QuestionService questionService, SubjectService subjectService, ExamPaperDepartmentService examPaperDepartmentService, ExamPaperSubjectService examPaperSubjectService, QuestionSubjectService questionSubjectService, ExamPaperUserService examPaperUserService, UserService userService, UserDepartmentMapper userDepartmentMapper, DepartmentService departmentService) { super(examPaperMapper); this.examPaperMapper = examPaperMapper; + this.examPaperAnswerMapper = examPaperAnswerMapper; this.questionMapper = questionMapper; this.textContentService = textContentService; this.questionService = questionService; @@ -599,4 +600,19 @@ return randomNumber; } + + @Override + @Transactional + public void missExam(ExamPaperEditRequestVM model) { + // 淇敼鍘熸潵鐨勮瘯鍗锋椂闂� + if (ObjectUtils.isNotEmpty(model.getLimitDateTime())) { + ExamPaper examPaper = new ExamPaper(); + examPaper.setId(model.getExamPaperId()); + examPaper.setLimitStartTime(DateTimeUtil.parse(model.getLimitDateTime().get(0), DateTimeUtil.STANDER_FORMAT)); + examPaper.setLimitEndTime(DateTimeUtil.parse(model.getLimitDateTime().get(1), DateTimeUtil.STANDER_FORMAT)); + examPaperMapper.updateByPrimaryKeySelective(examPaper); + } + // 鏍规嵁鑰冭瘯id灏嗛�夋嫨鐨勮ˉ鑰冭�冪敓鐨勮�冭瘯鎴愮哗璁剧疆涓烘棤鏁� + examPaperAnswerMapper.setMissExam(model); + } } -- Gitblit v1.8.0