|
|
@ -65,13 +65,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
idlist.addAll(singleIdList);
|
|
|
|
idlist.addAll(singleIdList);
|
|
|
|
idlist.addAll(multipleIdList);
|
|
|
|
idlist.addAll(multipleIdList);
|
|
|
|
idlist.addAll(judgeIdList);
|
|
|
|
idlist.addAll(judgeIdList);
|
|
|
|
List<SysObjectiveQuestion> returnQuestionList = new ArrayList();
|
|
|
|
List<SysObjectiveQuestion> returnQuestionList = objectiveQuestionMapper.selectBatchByIdList(idlist);
|
|
|
|
for (int i = 0; i < idlist.size(); i++) {
|
|
|
|
|
|
|
|
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(idlist.get(i));
|
|
|
|
|
|
|
|
returnQuestionList.add(objectiveQuestion);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// List<SysObjectiveQuestion> returnQuestionList = objectiveQuestionMapper.selectBatchByIdList(idlist);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return returnQuestionList;
|
|
|
|
return returnQuestionList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -122,9 +116,11 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
Integer examCount = record.getExamCount();
|
|
|
|
Integer examCount = record.getExamCount();
|
|
|
|
BigDecimal averageScore = record.getAverageScore();
|
|
|
|
BigDecimal averageScore = record.getAverageScore();
|
|
|
|
BigDecimal multiply = averageScore.multiply(BigDecimal.valueOf(examCount));
|
|
|
|
BigDecimal multiply = averageScore.multiply(BigDecimal.valueOf(examCount));
|
|
|
|
multiply.add(score).divide(BigDecimal.valueOf(examCount).add(BigDecimal.valueOf(1))).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
BigDecimal newAvg = multiply.add(score).divide(BigDecimal.valueOf(examCount).add(BigDecimal.valueOf(1)), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
|
|
record.setAverageScore(newAvg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
theoryRecordMapper.updateByPrimaryKey(record);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -329,6 +325,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
PageHelper.startPage(index, size);
|
|
|
|
PageHelper.startPage(index, size);
|
|
|
|
StuTheoryExamExample example = new StuTheoryExamExample();
|
|
|
|
StuTheoryExamExample example = new StuTheoryExamExample();
|
|
|
|
example.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
example.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
|
|
|
example.setOrderByClause("exam_time desc");
|
|
|
|
List<StuTheoryExam> stuTheoryExams = theoryExamMapper.selectByExample(example);
|
|
|
|
List<StuTheoryExam> stuTheoryExams = theoryExamMapper.selectByExample(example);
|
|
|
|
PageInfo<StuTheoryExam> pageInfo = new PageInfo<>(stuTheoryExams);
|
|
|
|
PageInfo<StuTheoryExam> pageInfo = new PageInfo<>(stuTheoryExams);
|
|
|
|
return pageInfo;
|
|
|
|
return pageInfo;
|
|
|
@ -348,22 +345,62 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
idsList.addAll(multipleIdList);
|
|
|
|
idsList.addAll(multipleIdList);
|
|
|
|
idsList.addAll(judgeIdList);
|
|
|
|
idsList.addAll(judgeIdList);
|
|
|
|
ArrayList<String> answerList = new ArrayList<>();
|
|
|
|
ArrayList<String> answerList = new ArrayList<>();
|
|
|
|
List<String> singleStuAnswer =Arrays.asList(theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(","));
|
|
|
|
if(theoryExam.getSingleStuAnswer()!=null){
|
|
|
|
List<String> multipleStuAnswer = Arrays.asList(theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(","));
|
|
|
|
String[] singleSplit = theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(",");
|
|
|
|
List<String> judgeStuAnswer = Arrays.asList(theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(","));
|
|
|
|
for (String str : singleSplit) {
|
|
|
|
answerList.addAll(singleStuAnswer);
|
|
|
|
if (str.equals("") || str.equals(" ")) {
|
|
|
|
answerList.addAll(multipleStuAnswer);
|
|
|
|
answerList.add(null);
|
|
|
|
answerList.addAll(judgeStuAnswer);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
answerList.add(str);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(theoryExam.getMultipleStuAnswer()!=null){
|
|
|
|
|
|
|
|
String[] multipleSplit = theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(",");
|
|
|
|
|
|
|
|
for (String str : multipleSplit) {
|
|
|
|
|
|
|
|
if (str.equals("") || str.equals(" ")) {
|
|
|
|
|
|
|
|
answerList.add(null);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
String strSort = sortString(str);
|
|
|
|
|
|
|
|
answerList.add(strSort);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(theoryExam.getJudgeStuAnswer()!=null){
|
|
|
|
|
|
|
|
String[] judgeSplit = theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(",");
|
|
|
|
|
|
|
|
for (String str : judgeSplit) {
|
|
|
|
|
|
|
|
if (str.equals("") || str.equals(" ")) {
|
|
|
|
|
|
|
|
answerList.add(null);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
answerList.add(str);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
List<StuTheoryExamDetailDto> detailDtos=new ArrayList<>();
|
|
|
|
List<StuTheoryExamDetailDto> detailDtos=new ArrayList<>();
|
|
|
|
|
|
|
|
if(answerList.size()==0){
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < answerList.size(); i++) {
|
|
|
|
|
|
|
|
if(answerList.get(i)==null){
|
|
|
|
|
|
|
|
answerList.set(i,"空");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
for (Integer i = (index-1)*size; i < (index-1)*size+size; i++) {
|
|
|
|
for (Integer i = (index-1)*size; i < (index-1)*size+size; i++) {
|
|
|
|
StuTheoryExamDetailDto detailDto = new StuTheoryExamDetailDto();
|
|
|
|
StuTheoryExamDetailDto detailDto = new StuTheoryExamDetailDto();
|
|
|
|
String objectiveQuestionId = idsList.get(i);
|
|
|
|
String objectiveQuestionId = idsList.get(i);
|
|
|
|
String stuAnswer = answerList.get(i);
|
|
|
|
String stuAnswer = answerList.get(i).trim();
|
|
|
|
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(objectiveQuestionId);
|
|
|
|
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(objectiveQuestionId);
|
|
|
|
BigDecimal score = objectiveQuestion.getScore();
|
|
|
|
BigDecimal score = objectiveQuestion.getScore();
|
|
|
|
String content = objectiveQuestion.getContent();
|
|
|
|
String content = objectiveQuestion.getContent();
|
|
|
|
String answer = objectiveQuestion.getAnswer();
|
|
|
|
String answer = objectiveQuestion.getAnswer();
|
|
|
|
if(answer.equals(stuAnswer)){
|
|
|
|
if(stuAnswer.equals("true")){
|
|
|
|
|
|
|
|
stuAnswer="对";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(stuAnswer.equals("false")){
|
|
|
|
|
|
|
|
stuAnswer="错";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(answer.replaceAll(",","").equals(stuAnswer)){
|
|
|
|
detailDto.setScore(String.valueOf(score));
|
|
|
|
detailDto.setScore(String.valueOf(score));
|
|
|
|
detailDto.setStatus("正确");
|
|
|
|
detailDto.setStatus("正确");
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
@ -372,11 +409,9 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
detailDto.setContent(content);
|
|
|
|
detailDto.setContent(content);
|
|
|
|
detailDto.setMychoice(stuAnswer);
|
|
|
|
detailDto.setMychoice(stuAnswer);
|
|
|
|
detailDto.setAnswer(answer);
|
|
|
|
detailDto.setAnswer(answer.replaceAll(",",""));
|
|
|
|
detailDtos.add(detailDto);
|
|
|
|
detailDtos.add(detailDto);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return detailDtos;
|
|
|
|
return detailDtos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -403,5 +438,12 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//字母排序
|
|
|
|
|
|
|
|
private static String sortString(String str) {
|
|
|
|
|
|
|
|
char[] charArray = str.toCharArray();
|
|
|
|
|
|
|
|
Arrays.sort(charArray);
|
|
|
|
|
|
|
|
return new String(charArray);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|