【修改】 除选择题,所有题进入学生分库

This commit is contained in:
DESKTOP-932OMT8\REN
2025-05-28 10:00:23 +08:00
parent 940a71ae47
commit 725b15a813

View File

@@ -263,55 +263,198 @@ public class AutoToolsServiceImpl implements AutoToolsService{
for (File file_one : qu_file_list) {
// 判断名称 类似于 C语言程序设计。 课程+题型
System.out.println(one_file.getName());
if (one_file.getName().split("\\.")[0].equals("C语言编程题")) {
StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuId, paperId, examQuestion.getQuId());
// 判断是否做过该题
boolean isNull = false;
if (stuPaperScoreDO == null) {
stuPaperScoreDO = new StuPaperScoreDO();
stuPaperScoreDO.setStuId(stuId);
stuPaperScoreDO.setQuId(examQuestion.getQuId());
stuPaperScoreDO.setPaperId(paperId);
isNull = true;
}
if ("C语言编程题".equals(one_file.getName().split("\\.")[0])) {
double c_score = judgementService.ProgrammingC(15.0, one_file.getPath(), file_one.getName(), examQuestion);
score += c_score;
stuPaperScoreDO.setScore(new BigDecimal(c_score));
// 原始正确分数
stuPaperScoreDO.setTrueScore(new BigDecimal("15.0"));
// 判断题是否正确
if (c_score == 15.0) {
stuPaperScoreDO.setIsTrue(0);
} else if (c_score == 0) {
stuPaperScoreDO.setIsTrue(1);
} else {
stuPaperScoreDO.setIsTrue(2);
}
stuPaperScoreDO.setSubjectName(examQuestion.getSubjectName());
if (isNull) {
// 如果之前没做过,则插入该题的分数
stuPaperScoreService.insertStuPaperScore(stuPaperScoreDO);
} else {
// 如果之前做过,则更新该题的分数
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
}
System.out.println(c_score+"C语言程序设计得分");
break;
}
// wps 类型存在多级文文件夹,需要个性化设置
if (one_file.getName().split("\\.")[0].equals("WPS文字")) {
if ("WPS文字".equals(one_file.getName().split("\\.")[0])) {
double wps_word_score = judgementWpsWordService.judgementWpsWord(15.0, one_file.getPath(), file_one.getPath(), examQuestion);
score += wps_word_score;
stuPaperScoreDO.setScore(new BigDecimal(wps_word_score));
// 原始正确分数
stuPaperScoreDO.setTrueScore(new BigDecimal("15.0"));
// 判断题是否正确
if (wps_word_score == 15.0) {
stuPaperScoreDO.setIsTrue(0);
} else if (wps_word_score == 0) {
stuPaperScoreDO.setIsTrue(1);
} else {
stuPaperScoreDO.setIsTrue(2);
}
stuPaperScoreDO.setSubjectName(examQuestion.getSubjectName());
if (isNull) {
// 如果之前没做过,则插入该题的分数
stuPaperScoreService.insertStuPaperScore(stuPaperScoreDO);
} else {
// 如果之前做过,则更新该题的分数
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
}
System.out.println(wps_word_score+"wps_word得分");
break;
}
if (one_file.getName().split("\\.")[0].equals("WPS演示")) {
if ("WPS演示".equals(one_file.getName().split("\\.")[0])) {
double wps_pptx_score = judgementWpsPptxService.judgementWpsPptx(15.0, one_file.getPath(), file_one.getPath(), examQuestion);
score += wps_pptx_score;
stuPaperScoreDO.setScore(new BigDecimal(wps_pptx_score));
// 原始正确分数
stuPaperScoreDO.setTrueScore(new BigDecimal("15.0"));
// 判断题是否正确
if (wps_pptx_score == 15.0) {
stuPaperScoreDO.setIsTrue(0);
} else if (wps_pptx_score == 0) {
stuPaperScoreDO.setIsTrue(1);
} else {
stuPaperScoreDO.setIsTrue(2);
}
stuPaperScoreDO.setSubjectName(examQuestion.getSubjectName());
if (isNull) {
// 如果之前没做过,则插入该题的分数
stuPaperScoreService.insertStuPaperScore(stuPaperScoreDO);
} else {
// 如果之前做过,则更新该题的分数
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
}
System.out.println(wps_pptx_score+"wps_ppt得分");
break;
}
if (one_file.getName().split("\\.")[0].equals("WPS表格")) {
if ("WPS表格".equals(one_file.getName().split("\\.")[0])) {
double wps_excel_score = judgementWpsExcelService.judgementWpsXlsx(15.0, one_file.getPath(), file_one.getPath(), examQuestion);
score += wps_excel_score;
stuPaperScoreDO.setScore(new BigDecimal(wps_excel_score));
// 原始正确分数
stuPaperScoreDO.setTrueScore(new BigDecimal("15.0"));
// 判断题是否正确
if (wps_excel_score == 15.0) {
stuPaperScoreDO.setIsTrue(0);
} else if (wps_excel_score == 0) {
stuPaperScoreDO.setIsTrue(1);
} else {
stuPaperScoreDO.setIsTrue(2);
}
stuPaperScoreDO.setSubjectName(examQuestion.getSubjectName());
if (isNull) {
// 如果之前没做过,则插入该题的分数
stuPaperScoreService.insertStuPaperScore(stuPaperScoreDO);
} else {
// 如果之前做过,则更新该题的分数
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
}
System.out.println(wps_excel_score+"wps_excel得分");
break;
}
//windows文件处理
if (one_file.getName().split("\\.")[0].equals("文件处理")) {
if ("文件处理".equals(one_file.getName().split("\\.")[0])) {
File win_file = new File(one_file.getPath());
double win_file_score = fileServerice.run_file_point(20.0,win_file, examQuestion);
score += win_file_score;
stuPaperScoreDO.setScore(new BigDecimal(win_file_score));
// 原始正确分数
stuPaperScoreDO.setTrueScore(new BigDecimal("15.0"));
// 判断题是否正确
if (win_file_score == 20.0) {
stuPaperScoreDO.setIsTrue(0);
} else if (win_file_score == 0) {
stuPaperScoreDO.setIsTrue(1);
} else {
stuPaperScoreDO.setIsTrue(2);
}
stuPaperScoreDO.setSubjectName(examQuestion.getSubjectName());
if (isNull) {
// 如果之前没做过,则插入该题的分数
stuPaperScoreService.insertStuPaperScore(stuPaperScoreDO);
} else {
// 如果之前做过,则更新该题的分数
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
}
System.out.println(win_file_score+"windows文件处理得分");
break;
}
//浏览器操作
// if ("浏览器网络题".equals(examQuestion.getCourseName()+examQuestion.getSubjectName())){
if (one_file.getName().split("\\.")[0].equals("网络题")) {
if ("网络题".equals(one_file.getName().split("\\.")[0])) {
System.out.println(one_file);
File edge_file = new File(one_file.getPath());
double browse_score= browserServerice.Judgement(20.0,edge_file,examQuestion);
score += browse_score;
stuPaperScoreDO.setScore(new BigDecimal(browse_score));
// 原始正确分数
stuPaperScoreDO.setTrueScore(new BigDecimal("15.0"));
// 判断题是否正确
if (browse_score == 20.0) {
stuPaperScoreDO.setIsTrue(0);
} else if (browse_score == 0) {
stuPaperScoreDO.setIsTrue(1);
} else {
stuPaperScoreDO.setIsTrue(2);
}
stuPaperScoreDO.setSubjectName(examQuestion.getSubjectName());
if (isNull) {
// 如果之前没做过,则插入该题的分数
stuPaperScoreService.insertStuPaperScore(stuPaperScoreDO);
} else {
// 如果之前做过,则更新该题的分数
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
}
System.out.println(browse_score+"浏览器操作得分");
break;
}
if (one_file.getName().split("\\.")[0].equals("程序设计")) {
if ("程序设计".equals(one_file.getName().split("\\.")[0])) {
System.out.println(one_file);
File mysql_file = new File(one_file.getPath());
double judgement = mysqlServerice.Judgement(20.0,mysql_file, examQuestion);
score+=judgement;
stuPaperScoreDO.setScore(new BigDecimal(judgement));
// 原始正确分数
stuPaperScoreDO.setTrueScore(new BigDecimal("15.0"));
// 判断题是否正确
if (judgement == 20.0) {
stuPaperScoreDO.setIsTrue(0);
} else if (judgement == 0) {
stuPaperScoreDO.setIsTrue(1);
} else {
stuPaperScoreDO.setIsTrue(2);
}
stuPaperScoreDO.setSubjectName(examQuestion.getSubjectName());
if (isNull) {
// 如果之前没做过,则插入该题的分数
stuPaperScoreService.insertStuPaperScore(stuPaperScoreDO);
} else {
// 如果之前做过,则更新该题的分数
stuPaperScoreService.updateStuPaperScore(stuPaperScoreDO);
}
System.out.println(judgement+"mysql得分");
break;
}