【修改】mysql、文件处理、浏览器判分路径

This commit is contained in:
huababa1
2025-08-01 17:28:53 +08:00
parent fe00f061b5
commit 8430fde91d
3 changed files with 58 additions and 42 deletions

View File

@@ -62,6 +62,9 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
// 需要根据题号获取试题ID // 需要根据题号获取试题ID
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuNumber(quNumber); ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuNumber(quNumber);
String quId = examQuestion.getQuId(); String quId = examQuestion.getQuId();
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
// 3、根据题号进行查询试题的相关信息 // 3、根据题号进行查询试题的相关信息
Optional<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(name)).findFirst(); Optional<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(name)).findFirst();
Optional<EducationPaperQu> results = educationPaperQus.stream().filter(quLists -> quLists.getQuId().equals(quId)).findFirst(); Optional<EducationPaperQu> results = educationPaperQus.stream().filter(quLists -> quLists.getQuId().equals(quId)).findFirst();
@@ -105,6 +108,7 @@ public class AutoForBrowerServiceImpl implements AutoForBrowerService {
stuPaperScoreService.insertStuPaperScore(insertInfo); stuPaperScoreService.insertStuPaperScore(insertInfo);
} }
break; break;
}
} }
} }
} }

View File

@@ -69,49 +69,52 @@ public class AutoForFileServiceImpl implements AutoForFileService {
// 需要根据题号获取试题ID // 需要根据题号获取试题ID
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuNumber(quNumber); ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuNumber(quNumber);
String quId = examQuestion.getQuId(); String quId = examQuestion.getQuId();
// 3、根据题号进行查询试题的相关信息 File[] wjFiles = stFile.listFiles();
Optional<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(name)).findFirst(); for (File wjFile : wjFiles) {
Optional<EducationPaperQu> results = educationPaperQus.stream().filter(quLists -> quLists.getQuId().equals(quId)).findFirst(); // 3、根据题号进行查询试题的相关信息
EducationPaperScheme educationPaperScheme = result.get(); Optional<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(name)).findFirst();
EducationPaperQu educationPaperQu = results.get(); Optional<EducationPaperQu> results = educationPaperQus.stream().filter(quLists -> quLists.getQuId().equals(quId)).findFirst();
String quScore = educationPaperScheme.getQuScores(); EducationPaperScheme educationPaperScheme = result.get();
String judgementStr = "<p>-----------------------------------------------------------</p>"; EducationPaperQu educationPaperQu = results.get();
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>"; String quScore = educationPaperScheme.getQuScores();
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>"; String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题分数" + Double.parseDouble(quScore) + "</p>"; judgementStr += "<p>试题序号" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题名称" + name + "</p>"; judgementStr += "<p>试题编号" + examQuestion.getQuNum() + "</p>";
SourceAndText cpojo = fileServerice.Judgement(Double.parseDouble(quScore), stFile, examQuestion, judgementStr); judgementStr += "<p>试题分数:" + Double.parseDouble(quScore) + "</p>";
score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); judgementStr += "<p>试题名称:" + name + "</p>";
judgementStr = cpojo.getText(); SourceAndText cpojo = fileServerice.Judgement(Double.parseDouble(quScore), stFile, examQuestion, judgementStr);
judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>"; score = score.add(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
// 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息 judgementStr = cpojo.getText();
// 通过 quIdstuIdpaperId 查询 judgementStr += "<p>试题得分:" + cpojo.getScore() + "</p>";
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId); // 4、需要更新学生试题得分首先需要查询试题的数据库是否保存信息
if (stuPaperScoreDO != null) { // 通过 quIdstuIdpaperId 查询
// 说明已经是做过该题,需要更新数据 StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuInfoVo.getStuId(), stuInfoVo.getPaperId(), quId);
stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); if (stuPaperScoreDO != null) {
stuPaperScoreDO.setContent(judgementStr); // 说明已经是做过该题,需要更新数据
stuPaperScoreDO.setSort(educationPaperQu.getSort()); stuPaperScoreDO.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
stuPaperScoreDO.setSubjectName(name); stuPaperScoreDO.setContent(judgementStr);
stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2); stuPaperScoreDO.setSort(educationPaperQu.getSort());
stuPaperScoreDO.setTrueScore(new BigDecimal(quScore)); stuPaperScoreDO.setSubjectName(name);
stuPaperScoreDO.setTenantId(systemTenant.getId()); stuPaperScoreDO.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO); stuPaperScoreDO.setTrueScore(new BigDecimal(quScore));
} else { stuPaperScoreDO.setTenantId(systemTenant.getId());
StuPaperScoreDO insertInfo = new StuPaperScoreDO(); stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
insertInfo.setStuId(stuInfoVo.getStuId()); } else {
insertInfo.setPaperId(stuInfoVo.getPaperId()); StuPaperScoreDO insertInfo = new StuPaperScoreDO();
insertInfo.setQuId(quId); insertInfo.setStuId(stuInfoVo.getStuId());
insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP)); insertInfo.setPaperId(stuInfoVo.getPaperId());
insertInfo.setContent(judgementStr); insertInfo.setQuId(quId);
insertInfo.setSort(educationPaperQu.getSort()); insertInfo.setScore(new BigDecimal(cpojo.getScore()).setScale(1, BigDecimal.ROUND_HALF_UP));
insertInfo.setSubjectName(name); insertInfo.setContent(judgementStr);
insertInfo.setTrueScore(new BigDecimal(quScore)); insertInfo.setSort(educationPaperQu.getSort());
insertInfo.setTenantId(systemTenant.getId()); insertInfo.setSubjectName(name);
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2); insertInfo.setTrueScore(new BigDecimal(quScore));
stuPaperScoreService.insertStuPaperScore(insertInfo); insertInfo.setTenantId(systemTenant.getId());
insertInfo.setIsTrue(cpojo.getScore() == 0 ? 1 : cpojo.getScore() == Double.parseDouble(quScore) ? 0 : 2);
stuPaperScoreService.insertStuPaperScore(insertInfo);
}
break;
} }
break;
} }
} }
} }

