|
|
@ -147,7 +147,7 @@ public class CompetitionExamBiz {
|
|
|
|
|
|
|
|
|
|
|
|
CompetitionTask task = competitionTaskDao.getByCompetitionIdAndStageId(vo.getCompId(), vo.getStageId());
|
|
|
|
CompetitionTask task = competitionTaskDao.getByCompetitionIdAndStageId(vo.getCompId(), vo.getStageId());
|
|
|
|
Long costTime = now.getTime() - member.getExamStartTime().getTime();
|
|
|
|
Long costTime = now.getTime() - member.getExamStartTime().getTime();
|
|
|
|
if(costTime >3600000*task.getExamDuration()){
|
|
|
|
if (costTime > 3600000L * task.getExamDuration()) {
|
|
|
|
return Result.error("考试超时");
|
|
|
|
return Result.error("考试超时");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (task.getExamEndTime().getTime() < now.getTime()) {
|
|
|
|
if (task.getExamEndTime().getTime() < now.getTime()) {
|
|
|
@ -169,16 +169,24 @@ public class CompetitionExamBiz {
|
|
|
|
//计算得分
|
|
|
|
//计算得分
|
|
|
|
private Double computeScore(List<QuestionVo> questionVoList, List<SubmitQuestionVO> submitQuestionVOS) {
|
|
|
|
private Double computeScore(List<QuestionVo> questionVoList, List<SubmitQuestionVO> submitQuestionVOS) {
|
|
|
|
Double totalScore = 0D;
|
|
|
|
Double totalScore = 0D;
|
|
|
|
for(int j = 0;j< submitQuestionVOS.size();j++)
|
|
|
|
for (int j = 0; j < submitQuestionVOS.size(); j++) {
|
|
|
|
{
|
|
|
|
|
|
|
|
SubmitQuestionVO submitQuestionVO = submitQuestionVOS.get(j);
|
|
|
|
SubmitQuestionVO submitQuestionVO = submitQuestionVOS.get(j);
|
|
|
|
QuestionVo q = questionVoList.stream().filter(questionVo -> questionVo.getId().equals(submitQuestionVO.getId())).findFirst().orElse(null);
|
|
|
|
QuestionVo q = questionVoList.stream().filter(questionVo -> questionVo.getId().equals(submitQuestionVO.getId())).findFirst().orElse(null);
|
|
|
|
if(q == null) { continue; }
|
|
|
|
if (q == null) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (q.getType() == 0) {
|
|
|
|
if (q.getType() == 0) {
|
|
|
|
//普通题
|
|
|
|
//普通题
|
|
|
|
if (checkCorrect(q.getAnswerId(), submitQuestionVO.getIds())) {
|
|
|
|
if (checkCorrect(q.getAnswerId(), submitQuestionVO.getIds())) {
|
|
|
|
totalScore += q.getScore();
|
|
|
|
totalScore += q.getScore();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//填空题直接对比
|
|
|
|
|
|
|
|
if (q.getQuestionType() == 4) {
|
|
|
|
|
|
|
|
String title = q.getAnswerList().get(0).getTitle();
|
|
|
|
|
|
|
|
if (title.equals(submitQuestionVO.getGapFillingAnswer())) {
|
|
|
|
|
|
|
|
totalScore += q.getScore();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
//案例题
|
|
|
|
//案例题
|
|
|
|
SubQuestionVO subQuestionVO = q.getChildren().stream().filter(subQuestionVO1 -> subQuestionVO1.getId().intValue() == submitQuestionVO.getSubId()).findFirst().orElse(null);
|
|
|
|
SubQuestionVO subQuestionVO = q.getChildren().stream().filter(subQuestionVO1 -> subQuestionVO1.getId().intValue() == submitQuestionVO.getSubId()).findFirst().orElse(null);
|
|
|
@ -194,7 +202,9 @@ public class CompetitionExamBiz {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private boolean checkCorrect(List<Integer> answerId, List<Integer> checkList) {
|
|
|
|
private boolean checkCorrect(List<Integer> answerId, List<Integer> checkList) {
|
|
|
|
if(checkList ==null||checkList.size() == 0) {return false;}
|
|
|
|
if (checkList == null || checkList.size() == 0) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (answerId.size() == checkList.size()) {
|
|
|
|
if (answerId.size() == checkList.size()) {
|
|
|
|
boolean correct = true;
|
|
|
|
boolean correct = true;
|
|
|
|
for (int i = 0; i < checkList.size(); i++) {
|
|
|
|
for (int i = 0; i < checkList.size(); i++) {
|
|
|
|