考试定义调整

This commit is contained in:
tiger_zhou 2023-05-22 10:05:31 +08:00
parent 4fa0c0c2b7
commit b302f7d4d4

View File

@ -54,6 +54,7 @@ public class PaperUserSubmitAnswerService {
*/
@Transactional(rollbackFor = Exception.class)
public PaperSubmitAnswerRspVo submitAnswer(PaperSubmitAnswerReqVo req, AccountVO user) {
BusinessExceptionAssertEnum.DATA_INVALID.assertTrue(Objects.nonNull(req.getType()),"未知的考试类型");
//用户试卷题目
final PaperUserQuestionExample puqExample = new PaperUserQuestionExample();
puqExample.createCriteria().andPuIdEqualTo(req.getPuId()).andQuestionIdEqualTo(req.getPqId());
@ -70,21 +71,21 @@ public class PaperUserSubmitAnswerService {
//校验
// this.assertCanSubmitAnswer(pc, pu, puq, user);
//
final PaperSubmitAnswerRspVo rsp = new PaperSubmitAnswerRspVo();
rsp.setPuId(req.getPuId());
rsp.setPqId(req.getPqId());
rsp.setType(req.getType());
rsp.setSubType(req.getSubType());
TrainAnswerVO answerVO;
BusinessExceptionAssertEnum.DATA_INVALID.assertTrue(Objects.nonNull(req.getType()),"未知的考试类型");
//处理用户提交的答案
if(req.getType() == PaperQType.GroupType.Common){
answerVO = submitCommonAnswer(puq, req);
}else{
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue((req.getSubType() != PaperQType.SubType.Single && req.getSubType() != PaperQType.SubType.Scene),String.format("未知答题类型[%s]",req.getSubType()));
answerVO = this.submitTrainingAnswer(user,req);
}
final PaperSubmitAnswerRspVo rsp = new PaperSubmitAnswerRspVo();
rsp.setPuId(req.getPuId());
rsp.setPqId(req.getPqId());
rsp.setType(req.getType());
rsp.setSubType(req.getSubType());
rsp.setResult(answerVO.getState());
//记录用户答题情况
PaperUserQuestion record = new PaperUserQuestion();