From 07a5294a9baa726648bd199487084e261a612ea1 Mon Sep 17 00:00:00 2001 From: "YOHO\\20373" <2037305722@qq.com> Date: Thu, 29 May 2025 21:14:44 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=A2=98=E9=9D=9E=E7=A9=BA=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 | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 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 df1daa12..1138ad46 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 @@ -1,6 +1,7 @@ package pc.exam.pp.module.judgement.service.auto_tools; import cn.hutool.core.io.IoUtil; +import com.alibaba.excel.util.StringUtils; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.annotation.Resource; @@ -193,22 +194,24 @@ public class AutoToolsServiceImpl implements AutoToolsService{ // 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(stu!=null){ + // 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();