【修改】判分层级、监控管理进入考试redis、返回试卷增加试卷id

This commit is contained in:
YOHO\20373
2025-05-08 12:07:09 +08:00
parent b04ad2858c
commit c93b6be468
12 changed files with 142 additions and 443 deletions

View File

@@ -109,10 +109,10 @@ public class BrowserServericeImpl implements IBrowserServerice {
if (isCorrect) {
totalScore += currentScore;
appendToFile(answerLogPath,"考点"+answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate()+"-> 是否得分:"+isCorrect);
appendToFile(answerLogPath,"考点"+answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate()+"-> 是否得分:"+isCorrect+"");
}else {
appendToFile(answerLogPath,"考点"+answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate()+"-> 是否得分:"+isCorrect);
appendToFile(answerLogPath,"考点"+answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate()+"-> 是否得分:"+isCorrect+"");
}
}

View File

@@ -38,6 +38,7 @@ public class FileServericeImpl implements IFileServerice {
// 设置日志文件路径为file所在目录下的answerLogFile.txt
answerLogPath = file.getParent() + File.separator + "log.txt";
System.out.println(answerLogPath);
// 获取 stu 文件夹的内容
Map<String, String> stuFiles = GetDifferencesBetweenFolders.listFilesAndFoldersWithAttributes(stuPath.toPath());
@@ -90,9 +91,9 @@ public class FileServericeImpl implements IFileServerice {
// 如果正确,则累加总分
if (isCorrect) {
totalScore += currentScore;
appendToFile(answerLogPath,answer.getContent() + " -> " + answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate()+"-> 是否得分:"+isCorrect);
appendToFile(answerLogPath,answer.getContent() + " -> " + answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate()+"-> 是否得分:"+isCorrect+"");
}else {
appendToFile(answerLogPath,answer.getContent() + " -> " + answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate()+"-> 是否得分:"+isCorrect);
appendToFile(answerLogPath,answer.getContent() + " -> " + answer.getContentIn() + " -> 得分权值:" + answer.getScoreRate()+"-> 是否得分:"+isCorrect+"");
}
}

View File

@@ -13,9 +13,9 @@ public class testServiceImpl implements testservice {
public boolean test() {
String s = endStuMonitorUtils.endStuMonitor("160", "78f7496a68ae48e0bfb0c288549485d8");
String s = endStuMonitorUtils.endStuMonitor("160", "2bf4510550e34d85a852394cea61b455");
endStuMonitorUtils.endStuMonitor("160","78f7496a68ae48e0bfb0c288549485d8",20.0);
endStuMonitorUtils.endStuMonitor("160","2bf4510550e34d85a852394cea61b455",20.0);
return true;
}

View File

@@ -204,7 +204,7 @@ public class AutoToolsServiceImpl implements AutoToolsService{
String stu_files = null;
// 5.1、 只查询文件夹 (学号-试卷ID-试题ID-具体内容)
if (files == null) return CommonResult.error(100032, "1、试题文件上传目录不正确");
if (files.length > 1) return CommonResult.error(100033, "2、试题文件上传目录不正确");
// if (files.length > 1) return CommonResult.error(100033, "2、试题文件上传目录不正确");
if (!files[0].isDirectory()) return CommonResult.error(100034, "3、试题文件上传目录不正确");
// 判断学号是否正确
if (!files[0].getName().equals(stuId.toString())) return CommonResult.error(100035, "文件与学号匹配异常");
@@ -227,53 +227,59 @@ public class AutoToolsServiceImpl implements AutoToolsService{
File cs_files = new File(file.getPath());
// 所有试题文件夹
File[] cs_file_list = cs_files.listFiles();
for (File one_file : cs_file_list) {
// 6、根据试题ID查询试题详情
String qu_id = one_file.getName();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(qu_id);
if (examQuestion != null) {
// 7、进行对应得判分
// --- 7.1、查询试题文件
File qu_file = new File(one_file.getPath());
File[] qu_file_list = qu_file.listFiles();
if (qu_file_list == null) continue;
// --- 7.2、通过文件名称进行判分
for (File file_one : qu_file_list) {
// 判断名称 类似于 C语言程序设计。 课程+题型
if (file_one.getName().split("\\.")[0].equals(examQuestion.getCourseName()+examQuestion.getSubjectName())) {
double c_score = judgementService.ProgrammingC(15.0, one_file.getPath(), file_one.getName(), examQuestion);
score += c_score;
break;
}
// wps 类型存在多级文文件夹,需要个性化设置
if (file_one.getName().split("\\.")[0].equals("文档")) {
double wps_word_score = judgementWpsWordService.judgementWpsWord(15.0, one_file.getPath(), file_one.getPath(), examQuestion);
score += wps_word_score;
break;
}
// D:\1d70c404e6d42d144d0028496e893565dd2dec447f7e9b1db66466f00472424d\160\cb3cc9089b104a1e9e92deb330d0cfe8\d9f988d5ae6d435ba12d4d979d044219\stu
//windows文件处理
if (file_one.getName().equals("stu")) {
File win_file = new File(file_one.getPath());
double win_file_score = fileServerice.run_file_point(20.0,win_file, examQuestion);
score += win_file_score;
}
System.out.println(file_one);
//浏览器操作
// if ("浏览器网络题".equals(examQuestion.getCourseName()+examQuestion.getSubjectName())){
if (file_one.getName().equals("edge")) {
File edge_file = new File(file_one.getPath());
double browse_score= browserServerice.Judgement(20.0,edge_file,examQuestion);
score += browse_score;
}
}
ExamQuestion mysql=new ExamQuestion();
double judgement = mysqlServerice.Judgement(20, mysql);
score+=judgement;
}
if (cs_file_list!=null){
for (File one_file : cs_file_list) {
// 6、根据试题ID查询试题详情
// String qu_id = file.getName();
String qu_id = file.getName();
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(qu_id);
if (examQuestion != null) {
// 7、进行对应得判分
// --- 7.1、查询试题文件
File qu_file = new File(one_file.getPath());
File[] qu_file_list = qu_file.listFiles();
if (qu_file_list == null) continue;
// --- 7.2、通过文件名称进行判分
// for (File file_one : qu_file_list) {
// 判断名称 类似于 C语言程序设计。 课程+题型
if (one_file.getName().split("\\.")[0].equals(examQuestion.getCourseName()+examQuestion.getSubjectName())) {
double c_score = judgementService.ProgrammingC(15.0, one_file.getPath(), one_file.getName(), examQuestion);
score += c_score;
break;
}
// wps 类型存在多级文文件夹,需要个性化设置
if (one_file.getName().split("\\.")[0].equals("文档")) {
double wps_word_score = judgementWpsWordService.judgementWpsWord(15.0, one_file.getPath(), one_file.getPath(), examQuestion);
score += wps_word_score;
break;
}
// D:\1d70c404e6d42d144d0028496e893565dd2dec447f7e9b1db66466f00472424d\160\cb3cc9089b104a1e9e92deb330d0cfe8\d9f988d5ae6d435ba12d4d979d044219\stu
//windows文件处理
if (one_file.getName().equals("stu")) {
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;
}
System.out.println(one_file);
//浏览器操作
// if ("浏览器网络题".equals(examQuestion.getCourseName()+examQuestion.getSubjectName())){
if (one_file.getName().equals("edge")) {
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;
}
// }
}
}
}
}
ExamQuestion mysql=new ExamQuestion();
double judgement = mysqlServerice.Judgement(20, mysql);
score+=judgement;
// 8、将解压之后得问及那继续重新压缩并上传到服务器并删除文件和文件夹
String zipPath = FolderZipper.zipFolder(files[0].getPath());
// 9、上传文件