【修改】 所有判分的判分路径

This commit is contained in:
dlaren
2025-07-15 10:59:26 +08:00
parent 3f4c7b6fa5
commit efa85abdfc
11 changed files with 507 additions and 492 deletions

View File

@@ -163,7 +163,6 @@ public class AutoController {
public Result<String> judgementForChoiceToJson(@RequestBody StuInfoVo stuInfoVo){
return Result.success(autoForChoiceService.autoForChoiceToJson(stuInfoVo));
}
/**
* 选择题判分
* @param stuInfoVo 学生选择题信息

View File

@@ -51,65 +51,65 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
File folder = new File(filePath);
// 2、获取到学生文件
File[] files = folder.listFiles();
for (File file : files) {
File csFiles = new File(file.getPath());
String quId = csFiles.getName();
File[] csFileList = csFiles.listFiles();
if (csFileList == null) {
System.err.println("子目录读取失败: " + csFiles.getAbsolutePath());
continue;
}
for (File one_file : csFileList) {
String name = one_file.getName();
if ("网络题".equals(name)) {
File mysql_file = new File(one_file.getPath());
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText cpojo = judgementBrowerService.Judgement(Double.parseDouble(quScore), mysql_file, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 获取到题型
for (File txFile : files) {
String name = txFile.getName();
if ("网络题".equals(name)) {
File[] txFileList = txFile.listFiles();
for (File stFile : txFileList) {
// 获取试题编号和试题ID
String quId = stFile.getName().split("@")[1];
String quNumber = stFile.getName().split("@")[0];
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
if ("文件".equals(wjFile.getName())) {
File browerFile = new File(wjFile.getPath());
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText cpojo = judgementBrowerService.Judgement(Double.parseDouble(quScore), browerFile, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
break;
}
}
System.out.println(judgementStr);
break;
}
}
}

View File

@@ -48,71 +48,75 @@ public class AutoForCServiceImpl implements AutoForCService {
File folder = new File(filePath);
// 2、获取到学生文件
File[] files = folder.listFiles();
for (File file : files) {
File csFiles = new File(file.getPath());
String quId = csFiles.getName();
File[] csFileList = csFiles.listFiles();
if (csFileList == null) {
System.err.println("子目录读取失败: " + csFiles.getAbsolutePath());
continue;
}
for (File csFile : csFileList) {
String name = csFile.getName();
if ("编程题".equals(name)) {
File[] cs_file_list = csFile.listFiles();
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
for (File lastFile : cs_file_list) {
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称" + name + "</p>";
// 获取不带文件名称的路径
String filePaths = lastFile.getParent();
SourceAndText cpojo = judgementService.ProgrammingC(Double.parseDouble(quScore), filePaths, lastFile.getName(), examQuestion, judgementStr);
judgementStr = cpojo.getText();
BigDecimal dangSource = new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP);
judgementStr += "<p>试题得分:" + dangSource + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(dangSource);
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 获取到题型
for (File txFile : files) {
String name = txFile.getName();
if ("编程题".equals(name)) {
File[] txFileList = txFile.listFiles();
for (File stFile : txFileList) {
// 获取试题编号和试题ID
String quId = stFile.getName().split("@")[1];
String quNumber = stFile.getName().split("@")[0];
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
if ("文件".equals(wjFile.getName())) {
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
System.out.println(wjFile);
File[] lastFiles = wjFile.listFiles();
for (File lastFile : lastFiles) {
if (lastFile.getName().contains(".c")) {
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
// 获取不带文件名称的路径
String filePaths = lastFile.getParent();
SourceAndText cpojo = judgementService.ProgrammingC(Double.parseDouble(quScore), filePaths, lastFile.getName(), examQuestion, judgementStr);
judgementStr = cpojo.getText();
BigDecimal dangSource = new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP);
judgementStr += "<p>试题得分:" + dangSource + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(dangSource);
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
break;
}
}
}
break;
}
}
}
}
return score;
}

View File

@@ -57,68 +57,65 @@ public class AutoForFileServiceImpl implements AutoForFileService {
File folder = new File(filePath);
// 2、获取到学生文件
File[] files = folder.listFiles();
for (File file : files) {
File csFiles = new File(file.getPath());
String quId = csFiles.getName();
File[] csFileList = csFiles.listFiles();
if (csFileList == null) {
System.err.println("子目录读取失败: " + csFiles.getAbsolutePath());
continue;
}
for (File one_file : csFileList) {
String name = one_file.getName();
if ("文件处理".equals(name)) {
File[] cs_file_list = csFiles.listFiles();
String lastFilePath = one_file.getPath();
File mysql_file = new File(one_file.getPath());
File[] lastFiles = one_file.listFiles();
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText cpojo = fileServerice.Judgement(Double.parseDouble(quScore), mysql_file, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 获取到题型
for (File txFile : files) {
String name = txFile.getName();
if ("文件处理".equals(name)) {
File[] txFileList = txFile.listFiles();
for (File stFile : txFileList) {
// 获取试题编号和试题ID
String quId = stFile.getName().split("@")[1];
String quNumber = stFile.getName().split("@")[0];
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
if ("文件".equals(wjFile.getName())) {
File fileFile = new File(wjFile.getPath());
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称" + name + "</p>";
SourceAndText cpojo = fileServerice.Judgement(Double.parseDouble(quScore), fileFile, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
break;
}
}
System.out.println(judgementStr);
break;
}
}
}

View File

@@ -51,65 +51,66 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
File folder = new File(filePath);
// 2、获取到学生文件
File[] files = folder.listFiles();
for (File file : files) {
File csFiles = new File(file.getPath());
String quId = csFiles.getName();
File[] csFileList = csFiles.listFiles();
if (csFileList == null) {
System.err.println("子目录读取失败: " + csFiles.getAbsolutePath());
continue;
}
for (File one_file : csFileList) {
String name = one_file.getName();
if ("程序设计".equals(name)) {
File mysql_file = new File(one_file.getPath());
// 3、根据题号进行查询试题的相关信息
Optional<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(one_file.getName())).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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText cpojo = mysqlLocalService.Judgement(Double.parseDouble(quScore), mysql_file, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(one_file.getName());
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 获取到题型
for (File txFile : files) {
String name = txFile.getName();
if ("程序设计".equals(name)) {
File[] txFileList = txFile.listFiles();
for (File stFile : txFileList) {
// 获取试题编号和试题ID
String quId = stFile.getName().split("@")[1];
String quNumber = stFile.getName().split("@")[0];
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
if ("文件".equals(wjFile.getName())) {
File mysql_file = new File(wjFile.getPath());
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText cpojo = mysqlLocalService.Judgement(Double.parseDouble(quScore), mysql_file, examQuestion, judgementStr);
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = cpojo.getText();
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
System.out.println(judgementStr);
break;
}
}
System.out.println(judgementStr);
break;
}
}
}
@@ -123,18 +124,23 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
File folder = new File(filePath);
// 2、获取到学生文件
File[] files = folder.listFiles();
for (File file : files) {
File csFiles = new File(file.getPath());
String quId = csFiles.getName();
File[] csFileList = csFiles.listFiles();
for (File one_file : csFileList) {
String name = one_file.getName();
if ("程序设计".equals(name)) {
File mysql_file = new File(one_file.getPath());
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
mysqlLocalService.JudgementFile( mysql_file, examQuestion);
break;
// 获取到题型
for (File txFile : files) {
String name = txFile.getName();
if ("程序设计".equals(name)) {
File[] txFileList = txFile.listFiles();
for (File stFile : txFileList) {
// 获取试题编号和试题ID
String quId = stFile.getName().split("@")[1];
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
if ("文件".equals(wjFile.getName())) {
File mysql_file = new File(wjFile.getPath());
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
mysqlLocalService.JudgementFile(mysql_file, examQuestion);
break;
}
}
}
}
}

View File

@@ -46,66 +46,70 @@ public class AutoForPsServiceImpl implements AutoForPsService{
File folder = new File(filePath);
// 2、获取到学生文件
File[] files = folder.listFiles();
for (File file : files) {
File csFiles = new File(file.getPath());
String quId = csFiles.getName();
File[] csFileList = csFiles.listFiles();
if (csFileList == null) {
System.err.println("子目录读取失败: " + csFiles.getAbsolutePath());
continue;
}
String name = csFileList[0].getName();
// 获取到题型
for (File txFile : files) {
String name = txFile.getName();
if ("图像处理".equals(name)) {
File[] cs_file_list = csFiles.listFiles();
String lastFilePath = cs_file_list[0].getPath();
File[] lastFiles = cs_file_list[0].listFiles();
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
for (File lastFile : lastFiles) {
if (lastFile.getName().contains("原始")) {
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText wordpojo = psService.Judgement(Double.parseDouble(quScore), lastFilePath, lastFile.getPath(), examQuestion, judgementStr);
score = score.add(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = wordpojo.getText();
judgementStr += "<p>试题得分" + wordpojo.getScore() + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
File[] txFileList = txFile.listFiles();
for (File stFile : txFileList) {
// 获取试题编号和试题ID
String quId = stFile.getName().split("@")[1];
String quNumber = stFile.getName().split("@")[0];
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
if ("文件".equals(wjFile.getName())) {
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
System.out.println(wjFile);
File[] lastFiles = wjFile.listFiles();
for (File lastFile : lastFiles) {
if (lastFile.getName().contains("原始")) {
String filePaths = lastFile.getParent();
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText wordpojo = psService.Judgement(Double.parseDouble(quScore), filePaths, lastFile.getPath(), examQuestion, judgementStr);
score = score.add(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
judgementStr = wordpojo.getText();
judgementStr += "<p>试题得分:" + wordpojo.getScore() + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(new BigDecimal(wordpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
break;
}
}
}
break;
}
}
}

View File

@@ -89,7 +89,8 @@ public class JudgementServiceImpl implements JudgementService
// 进行关键字权重比对进行判断
for (ExamQuestionKeyword examQuestionKeyword : examQuestion.getQuestionKeywords()) {
boolean keyword_run = code.contains(examQuestionKeyword.getKeyword());
String codeSpacking = code.replace(" ","");
boolean keyword_run = codeSpacking.contains(examQuestionKeyword.getKeyword());
// 计算权值
Map<String, Object> item = new HashMap<>();
item.put("success", keyword_run);

View File

@@ -63,18 +63,14 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
File folder = new File(stuFilePath);
// 5、解压之后得文件获取文件夹和文件
String stu_files = null;
// 5.2、查询试题ID
List<ExamQuestionAnswer> examQuestionAnswers = examQuestionAnswerMapper.selectExamQuestionAnswerByQuId(examQuestion.getQuId());
int correctCount = 0; // 完全正确的题目数量
int totalQuestions = examQuestionAnswers.size(); // 总题目数量// 总题目数量
String totalKeyScore ="0";
//得出 这个题总共的权值点
totalKeyScore=examQuestionAnswerMapper.selectCountPointByQuId(examQuestion.getQuId());
answerLogPath = filepath.getParent() + File.separator + "log.txt";
AtomicInteger total = new AtomicInteger();
// 文件路径

View File

@@ -52,66 +52,69 @@ public class JudgementForExcelServiceImpl implements JudgementForExcelService {
File folder = new File(filePath);
// 2、获取到学生文件
File[] files = folder.listFiles();
for (File file : files) {
File csFiles = new File(file.getPath());
String quId = csFiles.getName();
File[] csFileList = csFiles.listFiles();
if (csFileList == null) {
System.err.println("子目录读取失败: " + csFiles.getAbsolutePath());
continue;
}
for (File csFile : csFileList) {
String name = csFile.getName();
if ("表格".equals(name)) {
File[] cs_file_list = csFile.listFiles();
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
for (File lastFile : cs_file_list) {
if (lastFile.getName().contains("文档")) {
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称" + name + "</p>";
SourceAndText excelpojo = judgementWpsExcelService.judgementWpsXlsx(Double.parseDouble(quScore), lastFile.getPath(), lastFile.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 += "<p>试题得分:" + dangSource + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(dangSource);
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(excelpojo.getScore() == 0 ? 1 : excelpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(excelpojo.getScore() == 0 ? 1 : excelpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 获取到题型
for (File txFile : files) {
String name = txFile.getName();
if ("表格".equals(name)) {
File[] txFileList = txFile.listFiles();
for (File stFile : txFileList) {
// 获取试题编号和试题ID
String quId = stFile.getName().split("@")[1];
String quNumber = stFile.getName().split("@")[0];
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
if ("文件".equals(wjFile.getName())) {
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
System.out.println(wjFile);
File[] lastFiles = wjFile.listFiles();
for (File lastFile : lastFiles) {
if (lastFile.getName().contains("文档")) {
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText excelpojo = judgementWpsExcelService.judgementWpsXlsx(Double.parseDouble(quScore), lastFile.getPath(), lastFile.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 += "<p>试题得分:" + dangSource + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(dangSource);
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(excelpojo.getScore() == 0 ? 1 : excelpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(excelpojo.getScore() == 0 ? 1 : excelpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
break;
}
}
break;
}
}
}

View File

@@ -53,66 +53,69 @@ public class JudgementForPptxServiceImpl implements JudgementForPptxService {
File folder = new File(filePath);
// 2、获取到学生文件
File[] files = folder.listFiles();
for (File file : files) {
File csFiles = new File(file.getPath());
String quId = csFiles.getName();
File[] csFileList = csFiles.listFiles();
if (csFileList == null) {
System.err.println("子目录读取失败: " + csFiles.getAbsolutePath());
continue;
}
for (File csFile : csFileList) {
String name = csFile.getName();
if ("演示".equals(name)) {
File[] cs_file_list = csFile.listFiles();
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
for (File lastFile : cs_file_list) {
String fileNames = lastFile.getName();
if (fileNames.contains("文档")) {
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称" + name + "</p>";
SourceAndText pptxpojo = judgementWpsPptxService.judgementWpsPptx(Double.parseDouble(quScore), lastFile.getPath(), lastFile.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 += "<p>试题得分:" + dangSource + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(dangSource);
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(pptxpojo.getScore() == 0 ? 1 : pptxpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(pptxpojo.getScore() == 0 ? 1 : pptxpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 获取到题型
for (File txFile : files) {
String name = txFile.getName();
if ("演示".equals(name)) {
File[] txFileList = txFile.listFiles();
for (File stFile : txFileList) {
// 获取试题编号和试题ID
String quId = stFile.getName().split("@")[1];
String quNumber = stFile.getName().split("@")[0];
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
if ("文件".equals(wjFile.getName())) {
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
System.out.println(wjFile);
File[] lastFiles = wjFile.listFiles();
for (File lastFile : lastFiles) {
if (lastFile.getName().contains("文档")) {
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText pptxpojo = judgementWpsPptxService.judgementWpsPptx(Double.parseDouble(quScore), lastFile.getPath(), lastFile.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 += "<p>试题得分:" + dangSource + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(dangSource);
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(pptxpojo.getScore() == 0 ? 1 : pptxpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(pptxpojo.getScore() == 0 ? 1 : pptxpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
break;
}
}
break;
}
}
}

View File

@@ -50,71 +50,73 @@ public class JudgementForWordServiceImpl implements JudgementForWordService {
File folder = new File(filePath);
// 2、获取到学生文件
File[] files = folder.listFiles();
for (File file : files) {
File csFiles = new File(file.getPath());
String quId = csFiles.getName();
File[] csFileList = csFiles.listFiles();
if (csFileList == null) {
System.err.println("子目录读取失败: " + csFiles.getAbsolutePath());
continue;
}
for (File csFile : csFileList) {
String name = csFile.getName();
if ("文字".equals(name)) {
File[] cs_file_list = csFile.listFiles();
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
for (File lastFile : cs_file_list) {
if (lastFile.getName().contains("文档")) {
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题号:" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称" + name + "</p>";
SourceAndText wordpojo = judgementWpsWordService.judgementWpsWord(Double.parseDouble(quScore), lastFile.getPath(), lastFile.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 += "<p>试题得分:" + dangSource + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(dangSource);
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
// 获取到题型
for (File txFile : files) {
String name = txFile.getName();
if ("文字".equals(name)) {
File[] txFileList = txFile.listFiles();
for (File stFile : txFileList) {
// 获取试题编号和试题ID
String quId = stFile.getName().split("@")[1];
String quNumber = stFile.getName().split("@")[0];
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
if ("文件".equals(wjFile.getName())) {
// 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();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(quId);
System.out.println(wjFile);
File[] lastFiles = wjFile.listFiles();
for (File lastFile : lastFiles) {
if (lastFile.getName().contains("文档")) {
String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号" + examQuestion.getQuNum() + "</p>";
judgementStr += "<p>试题分数" + Double.parseDouble(quScore) + "</p>";
judgementStr += "<p>试题名称:" + name + "</p>";
SourceAndText wordpojo = judgementWpsWordService.judgementWpsWord(Double.parseDouble(quScore), lastFile.getPath(), lastFile.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 += "<p>试题得分:" + dangSource + "</p>";
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
// 通过 quIdstuIdpaperId 查询
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
if (stuPaperScoreDO != null) {
// 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setScore(dangSource);
stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
stuPaperScoreDO.setTenantId(systemTenant.getId());
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
} else {
StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setQuId(quId);
insertInfo.setScore(dangSource);
insertInfo.setContent(judgementStr);
insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setSubjectName(name);
insertInfo.setTrueScore(new BigDecimal(quScore));
insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(wordpojo.getScore() == 0 ? 1 : wordpojo.getScore() >= Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
break;
}
}
break;
}
}
}
}
}
return score;
}