|
|
@ -1,6 +1,5 @@
|
|
|
|
package com.sztzjy.financial_bigdata.service.stu.impl;
|
|
|
|
package com.sztzjy.financial_bigdata.service.stu.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
import com.sztzjy.financial_bigdata.config.Constant;
|
|
|
|
import com.sztzjy.financial_bigdata.config.Constant;
|
|
|
@ -11,7 +10,6 @@ import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto;
|
|
|
|
import com.sztzjy.financial_bigdata.mapper.*;
|
|
|
|
import com.sztzjy.financial_bigdata.mapper.*;
|
|
|
|
import com.sztzjy.financial_bigdata.resourceCenterAPI.ObjectiveApi;
|
|
|
|
import com.sztzjy.financial_bigdata.resourceCenterAPI.ObjectiveApi;
|
|
|
|
import com.sztzjy.financial_bigdata.service.stu.ITheoryTestService;
|
|
|
|
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.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
@ -37,25 +35,25 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
// 之前没有进行考试 从客观题库表中查询 35道单选,每题2分,5道多选每题4分,10道判断每题1分 并将id保存至理论考试表中
|
|
|
|
// 之前没有进行考试 从客观题库表中查询 35道单选,每题2分,5道多选每题4分,10道判断每题1分 并将id保存至理论考试表中
|
|
|
|
// 注意 开始考试后 要生成理论记录表基础数据
|
|
|
|
// 注意 开始考试后 要生成理论记录表基础数据
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<SysObjectiveQuestions> startTheoryTest(String userId,String systemOwner) throws IOException {
|
|
|
|
public List<SysObjectiveQuestions> startTheoryTest(String userId, String systemOwner) throws IOException {
|
|
|
|
StuTheoryExamExample example = new StuTheoryExamExample();
|
|
|
|
StuTheoryExamExample example = new StuTheoryExamExample();
|
|
|
|
example.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
example.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
example.setOrderByClause("exam_time DESC");
|
|
|
|
example.setOrderByClause("exam_time DESC");
|
|
|
|
List<StuTheoryExamWithBLOBs> stuTheoryExams = theoryExamMapper.selectByExampleWithBLOBs(example);
|
|
|
|
List<StuTheoryExamWithBLOBs> stuTheoryExams = theoryExamMapper.selectByExampleWithBLOBs(example);
|
|
|
|
if (stuTheoryExams.isEmpty()) { //之前没有进行考试
|
|
|
|
if (stuTheoryExams.isEmpty()) { //之前没有进行考试
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId,systemOwner);
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId, systemOwner);
|
|
|
|
GenerateTheoryRecordFirst(userId);
|
|
|
|
GenerateTheoryRecordFirst(userId, systemOwner);
|
|
|
|
return objectiveQuestionList;
|
|
|
|
return objectiveQuestionList;
|
|
|
|
} else { //根据考试时间排序 查询最近的一条
|
|
|
|
} else { //根据考试时间排序 查询最近的一条
|
|
|
|
StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0);
|
|
|
|
StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0);
|
|
|
|
Date currentTime = new Date();
|
|
|
|
Date currentTime = new Date();
|
|
|
|
Date twoHoursAgo = new Date(currentTime.getTime() - (2 * 60 * 60 * 1000)); // 当前时间减去两个小时
|
|
|
|
Date twoHoursAgo = new Date(currentTime.getTime() - (2 * 60 * 60 * 1000)); // 当前时间减去两个小时
|
|
|
|
if(stuTheoryExam.getAnswered()){
|
|
|
|
if (stuTheoryExam.getAnswered()) {
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId,systemOwner);
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId, systemOwner);
|
|
|
|
return objectiveQuestionList;
|
|
|
|
return objectiveQuestionList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (stuTheoryExam.getExamTime().before(twoHoursAgo)) { //已超出两个小时 从新生成新试卷
|
|
|
|
if (stuTheoryExam.getExamTime().before(twoHoursAgo)) { //已超出两个小时 从新生成新试卷
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId,systemOwner);
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList = GenerateTest(userId, systemOwner);
|
|
|
|
return objectiveQuestionList;
|
|
|
|
return objectiveQuestionList;
|
|
|
|
} else { //在两个小时内 返回最近的一条试卷
|
|
|
|
} else { //在两个小时内 返回最近的一条试卷
|
|
|
|
String singleIds = stuTheoryExam.getSingleIds();
|
|
|
|
String singleIds = stuTheoryExam.getSingleIds();
|
|
|
@ -77,9 +75,9 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//第一次生成理论考试记录数据 先判断是否生成过理论考试记录数据
|
|
|
|
//第一次生成理论考试记录数据 先判断是否生成过理论考试记录数据
|
|
|
|
public void GenerateTheoryRecordFirst(String userId){
|
|
|
|
public void GenerateTheoryRecordFirst(String userId, String systemOwner) {
|
|
|
|
StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId);
|
|
|
|
StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId);
|
|
|
|
if(record==null){
|
|
|
|
if (record == null) {
|
|
|
|
StuUser stuUser = userMapper.selectByPrimaryKey(userId);
|
|
|
|
StuUser stuUser = userMapper.selectByPrimaryKey(userId);
|
|
|
|
StuTheoryRecord stuTheoryRecord = new StuTheoryRecord();
|
|
|
|
StuTheoryRecord stuTheoryRecord = new StuTheoryRecord();
|
|
|
|
stuTheoryRecord.setUserId(userId);
|
|
|
|
stuTheoryRecord.setUserId(userId);
|
|
|
@ -88,36 +86,37 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
stuTheoryRecord.setName(stuUser.getName());
|
|
|
|
stuTheoryRecord.setName(stuUser.getName());
|
|
|
|
stuTheoryRecord.setStudentId(stuUser.getStudentId());
|
|
|
|
stuTheoryRecord.setStudentId(stuUser.getStudentId());
|
|
|
|
stuTheoryRecord.setExamCount(0);
|
|
|
|
stuTheoryRecord.setExamCount(0);
|
|
|
|
|
|
|
|
stuTheoryRecord.setSystemOwner(systemOwner);
|
|
|
|
theoryRecordMapper.insert(stuTheoryRecord);
|
|
|
|
theoryRecordMapper.insert(stuTheoryRecord);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void UpdateTheoryRecord(String userId,BigDecimal score,Integer examDuration){
|
|
|
|
public void UpdateTheoryRecord(String userId, BigDecimal score, Integer examDuration) {
|
|
|
|
StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId);
|
|
|
|
StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId);
|
|
|
|
if(record!=null){
|
|
|
|
if (record != null) {
|
|
|
|
record.setExamCount(record.getExamCount()+1);
|
|
|
|
record.setExamCount(record.getExamCount() + 1);
|
|
|
|
if(record.getHighestScore()==null){
|
|
|
|
if (record.getHighestScore() == null) {
|
|
|
|
record.setHighestScore(score);
|
|
|
|
record.setHighestScore(score);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
if(record.getHighestScore().compareTo(score)<0){
|
|
|
|
if (record.getHighestScore().compareTo(score) < 0) {
|
|
|
|
record.setHighestScore(score);
|
|
|
|
record.setHighestScore(score);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(record.getLowestScore()==null){
|
|
|
|
if (record.getLowestScore() == null) {
|
|
|
|
record.setLowestScore(score);
|
|
|
|
record.setLowestScore(score);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
if(record.getLowestScore().compareTo(score)>0){
|
|
|
|
if (record.getLowestScore().compareTo(score) > 0) {
|
|
|
|
record.setLowestScore(score);
|
|
|
|
record.setLowestScore(score);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(record.getTotalDuration()==null){
|
|
|
|
if (record.getTotalDuration() == null) {
|
|
|
|
record.setTotalDuration(examDuration);
|
|
|
|
record.setTotalDuration(examDuration);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
record.setTotalDuration(examDuration+record.getTotalDuration());
|
|
|
|
record.setTotalDuration(examDuration + record.getTotalDuration());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(record.getAverageScore()==null){
|
|
|
|
if (record.getAverageScore() == null) {
|
|
|
|
record.setAverageScore(score);
|
|
|
|
record.setAverageScore(score);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
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));
|
|
|
@ -130,11 +129,11 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//随机生成100分题目
|
|
|
|
//随机生成100分题目
|
|
|
|
public List<SysObjectiveQuestions> GenerateTest(String userId,String systemOwner) throws IOException {
|
|
|
|
public List<SysObjectiveQuestions> GenerateTest(String userId, String systemOwner) throws IOException {
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList1 = ObjectiveApi.selectRandomObjectiveSingle(systemOwner);
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList1 = ObjectiveApi.selectRandomObjectiveSingle(systemOwner);
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList2 = ObjectiveApi.selectRandomObjectiveMany(systemOwner);
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList2 = ObjectiveApi.selectRandomObjectiveMany(systemOwner);
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList3 = ObjectiveApi.selectRandomObjectiveJudge(systemOwner);
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList3 = ObjectiveApi.selectRandomObjectiveJudge(systemOwner);
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList=new ArrayList<>();
|
|
|
|
List<SysObjectiveQuestions> objectiveQuestionList = new ArrayList<>();
|
|
|
|
objectiveQuestionList.addAll(objectiveQuestionList1);
|
|
|
|
objectiveQuestionList.addAll(objectiveQuestionList1);
|
|
|
|
objectiveQuestionList.addAll(objectiveQuestionList2);
|
|
|
|
objectiveQuestionList.addAll(objectiveQuestionList2);
|
|
|
|
objectiveQuestionList.addAll(objectiveQuestionList3);
|
|
|
|
objectiveQuestionList.addAll(objectiveQuestionList3);
|
|
|
@ -202,7 +201,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
errorMapper.insert(stuError);
|
|
|
|
errorMapper.insert(stuError);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
StuErrorWithBLOBs stuError = stuErrors.get(0);
|
|
|
|
StuErrorWithBLOBs stuError = stuErrors.get(0);
|
|
|
|
if (stuError.getSingleIds()!=null) {
|
|
|
|
if (stuError.getSingleIds() != null) {
|
|
|
|
List<String> stringList = Arrays.asList(stuError.getSingleIds().substring(1, stuError.getSingleIds().length() - 1).split(", "));
|
|
|
|
List<String> stringList = Arrays.asList(stuError.getSingleIds().substring(1, stuError.getSingleIds().length() - 1).split(", "));
|
|
|
|
List<String> singleErrorIds = theoryTestDto.getSingleErrorIds();
|
|
|
|
List<String> singleErrorIds = theoryTestDto.getSingleErrorIds();
|
|
|
|
|
|
|
|
|
|
|
@ -214,7 +213,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
stuError.setSingleIds(String.valueOf(theoryTestDto.getSingleErrorIds()));
|
|
|
|
stuError.setSingleIds(String.valueOf(theoryTestDto.getSingleErrorIds()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (stuError.getMultipleIds()!=null) {
|
|
|
|
if (stuError.getMultipleIds() != null) {
|
|
|
|
List<String> stringList = Arrays.asList(stuError.getMultipleIds().substring(1, stuError.getMultipleIds().length() - 1).split(", "));
|
|
|
|
List<String> stringList = Arrays.asList(stuError.getMultipleIds().substring(1, stuError.getMultipleIds().length() - 1).split(", "));
|
|
|
|
List<String> multipleErrorIds = theoryTestDto.getMultipleErrorIds();
|
|
|
|
List<String> multipleErrorIds = theoryTestDto.getMultipleErrorIds();
|
|
|
|
|
|
|
|
|
|
|
@ -226,7 +225,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds()));
|
|
|
|
stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (stuError.getJudgeIds()!=null) {
|
|
|
|
if (stuError.getJudgeIds() != null) {
|
|
|
|
List<String> stringList = Arrays.asList(stuError.getJudgeIds().substring(1, stuError.getJudgeIds().length() - 1).split(", "));
|
|
|
|
List<String> stringList = Arrays.asList(stuError.getJudgeIds().substring(1, stuError.getJudgeIds().length() - 1).split(", "));
|
|
|
|
List<String> judgeErrorIds = theoryTestDto.getJudgeErrorIds();
|
|
|
|
List<String> judgeErrorIds = theoryTestDto.getJudgeErrorIds();
|
|
|
|
List<String> combinedList = new ArrayList<>(stringList);
|
|
|
|
List<String> combinedList = new ArrayList<>(stringList);
|
|
|
@ -239,12 +238,12 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
errorMapper.updateByPrimaryKey(stuError);
|
|
|
|
errorMapper.updateByPrimaryKey(stuError);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
UpdateTheoryRecord(theoryTestDto.getUserId(),theoryTestDto.getScore(),theoryTestDto.getExamDuration());
|
|
|
|
UpdateTheoryRecord(theoryTestDto.getUserId(), theoryTestDto.getScore(), theoryTestDto.getExamDuration());
|
|
|
|
return i;
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<SysObjectiveQuestions> selectErrors(String userId,String schoolId,String systemOwner) throws IOException {
|
|
|
|
public List<SysObjectiveQuestions> selectErrors(String userId, String schoolId, String systemOwner) throws IOException {
|
|
|
|
StuErrorExample example = new StuErrorExample();
|
|
|
|
StuErrorExample example = new StuErrorExample();
|
|
|
|
example.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
example.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
List<StuErrorWithBLOBs> stuErrors = errorMapper.selectByExampleWithBLOBs(example);
|
|
|
|
List<StuErrorWithBLOBs> stuErrors = errorMapper.selectByExampleWithBLOBs(example);
|
|
|
@ -294,9 +293,9 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
List<String> stringList = Arrays.asList(error.getSingleIds().substring(1, stuErrors.get(0).getSingleIds().length() - 1).split(", "));
|
|
|
|
List<String> stringList = Arrays.asList(error.getSingleIds().substring(1, stuErrors.get(0).getSingleIds().length() - 1).split(", "));
|
|
|
|
Set<String> set = new LinkedHashSet<>(stringList);
|
|
|
|
Set<String> set = new LinkedHashSet<>(stringList);
|
|
|
|
set.remove(objectiveQuestionId);
|
|
|
|
set.remove(objectiveQuestionId);
|
|
|
|
if(set.isEmpty()){
|
|
|
|
if (set.isEmpty()) {
|
|
|
|
error.setSingleIds(null);
|
|
|
|
error.setSingleIds(null);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
List<String> list = new ArrayList<>(set);
|
|
|
|
List<String> list = new ArrayList<>(set);
|
|
|
|
error.setSingleIds(String.valueOf(list));
|
|
|
|
error.setSingleIds(String.valueOf(list));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -304,25 +303,25 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
if (Constant.OBJECTIVE_TYPE_Many.equals(type)) {
|
|
|
|
if (Constant.OBJECTIVE_TYPE_Many.equals(type)) {
|
|
|
|
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getMultipleIds().substring(1, error.getMultipleIds().length() - 1).split(", ")));
|
|
|
|
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getMultipleIds().substring(1, error.getMultipleIds().length() - 1).split(", ")));
|
|
|
|
set.remove(objectiveQuestionId);
|
|
|
|
set.remove(objectiveQuestionId);
|
|
|
|
if(set.isEmpty()){
|
|
|
|
if (set.isEmpty()) {
|
|
|
|
error.setMultipleIds(null);
|
|
|
|
error.setMultipleIds(null);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
List<String> list = new ArrayList<>(set);
|
|
|
|
List<String> list = new ArrayList<>(set);
|
|
|
|
error.setMultipleIds(String.valueOf(list));
|
|
|
|
error.setMultipleIds(String.valueOf(list));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(Constant.OBJECTIVE_TYPE_JUDGE.equals(type)){
|
|
|
|
if (Constant.OBJECTIVE_TYPE_JUDGE.equals(type)) {
|
|
|
|
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getJudgeIds().substring(1, error.getJudgeIds().length() - 1).split(", ")));
|
|
|
|
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getJudgeIds().substring(1, error.getJudgeIds().length() - 1).split(", ")));
|
|
|
|
set.remove(objectiveQuestionId);
|
|
|
|
set.remove(objectiveQuestionId);
|
|
|
|
if(set.isEmpty()){
|
|
|
|
if (set.isEmpty()) {
|
|
|
|
error.setJudgeIds(null);
|
|
|
|
error.setJudgeIds(null);
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
List<String> list = new ArrayList<>(set);
|
|
|
|
List<String> list = new ArrayList<>(set);
|
|
|
|
error.setJudgeIds(String.valueOf(list));
|
|
|
|
error.setJudgeIds(String.valueOf(list));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int i = errorMapper.updateByPrimaryKeyWithBLOBs(error);
|
|
|
|
int i = errorMapper.updateByPrimaryKeyWithBLOBs(error);
|
|
|
|
return i==1;
|
|
|
|
return i == 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -337,7 +336,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size,String schoolId,String systemOwner) throws IOException {
|
|
|
|
public List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size, String schoolId, String systemOwner) throws IOException {
|
|
|
|
StuTheoryExamWithBLOBs theoryExam = theoryExamMapper.selectByPrimaryKey(theoryExamId);
|
|
|
|
StuTheoryExamWithBLOBs theoryExam = theoryExamMapper.selectByPrimaryKey(theoryExamId);
|
|
|
|
String singleIds = theoryExam.getSingleIds();
|
|
|
|
String singleIds = theoryExam.getSingleIds();
|
|
|
|
ArrayList<String> idsList = new ArrayList<>();
|
|
|
|
ArrayList<String> idsList = new ArrayList<>();
|
|
|
@ -350,7 +349,7 @@ 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<>();
|
|
|
|
if(theoryExam.getSingleStuAnswer()!=null){
|
|
|
|
if (theoryExam.getSingleStuAnswer() != null) {
|
|
|
|
String[] singleSplit = theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(",");
|
|
|
|
String[] singleSplit = theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(",");
|
|
|
|
for (String str : singleSplit) {
|
|
|
|
for (String str : singleSplit) {
|
|
|
|
if (str.equals("") || str.equals(" ")) {
|
|
|
|
if (str.equals("") || str.equals(" ")) {
|
|
|
@ -360,7 +359,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(theoryExam.getMultipleStuAnswer()!=null){
|
|
|
|
if (theoryExam.getMultipleStuAnswer() != null) {
|
|
|
|
String[] multipleSplit = theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(",");
|
|
|
|
String[] multipleSplit = theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(",");
|
|
|
|
for (String str : multipleSplit) {
|
|
|
|
for (String str : multipleSplit) {
|
|
|
|
if (str.equals("") || str.equals(" ")) {
|
|
|
|
if (str.equals("") || str.equals(" ")) {
|
|
|
@ -371,7 +370,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(theoryExam.getJudgeStuAnswer()!=null){
|
|
|
|
if (theoryExam.getJudgeStuAnswer() != null) {
|
|
|
|
String[] judgeSplit = theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(",");
|
|
|
|
String[] judgeSplit = theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(",");
|
|
|
|
for (String str : judgeSplit) {
|
|
|
|
for (String str : judgeSplit) {
|
|
|
|
if (str.equals("") || str.equals(" ")) {
|
|
|
|
if (str.equals("") || str.equals(" ")) {
|
|
|
@ -381,17 +380,17 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<StuTheoryExamDetailDto> detailDtos=new ArrayList<>();
|
|
|
|
List<StuTheoryExamDetailDto> detailDtos = new ArrayList<>();
|
|
|
|
if(answerList.size()==0){
|
|
|
|
if (answerList.size() == 0) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < answerList.size(); i++) {
|
|
|
|
for (int i = 0; i < answerList.size(); i++) {
|
|
|
|
if(answerList.get(i)==null){
|
|
|
|
if (answerList.get(i) == null) {
|
|
|
|
answerList.set(i,"空");
|
|
|
|
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).trim();
|
|
|
|
String stuAnswer = answerList.get(i).trim();
|
|
|
@ -399,22 +398,22 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
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(stuAnswer.equals("true")){
|
|
|
|
if (stuAnswer.equals("true")) {
|
|
|
|
stuAnswer="对";
|
|
|
|
stuAnswer = "对";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(stuAnswer.equals("false")){
|
|
|
|
if (stuAnswer.equals("false")) {
|
|
|
|
stuAnswer="错";
|
|
|
|
stuAnswer = "错";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(answer.replaceAll(",","").equals(stuAnswer)){
|
|
|
|
if (answer.replaceAll(",", "").equals(stuAnswer)) {
|
|
|
|
detailDto.setScore(String.valueOf(score));
|
|
|
|
detailDto.setScore(String.valueOf(score));
|
|
|
|
detailDto.setStatus("正确");
|
|
|
|
detailDto.setStatus("正确");
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
detailDto.setScore("0");
|
|
|
|
detailDto.setScore("0");
|
|
|
|
detailDto.setStatus("错误");
|
|
|
|
detailDto.setStatus("错误");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
detailDto.setContent(content);
|
|
|
|
detailDto.setContent(content);
|
|
|
|
detailDto.setMychoice(stuAnswer);
|
|
|
|
detailDto.setMychoice(stuAnswer);
|
|
|
|
detailDto.setAnswer(answer.replaceAll(",",""));
|
|
|
|
detailDto.setAnswer(answer.replaceAll(",", ""));
|
|
|
|
detailDtos.add(detailDto);
|
|
|
|
detailDtos.add(detailDto);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return detailDtos;
|
|
|
|
return detailDtos;
|
|
|
@ -430,7 +429,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
} else { //根据考试时间排序 查询最近的一条
|
|
|
|
} else { //根据考试时间排序 查询最近的一条
|
|
|
|
StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0);
|
|
|
|
StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0);
|
|
|
|
if(stuTheoryExam.getAnswered()){
|
|
|
|
if (stuTheoryExam.getAnswered()) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Date currentTime = new Date();
|
|
|
|
Date currentTime = new Date();
|
|
|
|