【修改】提交未拉取代码

This commit is contained in:
huababa1
2025-08-26 23:20:48 +08:00
12 changed files with 318 additions and 100 deletions

View File

@@ -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<ExamQuestion> selectPaperQuByPaperId(String paperId);
}

View File

@@ -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<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
Optional<EducationPaperQu> resultss = educationPaperQus.stream().filter(entry -> entry.getQuId().equals(quId))
@@ -136,6 +140,7 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
List<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
Optional<EducationPaperScheme> 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<String, String> map = objectMapper.readValue(jsonText, Map.class);
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称: 邮箱 </h2>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号:" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称: 邮箱 </h3>";
judgementStr += "<p>✅ 开始QQ邮箱提判分</p>";
// 考试进行比对
for (ExamQuestionAnswer questionAnswer : examQuestion.getAnswerList()) {
@@ -183,7 +188,7 @@ public class AutoForWinEmailSettingServiceImpl implements AutoForWinEmailSetting
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】"+questionAnswer.getContentIn() + " 得分失败");
}
}
judgementStr += "<h2>试题得分: " + oneScore + " </h2>";
judgementStr += "<h3>试题得分: " + oneScore + " </h3>";
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<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
Optional<EducationPaperScheme> 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 = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称: 邮箱 </p>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号:" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称: 邮箱 </p>";
judgementStr += "<p>✅ 开始QQ邮箱提判分</p>";
judgementStr += "<p>❌ 未成功检测到作答情况</p>";
judgementStr += "<h2>试题得分: 0分 </h2>";
judgementStr += "<h3>试题得分: 0分 </h3>";
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);
}

View File

@@ -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<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
Optional<EducationPaperQu> resultss = educationPaperQus.stream().filter(entry -> entry.getQuId().equals(quId))
.findFirst();
// 获取排序
EducationPaperQu educationPaperQu = resultss.get();
// 试题分数
List<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
Optional<EducationPaperScheme> 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<String, String> map = objectMapper.readValue(jsonText, Map.class);
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称: windows网络设置 </h2>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号:" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称: windows网络设置 </h3>";
judgementStr += "<p>✅ 开始EDGE浏览器网络设置判分</p>";
// 考试进行比对
for (ExamQuestionAnswer questionAnswer : examQuestion.getAnswerList()) {
@@ -183,7 +185,7 @@ public class AutoForWinEdgeSettingServiceImpl implements AutoForWinEdgeSettingSe
judgementStr = HtmlAppender.appendHtmlLine(judgementStr, "【❌】"+questionAnswer.getContentIn() + " 得分失败 ");
}
}
judgementStr += "<h2>试题得分: " + oneScore + " </h2>";
judgementStr += "<h3>试题得分: " + oneScore + " </h3>";
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<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
Optional<EducationPaperScheme> 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 = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称: windows网络设置 </h2>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号:" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称: windows网络设置 </h3>";
judgementStr += "<p>✅ 开始EDGE浏览器网络设置判分</p>";
judgementStr += "<p>❌ 未成功检测到作答情况</p>";
judgementStr += "<h2>试题得分: 0分 </h2>";
judgementStr += "<h3>试题得分: 0分 </h3>";
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);
}

View File

@@ -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<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(name)).findFirst();
Optional<EducationPaperQu> 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 = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称" + name + "</h2>";
judgementStr += "<p>✅ 开始网络题判分</p>";
judgementStr += "<h3>试题号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称:" + name + "</h3>";
judgementStr += "<p>✅ 开始网络提判分</p>";
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 += "<h2>试题得分:" + cpojo.getScore() + "</h2>";
judgementStr += "<h3>试题得分:" + cpojo.getScore() + "</h3>";
// 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;
}
}

View File

@@ -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 = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称:" + name + "</h2>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号:" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称:" + name + "</h3>";
judgementStr += "<p>✅ 开始C语言编程题判分</p>";
// 获取不带文件名称的路径
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 += "<h2>试题得分:" + dangSource + "</h2>";
judgementStr += "<h3>试题得分:" + dangSource + "</h3>";
// 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;
}
}

View File

