From ee4181f1eb453579d39e66193c0b2b2ee22dfd9a Mon Sep 17 00:00:00 2001 From: wangxy <1356089412@qq.com> Date: Fri, 5 Jul 2024 14:31:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/web/controller/exam/PaperController.java | 10 ++++++++++ .../ruoyi/web/controller/manager/PaperManager.java | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/PaperController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/PaperController.java index bf05fe4..ec298e5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/PaperController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/PaperController.java @@ -109,6 +109,16 @@ public class PaperController extends BaseController { } + @ApiOperation("检测进行中的考试") + @GetMapping("/checkProcess") + @ResponseBody + public AjaxResult checkProcess() { + return AjaxResult.success(paperManager.checkProcess(getUserId())); + } + + + + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/PaperManager.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/PaperManager.java index f998490..2a1364c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/PaperManager.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/PaperManager.java @@ -15,6 +15,7 @@ import com.ruoyi.system.domain.exam.enums.ExamState; import com.ruoyi.system.domain.paper.ElPaper; import com.ruoyi.system.domain.paper.ElPaperQu; import com.ruoyi.system.domain.paper.ElPaperQuAnswer; +import com.ruoyi.system.domain.paper.dto.PaperDTO; import com.ruoyi.system.domain.paper.dto.PaperQuDTO; import com.ruoyi.system.domain.paper.dto.ext.PaperQuAnswerExtDTO; import com.ruoyi.system.domain.paper.dto.ext.PaperQuDetailDTO; @@ -495,5 +496,18 @@ public class PaperManager { } + public PaperDTO checkProcess(Long userId) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.lambda() + .eq(ElPaper::getUserId, userId) + .eq(ElPaper::getState, PaperState.ING); + ElPaper paper = paperService.getOne(wrapper, false); + if (Objects.nonNull(paper)) { + return Convert.convert(PaperDTO.class, paper); + } + return null; + } + + }