kangwei:在线考试:试题、试卷功能
3、试题管理的提交人都是空的 4、试题新增后增加审批过程,增加审批状态字段,新提交的试题都是待审批状态,集团审批后的试题才能在考试中新增(审批按钮配置按钮权限) 5、增加随机生成试卷功能(类似于科目一考试)
正在显示
8 个修改的文件
包含
168 行增加
和
34 行删除
... | @@ -18,6 +18,7 @@ import com.skua.core.util.push.IPushService; | ... | @@ -18,6 +18,7 @@ import com.skua.core.util.push.IPushService; |
18 | import com.skua.core.util.push.MessageEntity; | 18 | import com.skua.core.util.push.MessageEntity; |
19 | import com.skua.core.util.push.PushMessageFactory; | 19 | import com.skua.core.util.push.PushMessageFactory; |
20 | import com.skua.modules.edu.entity.Paper; | 20 | import com.skua.modules.edu.entity.Paper; |
21 | import com.skua.modules.edu.entity.Question; | ||
21 | import com.skua.modules.edu.service.IPaperService; | 22 | import com.skua.modules.edu.service.IPaperService; |
22 | import java.util.Date; | 23 | import java.util.Date; |
23 | import java.util.stream.Collectors; | 24 | import java.util.stream.Collectors; |
... | @@ -25,6 +26,8 @@ import java.util.stream.Collectors; | ... | @@ -25,6 +26,8 @@ import java.util.stream.Collectors; |
25 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 26 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
26 | import com.baomidou.mybatisplus.core.metadata.IPage; | 27 | import com.baomidou.mybatisplus.core.metadata.IPage; |
27 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 28 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
29 | import com.skua.modules.edu.service.IQuestionService; | ||
30 | import com.skua.modules.edu.vo.PaperRandomVO; | ||
28 | import com.skua.modules.edu.vo.PaperVO; | 31 | import com.skua.modules.edu.vo.PaperVO; |
29 | import com.skua.modules.guest.util.DateUtil; | 32 | import com.skua.modules.guest.util.DateUtil; |
30 | import com.skua.modules.system.entity.SysUser; | 33 | import com.skua.modules.system.entity.SysUser; |
... | @@ -65,18 +68,10 @@ public class PaperController { | ... | @@ -65,18 +68,10 @@ public class PaperController { |
65 | @Autowired | 68 | @Autowired |
66 | private IPaperService paperService; | 69 | private IPaperService paperService; |
67 | 70 | ||
68 | /** | 71 | @Autowired |
69 | * <pre> | 72 | private IQuestionService questionService; |
70 | * 分页列表查询 | 73 | |
71 | * </pre> | 74 | |
72 | * @param paper | ||
73 | * @param pageNo | ||
74 | * @param pageSize | ||
75 | * @param req | ||
76 | * @return | ||
77 | * @author 开发者姓名, 开发时间 | ||
78 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
79 | */ | ||
80 | @AutoLog(value = "在线考试-试卷-分页列表查询") | 75 | @AutoLog(value = "在线考试-试卷-分页列表查询") |
81 | @ApiOperation(value="在线考试-试卷-分页列表查询", notes="在线考试-试卷-分页列表查询") | 76 | @ApiOperation(value="在线考试-试卷-分页列表查询", notes="在线考试-试卷-分页列表查询") |
82 | @GetMapping(value = "/list") | 77 | @GetMapping(value = "/list") |
... | @@ -93,15 +88,24 @@ public class PaperController { | ... | @@ -93,15 +88,24 @@ public class PaperController { |
93 | return result; | 88 | return result; |
94 | } | 89 | } |
95 | 90 | ||
96 | /** | 91 | |
97 | * <pre> | 92 | @AutoLog(value = "在线考试-随机组卷试题") |
98 | * 添加 | 93 | @ApiOperation(value="在线考试-随机组卷试题", notes="在线考试-随机组卷试题") |
99 | * </pre> | 94 | @PostMapping(value = "/randomQuestion") |
100 | * @param paperVO | 95 | public Result<List<Question>> randomQuestion(@RequestBody PaperRandomVO paperRandomVO) throws Exception{ |
101 | * @return | 96 | Result<List<Question>> result = new Result<>(); |
102 | * @author 开发者姓名, 开发时间 | 97 | try { |
103 | * @Description: TODO(这里描述这个方法的需求变更情况) | 98 | List<Question> dataList = questionService.randomQuestion(paperRandomVO); |
104 | */ | 99 | result.setResult( dataList ); |
100 | result.success("操作成功!"); | ||
101 | |||
102 | } catch (Exception e) { | ||
103 | log.error(e.getMessage(),e); | ||
104 | result.error500("操作失败"); | ||
105 | } | ||
106 | return result; | ||
107 | } | ||
108 | |||
105 | @AutoLog(value = "在线考试-试卷-添加") | 109 | @AutoLog(value = "在线考试-试卷-添加") |
106 | @ApiOperation(value="在线考试-试卷-添加", notes="在线考试-试卷-添加") | 110 | @ApiOperation(value="在线考试-试卷-添加", notes="在线考试-试卷-添加") |
107 | @PostMapping(value = "/add") | 111 | @PostMapping(value = "/add") |
... | @@ -116,15 +120,7 @@ public class PaperController { | ... | @@ -116,15 +120,7 @@ public class PaperController { |
116 | } | 120 | } |
117 | return result; | 121 | return result; |
118 | } | 122 | } |
119 | /** | 123 | |
120 | * <pre> | ||
121 | * 编辑 | ||
122 | * </pre> | ||
123 | * @param paperVO | ||
124 | * @return | ||
125 | * @author 开发者姓名, 开发时间 | ||
126 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
127 | */ | ||
128 | @AutoLog(value = "在线考试-试卷-编辑") | 124 | @AutoLog(value = "在线考试-试卷-编辑") |
129 | @ApiOperation(value="在线考试-试卷-编辑", notes="在线考试-试卷-编辑") | 125 | @ApiOperation(value="在线考试-试卷-编辑", notes="在线考试-试卷-编辑") |
130 | @PutMapping(value = "/edit") | 126 | @PutMapping(value = "/edit") | ... | ... |
... | @@ -27,6 +27,7 @@ import com.skua.modules.system.service.ISysDepartService; | ... | @@ -27,6 +27,7 @@ import com.skua.modules.system.service.ISysDepartService; |
27 | import com.skua.tool.util.JSUtils; | 27 | import com.skua.tool.util.JSUtils; |
28 | import lombok.extern.slf4j.Slf4j; | 28 | import lombok.extern.slf4j.Slf4j; |
29 | 29 | ||
30 | import org.apache.commons.lang.StringUtils; | ||
30 | import org.jeecgframework.poi.excel.ExcelImportUtil; | 31 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
31 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | 32 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
32 | import org.jeecgframework.poi.excel.entity.ExportParams; | 33 | import org.jeecgframework.poi.excel.entity.ExportParams; |
... | @@ -65,15 +66,39 @@ public class QuestionController { | ... | @@ -65,15 +66,39 @@ public class QuestionController { |
65 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | 66 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
66 | HttpServletRequest req) { | 67 | HttpServletRequest req) { |
67 | Result<IPage<Question>> result = new Result<IPage<Question>>(); | 68 | Result<IPage<Question>> result = new Result<IPage<Question>>(); |
68 | //QueryWrapper<Question> queryWrapper = QueryGenerator.initQueryWrapper(question, req.getParameterMap()); | 69 | QueryWrapper<Question> queryWrapper = QueryGenerator.initQueryWrapper(question, req.getParameterMap()); |
69 | Page<Question> page = new Page<Question>(pageNo, pageSize); | 70 | Page<Question> page = new Page<Question>(pageNo, pageSize); |
70 | //IPage<Question> pageList = questionService.page(page, queryWrapper); | 71 | queryWrapper.orderByDesc("create_time"); |
71 | IPage<Question> pageList = questionService.queryPageList(page, question); | 72 | |
73 | IPage<Question> pageList = questionService.page(page, queryWrapper); | ||
74 | //IPage<Question> pageList = questionService.queryPageList(page, question); | ||
72 | result.setSuccess(true); | 75 | result.setSuccess(true); |
73 | result.setResult(pageList); | 76 | result.setResult(pageList); |
74 | return result; | 77 | return result; |
75 | } | 78 | } |
79 | @AutoLog(value = "在线考试-试题-审批列表") | ||
80 | @ApiOperation(value="在线考试-试题-审批列表", notes="在线考试-试题-审批列表") | ||
81 | @GetMapping(value = "/handleList") | ||
82 | public Result<IPage<Question>> handleList(Question question, | ||
83 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | ||
84 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | ||
85 | HttpServletRequest req) { | ||
86 | Result<IPage<Question>> result = new Result<IPage<Question>>(); | ||
87 | QueryWrapper<Question> queryWrapper = QueryGenerator.initQueryWrapper(question, req.getParameterMap()); | ||
88 | Page<Question> page = new Page<Question>(pageNo, pageSize); | ||
89 | //queryWrapper.gt("audit_status","0");//>0 | ||
90 | //queryWrapper.lt("audit_status","3");// < 3 | ||
91 | if(StringUtils.isEmpty(question.getAuditStatus())){ | ||
92 | queryWrapper.eq("audit_status","1"); | ||
93 | } | ||
94 | queryWrapper.orderByDesc("create_time"); | ||
76 | 95 | ||
96 | IPage<Question> pageList = questionService.page(page, queryWrapper); | ||
97 | //IPage<Question> pageList = questionService.queryPageList(page, question); | ||
98 | result.setSuccess(true); | ||
99 | result.setResult(pageList); | ||
100 | return result; | ||
101 | } | ||
77 | @AutoLog(value = "在线考试-题库-题库下试题列表") | 102 | @AutoLog(value = "在线考试-题库-题库下试题列表") |
78 | @ApiOperation(value="在线考试-题库下试题列表", notes="在线考试-题库下试题列表") | 103 | @ApiOperation(value="在线考试-题库下试题列表", notes="在线考试-题库下试题列表") |
79 | @GetMapping(value = "/questionList/{dbId}") | 104 | @GetMapping(value = "/questionList/{dbId}") |
... | @@ -250,6 +275,9 @@ public class QuestionController { | ... | @@ -250,6 +275,9 @@ public class QuestionController { |
250 | return result; | 275 | return result; |
251 | } | 276 | } |
252 | 277 | ||
278 | |||
279 | |||
280 | |||
253 | @RequestMapping(value = "/exportXlsTemplate") | 281 | @RequestMapping(value = "/exportXlsTemplate") |
254 | public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { | 282 | public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { |
255 | // Step.1 组装查询条件 | 283 | // Step.1 组装查询条件 | ... | ... |
1 | package com.skua.modules.edu.mapper; | 1 | package com.skua.modules.edu.mapper; |
2 | 2 | ||
3 | import java.util.Collection; | ||
3 | import java.util.List; | 4 | import java.util.List; |
4 | 5 | ||
5 | import com.baomidou.mybatisplus.core.metadata.IPage; | 6 | import com.baomidou.mybatisplus.core.metadata.IPage; |
... | @@ -61,4 +62,7 @@ public interface QuestionMapper extends BaseMapper<Question> { | ... | @@ -61,4 +62,7 @@ public interface QuestionMapper extends BaseMapper<Question> { |
61 | * @return | 62 | * @return |
62 | */ | 63 | */ |
63 | public int batchSendAudit(@Param("id")String ids, @Param("auditStatus")String auditStatus); | 64 | public int batchSendAudit(@Param("id")String ids, @Param("auditStatus")String auditStatus); |
65 | |||
66 | /**随机试题集合*/ | ||
67 | List<Question> randomQuestion(@Param("dbId")String dbId, @Param("questionType")String questionType, @Param("qNums")String qNums, @Param("qScore")String qScore); | ||
64 | } | 68 | } | ... | ... |
... | @@ -20,6 +20,8 @@ | ... | @@ -20,6 +20,8 @@ |
20 | <result property="departName" column="depart_name" /> | 20 | <result property="departName" column="depart_name" /> |
21 | <result property="userName" column="user_name" /> | 21 | <result property="userName" column="user_name" /> |
22 | 22 | ||
23 | <result property="score" column="score" /> | ||
24 | |||
23 | </resultMap> | 25 | </resultMap> |
24 | 26 | ||
25 | <sql id="selectEduQuestionVo"> | 27 | <sql id="selectEduQuestionVo"> |
... | @@ -36,12 +38,23 @@ | ... | @@ -36,12 +38,23 @@ |
36 | <if test="param.questionAnswer != null and param.questionAnswer != ''"> and t.question_answer = #{param.questionAnswer}</if> | 38 | <if test="param.questionAnswer != null and param.questionAnswer != ''"> and t.question_answer = #{param.questionAnswer}</if> |
37 | <if test="param.questionData != null and param.questionData != ''"> and t.question_data = #{param.questionData}</if> | 39 | <if test="param.questionData != null and param.questionData != ''"> and t.question_data = #{param.questionData}</if> |
38 | <if test="param.analyzes != null and param.analyzes != ''"> and t.analyzes = #{param.analyzes}</if> | 40 | <if test="param.analyzes != null and param.analyzes != ''"> and t.analyzes = #{param.analyzes}</if> |
39 | <if test="param.createDept != null and param.createDept != ''"> and t.create_dept = #{param.createDept}</if> | 41 | <if test="param.auditStatus != null and param.auditStatus != ''"> and t.audit_status = #{param.auditStatus}</if> |
40 | <if test="param.delFlag != null "> and t.del_flag = #{param.delFlag}</if> | 42 | <if test="param.delFlag != null "> and t.del_flag = #{param.delFlag}</if> |
43 | |||
44 | |||
41 | </where> | 45 | </where> |
42 | 46 | ||
43 | order by create_time desc | 47 | order by create_time desc |
44 | </select> | 48 | </select> |
49 | <!-- 随机试题集合--> | ||
50 | <select id="randomQuestion" resultMap="EduQuestionResult"> | ||
51 | select t.* , #{qScore} score from edu_question t | ||
52 | <where> t.audit_status = 3 | ||
53 | <if test="dbId!= null and dbId != ''"> and t.question_db_id = #{dbId}</if> | ||
54 | <if test="questionType != null and questionType != ''"> and t.question_type = #{questionType}</if> | ||
55 | </where> | ||
56 | order by rand() limit ${qNums} | ||
57 | </select> | ||
45 | 58 | ||
46 | <select id="selectQuestionList" parameterType="com.skua.modules.edu.entity.Question" resultMap="EduQuestionResult"> | 59 | <select id="selectQuestionList" parameterType="com.skua.modules.edu.entity.Question" resultMap="EduQuestionResult"> |
47 | select d.depart_name ,u.realname 'user_name' , t.* from edu_question t | 60 | select d.depart_name ,u.realname 'user_name' , t.* from edu_question t | ... | ... |
... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | ... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
5 | import com.skua.modules.edu.entity.Question; | 5 | import com.skua.modules.edu.entity.Question; |
6 | import com.baomidou.mybatisplus.extension.service.IService; | 6 | import com.baomidou.mybatisplus.extension.service.IService; |
7 | import com.skua.modules.edu.vo.PaperRandomVO; | ||
7 | import com.skua.modules.edu.vo.QuestionExcel; | 8 | import com.skua.modules.edu.vo.QuestionExcel; |
8 | 9 | ||
9 | import java.util.List; | 10 | import java.util.List; |
... | @@ -80,4 +81,11 @@ public interface IQuestionService extends IService<Question> { | ... | @@ -80,4 +81,11 @@ public interface IQuestionService extends IService<Question> { |
80 | * @return | 81 | * @return |
81 | */ | 82 | */ |
82 | String auditBatchQuestion(String ids, String approveState, String approveMessage); | 83 | String auditBatchQuestion(String ids, String approveState, String approveMessage); |
84 | |||
85 | /*** | ||
86 | * 随机组卷的试题集合 | ||
87 | * @param paperRandomVO | ||
88 | * @return | ||
89 | */ | ||
90 | List<Question> randomQuestion(PaperRandomVO paperRandomVO); | ||
83 | } | 91 | } | ... | ... |
... | @@ -13,6 +13,7 @@ import com.skua.modules.edu.mapper.QuestionMapper; | ... | @@ -13,6 +13,7 @@ import com.skua.modules.edu.mapper.QuestionMapper; |
13 | import com.skua.modules.edu.mapper.QuestionOptionMapper; | 13 | import com.skua.modules.edu.mapper.QuestionOptionMapper; |
14 | import com.skua.modules.edu.service.IQuestionOptionService; | 14 | import com.skua.modules.edu.service.IQuestionOptionService; |
15 | import com.skua.modules.edu.service.IQuestionService; | 15 | import com.skua.modules.edu.service.IQuestionService; |
16 | import com.skua.modules.edu.vo.PaperRandomVO; | ||
16 | import com.skua.modules.edu.vo.QuestionExcel; | 17 | import com.skua.modules.edu.vo.QuestionExcel; |
17 | import com.skua.modules.erp.entity.ApproveRecord; | 18 | import com.skua.modules.erp.entity.ApproveRecord; |
18 | import com.skua.modules.erp.mapper.ApproveRecordMapper; | 19 | import com.skua.modules.erp.mapper.ApproveRecordMapper; |
... | @@ -185,6 +186,28 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i | ... | @@ -185,6 +186,28 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i |
185 | return "0" ; | 186 | return "0" ; |
186 | } | 187 | } |
187 | 188 | ||
189 | /*** | ||
190 | * 随机组卷的试题集合 | ||
191 | * @param paperRandomVO | ||
192 | * @return | ||
193 | */ | ||
194 | public List<Question> randomQuestion(PaperRandomVO paperRandomVO){ | ||
195 | List<Question> dataList = new ArrayList<>(); | ||
196 | //单选题 | ||
197 | if(StringUtils.isNotEmpty(paperRandomVO.getSingleNums())){ | ||
198 | dataList.addAll( this.baseMapper.randomQuestion(paperRandomVO.getDbId(),"1",paperRandomVO.getSingleNums(),paperRandomVO.getSingleScore()) ); | ||
199 | } | ||
200 | // 多选题 | ||
201 | if(StringUtils.isNotEmpty(paperRandomVO.getMultipleNums())){ | ||
202 | dataList.addAll( this.baseMapper.randomQuestion(paperRandomVO.getDbId(),"2",paperRandomVO.getMultipleNums(),paperRandomVO.getMultipleScore()) ); | ||
203 | } | ||
204 | // 判断题 | ||
205 | if(StringUtils.isNotEmpty(paperRandomVO.getJudgeNums())){ | ||
206 | dataList.addAll( this.baseMapper.randomQuestion(paperRandomVO.getDbId(),"3",paperRandomVO.getJudgeNums(),paperRandomVO.getJudgeScore()) ); | ||
207 | } | ||
208 | return dataList; | ||
209 | } | ||
210 | |||
188 | 211 | ||
189 | /*** | 212 | /*** |
190 | * 批量送审 | 213 | * 批量送审 | ... | ... |
1 | package com.skua.modules.edu.vo; | ||
2 | |||
3 | import io.swagger.annotations.ApiModel; | ||
4 | import io.swagger.annotations.ApiModelProperty; | ||
5 | import lombok.Data; | ||
6 | |||
7 | /** | ||
8 | * @auther kangwei | ||
9 | * @create 2025-02-25-17:18 | ||
10 | */ | ||
11 | @Data | ||
12 | @ApiModel(value="随机组卷对象", description="随机组卷对象") | ||
13 | public class PaperRandomVO { | ||
14 | |||
15 | @ApiModelProperty(value = "题库编号") | ||
16 | private String dbId; | ||
17 | |||
18 | @ApiModelProperty(value = "单选-试题数量") | ||
19 | private String singleNums; | ||
20 | @ApiModelProperty(value = "单选-试题分值") | ||
21 | private String singleScore; | ||
22 | |||
23 | @ApiModelProperty(value = "多选-试题数量") | ||
24 | private String multipleNums; | ||
25 | @ApiModelProperty(value = "多选-试题分值") | ||
26 | private String multipleScore; | ||
27 | |||
28 | @ApiModelProperty(value = "判断-试题数量") | ||
29 | private String judgeNums; | ||
30 | @ApiModelProperty(value = "判断-试题分值") | ||
31 | private String judgeScore; | ||
32 | } |
1 | package com.skua.modules.edu.vo; | ||
2 | |||
3 | import io.swagger.annotations.ApiModel; | ||
4 | import io.swagger.annotations.ApiModelProperty; | ||
5 | import lombok.Data; | ||
6 | import org.jeecgframework.poi.excel.annotation.Excel; | ||
7 | |||
8 | /** | ||
9 | * @auther kangwei | ||
10 | * @create 2025-02-25-17:18 | ||
11 | */ | ||
12 | @Data | ||
13 | @ApiModel(value="随机组卷--章节对象", description="随机组卷--章节") | ||
14 | public class PaperSectionVO { | ||
15 | |||
16 | @ApiModelProperty(value = "题库编号") | ||
17 | private String dbId; | ||
18 | |||
19 | @ApiModelProperty(value = "试题类型:1 单选、2多选、3判断") | ||
20 | private String questionType; | ||
21 | |||
22 | //@ApiModelProperty(value = "试题难易程度") | ||
23 | //private String qLevel; | ||
24 | |||
25 | @ApiModelProperty(value = "试题数量") | ||
26 | private String qNums; | ||
27 | |||
28 | @ApiModelProperty(value = "试题分值") | ||
29 | private String qScore; | ||
30 | } |
-
请 注册 或 登录 后发表评论