@@ -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<EducationPaperScheme> educationPaperSchemeList = educationPaperSchemeMapper.selectEducationPaperTaskByPaperId(stuInfoVo.getPaperId());
Optional<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals("选择题")).findFirst();
String quScore = result.get().getQuScores();
String taskId = result.get().getTaskId();
List<EducationPaperQu> educationPaperQus = educationPaperQuMapper.selectPaperQuListByPaperId(stuInfoVo.getPaperId());
// 获取Paper下的所有选择题ID
List<ExamQuestion> examQuestions = educationPaperMapper.selectPaperQuByPaperId(stuInfoVo.getPaperId());
@@ -122,22 +127,22 @@ public class AutoForChoiceServiceImpl implements AutoForChoiceService {
stuAnswerSort = convertToLetter(resultAnswer.get().getSort());
}
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称: 选择题 </h2>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号:" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称: 选择题 </h3>";
judgementStr += "<p>学生答案:" + stuAnswerSort + "</p>";
judgementStr += "<p>正确答案:" + trueAbswerSort + "</p>";
boolean isRight = false;
// 开始判断学生的答案是否正确
if (stuAnswerId.equals(trueAnswerId)) {
// 正确
judgementStr += "<h2>得分:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h3>得分:" + Double.parseDouble(quScore) + "</h3>";
isRight = true;
score += Double.parseDouble(quScore);
} else {
// 不正确
judgementStr += "<h2>得分0 </h2>";
judgementStr += "<h3>得分0 </h3>";
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 = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2试题编号" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称: 选择题 </h2>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h2试题编号" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称: 选择题 </h3>";
judgementStr += "<p>学生答案: 未作答 </p>";
judgementStr += "<p>正确答案:" + trueAbswerSort + "</p>";
judgementStr += "<h2>得分0 </h2>";
judgementStr += "<h3>得分0 </h3>";
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 = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2p>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称: 选择题 </h2>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号:" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h2p>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称: 选择题 </h3>";
judgementStr += "<p>学生答案: 未作答 </p>";
judgementStr += "<p>正确答案:" + trueAbswerSort + "</p>";
judgementStr += "<h2>得分0 </p>";
judgementStr += "<h3>得分0 </p>";
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;

View File

@@ -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 = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称:" + name + "</h2>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号:" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称:" + name + "</h3>";
judgementStr += "<p>✅ 开始文件题判分</p>";
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 += "<h2>试题得分:" + cpojo.getScore() + "</h2>";
judgementStr += "<h3>试题得分:" + cpojo.getScore() + "</h3>";
// 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;
}
}

View File

@@ -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 = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称:" + name + "</h2>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号:" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称:" + name + "</h3>";
judgementStr += "<p>✅ 开始MYSQL判分</p>";
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 += "<h2>试题得分:" + cpojo.getScore() + "</h2>";
judgementStr += "<h3>试题得分:" + cpojo.getScore() + "</h3>";
// 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;
}

View File

@@ -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 = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称" + name + "</h2>";
judgementStr += "<p>✅ 开始PS判分</p>";
judgementStr += "<h3>试题号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称:" + name + "</h3>";
judgementStr += "<p>✅ 开始QQ邮箱提判分</p>";
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 += "<h2>试题得分:" + wordpojo.getScore() + "</h2>";
judgementStr += "<h3>试题得分:" + wordpojo.getScore() + "</h3>";
// 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;
}
}

View File

@@ -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 = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称:" + name + "</h2>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号:" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称:" + name + "</h3>";
judgementStr += "<p>✅ 开始WPS_EXCEL判分</p>";
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 += "<h2>试题得分:" + dangSource + "</h2>";
judgementStr += "<h3>试题得分:" + dangSource + "</h3>";
// 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;
}
}

View File

@@ -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 = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称:" + name + "</h2>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号:" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称:" + name + "</h3>";
judgementStr += "<p>✅ 开始WPS_PPTX判分</p>";
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 += "<h2>试题得分:" + dangSource + "</h2>";
judgementStr += "<h3>试题得分:" + dangSource + "</h3>";
// 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;
}
}

View File

@@ -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 = "<p>-----------------------------------------------------------</p>";
judgementStr += "<h2>试题序号:" + educationPaperQu.getSort() + "</h2>";
judgementStr += "<h2>试题编号:" + examQuestion.getQuNum() + "</h2>";
judgementStr += "<h2>试题分数:" + Double.parseDouble(quScore) + "</h2>";
judgementStr += "<h2>试题名称:" + name + "</h2>";
judgementStr += "<h3>试题序号:" + educationPaperQu.getSort() + "</h3>";
judgementStr += "<h3>试题编号:" + examQuestion.getQuNum() + "</h3>";
judgementStr += "<h3>试题分数:" + Double.parseDouble(quScore) + "</h3>";
judgementStr += "<h3>试题名称:" + name + "</h3>";
judgementStr += "<p>✅ 开始WPS_WORD判分</p>";
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 += "<h2>试题得分:" + dangSource + "</h2>";
judgementStr += "<h3>试题得分:" + dangSource + "</h3>";
// 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;
}
}