【修改】 修改判分相关方法

This commit is contained in:
DESKTOP-932OMT8\REN
2025-05-21 21:57:33 +08:00
parent f98e8d04aa
commit 5671df925c
3 changed files with 17 additions and 15 deletions

View File

@@ -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();

View File

@@ -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;

View File

@@ -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);