diff --git a/src/main/java/com/example/exam/exam/mapper/EducationPaperMapper.java b/src/main/java/com/example/exam/exam/mapper/EducationPaperMapper.java
index f5092e5..20614d1 100644
--- a/src/main/java/com/example/exam/exam/mapper/EducationPaperMapper.java
+++ b/src/main/java/com/example/exam/exam/mapper/EducationPaperMapper.java
@@ -4,15 +4,16 @@ import com.example.exam.exam.dal.ExamQuestion;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
+
@Mapper
public interface EducationPaperMapper {
/**
* 根据试卷id返回 该试卷下的试题和试题答案 按顺序
+ *
* @param paperId
* @return
*/
List selectPaperQuByPaperId(String paperId);
-
}
diff --git a/src/main/java/com/example/exam/exam/service/autoForEmailSetting/AutoForWinEmailSettingServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoForEmailSetting/AutoForWinEmailSettingServiceImpl.java
index 2cd432b..56b54c8 100644
--- a/src/main/java/com/example/exam/exam/service/autoForEmailSetting/AutoForWinEmailSettingServiceImpl.java
+++ b/src/main/java/com/example/exam/exam/service/autoForEmailSetting/AutoForWinEmailSettingServiceImpl.java
@@ -6,11 +6,13 @@ import com.example.exam.exam.mapper.EducationPaperMapper;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
+import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
import com.example.exam.exam.service.tenant.SystemTenantService;
import com.example.exam.exam.utils.HtmlAppender;
import com.example.exam.exam.utils.c.LogFileUtils;
+import com.example.exam.exam.utils.error_question.ErrorQuestion;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.annotation.Resource;
@@ -36,8 +38,10 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
- @Autowired
- private EducationPaperMapper educationPaperMapper;
+ @Resource
+ EducationPaperMapper educationPaperMapper;
+ @Resource
+ IExamErrorQuestionService examErrorQuestionService;
/**
* 自动判题邮箱
@@ -124,7 +128,7 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
File jsonFile = new File(file.getPath());
ObjectMapper objectMapper = new ObjectMapper();
if (jsonFile.exists()) {
- Double oneScore = 0.0;
+ double oneScore = 0.0;
String quId = file.getName().split("@")[0];
List educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
Optional resultss = educationPaperQus.stream().filter(entry -> entry.getQuId().equals(quId))
@@ -136,6 +140,7 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
Optional result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals("邮箱")).findFirst();
String quScore = result.get().getQuScores();
+ String taskId = result.get().getTaskId();
// 根据ID查询试题
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
@@ -148,10 +153,10 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
Map map = objectMapper.readValue(jsonText, Map.class);
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称: 邮箱
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称: 邮箱
";
judgementStr += "✅ 开始QQ邮箱提判分
";
// 考试进行比对
for (ExamQuestionAnswer questionAnswer : examQuestion.getAnswerList()) {
@@ -183,7 +188,7 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】"+questionAnswer.getContentIn() + " 得分失败");
}
}
- judgementStr += "试题得分: " + oneScore + "
";
+ judgementStr += "试题得分: " + oneScore + "
";
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -198,6 +203,18 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isTrue);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
+
+ // 关闭文件输入流
if (fileInputStream != null) {
try {
fileInputStream.close();
@@ -224,16 +241,17 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
Optional result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals("邮箱")).findFirst();
String quScore = result.get().getQuScores();
+ String taskId = result.get().getTaskId();
// 根据ID查询试题
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称: 邮箱
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称: 邮箱 ";
judgementStr += "
✅ 开始QQ邮箱提判分
";
judgementStr += "❌ 未成功检测到作答情况
";
- judgementStr += "试题得分: 0分
";
+ judgementStr += "试题得分: 0分
";
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -247,6 +265,16 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, 1);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
}
return score.setScale(1, BigDecimal.ROUND_HALF_UP);
}
diff --git a/src/main/java/com/example/exam/exam/service/autoForWinEdgeSetting/AutoForWinEdgeSettingServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoForWinEdgeSetting/AutoForWinEdgeSettingServiceImpl.java
index 44df093..63e32c6 100644
--- a/src/main/java/com/example/exam/exam/service/autoForWinEdgeSetting/AutoForWinEdgeSettingServiceImpl.java
+++ b/src/main/java/com/example/exam/exam/service/autoForWinEdgeSetting/AutoForWinEdgeSettingServiceImpl.java
@@ -6,15 +6,16 @@ import com.example.exam.exam.mapper.EducationPaperMapper;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
+import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
import com.example.exam.exam.service.tenant.SystemTenantService;
import com.example.exam.exam.utils.HtmlAppender;
import com.example.exam.exam.utils.c.LogFileUtils;
+import com.example.exam.exam.utils.error_question.ErrorQuestion;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.annotation.Resource;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.*;
@@ -36,8 +37,10 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
- @Autowired
- private EducationPaperMapper educationPaperMapper;
+ @Resource
+ EducationPaperMapper educationPaperMapper;
+ @Resource
+ IExamErrorQuestionService examErrorQuestionService;
/**
* 自动判题Edge
@@ -124,21 +127,20 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
File jsonFile = new File(file.getPath());
ObjectMapper objectMapper = new ObjectMapper();
if (jsonFile.exists()) {
- Double oneScore = 0.0;
+ double oneScore = 0.0;
String quId = file.getName().split("@")[0];
List educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
Optional resultss = educationPaperQus.stream().filter(entry -> entry.getQuId().equals(quId))
.findFirst();
// 获取排序
EducationPaperQu educationPaperQu = resultss.get();
-
// 试题分数
List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
Optional result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals("windows网络设置")).findFirst();
String quScore = result.get().getQuScores();
+ String taskId = result.get().getTaskId();
// 根据ID查询试题
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
-
// 读取学生文件
try (FileInputStream fileInputStream = new FileInputStream(jsonFile)) {
// 读取文件并转换为 JsonNode
@@ -148,10 +150,10 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
Map map = objectMapper.readValue(jsonText, Map.class);
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称: windows网络设置
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称: windows网络设置
";
judgementStr += "✅ 开始EDGE浏览器网络设置判分
";
// 考试进行比对
for (ExamQuestionAnswer questionAnswer : examQuestion.getAnswerList()) {
@@ -183,7 +185,7 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】"+questionAnswer.getContentIn() + " 得分失败 ");
}
}
- judgementStr += "试题得分: " + oneScore + "
";
+ judgementStr += "试题得分: " + oneScore + "
";
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -198,6 +200,17 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isTrue);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
+ // 关闭文件输入流
if (fileInputStream != null) {
try {
fileInputStream.close();
@@ -219,21 +232,21 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
.findFirst();
// 获取排序
EducationPaperQu educationPaperQu = resultss.get();
-
// 试题分数
List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
Optional result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals("windows网络设置")).findFirst();
- String quScore = result.get().getQuScores();
+ String quScore = result.get().getQuScores(); // 分数
+ String taskId = result.get().getTaskId(); // 任务ID
// 根据ID查询试题
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称: windows网络设置
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称: windows网络设置
";
judgementStr += "✅ 开始EDGE浏览器网络设置判分
";
judgementStr += "❌ 未成功检测到作答情况
";
- judgementStr += "试题得分: 0分
";
+ judgementStr += "试题得分: 0分
";
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -247,6 +260,16 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, 1);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
}
return score.setScale(1, BigDecimal.ROUND_HALF_UP);
}
diff --git a/src/main/java/com/example/exam/exam/service/autoforbrower/AutoForBrowerServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoforbrower/AutoForBrowerServiceImpl.java
index ca08e4e..e716456 100644
--- a/src/main/java/com/example/exam/exam/service/autoforbrower/AutoForBrowerServiceImpl.java
+++ b/src/main/java/com/example/exam/exam/service/autoforbrower/AutoForBrowerServiceImpl.java
@@ -5,10 +5,12 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.brower.JudgementBrowerService;
+import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
import com.example.exam.exam.service.tenant.SystemTenantService;
import com.example.exam.exam.service.winfile.IFileServerice;
+import com.example.exam.exam.utils.error_question.ErrorQuestion;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
@@ -34,6 +36,8 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
+ @Resource
+ IExamErrorQuestionService examErrorQuestionService;
/**
* 自动判题文件处理
@@ -66,23 +70,24 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
String quId = examQuestion.getQuId();
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
-
// 3、根据题号进行查询试题的相关信息
Optional result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(name)).findFirst();
Optional results = educationPaperQus.stream().filter(quLists -> quLists.getQuId().equals(quId)).findFirst();
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
+ String taskId = educationPaperScheme.getTaskId();
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称:" + name + "
";
- judgementStr += "✅ 开始网络题判分
";
+
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称:" + name + "
";
+ judgementStr += "✅ 开始网络提判分
";
SourceAndText cpojo = judgementBrowerService.Judgement(Double.parseDouble(quScore), stFile, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
- judgementStr += "试题得分:" + cpojo.getScore() + "
";
+ judgementStr += "试题得分:" + cpojo.getScore() + "
";
// 4、需要更新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
@@ -97,6 +102,17 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ int isError = cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
break;
}
}
diff --git a/src/main/java/com/example/exam/exam/service/autoforc/AutoForCServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoforc/AutoForCServiceImpl.java
index 15e145e..504fbf7 100644
--- a/src/main/java/com/example/exam/exam/service/autoforc/AutoForCServiceImpl.java
+++ b/src/main/java/com/example/exam/exam/service/autoforc/AutoForCServiceImpl.java
@@ -5,16 +5,20 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
+import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
import com.example.exam.exam.service.tenant.SystemTenantService;
-import com.example.exam.exam.utils.HtmlAppender;
+import com.example.exam.exam.utils.error_question.ErrorQuestion;
+import com.example.exam.exam.utils.snowflake.SnowflakeId;
import jakarta.annotation.Resource;
+import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
+import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
@@ -33,6 +37,8 @@ public class AutoForCServiceImpl implements AutoForCService {
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
+ @Resource
+ IExamErrorQuestionService examErrorQuestionService;
/**
* 自动判题C语言
@@ -71,19 +77,20 @@ public class AutoForCServiceImpl implements AutoForCService {
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
+ String taskId = educationPaperScheme.getTaskId();
if (wjFile.getName().contains(".c")) {
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称:" + name + "
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称:" + name + "
";
judgementStr += "✅ 开始C语言编程题判分
";
// 获取不带文件名称的路径
String filePaths = wjFile.getParent();
SourceAndText cpojo = judgementService.ProgrammingC(Double.parseDouble(quScore), filePaths, wjFile.getName(), examQuestion, judgementStr);
judgementStr = cpojo.getText();
BigDecimal dangSource = new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP);
- judgementStr += "试题得分:" + dangSource + "
";
+ judgementStr += "试题得分:" + dangSource + "
";
// 4、需要更新学生试题得分,首先需要查询试题的数据库是否保存信息
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
// 直接进行新增,不需要进行更新
@@ -100,6 +107,17 @@ public class AutoForCServiceImpl implements AutoForCService {
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ int isError = cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
break;
}
}
diff --git a/src/main/java/com/example/exam/exam/service/autoforchoice/AutoForChoiceServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoforchoice/AutoForChoiceServiceImpl.java
index 3034ede..d5712fe 100644
--- a/src/main/java/com/example/exam/exam/service/autoforchoice/AutoForChoiceServiceImpl.java
+++ b/src/main/java/com/example/exam/exam/service/autoforchoice/AutoForChoiceServiceImpl.java
@@ -6,10 +6,12 @@ import com.example.exam.exam.mapper.EducationPaperMapper;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
+import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
import com.example.exam.exam.service.tenant.SystemTenantService;
import com.example.exam.exam.utils.c.LogFileUtils;
+import com.example.exam.exam.utils.error_question.ErrorQuestion;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
@@ -36,8 +38,10 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
- @Autowired
- private EducationPaperMapper educationPaperMapper;
+ @Resource
+ EducationPaperMapper educationPaperMapper;
+ @Resource
+ IExamErrorQuestionService examErrorQuestionService;
/**
* 自动判题选择题
@@ -65,7 +69,7 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
@Override
public Double autoForChoice(StuInfoVo stuInfoVo) throws IOException {
SystemTenant systemTenant = systemTenantService.getId(stuInfoVo.getSchoolName());
- Double score = 0.0;
+ double score = 0.0;
// 文件路径
String filePath = stuInfoVo.getFilePath() + "/Choice.json";
// 读取JSON文件
@@ -75,6 +79,7 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
List educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
Optional result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals("选择题")).findFirst();
String quScore = result.get().getQuScores();
+ String taskId = result.get().getTaskId();
List educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
// 获取Paper下的所有选择题ID
List examQuestions = educationPaperMapper.selectPaperQuByPaperId(stuInfoVo.getPaperId());
@@ -122,22 +127,22 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
stuAnswerSort = convertToLetter(resultAnswer.get().getSort());
}
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称: 选择题
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称: 选择题
";
judgementStr += "学生答案:" + stuAnswerSort + "
";
judgementStr += "正确答案:" + trueAbswerSort + "
";
boolean isRight = false;
// 开始判断学生的答案是否正确
if (stuAnswerId.equals(trueAnswerId)) {
// 正确
- judgementStr += "得分:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "得分:" + Double.parseDouble(quScore) + "
";
isRight = true;
score += Double.parseDouble(quScore);
} else {
// 不正确
- judgementStr += "得分:0
";
+ judgementStr += "得分:0
";
isRight = false;
}
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
@@ -153,6 +158,17 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ int isError = isRight ? 0 : 1;
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
} else {
// 根据ID查询试题
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
@@ -165,13 +181,13 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
}
// 没有找到作答情况直接该题判0分
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称: 选择题
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称: 选择题
";
judgementStr += "
学生答案: 未作答
";
judgementStr += "正确答案:" + trueAbswerSort + "
";
- judgementStr += "得分:0
";
+ judgementStr += "得分:0
";
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -185,6 +201,16 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, 1);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
}
}
if (fileInputStream != null) {
@@ -215,13 +241,13 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
EducationPaperQu educationPaperQu = resultss.get();
// 没有找到作答情况直接该题判0分
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "";
- judgementStr += "试题名称: 选择题
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "";
+ judgementStr += "试题名称: 选择题
";
judgementStr += "学生答案: 未作答
";
judgementStr += "正确答案:" + trueAbswerSort + "
";
- judgementStr += "得分:0 ";
+ judgementStr += "得分:0 ";
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
@@ -235,6 +261,16 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, 1);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
}
}
return score;
diff --git a/src/main/java/com/example/exam/exam/service/autoforfile/AutoForFileServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoforfile/AutoForFileServiceImpl.java
index 670fd86..9563edf 100644
--- a/src/main/java/com/example/exam/exam/service/autoforfile/AutoForFileServiceImpl.java
+++ b/src/main/java/com/example/exam/exam/service/autoforfile/AutoForFileServiceImpl.java
@@ -5,12 +5,14 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
+import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.mysql.IMysqlLocalService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
import com.example.exam.exam.service.tenant.SystemTenantService;
import com.example.exam.exam.service.winfile.IFileServerice;
import com.example.exam.exam.utils.c.LogFileUtils;
+import com.example.exam.exam.utils.error_question.ErrorQuestion;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
@@ -40,6 +42,8 @@ public class AutoForFileServiceImpl implements AutoForFileService {
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
+ @Resource
+ IExamErrorQuestionService examErrorQuestionService;
/**
* 自动判题文件处理
@@ -79,16 +83,17 @@ public class AutoForFileServiceImpl implements AutoForFileService {
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
+ String taskId = educationPaperScheme.getTaskId();
String judgementStr = "
-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称:" + name + "
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称:" + name + "
";
judgementStr += "✅ 开始文件题判分
";
SourceAndText cpojo = fileServerice.Judgement(Double.parseDouble(quScore), stFile, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
- judgementStr += "试题得分:" + cpojo.getScore() + "
";
+ judgementStr += "试题得分:" + cpojo.getScore() + "
";
// 4、需要更新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
@@ -103,6 +108,17 @@ public class AutoForFileServiceImpl implements AutoForFileService {
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ int isError = cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
break;
}
}
diff --git a/src/main/java/com/example/exam/exam/service/autoformysql/AutoForMysqlServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoformysql/AutoForMysqlServiceImpl.java
index f905ac8..13c7b7b 100644
--- a/src/main/java/com/example/exam/exam/service/autoformysql/AutoForMysqlServiceImpl.java
+++ b/src/main/java/com/example/exam/exam/service/autoformysql/AutoForMysqlServiceImpl.java
@@ -5,10 +5,12 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
+import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.mysql.IMysqlLocalService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
import com.example.exam.exam.service.tenant.SystemTenantService;
+import com.example.exam.exam.utils.error_question.ErrorQuestion;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
@@ -34,6 +36,8 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
+ @Resource
+ IExamErrorQuestionService examErrorQuestionService;
/**
* 自动判题C语言
@@ -75,18 +79,18 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
+ String taskId = educationPaperScheme.getTaskId();
if (wjFile.getName().contains(".sql")) {
-
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称:" + name + "
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称:" + name + "
";
judgementStr += "✅ 开始MYSQL判分
";
SourceAndText cpojo = mysqlLocalService.Judgement(Double.parseDouble(quScore), stFile, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
- judgementStr += "试题得分:" + cpojo.getScore() + "
";
+ judgementStr += "试题得分:" + cpojo.getScore() + "
";
// 4、需要更新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
@@ -101,7 +105,17 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
- System.out.println(judgementStr);
+ // 判断是否进入错题集
+ int isError = cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
}
break;
}
diff --git a/src/main/java/com/example/exam/exam/service/autoforps/AutoForPsServiceImpl.java b/src/main/java/com/example/exam/exam/service/autoforps/AutoForPsServiceImpl.java
index 8767b38..b5f568e 100644
--- a/src/main/java/com/example/exam/exam/service/autoforps/AutoForPsServiceImpl.java
+++ b/src/main/java/com/example/exam/exam/service/autoforps/AutoForPsServiceImpl.java
@@ -4,11 +4,13 @@ import com.example.exam.exam.controller.auto.vo.StuInfoVo;
import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
+import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.mysql.IMysqlLocalService;
import com.example.exam.exam.service.ps.PsService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
import com.example.exam.exam.service.tenant.SystemTenantService;
+import com.example.exam.exam.utils.error_question.ErrorQuestion;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
@@ -33,6 +35,8 @@ public class AutoForPsServiceImpl implements AutoForPsService {
StuPaperScoreService stuPaperScoreService;
@Resource
SystemTenantService systemTenantService;
+ @Resource
+ IExamErrorQuestionService examErrorQuestionService;
@Override
public BigDecimal autoForPs(StuInfoVo stuInfoVo) throws IOException {
@@ -66,18 +70,20 @@ public class AutoForPsServiceImpl implements AutoForPsService {
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
+ String taskId = educationPaperScheme.getTaskId();
if (wjFile.getName().contains("原始")) {
String filePaths = wjFile.getParent();
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称:" + name + "
";
- judgementStr += "✅ 开始PS判分
";
+
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称:" + name + "
";
+ judgementStr += "✅ 开始QQ邮箱提判分
";
SourceAndText wordpojo = psService.Judgement(Double.parseDouble(quScore), filePaths, wjFile.getPath(), examQuestion, judgementStr);
score = score.add(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = wordpojo.getText();
- judgementStr += "试题得分:" + wordpojo.getScore() + "
";
+ judgementStr += "试题得分:" + wordpojo.getScore() + "
";
// 4、需要更新学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
@@ -92,6 +98,17 @@ public class AutoForPsServiceImpl implements AutoForPsService {
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ int isError = wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
break;
}
}
diff --git a/src/main/java/com/example/exam/exam/service/wpsexcel/excel/JudgementForExcelServiceImpl.java b/src/main/java/com/example/exam/exam/service/wpsexcel/excel/JudgementForExcelServiceImpl.java
index 7e3162d..c792ab1 100644
--- a/src/main/java/com/example/exam/exam/service/wpsexcel/excel/JudgementForExcelServiceImpl.java
+++ b/src/main/java/com/example/exam/exam/service/wpsexcel/excel/JudgementForExcelServiceImpl.java
@@ -6,10 +6,12 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
+import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
import com.example.exam.exam.service.tenant.SystemTenantService;
import com.example.exam.exam.service.wpsexcel.JudgementWpsExcelService;
+import com.example.exam.exam.utils.error_question.ErrorQuestion;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
@@ -38,6 +40,8 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService {
JudgementWpsExcelService judgementWpsExcelService;
@Resource
SystemTenantService systemTenantService;
+ @Resource
+ IExamErrorQuestionService examErrorQuestionService;
@Override
public BigDecimal autoForWpsExcel(StuInfoVo stuInfoVo) throws Exception {
@@ -70,19 +74,19 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService {
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
- System.out.println(wjFile.getName());
+ String taskId = educationPaperScheme.getTaskId();
if (wjFile.getName().contains("文档")) {
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称:" + name + "
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称:" + name + "
";
judgementStr += "✅ 开始WPS_EXCEL判分
";
SourceAndText excelpojo = judgementWpsExcelService.judgementWpsXlsx(Double.parseDouble(quScore), wjFile.getPath(), wjFile.getPath(), examQuestion, judgementStr);
score = score.add(new BigDecimal(excelpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = excelpojo.getText();
BigDecimal dangSource = new BigDecimal(excelpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP);
- judgementStr += "试题得分:" + dangSource + "
";
+ judgementStr += "试题得分:" + dangSource + "
";
// 4、需要新增生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
@@ -97,6 +101,17 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService {
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(excelpojo.getScore() == 0 ? 1 : excelpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ int isError = excelpojo.getScore() == 0 ? 1 : excelpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
break;
}
}
diff --git a/src/main/java/com/example/exam/exam/service/wpspptx/pptx/JudgementForPptxServiceImpl.java b/src/main/java/com/example/exam/exam/service/wpspptx/pptx/JudgementForPptxServiceImpl.java
index 393ade1..315751f 100644
--- a/src/main/java/com/example/exam/exam/service/wpspptx/pptx/JudgementForPptxServiceImpl.java
+++ b/src/main/java/com/example/exam/exam/service/wpspptx/pptx/JudgementForPptxServiceImpl.java
@@ -6,12 +6,12 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
+import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
import com.example.exam.exam.service.tenant.SystemTenantService;
import com.example.exam.exam.service.wpspptx.JudgementWpsPptxService;
-import com.example.exam.exam.service.wpsword.JudgementWpsWordService;
-import com.example.exam.exam.service.wpsword.word.JudgementForWordService;
+import com.example.exam.exam.utils.error_question.ErrorQuestion;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
@@ -40,6 +40,8 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService {
JudgementWpsPptxService judgementWpsPptxService;
@Resource
SystemTenantService systemTenantService;
+ @Resource
+ IExamErrorQuestionService examErrorQuestionService;
@Override
public BigDecimal autoForWpsPptx(StuInfoVo stuInfoVo) throws Exception {
@@ -72,18 +74,19 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService {
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
+ String taskId = educationPaperScheme.getTaskId();
if (wjFile.getName().contains("文档")) {
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称:" + name + "
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称:" + name + "
";
judgementStr += "✅ 开始WPS_PPTX判分
";
SourceAndText pptxpojo = judgementWpsPptxService.judgementWpsPptx(Double.parseDouble(quScore), wjFile.getPath(), wjFile.getPath(), examQuestion, judgementStr);
score = score.add(new BigDecimal(pptxpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = pptxpojo.getText();
BigDecimal dangSource = new BigDecimal(pptxpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP);
- judgementStr += "试题得分:" + dangSource + "
";
+ judgementStr += "试题得分:" + dangSource + "
";
// 4、需要新增生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
@@ -98,6 +101,17 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService {
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(pptxpojo.getScore() == 0 ? 1 : pptxpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ int isError = pptxpojo.getScore() == 0 ? 1 : pptxpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
break;
}
}
diff --git a/src/main/java/com/example/exam/exam/service/wpsword/word/JudgementForWordServiceImpl.java b/src/main/java/com/example/exam/exam/service/wpsword/word/JudgementForWordServiceImpl.java
index 3fba574..ec2a076 100644
--- a/src/main/java/com/example/exam/exam/service/wpsword/word/JudgementForWordServiceImpl.java
+++ b/src/main/java/com/example/exam/exam/service/wpsword/word/JudgementForWordServiceImpl.java
@@ -6,15 +6,20 @@ import com.example.exam.exam.dal.*;
import com.example.exam.exam.mapper.EducationPaperQuMapper;
import com.example.exam.exam.mapper.EducationPaperSchemeMapper;
import com.example.exam.exam.service.c.JudgementService;
+import com.example.exam.exam.service.error.IExamErrorQuestionService;
import com.example.exam.exam.service.question.IExamQuestionService;
import com.example.exam.exam.service.stupaperscore.StuPaperScoreService;
import com.example.exam.exam.service.tenant.SystemTenantService;
import com.example.exam.exam.service.wpsword.JudgementWpsWordService;
+import com.example.exam.exam.utils.error_question.ErrorQuestion;
+import com.example.exam.exam.utils.snowflake.SnowflakeId;
import jakarta.annotation.Resource;
+import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.io.File;
import java.math.BigDecimal;
+import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
@@ -38,6 +43,9 @@ public class JudgementForWordServiceImpl implements JudgementForWordService {
JudgementWpsWordService judgementWpsWordService;
@Resource
SystemTenantService systemTenantService;
+ @Resource
+ IExamErrorQuestionService examErrorQuestionService;
+
@Override
public BigDecimal autoForWpsWord(StuInfoVo stuInfoVo) throws Exception {
SystemTenant systemTenant = systemTenantService.getId(stuInfoVo.getSchoolName());
@@ -69,18 +77,19 @@ public class JudgementForWordServiceImpl implements JudgementForWordService {
EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores();
+ String taskId = educationPaperScheme.getTaskId();
if (wjFile.getName().contains("文档")) {
String judgementStr = "-----------------------------------------------------------
";
- judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
- judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
- judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
- judgementStr += "试题名称:" + name + "
";
+ judgementStr += "试题序号:" + educationPaperQu.getSort() + "
";
+ judgementStr += "试题编号:" + examQuestion.getQuNum() + "
";
+ judgementStr += "试题分数:" + Double.parseDouble(quScore) + "
";
+ judgementStr += "试题名称:" + name + "
";
judgementStr += "✅ 开始WPS_WORD判分
";
SourceAndText wordpojo = judgementWpsWordService.judgementWpsWord(Double.parseDouble(quScore), wjFile.getPath(), wjFile.getPath(), examQuestion, judgementStr);
score = score.add(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = wordpojo.getText();
BigDecimal dangSource = new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP);
- judgementStr += "试题得分:" + dangSource + "
";
+ judgementStr += "试题得分:" + dangSource + "
";
// 4、需要新增学生试题得分
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
@@ -95,6 +104,17 @@ public class JudgementForWordServiceImpl implements JudgementForWordService {
insertInfo.setTemporaryId(stuInfoVo.getTemporaryId());
insertInfo.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
+ // 判断是否进入错题集
+ int isError = wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2;
+ ExamErrorQuestion examErrorQuestion = ErrorQuestion.insertErrorQuestion(quId, examQuestion, taskId, systemTenant, stuInfoVo, isError);
+ boolean isInsert = examErrorQuestionService.isExamErrorQuestion(quId,
+ String.valueOf(stuInfoVo.getStuId()),
+ String.valueOf(systemTenant.getId()));
+ if (!isInsert) {
+ if (examErrorQuestion != null) {
+ examErrorQuestionService.insertExamErrorQuestion(examErrorQuestion);
+ }
+ }
break;
}
}