考核评估-考题自动判断
This commit is contained in:
parent
505b55a351
commit
0328bac4c8
@ -6,11 +6,14 @@ import com.inspur.common.core.page.TableDataInfo;
|
|||||||
import com.inspur.examine.domain.ExamAttestation;
|
import com.inspur.examine.domain.ExamAttestation;
|
||||||
import com.inspur.examine.domain.ExamInfo;
|
import com.inspur.examine.domain.ExamInfo;
|
||||||
import com.inspur.examine.domain.ExamPaperInfo;
|
import com.inspur.examine.domain.ExamPaperInfo;
|
||||||
|
import com.inspur.examine.dto.SubmitExamDTO;
|
||||||
import com.inspur.examine.service.IMyExamineService;
|
import com.inspur.examine.service.IMyExamineService;
|
||||||
|
import com.inspur.examine.vo.MyExamVO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,8 +66,8 @@ public class ExamMyExamineController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('examine:myExamine:getExam')")
|
@PreAuthorize("@ss.hasPermi('examine:myExamine:getExam')")
|
||||||
@GetMapping("/getExam/{id}")
|
@GetMapping("/getExam/{id}")
|
||||||
public void getExam(@PathVariable("id") String id){
|
public MyExamVO getExam(@PathVariable("id") String id){
|
||||||
//todo: 获取考试信息以及试题
|
return myExamineService.getExam(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,4 +94,15 @@ public class ExamMyExamineController extends BaseController {
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交考试
|
||||||
|
*
|
||||||
|
* @param submitExamDTO 考试及答案
|
||||||
|
*/
|
||||||
|
@PostMapping("/submitExam")
|
||||||
|
@PreAuthorize("@ss.hasPermi('examine:myExamine:submitExam')")
|
||||||
|
public AjaxResult submitExam(@Valid @RequestBody SubmitExamDTO submitExamDTO) {
|
||||||
|
return toAjax(myExamineService.submitExam(submitExamDTO));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -67,4 +67,9 @@ public class ExamAttestation {
|
|||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date attestationTime;
|
private Date attestationTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相关考试
|
||||||
|
*/
|
||||||
|
private String examName;
|
||||||
}
|
}
|
||||||
|
@ -90,4 +90,9 @@ public class ExamPaperInfo {
|
|||||||
* 总分数
|
* 总分数
|
||||||
*/
|
*/
|
||||||
private BigDecimal totalScore;
|
private BigDecimal totalScore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过分数
|
||||||
|
*/
|
||||||
|
private BigDecimal passScore;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.inspur.examine.dto;
|
||||||
|
|
||||||
|
import com.inspur.common.annotation.Excel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正确答案
|
||||||
|
*
|
||||||
|
* @Author xusd
|
||||||
|
* @Date 2024/5/10 15:14
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class CorrectAnswerDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试卷试题表id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题类型 0 单选,1 多选,2 判断
|
||||||
|
*/
|
||||||
|
private String questionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题答案
|
||||||
|
*/
|
||||||
|
private String questionAnswer;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.inspur.examine.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交卷
|
||||||
|
*
|
||||||
|
* @Author xusd
|
||||||
|
* @Date 2024/5/10 10:59
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class SubmitExamDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试卷id
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "试卷id不能为空")
|
||||||
|
private String paperId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试开始时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
@NotNull(message = "考试开始时间不能为空")
|
||||||
|
private Date examStartTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试结束时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
@NotNull(message = "考试结束时间不能为空")
|
||||||
|
private Date examEndTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 答案
|
||||||
|
*/
|
||||||
|
@NotEmpty
|
||||||
|
private List<SubmitExamPaperQuestionDTO> answerList;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.inspur.examine.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 答案
|
||||||
|
*
|
||||||
|
* @Author xusd
|
||||||
|
* @Date 2024/5/10 11:02
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class SubmitExamPaperQuestionDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试卷试题id
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "试卷试题id不能为空")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考生答案
|
||||||
|
*/
|
||||||
|
private String examineAnswer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否正确(0:正确,1:错误)
|
||||||
|
*/
|
||||||
|
private String isSure;
|
||||||
|
|
||||||
|
}
|
@ -2,6 +2,7 @@ package com.inspur.examine.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.inspur.examine.domain.ExamPaperQuestion;
|
import com.inspur.examine.domain.ExamPaperQuestion;
|
||||||
|
import com.inspur.examine.dto.SubmitExamPaperQuestionDTO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,4 +69,13 @@ public interface ExamPaperQuestionMapper
|
|||||||
* @param paperQuestionList 数据
|
* @param paperQuestionList 数据
|
||||||
*/
|
*/
|
||||||
void batchInsertPaperQuestion(@Param("paperQuestionList") List<ExamPaperQuestion> paperQuestionList);
|
void batchInsertPaperQuestion(@Param("paperQuestionList") List<ExamPaperQuestion> paperQuestionList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改考生答案和是否答对
|
||||||
|
*
|
||||||
|
* @param answerList 数据
|
||||||
|
* @Author xusd
|
||||||
|
* @Date 11:33 2024/5/10
|
||||||
|
*/
|
||||||
|
void batchUpdatePaperQuestion(@Param("answerList") List<SubmitExamPaperQuestionDTO> answerList);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,9 @@ package com.inspur.examine.mapper;
|
|||||||
import com.inspur.examine.domain.ExamAttestation;
|
import com.inspur.examine.domain.ExamAttestation;
|
||||||
import com.inspur.examine.domain.ExamInfo;
|
import com.inspur.examine.domain.ExamInfo;
|
||||||
import com.inspur.examine.domain.ExamPaperInfo;
|
import com.inspur.examine.domain.ExamPaperInfo;
|
||||||
|
import com.inspur.examine.dto.CorrectAnswerDTO;
|
||||||
|
import com.inspur.examine.vo.MyExamPaperQuestionVO;
|
||||||
|
import com.inspur.examine.vo.MyExamVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -31,4 +34,26 @@ public interface MyExamineMapper {
|
|||||||
* 查询我的认证管理列表
|
* 查询我的认证管理列表
|
||||||
*/
|
*/
|
||||||
List<ExamAttestation> attestationList(ExamAttestation examAttestation);
|
List<ExamAttestation> attestationList(ExamAttestation examAttestation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取考试信息
|
||||||
|
*/
|
||||||
|
MyExamVO getExam(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据考试id获取考试题
|
||||||
|
* @param paperId 考试id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<MyExamPaperQuestionVO> selectPaperQuestionNoAnswerListByPaperId(String paperId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正确答案
|
||||||
|
*
|
||||||
|
* @Author xusd
|
||||||
|
* @Date 15:20 2024/5/10
|
||||||
|
* @param paperId 考试id
|
||||||
|
* @return java.util.List<com.inspur.examine.dto.CorrectAnswerDTO>
|
||||||
|
*/
|
||||||
|
List<CorrectAnswerDTO> selectPaperQuestionHaveAnswerListByPaperId(String paperId);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.inspur.examine.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.inspur.examine.domain.ExamPaperQuestion;
|
import com.inspur.examine.domain.ExamPaperQuestion;
|
||||||
|
import com.inspur.examine.dto.SubmitExamPaperQuestionDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 试卷试题Service接口
|
* 试卷试题Service接口
|
||||||
@ -67,4 +68,13 @@ public interface IExamPaperQuestionService
|
|||||||
* @param paperQuestionList 数据
|
* @param paperQuestionList 数据
|
||||||
*/
|
*/
|
||||||
void batchInsertPaperQuestion(List<ExamPaperQuestion> paperQuestionList);
|
void batchInsertPaperQuestion(List<ExamPaperQuestion> paperQuestionList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改考生答案和是否答对
|
||||||
|
*
|
||||||
|
* @param answerList 数据
|
||||||
|
* @Author xusd
|
||||||
|
* @Date 11:33 2024/5/10
|
||||||
|
*/
|
||||||
|
void batchUpdatePaperQuestion(List<SubmitExamPaperQuestionDTO> answerList);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.inspur.examine.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.inspur.examine.domain.ExamQuestionBank;
|
import com.inspur.examine.domain.ExamQuestionBank;
|
||||||
|
import com.inspur.examine.dto.CorrectAnswerDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 试题库Service接口
|
* 试题库Service接口
|
||||||
|
@ -4,6 +4,8 @@ import com.inspur.common.core.domain.AjaxResult;
|
|||||||
import com.inspur.examine.domain.ExamAttestation;
|
import com.inspur.examine.domain.ExamAttestation;
|
||||||
import com.inspur.examine.domain.ExamInfo;
|
import com.inspur.examine.domain.ExamInfo;
|
||||||
import com.inspur.examine.domain.ExamPaperInfo;
|
import com.inspur.examine.domain.ExamPaperInfo;
|
||||||
|
import com.inspur.examine.dto.SubmitExamDTO;
|
||||||
|
import com.inspur.examine.vo.MyExamVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -39,4 +41,16 @@ public interface IMyExamineService {
|
|||||||
* 查询我的认证管理列表
|
* 查询我的认证管理列表
|
||||||
*/
|
*/
|
||||||
List<ExamAttestation> attestationList(ExamAttestation examAttestation);
|
List<ExamAttestation> attestationList(ExamAttestation examAttestation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取考试信息以及试题
|
||||||
|
*/
|
||||||
|
MyExamVO getExam(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交考试
|
||||||
|
*
|
||||||
|
* @param submitExamDTO 考试及答案
|
||||||
|
*/
|
||||||
|
int submitExam(SubmitExamDTO submitExamDTO);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.inspur.examine.service.impl;
|
package com.inspur.examine.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.inspur.examine.dto.SubmitExamPaperQuestionDTO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.inspur.examine.mapper.ExamPaperQuestionMapper;
|
import com.inspur.examine.mapper.ExamPaperQuestionMapper;
|
||||||
@ -102,4 +104,16 @@ public class ExamPaperQuestionServiceImpl implements IExamPaperQuestionService
|
|||||||
public void batchInsertPaperQuestion(List<ExamPaperQuestion> paperQuestionList) {
|
public void batchInsertPaperQuestion(List<ExamPaperQuestion> paperQuestionList) {
|
||||||
examPaperQuestionMapper.batchInsertPaperQuestion(paperQuestionList);
|
examPaperQuestionMapper.batchInsertPaperQuestion(paperQuestionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改考生答案和是否答对
|
||||||
|
*
|
||||||
|
* @param answerList 数据
|
||||||
|
* @Author xusd
|
||||||
|
* @Date 11:33 2024/5/10
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void batchUpdatePaperQuestion(List<SubmitExamPaperQuestionDTO> answerList) {
|
||||||
|
examPaperQuestionMapper.batchUpdatePaperQuestion(answerList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,18 @@ import com.inspur.common.utils.SecurityUtils;
|
|||||||
import com.inspur.common.utils.StringUtils;
|
import com.inspur.common.utils.StringUtils;
|
||||||
import com.inspur.common.utils.uuid.IdUtils;
|
import com.inspur.common.utils.uuid.IdUtils;
|
||||||
import com.inspur.examine.domain.*;
|
import com.inspur.examine.domain.*;
|
||||||
|
import com.inspur.examine.dto.CorrectAnswerDTO;
|
||||||
|
import com.inspur.examine.dto.SubmitExamDTO;
|
||||||
|
import com.inspur.examine.dto.SubmitExamPaperQuestionDTO;
|
||||||
import com.inspur.examine.mapper.MyExamineMapper;
|
import com.inspur.examine.mapper.MyExamineMapper;
|
||||||
import com.inspur.examine.service.*;
|
import com.inspur.examine.service.*;
|
||||||
|
import com.inspur.examine.vo.MyExamPaperQuestionVO;
|
||||||
|
import com.inspur.examine.vo.MyExamVO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -38,6 +44,9 @@ public class MyExamineServiceImpl implements IMyExamineService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IExamPaperQuestionService examPaperQuestionService;
|
private IExamPaperQuestionService examPaperQuestionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamAttestationPeopleService attestationPeopleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询考试信息列表
|
* 查询考试信息列表
|
||||||
*/
|
*/
|
||||||
@ -203,4 +212,130 @@ public class MyExamineServiceImpl implements IMyExamineService {
|
|||||||
examAttestation.setUserId(SecurityUtils.getUserId());
|
examAttestation.setUserId(SecurityUtils.getUserId());
|
||||||
return myExamineMapper.attestationList(examAttestation);
|
return myExamineMapper.attestationList(examAttestation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取考试信息以及试题
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public MyExamVO getExam(String id) {
|
||||||
|
MyExamVO myExam = myExamineMapper.getExam(id);
|
||||||
|
if (Objects.isNull(myExam)){
|
||||||
|
throw new ServiceException("未查询到考试信息");
|
||||||
|
}
|
||||||
|
//考试题
|
||||||
|
List<MyExamPaperQuestionVO> allPaperQuestionList = myExamineMapper.selectPaperQuestionNoAnswerListByPaperId(id);
|
||||||
|
if (StringUtils.isEmpty(allPaperQuestionList)){
|
||||||
|
throw new ServiceException("未查询到考试题目");
|
||||||
|
}
|
||||||
|
//试题类型 0 单选,1 多选,2 判断
|
||||||
|
Map<String, List<MyExamPaperQuestionVO>> allPaperQuestionMap = allPaperQuestionList.stream().collect(Collectors.groupingBy(MyExamPaperQuestionVO::getQuestionType));
|
||||||
|
//单选
|
||||||
|
myExam.setSingleChoiceList(allPaperQuestionMap.get("0"));
|
||||||
|
//多选
|
||||||
|
myExam.setMultiChoiceList(allPaperQuestionMap.get("1"));
|
||||||
|
//判断
|
||||||
|
myExam.setJudgeList(allPaperQuestionMap.get("2"));
|
||||||
|
return myExam;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交考试
|
||||||
|
*
|
||||||
|
* @param submitExamDTO 考试及答案
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int submitExam(SubmitExamDTO submitExamDTO) {
|
||||||
|
//获取考试各个类型试题分数
|
||||||
|
ExamPaperInfo paperInfo = examPaperInfoService.selectExamPaperInfoById(submitExamDTO.getPaperId());
|
||||||
|
if (Objects.isNull(paperInfo)){
|
||||||
|
throw new ServiceException("未查询到考生考试信息");
|
||||||
|
}
|
||||||
|
if (!"0".equals(paperInfo.getStatus())){
|
||||||
|
throw new ServiceException("已参与过考试,请勿重复参加");
|
||||||
|
}
|
||||||
|
ExamInfo examInfo = examInfoService.selectExamInfoById(paperInfo.getExamId());
|
||||||
|
if (Objects.isNull(examInfo)){
|
||||||
|
throw new ServiceException("未查询到考试信息");
|
||||||
|
}
|
||||||
|
//计算成绩
|
||||||
|
//考生答案
|
||||||
|
List<SubmitExamPaperQuestionDTO> userAnswerList = submitExamDTO.getAnswerList();
|
||||||
|
//正确答案
|
||||||
|
List<CorrectAnswerDTO> correctAnswerList = myExamineMapper.selectPaperQuestionHaveAnswerListByPaperId(submitExamDTO.getPaperId());
|
||||||
|
if (StringUtils.isEmpty(correctAnswerList)){
|
||||||
|
throw new ServiceException("未查询到考试试题信息");
|
||||||
|
}
|
||||||
|
//判断答案是否正确,未作答也是回答错误
|
||||||
|
Map<String, CorrectAnswerDTO> correctAnswerMap = correctAnswerList.stream().collect(Collectors.toMap(CorrectAnswerDTO::getId, item->item));
|
||||||
|
//考试关联证书
|
||||||
|
String attestationId = examInfo.getAttestationId();
|
||||||
|
//通过分数
|
||||||
|
BigDecimal passScore = examInfo.getPassScore();
|
||||||
|
//单选题分数
|
||||||
|
BigDecimal singleChoiceScore = examInfo.getSingleChoiceScore();
|
||||||
|
//多选题分数
|
||||||
|
BigDecimal multipleChoiceScore = examInfo.getMultipleChoiceScore();
|
||||||
|
//判断题分数
|
||||||
|
BigDecimal judgeScore = examInfo.getJudgeScore();
|
||||||
|
//单选题回答正确数量
|
||||||
|
int singleChoice = 0;
|
||||||
|
//多选题回答正确数量
|
||||||
|
int multipleChoice = 0;
|
||||||
|
//判断题回答正确数量
|
||||||
|
int judge = 0;
|
||||||
|
for (SubmitExamPaperQuestionDTO item : userAnswerList) {
|
||||||
|
//是否正确 0:正确,1:错误
|
||||||
|
//试题类型 0 单选,1 多选,2 判断
|
||||||
|
CorrectAnswerDTO correctAnswerDTO = correctAnswerMap.get(item.getId());
|
||||||
|
if (Objects.nonNull(correctAnswerDTO)){
|
||||||
|
String correctAnswer = correctAnswerDTO.getQuestionAnswer();
|
||||||
|
String questionType = correctAnswerDTO.getQuestionType();
|
||||||
|
if (StringUtils.isEmpty(item.getExamineAnswer())){
|
||||||
|
item.setIsSure("1");
|
||||||
|
}else {
|
||||||
|
if (correctAnswer.replace("\\s","").equals(item.getExamineAnswer().replace("\\s",""))){
|
||||||
|
item.setIsSure("0");
|
||||||
|
if ("0".equals(questionType)){
|
||||||
|
singleChoice++;
|
||||||
|
}else if ("1".equals(questionType)){
|
||||||
|
multipleChoice++;
|
||||||
|
}else if ("2".equals(questionType)){
|
||||||
|
judge++;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
item.setIsSure("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//考生分数
|
||||||
|
BigDecimal score = (singleChoiceScore.multiply(new BigDecimal(singleChoice))).add(multipleChoiceScore.multiply(new BigDecimal(multipleChoice))).add(judgeScore.multiply(new BigDecimal(judge)));
|
||||||
|
//批量设置答案和是否答对
|
||||||
|
examPaperQuestionService.batchUpdatePaperQuestion(userAnswerList);
|
||||||
|
ExamPaperInfo examPaperInfo = new ExamPaperInfo();
|
||||||
|
examPaperInfo.setId(submitExamDTO.getPaperId());
|
||||||
|
examPaperInfo.setScore(score);
|
||||||
|
//状态 0 未作答,1 未通过,2通过
|
||||||
|
if (score.compareTo(passScore) < 0){
|
||||||
|
//未通过
|
||||||
|
examPaperInfo.setStatus("1");
|
||||||
|
}else {
|
||||||
|
//通过
|
||||||
|
examPaperInfo.setStatus("2");
|
||||||
|
//通过后判断考试是否关联证书,如果关联则新增证书关联信息
|
||||||
|
if (StringUtils.isNotEmpty(attestationId)){
|
||||||
|
ExamAttestationPeople examAttestationPeople = new ExamAttestationPeople();
|
||||||
|
examAttestationPeople.setId(IdUtils.fastSimpleUUID());
|
||||||
|
examAttestationPeople.setAttestationId(attestationId);
|
||||||
|
examAttestationPeople.setPeopleId(SecurityUtils.getUserId());
|
||||||
|
examAttestationPeople.setAttestationTime(new Date());
|
||||||
|
examAttestationPeople.setTenantId(SecurityUtils.getTenantId());
|
||||||
|
attestationPeopleService.insertExamAttestationPeople(examAttestationPeople);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
examPaperInfo.setExamStartTime(submitExamDTO.getExamStartTime());
|
||||||
|
examPaperInfo.setExamEndTime(submitExamDTO.getExamEndTime());
|
||||||
|
return examPaperInfoService.updateExamPaperInfo(examPaperInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.inspur.examine.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的考试试题返回对象
|
||||||
|
*
|
||||||
|
* @Author xusd
|
||||||
|
* @Date 2024/5/10 10:31
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class MyExamPaperQuestionVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试卷试题表id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题类型 0 单选,1 多选,2 判断
|
||||||
|
*/
|
||||||
|
private String questionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题题目
|
||||||
|
*/
|
||||||
|
private String questionTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题选项
|
||||||
|
*/
|
||||||
|
private String questionOptions;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
package com.inspur.examine.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的试卷
|
||||||
|
*
|
||||||
|
* @Author xusd
|
||||||
|
* @Date 2024/5/9 17:34
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class MyExamVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试卷id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试名称
|
||||||
|
*/
|
||||||
|
private String examName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考生名称
|
||||||
|
*/
|
||||||
|
private String examineName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 证书名称
|
||||||
|
*/
|
||||||
|
private String attestationName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试时长
|
||||||
|
*/
|
||||||
|
private Integer examDuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试规则
|
||||||
|
*/
|
||||||
|
private String examRules;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总分数
|
||||||
|
*/
|
||||||
|
private BigDecimal totalScore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过分数
|
||||||
|
*/
|
||||||
|
private BigDecimal passScore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单选题题目
|
||||||
|
*/
|
||||||
|
private List<MyExamPaperQuestionVO> singleChoiceList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多选题题目
|
||||||
|
*/
|
||||||
|
private List<MyExamPaperQuestionVO> multiChoiceList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断题题目
|
||||||
|
*/
|
||||||
|
private List<MyExamPaperQuestionVO> judgeList;
|
||||||
|
|
||||||
|
}
|
@ -63,6 +63,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="batchUpdatePaperQuestion">
|
||||||
|
update
|
||||||
|
exam_paper_question
|
||||||
|
set
|
||||||
|
<trim prefix="examine_answer = case id" suffix="end">
|
||||||
|
<foreach collection="answerList" item="item">
|
||||||
|
when #{item.id} then #{item.examineAnswer}
|
||||||
|
</foreach>
|
||||||
|
</trim>
|
||||||
|
<trim prefix=",is_sure = case id" suffix="end">
|
||||||
|
<foreach collection="answerList" item="item">
|
||||||
|
when #{item.id} then #{item.isSure}
|
||||||
|
</foreach>
|
||||||
|
</trim>
|
||||||
|
where
|
||||||
|
id in
|
||||||
|
<foreach collection="answerList" item="item" separator="," open="(" close=")">
|
||||||
|
#{item.id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteExamPaperQuestionById" parameterType="String">
|
<delete id="deleteExamPaperQuestionById" parameterType="String">
|
||||||
delete from exam_paper_question where id = #{id}
|
delete from exam_paper_question where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
<result property="examineName" column="nick_name" />
|
<result property="examineName" column="nick_name" />
|
||||||
<result property="examDuration" column="exam_duration" />
|
<result property="examDuration" column="exam_duration" />
|
||||||
<result property="totalScore" column="total_score" />
|
<result property="totalScore" column="total_score" />
|
||||||
|
<result property="passScore" column="pass_score" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="com.inspur.examine.domain.ExamAttestation" id="ExamAttestationResult">
|
<resultMap type="com.inspur.examine.domain.ExamAttestation" id="ExamAttestationResult">
|
||||||
@ -50,6 +51,7 @@
|
|||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="peopleCount" column="people_count" />
|
<result property="peopleCount" column="people_count" />
|
||||||
<result property="attestationTime" column="attestation_time" />
|
<result property="attestationTime" column="attestation_time" />
|
||||||
|
<result property="examName" column="exam_name" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="examList" resultMap="ExamInfoResult">
|
<select id="examList" resultMap="ExamInfoResult">
|
||||||
@ -124,7 +126,8 @@
|
|||||||
epi.tenant_id,
|
epi.tenant_id,
|
||||||
su.nick_name,
|
su.nick_name,
|
||||||
ei.exam_name,
|
ei.exam_name,
|
||||||
ei.total_score
|
ei.total_score,
|
||||||
|
ei.pass_score
|
||||||
FROM
|
FROM
|
||||||
exam_paper_info AS epi
|
exam_paper_info AS epi
|
||||||
LEFT JOIN sys_user AS su ON su.user_id = epi.examine_id
|
LEFT JOIN sys_user AS su ON su.user_id = epi.examine_id
|
||||||
@ -145,10 +148,12 @@
|
|||||||
ea.attestation_name,
|
ea.attestation_name,
|
||||||
ea.attestation_unit,
|
ea.attestation_unit,
|
||||||
ea.attestation_info,
|
ea.attestation_info,
|
||||||
eap.attestation_time
|
eap.attestation_time,
|
||||||
|
ei.exam_name
|
||||||
FROM
|
FROM
|
||||||
exam_attestation_people AS eap
|
exam_attestation_people AS eap
|
||||||
JOIN exam_attestation AS ea ON eap.attestation_id = ea.id
|
JOIN exam_attestation AS ea ON eap.attestation_id = ea.id
|
||||||
|
LEFT JOIN exam_info as ei on ei.attestation_id = ea.id
|
||||||
<where>
|
<where>
|
||||||
and eap.people_id = #{userId}
|
and eap.people_id = #{userId}
|
||||||
<if test="tenantId != null and tenantId != ''"> and eap.tenant_id = #{tenantId}</if>
|
<if test="tenantId != null and tenantId != ''"> and eap.tenant_id = #{tenantId}</if>
|
||||||
@ -159,4 +164,50 @@
|
|||||||
order by eap.attestation_time desc
|
order by eap.attestation_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getExam" resultType="com.inspur.examine.vo.MyExamVO">
|
||||||
|
SELECT
|
||||||
|
epi.id,
|
||||||
|
ei.exam_name AS examName,
|
||||||
|
su.nick_name AS examineName,
|
||||||
|
ea.attestation_name AS attestationName,
|
||||||
|
ei.exam_duration AS examDuration,
|
||||||
|
ei.exam_rules AS examRules,
|
||||||
|
ei.total_score AS totalScore,
|
||||||
|
ei.pass_score AS passScore
|
||||||
|
FROM
|
||||||
|
exam_paper_info AS epi
|
||||||
|
LEFT JOIN exam_info AS ei ON epi.exam_id = ei.id
|
||||||
|
LEFT JOIN sys_user AS su ON epi.examine_id = su.user_id
|
||||||
|
LEFT JOIN exam_attestation AS ea ON ei.attestation_id = ea.id
|
||||||
|
WHERE
|
||||||
|
epi.id = '38d240be52914ddd855054c183f6f0a3'
|
||||||
|
AND epi.`status` = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPaperQuestionNoAnswerListByPaperId" resultType="com.inspur.examine.vo.MyExamPaperQuestionVO">
|
||||||
|
SELECT
|
||||||
|
epq.id,
|
||||||
|
eqb.question_type as questionType,
|
||||||
|
eqb.question_title as questionTitle,
|
||||||
|
eqb.question_options as questionOptions
|
||||||
|
FROM
|
||||||
|
exam_paper_question AS epq
|
||||||
|
LEFT JOIN exam_question_bank AS eqb ON epq.question_id = eqb.id
|
||||||
|
WHERE
|
||||||
|
epq.paper_id = #{paperId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPaperQuestionHaveAnswerListByPaperId"
|
||||||
|
resultType="com.inspur.examine.dto.CorrectAnswerDTO">
|
||||||
|
SELECT
|
||||||
|
epq.id,
|
||||||
|
eqb.question_type as questionType,
|
||||||
|
eqb.question_answer as questionAnswer
|
||||||
|
FROM
|
||||||
|
exam_paper_question AS epq
|
||||||
|
LEFT JOIN exam_question_bank AS eqb ON epq.question_id = eqb.id
|
||||||
|
WHERE
|
||||||
|
epq.paper_id = #{paperId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -155,8 +155,9 @@
|
|||||||
<el-table-column label="考生名称" align="center" prop="examineName" />
|
<el-table-column label="考生名称" align="center" prop="examineName" />
|
||||||
<el-table-column label="考试开始时间" align="center" prop="examStartTime"/>
|
<el-table-column label="考试开始时间" align="center" prop="examStartTime"/>
|
||||||
<el-table-column label="考试结束时间" align="center" prop="examEndTime"/>
|
<el-table-column label="考试结束时间" align="center" prop="examEndTime"/>
|
||||||
<el-table-column label="考试分数" align="center" prop="score" />
|
<el-table-column label="答题分数" align="center" prop="score" />
|
||||||
<el-table-column label="满分分数" align="center" prop="totalScore" />
|
<el-table-column label="满分分数" align="center" prop="totalScore" />
|
||||||
|
<el-table-column label="通过分数" align="center" prop="passScore" />
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.examine_result" :value="scope.row.status"/>
|
<dict-tag :options="dict.type.examine_result" :value="scope.row.status"/>
|
||||||
@ -216,6 +217,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
<el-table v-loading="attestationLoading" :data="attestationList">
|
<el-table v-loading="attestationLoading" :data="attestationList">
|
||||||
<el-table-column label="认证名称" align="center" prop="attestationName" />
|
<el-table-column label="认证名称" align="center" prop="attestationName" />
|
||||||
|
<el-table-column label="相关考试" align="center" prop="examName" />
|
||||||
<el-table-column label="发布单位" align="center" prop="attestationUnit" />
|
<el-table-column label="发布单位" align="center" prop="attestationUnit" />
|
||||||
<el-table-column label="认证说明" align="center" prop="attestationInfo" />
|
<el-table-column label="认证说明" align="center" prop="attestationInfo" />
|
||||||
<el-table-column label="认证时间" align="center" prop="attestationTime" />
|
<el-table-column label="认证时间" align="center" prop="attestationTime" />
|
||||||
|
Loading…
Reference in New Issue
Block a user