View File

@@ -63,12 +63,18 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
// 需要根据题号获取试题ID // 需要根据题号获取试题ID
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuNumber(quNumber); ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuNumber(quNumber);
String quId = examQuestion.getQuId(); String quId = examQuestion.getQuId();
File[] wjFiles = stFile.listFiles();
for (File wjFile : wjFiles) {
// 3、根据题号进行查询试题的相关信息 // 3、根据题号进行查询试题的相关信息
Optional<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(name)).findFirst(); Optional<EducationPaperScheme> result = educationPaperSchemeList.stream().filter(quLists -> quLists.getSpName().equals(name)).findFirst();
Optional<EducationPaperQu> results = educationPaperQus.stream().filter(quLists -> quLists.getQuId().equals(quId)).findFirst(); Optional<EducationPaperQu> results = educationPaperQus.stream().filter(quLists -> quLists.getQuId().equals(quId)).findFirst();
EducationPaperScheme educationPaperScheme = result.get(); EducationPaperScheme educationPaperScheme = result.get();
EducationPaperQu educationPaperQu = results.get(); EducationPaperQu educationPaperQu = results.get();
String quScore = educationPaperScheme.getQuScores(); String quScore = educationPaperScheme.getQuScores();
if (wjFile.getName().contains(".sql")) {
String judgementStr = "<p>-----------------------------------------------------------</p>"; String judgementStr = "<p>-----------------------------------------------------------</p>";
judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>"; judgementStr += "<p>试题序号:" + educationPaperQu.getSort() + "</p>";
judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>"; judgementStr += "<p>试题编号:" + examQuestion.getQuNum() + "</p>";
@@ -106,7 +112,10 @@ public class AutoForMysqlServiceImpl implements AutoForMysqlService {
stuPaperScoreService.insertStuPaperScore(insertInfo); stuPaperScoreService.insertStuPaperScore(insertInfo);
} }
System.out.println(judgementStr); System.out.println(judgementStr);
}
break; break;
}
} }
} }
} }