package com.zhongzheng.controller.bank; import com.zhongzheng.common.annotation.Log; import com.zhongzheng.common.core.controller.BaseController; import com.zhongzheng.common.core.domain.AjaxResult; import com.zhongzheng.common.core.page.TableDataInfo; import com.zhongzheng.common.enums.BusinessType; import com.zhongzheng.common.utils.ServletUtils; import com.zhongzheng.framework.web.service.WxTokenService; import com.zhongzheng.modules.bank.bo.*; import com.zhongzheng.modules.bank.domain.QuestionBusiness; import com.zhongzheng.modules.bank.service.IExamQuestionService; import com.zhongzheng.modules.bank.service.IExamService; import com.zhongzheng.modules.bank.service.IQuestionBusinessService; import com.zhongzheng.modules.bank.service.IQuestionChapterExamService; import com.zhongzheng.modules.bank.vo.ExamQuestionVo; import com.zhongzheng.modules.bank.vo.ExamVo; import com.zhongzheng.modules.user.entity.ClientLoginUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 试卷Controller * * @author hjl * @date 2021-10-22 */ @Api(value = "试卷控制器", tags = {"试卷管理"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/bank/exam") public class ExamController extends BaseController { private final IExamService iExamService; private final IQuestionBusinessService iQuestionBusinessService; private final IExamQuestionService iExamQuestionService; private final IQuestionChapterExamService iQuestionChapterExamService; private final WxTokenService wxTokenService; /** * 获取试卷详细信息 */ @ApiOperation("获取试卷详细信息") @GetMapping("/{examId}") public AjaxResult getInfo(@PathVariable("examId" ) Long examId) { return AjaxResult.success(iExamService.queryById(examId)); } /** * 查询关联试卷列表 */ @ApiOperation("查询章卷关联试卷列表") @GetMapping("/exam/list") public AjaxResult> examList(QuestionChapterExamQueryBo bo) { ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest()); bo.setUserId(loginUser.getUser().getUserId()); List list = iQuestionChapterExamService.getList(bo); return AjaxResult.success(list); } /** * 获取试卷详细信息 */ @ApiOperation("获取本章的下一张试卷") @GetMapping("/nextExam") public AjaxResult getNextExam(QuestionChapterExamQueryBo bo) { return AjaxResult.success(iExamService.getNextExam(bo)); } }