Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
809056b560
|
|
@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo;
|
|||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.exam.domain.*;
|
||||
import com.ruoyi.exam.service.*;
|
||||
import com.ruoyi.exam.service.impl.ExamExaminationServiceImpl;
|
||||
import com.ruoyi.framework.jwt.JwtUtil;
|
||||
import com.ruoyi.framework.web.exception.base.BaseException;
|
||||
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||
|
|
@ -12,10 +13,7 @@ import com.ruoyi.system.service.ISysUserService;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -145,5 +143,18 @@ public class CmsExaminationController {
|
|||
return prefix+"detail";
|
||||
}
|
||||
|
||||
@RequestMapping("/examination/finish/{examUserExaminationId}/{examinationId}/{paperId}")
|
||||
@ResponseBody
|
||||
public AjaxResult finish(@RequestBody List<ExamUserExaminationQuestion> examUserExaminationQuestion,
|
||||
@PathVariable Integer examUserExaminationId, @PathVariable Integer examinationId, @PathVariable Integer paperId,ModelMap map) {
|
||||
SysUser sysUser = ShiroUtils.getSysUser();
|
||||
//交卷然后返回考试记录id
|
||||
Integer id = examExaminationService.finshExamination(examUserExaminationQuestion,sysUser,examUserExaminationId,examinationId,paperId);
|
||||
ExamUserExaminationVO data = examUserExaminationService.selectDetailById( id );
|
||||
AjaxResult success = AjaxResult.success( "报名成功" );
|
||||
success.put("id",id);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,14 @@
|
|||
<div class="layui-col-md12">
|
||||
<div class="fly-panel">
|
||||
|
||||
<div class="layui-col-md9">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card" style="text-align: center;">
|
||||
<span style="font-size: 30px;line-height: 60px">[[${examExamination.name}]]</span>
|
||||
<span style="font-size: 30px;line-height: 60px">[[${examExamination.name}]]</span><br>
|
||||
<button style="width: 100px;margin-bottom: 20px" class="layui-btn layui-btn-warm" onclick="endPaper()" >交卷</button>
|
||||
</div>
|
||||
<div class="layui-card question" th:each="question:${data}">
|
||||
<input type="hidden" class="questionId" th:value="${question.id}">
|
||||
<div class="layui-card-header">[[${questionStat.index+1}]]:<span
|
||||
th:text="${question.title}"></span>
|
||||
<span th:if="${question.type=='1'}">(单选)</span>
|
||||
|
|
@ -47,15 +49,14 @@
|
|||
<!--</div>-->
|
||||
</div>
|
||||
|
||||
<div class="layui-card">
|
||||
<button class="layui-btn layui-btn-warm" onclick="endPaper()" >交卷</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -84,18 +85,29 @@ document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Csc
|
|||
function endPaper() {
|
||||
var data = [];
|
||||
$(".question").each(function(){
|
||||
var examQuestionId = $(this).find(".questionId").eq(0).val()
|
||||
var userAnswer = "";
|
||||
$(this).find("."+examQuestionId+"useranswer:checked").each(function(){
|
||||
userAnswer+=$(this).val()+",";
|
||||
})
|
||||
userAnswer = userAnswer.substring(0,userAnswer.length-1)
|
||||
|
||||
data.push({examQuestionId:examQuestionId,userAnswer:userAnswer})
|
||||
})
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: "/api/v1/examination/finish/"+[[${examUserExaminationId}]]+"/"+[[${examExamination.id}]]+"/"+[[${paperId}]],
|
||||
url: "/web/examination/finish/"+[[${examUserExaminationId}]]+"/"+[[${examExamination.id}]]+"/"+[[${paperId}]],
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
success: function (result) {
|
||||
if (result.code != web_status.SUCCESS) {
|
||||
$.modal.msgError(result.msg);
|
||||
layer.msg(result.msg, {icon: 2})
|
||||
}else{
|
||||
layer.msg("已交卷", {icon: 1})
|
||||
location.href="/web/user/myuserexamination/detail/"+result.id;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,14 @@
|
|||
</a>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="type">
|
||||
{{# if (d.type == "2"){ }}
|
||||
正式考试
|
||||
{{# }else { }}
|
||||
模拟考试
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -84,6 +92,7 @@ document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Csc
|
|||
{checkbox: true}
|
||||
, {field: 'name', title: '考试名称'}
|
||||
, {field: 'trainCourseName', title: '课程名称'}
|
||||
,{field: 'type', title: '考试类型',templet: '#type'}
|
||||
, {field: 'timeLength', title: '考试时长'}
|
||||
, {field: 'passMark', title: '及格分数'}
|
||||
, {title: '操作', toolbar: '#barDemo'}
|
||||
|
|
@ -162,6 +171,7 @@ document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Csc
|
|||
{checkbox: true}
|
||||
, {field: 'name', title: '考试名称'}
|
||||
, {field: 'trainCourseName', title: '课程名称'}
|
||||
,{field: 'type', title: '考试类型',templet: '#type'}
|
||||
, {field: 'timeLength', title: '考试时长'}
|
||||
, {field: 'passMark', title: '及格分数'}
|
||||
, {title: '操作', toolbar: '#signup'}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,92 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="web/index::cmsHeader">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="fly-header layui-bg-black" th:replace="web/index::top">
|
||||
</div>
|
||||
|
||||
<div class="layui-container fly-marginTop fly-user-main">
|
||||
<div th:replace="web/user/set::userinfo">
|
||||
</div>
|
||||
|
||||
<div class="fly-panel fly-panel-user" pad20>
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
|
||||
<legend>我的支付记录</legend>
|
||||
</fieldset>
|
||||
<table class="layui-hide" id="test" lay-filter="test"></table>
|
||||
<script type="text/html" id="barDemo">
|
||||
<a class="layui-btn layui-btn-xs" lay-event="query">查看</a>
|
||||
<!--<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="delFlag">
|
||||
{{# if (d.delFlag == '0'){ }}
|
||||
未支付
|
||||
{{# }else { }}
|
||||
已支付
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="fly-footer" th:replace="web/index::cmsBottom">
|
||||
</div>
|
||||
|
||||
<script src="/web/res/layui/layui.js"></script>
|
||||
<script src="/js/jquery.min.js"></script>
|
||||
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
|
||||
document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "w.cnzz.com/c.php%3Fid%3D30088308' type='text/javascript'%3E%3C/script%3E"));</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#orders").addClass("layui-this")
|
||||
})
|
||||
|
||||
layui.use('table', function(){
|
||||
var table = layui.table;
|
||||
|
||||
table.render({
|
||||
elem: '#test'
|
||||
,url:'/web/user/orders/list'
|
||||
,title: '订单'
|
||||
,cols: [ [
|
||||
{checkbox: true}
|
||||
,{field: 'trainCourseName', title: '课程名称'}
|
||||
,{field: 'price', title: '支付金额'}
|
||||
,{field: 'createDate', title: '支付时间'}
|
||||
,{field: 'delFlag', title: '订单状态',templet: '#delFlag'}
|
||||
,{title: 'remarks',title: '备注'}
|
||||
] ]
|
||||
,request: {
|
||||
pageName: 'pageNum' //页码的参数名称,默认:page
|
||||
,limitName: 'pageSize' //每页数据量的参数名,默认:limit
|
||||
}
|
||||
,response: {
|
||||
statusCode: 200
|
||||
,countName: 'total'
|
||||
}
|
||||
,page: true
|
||||
});
|
||||
|
||||
|
||||
|
||||
table.on('tool(test)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
|
||||
var data = obj.data //获得当前行数据
|
||||
,layEvent = obj.event; //获得 lay-event 对应的值
|
||||
if(layEvent === 'query'){
|
||||
window.location.href = "/web/user/myuserexamination/detail/"+data.id;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="web/index::cmsHeader">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="fly-header layui-bg-black" th:replace="web/index::top">
|
||||
</div>
|
||||
|
||||
<div class="layui-container fly-marginTop fly-user-main">
|
||||
<div th:replace="web/user/set::userinfo">
|
||||
</div>
|
||||
|
||||
<div class="fly-panel fly-panel-user" pad20>
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
|
||||
<legend>我的考试记录</legend>
|
||||
</fieldset>
|
||||
<table class="layui-hide" id="test" lay-filter="test"></table>
|
||||
<script type="text/html" id="barDemo">
|
||||
<a class="layui-btn layui-btn-xs" lay-event="query">查看</a>
|
||||
<!--<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="trainCourseName">
|
||||
{{d.examExaminationVO.trainCourseName}}
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="examinationName">
|
||||
{{d.examExaminationVO.name}}
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="type">
|
||||
{{# if (d.examExaminationVO.type == "2"){ }}
|
||||
正式考试
|
||||
{{# }else { }}
|
||||
模拟考试
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="fly-footer" th:replace="web/index::cmsBottom">
|
||||
</div>
|
||||
|
||||
<script src="/web/res/layui/layui.js"></script>
|
||||
<script src="/js/jquery.min.js"></script>
|
||||
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
|
||||
document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "w.cnzz.com/c.php%3Fid%3D30088308' type='text/javascript'%3E%3C/script%3E"));</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#userexamination").addClass("layui-this")
|
||||
})
|
||||
|
||||
layui.use('table', function(){
|
||||
var table = layui.table;
|
||||
|
||||
table.render({
|
||||
elem: '#test'
|
||||
,url:'/web/user/myuserexamination/list'
|
||||
,title: '练习表'
|
||||
,cols: [ [
|
||||
{checkbox: true}
|
||||
,{field: 'trainCourseName', title: '课程名称',templet: '#trainCourseName'}
|
||||
,{field: 'name', title: '考试名称',templet: '#examinationName'}
|
||||
,{field: 'examPaperName', title: '试卷名称'}
|
||||
,{field: 'type', title: '考试类型',templet: '#type'}
|
||||
,{title: '操作',toolbar: '#barDemo'}
|
||||
] ]
|
||||
,request: {
|
||||
pageName: 'pageNum' //页码的参数名称,默认:page
|
||||
,limitName: 'pageSize' //每页数据量的参数名,默认:limit
|
||||
}
|
||||
,response: {
|
||||
statusCode: 200
|
||||
,countName: 'total'
|
||||
}
|
||||
,page: true
|
||||
});
|
||||
|
||||
|
||||
|
||||
table.on('tool(test)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
|
||||
var data = obj.data //获得当前行数据
|
||||
,layEvent = obj.event; //获得 lay-event 对应的值
|
||||
if(layEvent === 'query'){
|
||||
window.location.href = "/web/user/myuserexamination/detail/"+data.id;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="web/index::cmsHeader">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="fly-header layui-bg-black" th:replace="web/index::top">
|
||||
</div>
|
||||
|
||||
<div class="layui-container fly-marginTop fly-user-main">
|
||||
<div th:replace="web/user/set::userinfo">
|
||||
</div>
|
||||
|
||||
<div class="fly-panel fly-panel-user" pad20>
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;" th:if="${data == null or data.examExaminationVO.examEnd =='0'}">
|
||||
<legend>该试卷无法查看</legend>
|
||||
</fieldset>
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;" th:if="${data.examExaminationVO.examEnd =='1' or data.examExaminationVO.examEnd =='2' or data.examExaminationVO.examEnd =='3'}">
|
||||
<legend>得分:[[${data.score}]]</legend>
|
||||
</fieldset>
|
||||
<div class="layui-collapse" lay-filter="test" th:if="${data.examExaminationVO.examEnd =='2' or data.examExaminationVO.examEnd =='3'}">
|
||||
<div class="layui-colla-item" th:each="item:${data.examUserExaminationQuestions}">
|
||||
<h2 class="layui-colla-title">[[${itemStat.index+1}]]:[[${item.title}]]
|
||||
<span style="color: green" th:if="${item.answer==item.userAnswer}">✔️回答正确</span>
|
||||
<span style="color: red" th:if="${item.answer != item.userAnswer}">✘回答错误</span>
|
||||
</h2>
|
||||
|
||||
<div class="layui-colla-content" >
|
||||
<p th:each="qItem:${item.questionItems}">[[${qItem.number}]]:[[${qItem.content}]]</p>
|
||||
<p th:if="${data.examExaminationVO.examEnd == '3'}">正确答案[[${item.answer}]]</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="fly-footer" th:replace="web/index::cmsBottom">
|
||||
</div>
|
||||
|
||||
<script src="/web/res/layui/layui.js"></script>
|
||||
<script src="/js/jquery.min.js"></script>
|
||||
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
|
||||
document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "w.cnzz.com/c.php%3Fid%3D30088308' type='text/javascript'%3E%3C/script%3E"));</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#userexamination").addClass("layui-this")
|
||||
})
|
||||
|
||||
function del(id) {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: "/web/user/delcollectquestion",
|
||||
data: {questionId:id},
|
||||
success: function (result) {
|
||||
if (result.code != web_status.SUCCESS) {
|
||||
layer.msg(result.msg, {icon: 2});
|
||||
}else{
|
||||
window.location="/web/user/collectquestion.html"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -261,13 +261,13 @@ public class ApiExaminationController extends BaseController {
|
|||
//如果是模拟考试,考试记录新增数据
|
||||
if (examUserExaminationId == -1) {
|
||||
ExamUserExamination insert = new ExamUserExamination();
|
||||
insert.setExamExaminationId( examinationId );
|
||||
insert.setVipUserId( Integer.parseInt( userId.toString() ) );
|
||||
insert.setCreateDate( new Date() );
|
||||
insert.setExamPaperId( paperId );
|
||||
insert.setDelFlag( "0" );
|
||||
insert.setScore( 0 );
|
||||
examUserExaminationService.insertOne( insert );
|
||||
insert.setExamExaminationId(examinationId);
|
||||
insert.setVipUserId(Integer.parseInt(userId.toString()));
|
||||
insert.setCreateDate(new Date());
|
||||
insert.setExamPaperId(paperId);
|
||||
insert.setDelFlag("0");
|
||||
insert.setScore(0);
|
||||
examUserExaminationService.insertOne(insert);
|
||||
examUserExaminationId = insert.getId();
|
||||
}
|
||||
|
||||
|
|
@ -276,39 +276,39 @@ public class ApiExaminationController extends BaseController {
|
|||
HashMap<String, String> returnItem = new HashMap<>();
|
||||
String userAnswer = item.getUserAnswer();
|
||||
//存入用户回答
|
||||
if (StrUtil.isNotBlank( userAnswer )) {
|
||||
returnItem.put( "userAnswer", userAnswer );
|
||||
if (StrUtil.isNotBlank(userAnswer)) {
|
||||
returnItem.put("userAnswer", userAnswer);
|
||||
}
|
||||
Integer examQuestionId = item.getExamQuestionId();
|
||||
ExamQuestion examQuestion = examQuestionService.selectById( examQuestionId );
|
||||
ExamQuestion examQuestion = examQuestionService.selectById(examQuestionId);
|
||||
//存入正确答案
|
||||
if (StrUtil.isNotBlank( examQuestion.getAnswer() )) {
|
||||
returnItem.put( "answer", examQuestion.getAnswer() );
|
||||
if (StrUtil.isNotBlank(examQuestion.getAnswer())) {
|
||||
returnItem.put("answer", examQuestion.getAnswer());
|
||||
}
|
||||
returnItem.put( "title", examQuestion.getTitle() );
|
||||
returnItem.put( "rightWrong", "错误" );
|
||||
if (examQuestion.getAnswer().equals( userAnswer )) {
|
||||
returnItem.put("title", examQuestion.getTitle());
|
||||
returnItem.put("rightWrong", "错误");
|
||||
if (examQuestion.getAnswer().equals(userAnswer)) {
|
||||
ExamPaperQuestion examPaperQuestion = new ExamPaperQuestion();
|
||||
examPaperQuestion.setExamPaperId( paperId );
|
||||
examPaperQuestion.setExamQuestionId( examQuestionId );
|
||||
score += examPaperQuestionService.selectExamPaperQuestionList( examPaperQuestion ).get( 0 ).getScore();
|
||||
returnItem.put( "rightWrong", "正确" );
|
||||
examPaperQuestion.setExamPaperId(paperId);
|
||||
examPaperQuestion.setExamQuestionId(examQuestionId);
|
||||
score += examPaperQuestionService.selectExamPaperQuestionList(examPaperQuestion).get(0).getScore();
|
||||
returnItem.put("rightWrong", "正确");
|
||||
}
|
||||
item.setExamUserExaminationId( examUserExaminationId );
|
||||
item.setCreateDate( new Date() );
|
||||
item.setCreateBy( user.getLoginName() );
|
||||
item.setDelFlag( "0" );
|
||||
item.setId( null );
|
||||
examUserExaminationQuestionService.insertOne( item );
|
||||
data.add( returnItem );
|
||||
item.setExamUserExaminationId(examUserExaminationId);
|
||||
item.setCreateDate(new Date());
|
||||
item.setCreateBy(user.getLoginName());
|
||||
item.setDelFlag("0");
|
||||
item.setId(null);
|
||||
examUserExaminationQuestionService.insertOne(item);
|
||||
data.add(returnItem);
|
||||
}
|
||||
ExamUserExamination examUserExamination = examUserExaminationService.selectById( examUserExaminationId );
|
||||
examUserExamination.setScore( score );
|
||||
examUserExamination.setUpdateDate( new Date() );
|
||||
examUserExamination.setCreateBy( user.getLoginName() );
|
||||
examUserExaminationService.updateOneSelectiveById( examUserExamination );
|
||||
ExamUserExamination examUserExamination = examUserExaminationService.selectById(examUserExaminationId);
|
||||
examUserExamination.setScore(score);
|
||||
examUserExamination.setUpdateDate(new Date());
|
||||
examUserExamination.setCreateBy(user.getLoginName());
|
||||
examUserExaminationService.updateOneSelectiveById(examUserExamination);
|
||||
|
||||
ExamExamination examExamination = examExaminationService.selectById( examinationId );
|
||||
ExamExamination examExamination = examExaminationService.selectById(examinationId);
|
||||
String finishedPaper = examExamination.getFinishedPaper();
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.exam.domain.ExamQuestionVO;
|
||||
import com.ruoyi.exam.domain.ExamUserExaminationQuestion;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
|
||||
/**
|
||||
* 考试 服务层
|
||||
*
|
||||
|
|
@ -44,4 +47,6 @@ public interface IExamExaminationService extends AbstractBaseService<ExamExamina
|
|||
List<ExamExamination> selectEnterNameListFromWeb(Map<String, Object> map);
|
||||
|
||||
List<ExamQuestionVO> queryExaminationQuestion(ExamExamination examExamination,Integer examUserExaminationId);
|
||||
|
||||
Integer finshExamination(List<ExamUserExaminationQuestion> examUserExaminationQuestion, SysUser user, Integer examUserExaminationId, Integer examinationId, Integer paperId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.exam.service.impl;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.exam.domain.*;
|
||||
import com.ruoyi.exam.service.*;
|
||||
import com.ruoyi.framework.web.exception.base.BaseException;
|
||||
|
|
@ -9,6 +10,7 @@ import com.ruoyi.framework.web.util.ShiroUtils;
|
|||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.exam.mapper.ExamExaminationMapper;
|
||||
import com.ruoyi.common.support.Convert;
|
||||
|
|
@ -25,6 +27,9 @@ public class ExamExaminationServiceImpl extends AbstractBaseServiceImpl<ExamExam
|
|||
@Autowired
|
||||
private ExamExaminationMapper examExaminationMapper;
|
||||
|
||||
@Autowired
|
||||
private IExamExaminationService examExaminationService;
|
||||
|
||||
@Autowired
|
||||
private IExamPaperService examPaperService;
|
||||
|
||||
|
|
@ -34,6 +39,18 @@ public class ExamExaminationServiceImpl extends AbstractBaseServiceImpl<ExamExam
|
|||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
private IExamExaminationUserService examExaminationUserService;
|
||||
|
||||
@Autowired
|
||||
private IExamUserExaminationQuestionService examUserExaminationQuestionService;
|
||||
|
||||
@Autowired
|
||||
private IExamQuestionService examQuestionService;
|
||||
|
||||
@Autowired
|
||||
private IExamPaperQuestionService examPaperQuestionService;
|
||||
|
||||
@Autowired
|
||||
private IExamPaperTypeNumberService examPaperTypeNumberService;
|
||||
|
||||
|
|
@ -168,6 +185,64 @@ public class ExamExaminationServiceImpl extends AbstractBaseServiceImpl<ExamExam
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer finshExamination(List<ExamUserExaminationQuestion> examUserExaminationQuestion,SysUser user ,Integer examUserExaminationId, Integer examinationId, Integer paperId) {
|
||||
|
||||
ArrayList<Map<String, String>> data = new ArrayList<>();
|
||||
Integer userId = user.getUserId().intValue();
|
||||
//如果是模拟考试,考试记录新增数据
|
||||
if (examUserExaminationId == -1) {
|
||||
ExamUserExamination insert = new ExamUserExamination();
|
||||
insert.setExamExaminationId(examinationId);
|
||||
insert.setVipUserId(Integer.parseInt(userId.toString()));
|
||||
insert.setCreateDate(new Date());
|
||||
insert.setExamPaperId(paperId);
|
||||
insert.setDelFlag("0");
|
||||
insert.setScore(0);
|
||||
examUserExaminationService.insertOne(insert);
|
||||
examUserExaminationId = insert.getId();
|
||||
}
|
||||
|
||||
Integer score = 0;
|
||||
for (ExamUserExaminationQuestion item : examUserExaminationQuestion) {
|
||||
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)) {
|
||||
ExamPaperQuestion examPaperQuestion = new ExamPaperQuestion();
|
||||
examPaperQuestion.setExamPaperId(paperId);
|
||||
examPaperQuestion.setExamQuestionId(examQuestionId);
|
||||
score += examPaperQuestionService.selectExamPaperQuestionList(examPaperQuestion).get(0).getScore();
|
||||
returnItem.put("rightWrong", "正确");
|
||||
}
|
||||
item.setExamUserExaminationId(examUserExaminationId);
|
||||
item.setCreateDate(new Date());
|
||||
item.setCreateBy(user.getLoginName());
|
||||
item.setDelFlag("0");
|
||||
item.setId(null);
|
||||
examUserExaminationQuestionService.insertOne(item);
|
||||
data.add(returnItem);
|
||||
}
|
||||
ExamUserExamination examUserExamination = examUserExaminationService.selectById(examUserExaminationId);
|
||||
examUserExamination.setScore(score);
|
||||
examUserExamination.setUpdateDate(new Date());
|
||||
examUserExamination.setCreateBy(user.getLoginName());
|
||||
examUserExaminationService.updateOneSelectiveById(examUserExamination);
|
||||
|
||||
return examUserExaminationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询考试分页列表
|
||||
*
|
||||
|
|
@ -180,4 +255,7 @@ public class ExamExaminationServiceImpl extends AbstractBaseServiceImpl<ExamExam
|
|||
return examExaminationMapper.selectExamExaminationList(examExamination);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,9 +159,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
eqi.number,
|
||||
eqi.id as eqi_id,
|
||||
eueq.id as eueq_id,
|
||||
eq.id as eq_id
|
||||
eq.id as eq_id,
|
||||
ee.exam_end as ee_exam_end,
|
||||
ee.finished_paper as ee_finished_paper
|
||||
FROM exam_user_examination exam_user_examination
|
||||
LEFT JOIN exam_user_examination_question eueq ON exam_user_examination.id = eueq.exam_user_examination_id
|
||||
INNER JOIN exam_examination ee on exam_user_examination.exam_examination_id = ee.id
|
||||
INNER JOIN exam_question eq on eueq.exam_question_id = eq.id
|
||||
INNER JOIN exam_question_item eqi ON eq.id =eqi.exam_question_id
|
||||
WHERE exam_user_examination.id = #{id}
|
||||
|
|
@ -182,7 +185,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateDate" column="update_date" />
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
|
||||
<association property="examExaminationVO" javaType="com.ruoyi.exam.domain.ExamExaminationVO">
|
||||
<result property="examEnd" column="ee_exam_End" />
|
||||
<result property="finishedPaper" column="ee_finished_paper" />
|
||||
</association>
|
||||
|
||||
<collection property="examUserExaminationQuestions" ofType="com.ruoyi.exam.domain.ExamUserExaminationQuestionVO">
|
||||
<result property="id" column="eueq_id" />
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
join train_course c on c.id=o.train_course_id
|
||||
<where>
|
||||
<if test="id != null and id != '' "> and o.id = #{id}</if>
|
||||
<if test="vipUserId != null and vipUserId != '' "> and o.vip_user_id = #{vipUserId}</if>
|
||||
<if test="vipUserName != null "> and u.user_name like CONCAT('%',#{vipUserName},'%')</if>
|
||||
<if test="trainCourseName != null "> and c.name like CONCAT('%',#{trainCourseName},'%')</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and o.del_flag = #{delFlag}</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue