ExamController.java 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package com.zhongzheng.controller.bank;
  2. import com.zhongzheng.common.annotation.Log;
  3. import com.zhongzheng.common.core.controller.BaseController;
  4. import com.zhongzheng.common.core.domain.AjaxResult;
  5. import com.zhongzheng.common.core.page.TableDataInfo;
  6. import com.zhongzheng.common.enums.BusinessType;
  7. import com.zhongzheng.common.utils.ServletUtils;
  8. import com.zhongzheng.framework.web.service.WxTokenService;
  9. import com.zhongzheng.modules.bank.bo.*;
  10. import com.zhongzheng.modules.bank.domain.QuestionBusiness;
  11. import com.zhongzheng.modules.bank.service.IExamQuestionService;
  12. import com.zhongzheng.modules.bank.service.IExamService;
  13. import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
  14. import com.zhongzheng.modules.bank.service.IQuestionChapterExamService;
  15. import com.zhongzheng.modules.bank.vo.ExamQuestionVo;
  16. import com.zhongzheng.modules.bank.vo.ExamVo;
  17. import com.zhongzheng.modules.user.entity.ClientLoginUser;
  18. import io.swagger.annotations.Api;
  19. import io.swagger.annotations.ApiOperation;
  20. import lombok.RequiredArgsConstructor;
  21. import org.springframework.beans.factory.annotation.Autowired;
  22. import org.springframework.security.access.prepost.PreAuthorize;
  23. import org.springframework.web.bind.annotation.*;
  24. import java.util.List;
  25. /**
  26. * 试卷Controller
  27. *
  28. * @author hjl
  29. * @date 2021-10-22
  30. */
  31. @Api(value = "试卷控制器", tags = {"试卷管理"})
  32. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  33. @RestController
  34. @RequestMapping("/bank/exam")
  35. public class ExamController extends BaseController {
  36. private final IExamService iExamService;
  37. private final IQuestionBusinessService iQuestionBusinessService;
  38. private final IExamQuestionService iExamQuestionService;
  39. private final IQuestionChapterExamService iQuestionChapterExamService;
  40. private final WxTokenService wxTokenService;
  41. /**
  42. * 获取试卷详细信息
  43. */
  44. @ApiOperation("获取试卷详细信息")
  45. @GetMapping("/{examId}")
  46. public AjaxResult<ExamVo> getInfo(@PathVariable("examId" ) Long examId) {
  47. return AjaxResult.success(iExamService.queryById(examId));
  48. }
  49. /**
  50. * 查询关联试卷列表
  51. */
  52. @ApiOperation("查询章卷关联试卷列表")
  53. @GetMapping("/exam/list")
  54. public AjaxResult<List<ExamVo>> examList(QuestionChapterExamQueryBo bo) {
  55. ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
  56. bo.setUserId(loginUser.getUser().getUserId());
  57. List<ExamVo> list = iQuestionChapterExamService.getList(bo);
  58. return AjaxResult.success(list);
  59. }
  60. /**
  61. * 获取试卷详细信息
  62. */
  63. @ApiOperation("获取本章的下一张试卷")
  64. @GetMapping("/nextExam")
  65. public AjaxResult<ExamVo> getNextExam(QuestionChapterExamQueryBo bo) {
  66. return AjaxResult.success(iExamService.getNextExam(bo));
  67. }
  68. }