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; + } + + }