|
|
|
@ -5,15 +5,15 @@ import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.sztzjy.financial_bigdata.config.Constant;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.*;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryExamDetailDto;
|
|
|
|
|
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto;
|
|
|
|
|
import com.sztzjy.financial_bigdata.mapper.StuErrorMapper;
|
|
|
|
|
import com.sztzjy.financial_bigdata.mapper.StuTheoryExamMapper;
|
|
|
|
|
import com.sztzjy.financial_bigdata.mapper.SysObjectiveQuestionMapper;
|
|
|
|
|
import com.sztzjy.financial_bigdata.mapper.*;
|
|
|
|
|
import com.sztzjy.financial_bigdata.service.stu.ITheoryTestService;
|
|
|
|
|
import com.sztzjy.financial_bigdata.util.PageUtil;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@ -24,10 +24,15 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
|
SysObjectiveQuestionMapper objectiveQuestionMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
StuErrorMapper errorMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
StuUserMapper userMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
StuTheoryRecordMapper theoryRecordMapper;
|
|
|
|
|
|
|
|
|
|
//开始考试 1 先查询考试时间最近的一堂考试 判断是否超过2小时 如果没超过 根据理论考试表中的题目ID和答案进行回显
|
|
|
|
|
// 如果超过了两小时 定时方法算分将数据保存到理论考试表和理论记录表中 如果根据userid查询理论记录表中数据未null 则需要创建
|
|
|
|
|
// 之前没有进行考试 从客观题库表中查询 35道单选,每题2分,5道多选每题4分,10道判断每题1分 并将id保存至理论考试表中
|
|
|
|
|
// 注意 开始考试后 要生成理论记录表基础数据
|
|
|
|
|
@Override
|
|
|
|
|
public List<SysObjectiveQuestion> startTheoryTest(String userId) {
|
|
|
|
|
StuTheoryExamExample example = new StuTheoryExamExample();
|
|
|
|
@ -36,6 +41,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
|
List<StuTheoryExamWithBLOBs> stuTheoryExams = theoryExamMapper.selectByExampleWithBLOBs(example);
|
|
|
|
|
if (stuTheoryExams.isEmpty()) { //之前没有进行考试
|
|
|
|
|
List<SysObjectiveQuestion> objectiveQuestionList = GenerateTest(userId);
|
|
|
|
|
GenerateTheoryRecordFirst(userId);
|
|
|
|
|
return objectiveQuestionList;
|
|
|
|
|
} else { //根据考试时间排序 查询最近的一条
|
|
|
|
|
StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0);
|
|
|
|
@ -45,21 +51,21 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
|
List<SysObjectiveQuestion> objectiveQuestionList = GenerateTest(userId);
|
|
|
|
|
return objectiveQuestionList;
|
|
|
|
|
} else { //在两个小时内 返回最近的一条试卷
|
|
|
|
|
List<SysObjectiveQuestion> returnQuestionList=new ArrayList();
|
|
|
|
|
List<SysObjectiveQuestion> returnQuestionList = new ArrayList();
|
|
|
|
|
String singleIds = stuTheoryExam.getSingleIds();
|
|
|
|
|
String multipleIds = stuTheoryExam.getMultipleIds();
|
|
|
|
|
String judgeIds = stuTheoryExam.getJudgeIds();
|
|
|
|
|
List<String> singleIdList = Arrays.asList(singleIds);
|
|
|
|
|
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", "));
|
|
|
|
|
for (int i = 0; i < singleIdList.size(); i++) {
|
|
|
|
|
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(singleIdList.get(i));
|
|
|
|
|
returnQuestionList.add(objectiveQuestion);
|
|
|
|
|
}
|
|
|
|
|
List<String> multipleIdList = Arrays.asList(multipleIds);
|
|
|
|
|
List<String> multipleIdList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", "));
|
|
|
|
|
for (int i = 0; i < multipleIdList.size(); i++) {
|
|
|
|
|
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(multipleIdList.get(i));
|
|
|
|
|
returnQuestionList.add(objectiveQuestion);
|
|
|
|
|
}
|
|
|
|
|
List<String> judgeIdList = Arrays.asList(judgeIds);
|
|
|
|
|
List<String> judgeIdList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", "));
|
|
|
|
|
for (int i = 0; i < judgeIdList.size(); i++) {
|
|
|
|
|
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(judgeIdList.get(i));
|
|
|
|
|
returnQuestionList.add(objectiveQuestion);
|
|
|
|
@ -69,6 +75,54 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//第一次生成理论考试记录数据 先判断是否生成过理论考试记录数据
|
|
|
|
|
public void GenerateTheoryRecordFirst(String userId){
|
|
|
|
|
StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId);
|
|
|
|
|
if(record==null){
|
|
|
|
|
StuUser stuUser = userMapper.selectByPrimaryKey(userId);
|
|
|
|
|
StuTheoryRecord stuTheoryRecord = new StuTheoryRecord();
|
|
|
|
|
stuTheoryRecord.setUserId(userId);
|
|
|
|
|
stuTheoryRecord.setSchoolId(stuUser.getSchoolId());
|
|
|
|
|
stuTheoryRecord.setClassId(stuUser.getClassId());
|
|
|
|
|
stuTheoryRecord.setName(stuUser.getName());
|
|
|
|
|
stuTheoryRecord.setStudentId(stuUser.getStudentId());
|
|
|
|
|
stuTheoryRecord.setExamCount(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateTheoryRecord(String userId,BigDecimal score,Integer examDuration){
|
|
|
|
|
StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId);
|
|
|
|
|
if(record!=null){
|
|
|
|
|
record.setExamCount(record.getExamCount()+1);
|
|
|
|
|
if(record.getHighestScore()==null){
|
|
|
|
|
record.setHighestScore(score);
|
|
|
|
|
}else {
|
|
|
|
|
if(record.getHighestScore().compareTo(score)<0){
|
|
|
|
|
record.setHighestScore(score);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(record.getLowestScore()==null){
|
|
|
|
|
record.setLowestScore(score);
|
|
|
|
|
}else {
|
|
|
|
|
if(record.getLowestScore().compareTo(score)>0){
|
|
|
|
|
record.setLowestScore(score);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(record.getTotalDuration()==null){
|
|
|
|
|
record.setTotalDuration(examDuration);
|
|
|
|
|
}else {
|
|
|
|
|
record.setTotalDuration(examDuration+record.getTotalDuration());
|
|
|
|
|
}
|
|
|
|
|
if(record.getAverageScore()==null){
|
|
|
|
|
record.setAverageScore(score);
|
|
|
|
|
}else {
|
|
|
|
|
Integer examCount = record.getExamCount();
|
|
|
|
|
BigDecimal averageScore = record.getAverageScore();
|
|
|
|
|
BigDecimal multiply = averageScore.multiply(BigDecimal.valueOf(examCount));
|
|
|
|
|
multiply.add(score).divide(BigDecimal.valueOf(examCount).add(BigDecimal.valueOf(1))).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//随机生成100分题目
|
|
|
|
@ -102,13 +156,14 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//交卷后 更新理论考试记录数据
|
|
|
|
|
@Override
|
|
|
|
|
public int endTheoryTest(StuTheoryTestDto theoryTestDto) {
|
|
|
|
|
StuTheoryExamExample example = new StuTheoryExamExample();
|
|
|
|
|
example.createCriteria().andUserIdEqualTo(theoryTestDto.getUserId());
|
|
|
|
|
example.setOrderByClause("exam_time DESC");
|
|
|
|
|
List<StuTheoryExamWithBLOBs> stuTheoryExams = theoryExamMapper.selectByExampleWithBLOBs(example);
|
|
|
|
|
StuTheoryExamWithBLOBs stuTheoryExam= stuTheoryExams.get(0);
|
|
|
|
|
StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0);
|
|
|
|
|
stuTheoryExam.setExamDuration(theoryTestDto.getExamDuration());
|
|
|
|
|
stuTheoryExam.setScore(theoryTestDto.getScore());
|
|
|
|
|
stuTheoryExam.setAccuracy(theoryTestDto.getAccuracy());
|
|
|
|
@ -124,7 +179,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
|
StuErrorExample errorExample = new StuErrorExample();
|
|
|
|
|
errorExample.createCriteria().andUserIdEqualTo(theoryTestDto.getUserId());
|
|
|
|
|
List<StuErrorWithBLOBs> stuErrors = errorMapper.selectByExampleWithBLOBs(errorExample);
|
|
|
|
|
if(stuErrors.isEmpty()){
|
|
|
|
|
if (stuErrors.isEmpty()) {
|
|
|
|
|
StuErrorWithBLOBs stuError = new StuErrorWithBLOBs();
|
|
|
|
|
stuError.setErrorId(String.valueOf(UUID.randomUUID()));
|
|
|
|
|
stuError.setUserId(theoryTestDto.getUserId());
|
|
|
|
@ -132,10 +187,10 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
|
stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds()));
|
|
|
|
|
stuError.setJudgeIds(String.valueOf(theoryTestDto.getJudgeErrorIds()));
|
|
|
|
|
errorMapper.insert(stuError);
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
StuErrorWithBLOBs stuError = stuErrors.get(0);
|
|
|
|
|
if(!stuError.getSingleIds().isEmpty()){
|
|
|
|
|
List<String> stringList = Arrays.asList(stuError.getSingleIds());
|
|
|
|
|
if (!stuError.getSingleIds().isEmpty()) {
|
|
|
|
|
List<String> stringList = Arrays.asList(stuError.getSingleIds().substring(1, stuError.getSingleIds().length() - 1).split(", "));
|
|
|
|
|
List<String> singleErrorIds = theoryTestDto.getSingleErrorIds();
|
|
|
|
|
|
|
|
|
|
List<String> combinedList = new ArrayList<>(stringList);
|
|
|
|
@ -143,11 +198,11 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
|
Set<String> uniqueSet = new HashSet<>(combinedList);
|
|
|
|
|
List<String> uniqueList = new ArrayList<>(uniqueSet);
|
|
|
|
|
stuError.setSingleIds(String.valueOf(uniqueList));
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
stuError.setSingleIds(String.valueOf(theoryTestDto.getSingleErrorIds()));
|
|
|
|
|
}
|
|
|
|
|
if(!stuError.getMultipleIds().isEmpty()){
|
|
|
|
|
List<String> stringList = Arrays.asList(stuError.getMultipleIds());
|
|
|
|
|
if (!stuError.getMultipleIds().isEmpty()) {
|
|
|
|
|
List<String> stringList = Arrays.asList(stuError.getMultipleIds().substring(1, stuError.getMultipleIds().length() - 1).split(", "));
|
|
|
|
|
List<String> multipleErrorIds = theoryTestDto.getMultipleErrorIds();
|
|
|
|
|
|
|
|
|
|
List<String> combinedList = new ArrayList<>(stringList);
|
|
|
|
@ -155,22 +210,23 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
|
Set<String> uniqueSet = new HashSet<>(combinedList);
|
|
|
|
|
List<String> uniqueList = new ArrayList<>(uniqueSet);
|
|
|
|
|
stuError.setMultipleIds(String.valueOf(uniqueList));
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds()));
|
|
|
|
|
}
|
|
|
|
|
if(!stuError.getJudgeIds().isEmpty()){
|
|
|
|
|
List<String> stringList = Arrays.asList(stuError.getJudgeIds());
|
|
|
|
|
if (!stuError.getJudgeIds().isEmpty()) {
|
|
|
|
|
List<String> stringList = Arrays.asList(stuError.getJudgeIds().substring(1, stuError.getJudgeIds().length() - 1).split(", "));
|
|
|
|
|
List<String> judgeErrorIds = theoryTestDto.getJudgeErrorIds();
|
|
|
|
|
List<String> combinedList = new ArrayList<>(stringList);
|
|
|
|
|
combinedList.addAll(judgeErrorIds);
|
|
|
|
|
Set<String> uniqueSet = new HashSet<>(combinedList);
|
|
|
|
|
List<String> uniqueList = new ArrayList<>(uniqueSet);
|
|
|
|
|
stuError.setJudgeIds(String.valueOf(uniqueList));
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
stuError.setJudgeIds(String.valueOf(theoryTestDto.getJudgeErrorIds()));
|
|
|
|
|
}
|
|
|
|
|
errorMapper.updateByPrimaryKey(stuError);
|
|
|
|
|
}
|
|
|
|
|
UpdateTheoryRecord(theoryTestDto.getUserId(),theoryTestDto.getScore(),theoryTestDto.getExamDuration());
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -179,30 +235,30 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
|
StuErrorExample example = new StuErrorExample();
|
|
|
|
|
example.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuErrorWithBLOBs> stuErrors = errorMapper.selectByExampleWithBLOBs(example);
|
|
|
|
|
if(stuErrors.isEmpty()){
|
|
|
|
|
if (stuErrors.isEmpty()) {
|
|
|
|
|
return null;
|
|
|
|
|
}else {
|
|
|
|
|
List<SysObjectiveQuestion> objectiveQuestionList=new ArrayList<>();
|
|
|
|
|
} else {
|
|
|
|
|
List<SysObjectiveQuestion> objectiveQuestionList = new ArrayList<>();
|
|
|
|
|
StuErrorWithBLOBs stuError = stuErrors.get(0);
|
|
|
|
|
String singleIds = stuError.getSingleIds();
|
|
|
|
|
if(!singleIds.isEmpty()){
|
|
|
|
|
List<String> singleIdList = Arrays.asList(singleIds);
|
|
|
|
|
if (!singleIds.isEmpty()) {
|
|
|
|
|
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", "));
|
|
|
|
|
for (int i = 0; i < singleIdList.size(); i++) {
|
|
|
|
|
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(singleIdList.get(i));
|
|
|
|
|
objectiveQuestionList.add(objectiveQuestion);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String multipleIds = stuError.getMultipleIds();
|
|
|
|
|
if(!multipleIds.isEmpty()){
|
|
|
|
|
List<String> stringList = Arrays.asList(multipleIds);
|
|
|
|
|
if (!multipleIds.isEmpty()) {
|
|
|
|
|
List<String> stringList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", "));
|
|
|
|
|
for (int i = 0; i < stringList.size(); i++) {
|
|
|
|
|
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(stringList.get(i));
|
|
|
|
|
objectiveQuestionList.add(objectiveQuestion);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String judgeIds = stuError.getJudgeIds();
|
|
|
|
|
if(!judgeIds.isEmpty()){
|
|
|
|
|
List<String> stringList = Arrays.asList(judgeIds);
|
|
|
|
|
if (!judgeIds.isEmpty()) {
|
|
|
|
|
List<String> stringList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", "));
|
|
|
|
|
for (int i = 0; i < stringList.size(); i++) {
|
|
|
|
|
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(stringList.get(i));
|
|
|
|
|
objectiveQuestionList.add(objectiveQuestion);
|
|
|
|
@ -211,4 +267,106 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
|
return objectiveQuestionList;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean removeError(String userId, String objectiveQuestionId, String type) {
|
|
|
|
|
StuErrorExample stuErrorExample = new StuErrorExample();
|
|
|
|
|
stuErrorExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuErrorWithBLOBs> stuErrors = errorMapper.selectByExampleWithBLOBs(stuErrorExample);
|
|
|
|
|
if (stuErrors.isEmpty()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
StuErrorWithBLOBs error = stuErrors.get(0);
|
|
|
|
|
if (Constant.OBJECTIVE_TYPE_SINGLE.equals(type)) {
|
|
|
|
|
List<String> stringList = Arrays.asList(error.getSingleIds().substring(1, stuErrors.get(0).getSingleIds().length() - 1).split(", "));
|
|
|
|
|
Set<String> set = new LinkedHashSet<>(stringList);
|
|
|
|
|
set.remove(objectiveQuestionId);
|
|
|
|
|
if(set.isEmpty()){
|
|
|
|
|
error.setSingleIds(null);
|
|
|
|
|
}else {
|
|
|
|
|
List<String> list = new ArrayList<>(set);
|
|
|
|
|
error.setSingleIds(String.valueOf(list));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (Constant.OBJECTIVE_TYPE_Many.equals(type)) {
|
|
|
|
|
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getMultipleIds().substring(1, error.getMultipleIds().length() - 1).split(", ")));
|
|
|
|
|
set.remove(objectiveQuestionId);
|
|
|
|
|
if(set.isEmpty()){
|
|
|
|
|
error.setMultipleIds(null);
|
|
|
|
|
}else {
|
|
|
|
|
List<String> list = new ArrayList<>(set);
|
|
|
|
|
error.setMultipleIds(String.valueOf(list));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(Constant.OBJECTIVE_TYPE_JUDGE.equals(type)){
|
|
|
|
|
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getJudgeIds().substring(1, error.getJudgeIds().length() - 1).split(", ")));
|
|
|
|
|
set.remove(objectiveQuestionId);
|
|
|
|
|
if(set.isEmpty()){
|
|
|
|
|
error.setJudgeIds(null);
|
|
|
|
|
}else {
|
|
|
|
|
List<String> list = new ArrayList<>(set);
|
|
|
|
|
error.setJudgeIds(String.valueOf(list));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int i = errorMapper.updateByPrimaryKeyWithBLOBs(error);
|
|
|
|
|
return i==1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageInfo<StuTheoryExam> getTheoryTestList(String userId, Integer index, Integer size) {
|
|
|
|
|
PageHelper.startPage(index, size);
|
|
|
|
|
StuTheoryExamExample example = new StuTheoryExamExample();
|
|
|
|
|
example.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuTheoryExam> stuTheoryExams = theoryExamMapper.selectByExample(example);
|
|
|
|
|
PageInfo<StuTheoryExam> pageInfo = new PageInfo<>(stuTheoryExams);
|
|
|
|
|
return pageInfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size) {
|
|
|
|
|
StuTheoryExamWithBLOBs theoryExam = theoryExamMapper.selectByPrimaryKey(theoryExamId);
|
|
|
|
|
String singleIds = theoryExam.getSingleIds();
|
|
|
|
|
ArrayList<String> idsList = new ArrayList<>();
|
|
|
|
|
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", "));
|
|
|
|
|
String multipleIds = theoryExam.getMultipleIds();
|
|
|
|
|
List<String> multipleIdList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", "));
|
|
|
|
|
String judgeIds = theoryExam.getJudgeIds();
|
|
|
|
|
List<String> judgeIdList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", "));
|
|
|
|
|
idsList.addAll(singleIdList);
|
|
|
|
|
idsList.addAll(multipleIdList);
|
|
|
|
|
idsList.addAll(judgeIdList);
|
|
|
|
|
ArrayList<String> answerList = new ArrayList<>();
|
|
|
|
|
List<String> singleStuAnswer =Arrays.asList(theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(", "));
|
|
|
|
|
List<String> multipleStuAnswer = Arrays.asList(theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(", "));
|
|
|
|
|
List<String> judgeStuAnswer = Arrays.asList(theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(", "));
|
|
|
|
|
answerList.addAll(singleStuAnswer);
|
|
|
|
|
answerList.addAll(multipleStuAnswer);
|
|
|
|
|
answerList.addAll(judgeStuAnswer);
|
|
|
|
|
List<StuTheoryExamDetailDto> detailDtos=new ArrayList<>();
|
|
|
|
|
for (Integer i = (index-1)*size; i < (index-1)*size+size; i++) {
|
|
|
|
|
StuTheoryExamDetailDto detailDto = new StuTheoryExamDetailDto();
|
|
|
|
|
String objectiveQuestionId = idsList.get(i);
|
|
|
|
|
String stuAnswer = answerList.get(i);
|
|
|
|
|
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(objectiveQuestionId);
|
|
|
|
|
BigDecimal score = objectiveQuestion.getScore();
|
|
|
|
|
String content = objectiveQuestion.getContent();
|
|
|
|
|
String answer = objectiveQuestion.getAnswer();
|
|
|
|
|
if(answer.equals(stuAnswer)){
|
|
|
|
|
detailDto.setScore(String.valueOf(score));
|
|
|
|
|
detailDto.setStatus("正确");
|
|
|
|
|
}else {
|
|
|
|
|
detailDto.setScore("0");
|
|
|
|
|
detailDto.setStatus("错误");
|
|
|
|
|
}
|
|
|
|
|
detailDto.setContent(content);
|
|
|
|
|
detailDto.setMychoice(stuAnswer);
|
|
|
|
|
detailDto.setAnswer(answer);
|
|
|
|
|
detailDtos.add(detailDto);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return detailDtos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|