考试部分接口优化
This commit is contained in:
parent
692154150c
commit
429ce3ccae
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.exam.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.exam.domain.*;
|
||||
import com.ruoyi.exam.service.*;
|
||||
|
|
@ -49,6 +50,7 @@ public class ApiExaminationController extends BaseController {
|
|||
|
||||
/**
|
||||
* 获取考试列表
|
||||
*
|
||||
* @param examExamination
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -69,6 +71,7 @@ public class ApiExaminationController extends BaseController {
|
|||
|
||||
/**
|
||||
* 开始考试
|
||||
*
|
||||
* @param inationId
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -88,6 +91,7 @@ public class ApiExaminationController extends BaseController {
|
|||
//考试记录ID
|
||||
Integer examUserExaminationId = -1;
|
||||
|
||||
ExamUserExamination insert = new ExamUserExamination();
|
||||
//正式考试
|
||||
if (type.equals( "2" )) {
|
||||
ExamUserExamination examUserExamination = new ExamUserExamination();
|
||||
|
|
@ -119,7 +123,6 @@ public class ApiExaminationController extends BaseController {
|
|||
|| userExamination.get( 0 ).getUpdateDate() != null //最后一次考试已交卷
|
||||
|| userExamination.get( 0 ).getCreateDate().getTime() + timeLength * 60 * 1000 < new Date().getTime()//最后一次考试,已超过考过时长
|
||||
) {
|
||||
ExamUserExamination insert = new ExamUserExamination();
|
||||
insert.setExamExaminationId( Integer.parseInt( inationId ) );
|
||||
insert.setVipUserId( userId );
|
||||
insert.setCreateDate( new Date() );
|
||||
|
|
@ -142,12 +145,14 @@ public class ApiExaminationController extends BaseController {
|
|||
AjaxResult success = success( "查询成功" );
|
||||
success.put( "data", list );
|
||||
success.put( "examUserExaminationId", examUserExaminationId );
|
||||
success.put( "examExamination", examExamination );
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 报名列表
|
||||
*
|
||||
* @param examExamination
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -165,9 +170,9 @@ public class ApiExaminationController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 报名
|
||||
*
|
||||
* @param sysUser
|
||||
* @param inationId
|
||||
* @return
|
||||
|
|
@ -194,6 +199,7 @@ public class ApiExaminationController extends BaseController {
|
|||
|
||||
/**
|
||||
* 交卷
|
||||
*
|
||||
* @param examUserExaminationQuestion
|
||||
* @param examUserExaminationId
|
||||
* @param examinationId
|
||||
|
|
@ -229,11 +235,15 @@ public class ApiExaminationController extends BaseController {
|
|||
HashMap<String, String> returnItem = new HashMap<>();
|
||||
String userAnswer = item.getUserAnswer();
|
||||
//存入用户回答
|
||||
if (StrUtil.isNotBlank( userAnswer )) {
|
||||
returnItem.put( "userAnswer", userAnswer );
|
||||
}
|
||||
Integer examQuestionId = item.getExamQuestionId();
|
||||
ExamQuestion examQuestion = examQuestionService.selectById( examQuestionId );
|
||||
//存入正确答案
|
||||
if (StrUtil.isNotBlank( examQuestion.getAnswer() )) {
|
||||
returnItem.put( "answer", examQuestion.getAnswer() );
|
||||
}
|
||||
returnItem.put( "title", examQuestion.getTitle() );
|
||||
returnItem.put( "rightWrong", "错误" );
|
||||
if (examQuestion.getAnswer().equals( userAnswer )) {
|
||||
|
|
@ -247,6 +257,7 @@ public class ApiExaminationController extends BaseController {
|
|||
item.setCreateDate( new Date() );
|
||||
item.setCreateBy( user.getLoginName() );
|
||||
item.setDelFlag( "0" );
|
||||
item.setId( null );
|
||||
examUserExaminationQuestionService.insertOne( item );
|
||||
data.add( returnItem );
|
||||
}
|
||||
|
|
@ -273,10 +284,11 @@ public class ApiExaminationController extends BaseController {
|
|||
|
||||
/**
|
||||
* 考试记录列表
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/v1/examination/userexamination/list")
|
||||
@GetMapping("/v1/user/examination/page")
|
||||
public AjaxResult userexamination(ExamUserExaminationVO bean) {
|
||||
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||
bean.setVipUserId( Integer.parseInt( sysUser.getUserId().toString() ) );
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
<input id="name" name="name" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">证书照片:</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
|
|||
Loading…
Reference in New Issue