From 73824e16623b70576128cf315eebbe639b16ea9b Mon Sep 17 00:00:00 2001 From: "DESKTOP-932OMT8\\REN" Date: Wed, 28 May 2025 10:29:01 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=20?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E9=A2=98=E6=96=87=E4=BB=B6=E9=9D=9E=E7=A9=BA?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auto_tools/AutoToolsServiceImpl.java | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsServiceImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsServiceImpl.java index 4c627145..d34384c3 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsServiceImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/auto_tools/AutoToolsServiceImpl.java @@ -184,33 +184,35 @@ public class AutoToolsServiceImpl implements AutoToolsService{ stuPaperFileDO = stuPaperFileDOs; } } - // 1-1、 穿插选择题判分 - // 1-1-1、下载选择题文件 - String select_qu = downloadStudentFile(noZipFileDO.getUrl(), config.getValue()); - File select_file = new File(select_qu); - // 1-1-2、读取内容转换成json - String select_string = readFileAsString(select_file.getPath()); - Stu stu = stringToJson(select_string); - // 1-1-3、进行选择题判分 - for (String key : stu.getQuestionResultMap().keySet()) { - // 查询该题的成绩 - StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuId, paperId, key); - // 判断是否做过该题 - boolean isNull = false; - if (stuPaperScoreDO == null) { - stuPaperScoreDO = new StuPaperScoreDO(); - stuPaperScoreDO.setStuId(stuId); - stuPaperScoreDO.setQuId(key); - stuPaperScoreDO.setPaperId(paperId); - isNull = true; + // 判断选择题文件是否存在 + if (noZipFileDO != null) { + // 1-1、 穿插选择题判分 + // 1-1-1、下载选择题文件 + String select_qu = downloadStudentFile(noZipFileDO.getUrl(), config.getValue()); + File select_file = new File(select_qu); + // 1-1-2、读取内容转换成json + String select_string = readFileAsString(select_file.getPath()); + Stu stu = stringToJson(select_string); + // 1-1-3、进行选择题判分 + for (String key : stu.getQuestionResultMap().keySet()) { + // 查询该题的成绩 + StuPaperScoreDO stuPaperScoreDO = stuPaperScoreService.getStuScoreByPaperIdAndQuid(stuId, paperId, key); + // 判断是否做过该题 + boolean isNull = false; + if (stuPaperScoreDO == null) { + stuPaperScoreDO = new StuPaperScoreDO(); + stuPaperScoreDO.setStuId(stuId); + stuPaperScoreDO.setQuId(key); + stuPaperScoreDO.setPaperId(paperId); + isNull = true; + } + String value = stu.getQuestionResultMap().get(key); + double selectScore = judgementChoiceService.programmingChoice(2.0, key, value, stuPaperScoreDO, isNull); + score += selectScore; } - String value = stu.getQuestionResultMap().get(key); - double selectScore = judgementChoiceService.programmingChoice(2.0, key, value, stuPaperScoreDO, isNull); - score += selectScore; + // 1-1-4、删除文件 + select_file.delete(); } - // 1-1-4、删除文件 - select_file.delete(); - // 2、判断文件路径是否存在 if (stuPaperFileDO == null) { // return CommonResult.error(100031, "试题文件没有上传,无法判分!");