| | |
| | | package org.springblade.modules.exam.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.dispatcher.entity.Dispatcher; |
| | | import org.springblade.modules.exam.entity.ExamSubjectChoices; |
| | | import org.springblade.modules.exam.excel.ExamScoreExcel; |
| | | import org.springblade.modules.exam.excel.ExamScoreImporter; |
| | | import org.springblade.modules.exam.excel.ExamSubjectExcel; |
| | | import org.springblade.modules.exam.excel.ExamSubjectImporter; |
| | | import org.springblade.modules.exam.service.ExamSubjectChoicesService; |
| | | import org.springblade.modules.exam.vo.ExamSubjectChoicesVO; |
| | | import org.springblade.modules.jurisdiction.entity.Jurisdiction; |
| | | import org.springblade.modules.jurisdiction.vo.JurisdictionVO; |
| | | import org.springblade.modules.jurisdiction.wrapper.JurisdictionWrapper; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhongrj |
| | |
| | | @ApiOperation(value = "新增", notes = "传入examSubjectChoices") |
| | | public R save(@RequestBody ExamSubjectChoices examSubjectChoices) { |
| | | return R.status(examSubjectChoicesService.save(examSubjectChoices)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增题目及选项信息 |
| | | * |
| | | * @param examSubjectChoices 题目信息对象 |
| | | */ |
| | | @PostMapping("/saveSubjectChoicesAndOption") |
| | | @ApiOperation(value = "新增", notes = "传入examSubjectChoices") |
| | | public R saveSubjectChoicesAndOption(@RequestBody ExamSubjectChoicesVO examSubjectChoices) { |
| | | return R.status(examSubjectChoicesService.saveSubjectChoicesAndOption(examSubjectChoices)); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取下一题的题目,并判断上一题的答案,且返回上一题答题结果 |
| | | * |
| | | * @param examSubjectChoices 选择题信息对象 |
| | | */ |
| | | @GetMapping("/getSubjectResultInfo") |
| | | @ApiOperation(value = "详情", notes = "传入examSubjectChoices") |
| | | public R<ExamSubjectChoicesVO> getSubjectResultInfo(ExamSubjectChoicesVO examSubjectChoices) { |
| | | //查询下一题题目详情 |
| | | ExamSubjectChoicesVO detail = examSubjectChoicesService.selectExamSubjectChoicesInfo(examSubjectChoices); |
| | | //判断当前题目的答题结果 |
| | | if (examSubjectChoices.getPreSubJectId()!=null) { |
| | | if (null!=examSubjectChoices.getPreResult() && examSubjectChoices.getPreResult()!="" && !examSubjectChoices.getPreResult().equals("")) { |
| | | detail.setResult(examSubjectChoicesService.getAnswerResult(examSubjectChoices.getPreSubJectId(), examSubjectChoices.getPreResult())); |
| | | }else { |
| | | //无 |
| | | detail.setResult(3); |
| | | } |
| | | } |
| | | //返回 |
| | | return R.data(detail); |
| | | } |
| | | |
| | | /** |
| | | * 查询试卷包含的题目 |
| | | */ |
| | | @GetMapping("/getEexPaperChoices") |
| | |
| | | return R.status(examSubjectChoicesService.updateChoicesValue(id,value)); |
| | | } |
| | | |
| | | /** |
| | | * 导入题库 |
| | | * @param isCovered 1 覆盖 0不覆盖 |
| | | * @return |
| | | */ |
| | | @PostMapping("import-examSubject") |
| | | @ApiOperation(value = "导入题库", notes = "传入excel") |
| | | public R importExamScore(MultipartFile file, Integer isCovered) { |
| | | ExamSubjectImporter examSubjectImporter = new ExamSubjectImporter(examSubjectChoicesService, false); |
| | | ExcelUtil.save(file, examSubjectImporter, ExamSubjectExcel.class); |
| | | return R.success("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 导出模板 |
| | | */ |
| | | @GetMapping("export-template") |
| | | @ApiOperation(value = "导出模板") |
| | | public void exportUser(HttpServletResponse response) { |
| | | List<ExamSubjectExcel> list = new ArrayList<>(); |
| | | ExcelUtil.export(response, "题库导入数据模板", "题库导入数据表", list, ExamSubjectExcel.class); |
| | | } |
| | | |
| | | } |