123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- package com.ruoyi.sim.controller;
- import java.util.List;
- import javax.servlet.http.HttpServletResponse;
- import com.ruoyi.sim.service.impl.RealExamService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import com.ruoyi.common.annotation.Log;
- import com.ruoyi.common.core.controller.BaseController;
- import com.ruoyi.common.core.domain.AjaxResult;
- import com.ruoyi.common.enums.BusinessType;
- import com.ruoyi.sim.domain.RealExam;
- import com.ruoyi.common.utils.poi.ExcelUtil;
- import com.ruoyi.common.core.page.TableDataInfo;
- /**
- * 考试Controller
- *
- * @author tom
- * @date 2024-12-15
- */
- @RestController
- @RequestMapping("/sim/real-exam")
- @Api("考试Controller")
- public class RealExamController extends BaseController {
- @Autowired
- private RealExamService realExamService;
- /**
- * 查询考试列表
- */
- // @GetMapping("/teacher/list")
- // @ApiOperation("[老师]查询学生考试列表")
- public TableDataInfo list(RealExam realExam) {
- startPage();
- List<RealExam> list = realExamService.selectRealExamList(realExam);
- return getDataTable(list);
- }
- @GetMapping("/student/exam/listByUserId/{userId}")
- @ApiOperation("[学生]查询userId学生考试列表")
- public TableDataInfo listByUserId(@PathVariable("userId") Long userId) {
- // todo:
- RealExam q = new RealExam();
- q.setUserId(userId);
- startPage();
- List<RealExam> list = realExamService.selectRealExamList(q);
- // todo:
- return getDataTable(list);
- }
- @GetMapping("/student/exam/enter/{examId}")
- @ApiOperation("[学生]进入考试")
- public AjaxResult studentEnterRealExam(@PathVariable("examId") Long examId) {
- return realExamService.studentEnterRealExam(examId);
- }
- @GetMapping("/student/exam/prepare/{examId}")
- @ApiOperation("[轮询][学生]准备考试界面")
- public AjaxResult studentLoopPrepareRealExam(@PathVariable("examId") Long examId) {
- return realExamService.studentLoopPrepareRealExam(examId);
- }
- @GetMapping("/student/exam/start/{examId}")
- @ApiOperation("[学生]开始考试")
- public AjaxResult studentStartRealExam(@PathVariable("examId") Long examId) {
- return realExamService.studentStartRealExam(examId);
- }
- @GetMapping("/student/exam/answering/{examId}")
- @ApiOperation("[轮询][学生]正在考试界面")
- public AjaxResult studentLoopAnsweringRealExam(@PathVariable("examId") Long examId) {
- return realExamService.studentLoopAnsweringRealExam(examId);
- }
- @GetMapping("/student/exam/submit/{examId}")
- @ApiOperation("[学生]交卷")
- public AjaxResult studentSubmitRealExam(@PathVariable("examId") Long examId) {
- return realExamService.studentSubmitRealExam(examId);
- }
- @GetMapping("/student/exam/report/{examId}")
- @ApiOperation("[轮询][学生]结束考试界面")
- public AjaxResult studentLoopPostRealExam(@PathVariable("examId") Long examId) {
- return realExamService.studentLoopPostRealExam(examId);
- }
- // @GetMapping(value = "/student/{examId}")
- // @ApiOperation("[学生][轮询]获取考试详细信息")
- public AjaxResult getInfoStudent(@PathVariable("examId") Long examId) {
- return success(realExamService.selectRealExamByExamId(examId));
- }
- // @PreAuthorize("@ss.hasPermi('sim:real-exam:query')")
- // @GetMapping(value = "/teacher/{examId}")
- // @ApiOperation("[老师]获取考试详细信息")
- public AjaxResult getInfoTeacher(@PathVariable("examId") Long examId) {
- return success(realExamService.selectRealExamByExamId(examId));
- }
- /**
- * 新增考试
- */
- // @PreAuthorize("@ss.hasPermi('sim:real-exam:add')")
- @Log(title = "考试", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody RealExam realExam) {
- return toAjax(realExamService.insertRealExam(realExam));
- }
- /**
- * 修改考试
- */
- // @PreAuthorize("@ss.hasPermi('sim:real-exam:edit')")
- @Log(title = "考试", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody RealExam realExam) {
- return toAjax(realExamService.updateRealExam(realExam));
- }
- /**
- * 删除考试
- */
- // @PreAuthorize("@ss.hasPermi('sim:real-exam:remove')")
- @Log(title = "考试", businessType = BusinessType.DELETE)
- // @DeleteMapping("/{examIds}")
- public AjaxResult remove(@PathVariable Long[] examIds) {
- return toAjax(realExamService.deleteRealExamByExamIds(examIds));
- }
- }
|