From 5671df925cdcbb4f492241c4e038883160701a1f Mon Sep 17 00:00:00 2001 From: "DESKTOP-932OMT8\\REN" Date: Wed, 21 May 2025 21:57:33 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A4=E5=88=86=E7=9B=B8=E5=85=B3=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/auto_tools/AutoToolsServiceImpl.java | 16 +++++++++------- .../wps_excel/JudgementWpsExcelServiceImpl.java | 2 +- .../judgement/utils/wps_excel/WpsExcelUtils.java | 14 +++++++------- 3 files changed, 17 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 668d4f28..0b9cad70 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 @@ -264,26 +264,26 @@ 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(examQuestion.getCourseName()+examQuestion.getSubjectName())) { + if (one_file.getName().split("\\.")[0].equals("C语言编程题")) { double c_score = judgementService.ProgrammingC(15.0, one_file.getPath(), file_one.getName(), examQuestion); score += c_score; System.out.println(c_score+"C语言程序设计得分"); break; } // wps 类型存在多级文文件夹,需要个性化设置 - if (file_one.getName().split("\\.")[0].equals("WPS文字")) { + if (one_file.getName().split("\\.")[0].equals("WPS文字")) { double wps_word_score = judgementWpsWordService.judgementWpsWord(15.0, one_file.getPath(), file_one.getPath(), examQuestion); score += wps_word_score; System.out.println(wps_word_score+"wps_word得分"); break; } - if (file_one.getName().split("\\.")[0].equals("WPS演示")) { + if (one_file.getName().split("\\.")[0].equals("WPS演示")) { double wps_pptx_score = judgementWpsPptxService.judgementWpsPptx(15.0, one_file.getPath(), file_one.getPath(), examQuestion); score += wps_pptx_score; System.out.println(wps_pptx_score+"wps_ppt得分"); break; } - if (file_one.getName().split("\\.")[0].equals("WPS表格")) { + if (one_file.getName().split("\\.")[0].equals("WPS表格")) { double wps_excel_score = judgementWpsExcelService.judgementWpsXlsx(15.0, one_file.getPath(), file_one.getPath(), examQuestion); score += wps_excel_score; System.out.println(wps_excel_score+"wps_excel得分"); @@ -323,13 +323,15 @@ public class AutoToolsServiceImpl implements AutoToolsService{ } } // 8、将解压之后得问及那继续重新压缩并上传到服务器,并删除文件和文件夹 - String zipPath = FolderZipper.zipFolder(files[0].getPath()); + String zipPath = FolderZipper.zipFolder(files[0].getPath().replace("\\"+stuId, "")); + File folderStuUpdateFile = new File(files[0].getPath()); + folderStuUpdateFile.delete(); // 9、上传文件 MultipartFile file = new CustomMultipartFile(zipPath); String path = null; fileService.createStuFile(stuId, paperId, file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream())); - //更新学生分数 - endStuMonitorUtils.endStuMonitor(String.valueOf(stuId),paperId,score); + // 更新学生分数 + // endStuMonitorUtils.endStuMonitor(String.valueOf(stuId),paperId,score); // end、删除文件 zip_file.delete(); folder.delete(); diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/JudgementWpsExcelServiceImpl.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/JudgementWpsExcelServiceImpl.java index 2ba00b67..18ef862c 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/JudgementWpsExcelServiceImpl.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/service/wps_excel/JudgementWpsExcelServiceImpl.java @@ -91,7 +91,7 @@ public class JudgementWpsExcelServiceImpl implements JudgementWpsExcelService { LogFileUtils.writeLine("❌ " + examQuestionAnswer.getContentIn() + " 得分失败"); } } - LogFileUtils.writeLine("✅ 结束WPS_Pptx判分,试题得分:" + wpsXlsxScore); + LogFileUtils.writeLine("✅ 结束WPS_Xlsx判分,试题得分:" + wpsXlsxScore); // 关闭已经打开得文件 LogFileUtils.close(); return wpsXlsxScore; diff --git a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_excel/WpsExcelUtils.java b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_excel/WpsExcelUtils.java index b34baa41..a1627c1d 100644 --- a/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_excel/WpsExcelUtils.java +++ b/exam-module-judgement/exam-module-judgement-biz/src/main/java/pc/exam/pp/module/judgement/utils/wps_excel/WpsExcelUtils.java @@ -54,7 +54,7 @@ public class WpsExcelUtils { // 获取有多少个工作表 int sheetNumber = workbook.getNumberOfSheets(); for (int i = 0; i < sheetNumber; i++) { - System.out.println("第 " + (i + 1) + " 个工作表"); +// System.out.println("第 " + (i + 1) + " 个工作表"); // 获取工作表内容 XSSFSheet sheetXss = workbook.getSheetAt(i); // 获取工作表的XML对象 @@ -210,12 +210,12 @@ public class WpsExcelUtils { addXlsxInfo(String.valueOf(i+1), "图表是否存在", "isChart", String.valueOf(0), "chart", "图表", "isChart", "是否存在", "", xlsxInfoVos); // 说明是图表 try (XmlCursor chartXml = xlsxDrawingSheetVo.getXmlCursor().newCursor()) { - System.out.println(chartXml.xmlText()); +// System.out.println(chartXml.xmlText()); String chartNameSpace = getNamespace(chartXml.xmlText()); // 开始获取标题 XlsxInfoVo xlsxInfoVo = new XlsxInfoVo(); XmlCursor titleXml = chartXml.newCursor(); - System.out.println(titleXml.xmlText()); +// System.out.println(titleXml.xmlText()); titleXml.selectPath(chartNameSpace + ".//c:chart/c:title/c:tx/c:rich"); while (titleXml.toNextSelection()) { addXlsxInfo(String.valueOf(i+1), "图表标题是否存在", "isTitle", String.valueOf(0), "chart", "图表", "title", "标题", "", xlsxInfoVos); @@ -240,8 +240,8 @@ public class WpsExcelUtils { for (ChartTypeEntry chartTypeEntry : chartTypeEntries) { XmlCursor charTypeXmlInfo = charTypeXml.newCursor(); // 判断是否存在参数 - System.out.println(charTypeXmlInfo.xmlText()); - System.out.println(".//c:plotArea/" + chartTypeEntry.getTag()); +// System.out.println(charTypeXmlInfo.xmlText()); +// System.out.println(".//c:plotArea/" + chartTypeEntry.getTag()); charTypeXmlInfo.selectPath(chartNameSpace + "./" + chartTypeEntry.getTag()); if (charTypeXmlInfo.toNextSelection()) { if (chartTypeEntry.getTag().equals("c:barChart")) { @@ -962,7 +962,7 @@ public class WpsExcelUtils { cursors.selectPath("declare namespace r='http://schemas.openxmlformats.org/package/2006/relationships' .//r:Relationships/r:Relationship"); // 2、开始获取内容 while (cursors.toNextSelection()) { - System.out.println(cursors.xmlText()); +// System.out.println(cursors.xmlText()); XlsxDrawingSheetVo xlsxDrawingSheetVos = new XlsxDrawingSheetVo(); String target = cursors.getAttributeText(new QName("Target")); String rId = cursors.getAttributeText(new QName("Id")); @@ -978,7 +978,7 @@ public class WpsExcelUtils { newPath = target.replace("..", "xl"); } - System.out.println("Found path: " + newPath); +// System.out.println("Found path: " + newPath); // 递归继续查找下一级 if (zipFile.getEntry(relsPath) != null) { traverseRels(zipFile, newPath, xlsxDrawingSheetVos, sheetName, drawingVOS);