【修改】 修改PPT判分入口区分幻灯片得逻辑
This commit is contained in:
@@ -62,6 +62,7 @@ public class AutoController {
|
||||
|
||||
/**
|
||||
* 考试完成后,获取总分
|
||||
*
|
||||
* @param stuInfoVo 学生信息
|
||||
* @return 分数
|
||||
*/
|
||||
@@ -74,6 +75,7 @@ public class AutoController {
|
||||
}
|
||||
return Result.success(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* C语言判分
|
||||
*
|
||||
@@ -87,6 +89,7 @@ public class AutoController {
|
||||
|
||||
/**
|
||||
* WPS-WORD 判分
|
||||
*
|
||||
* @param stuInfoVo 学生信息
|
||||
* @return 分数
|
||||
* @throws Exception 异常信息
|
||||
@@ -98,6 +101,7 @@ public class AutoController {
|
||||
|
||||
/**
|
||||
* WPS-EXCEL 判分
|
||||
*
|
||||
* @param stuInfoVo 学生信息
|
||||
* @return 分数
|
||||
* @throws Exception 异常信息
|
||||
@@ -109,6 +113,7 @@ public class AutoController {
|
||||
|
||||
/**
|
||||
* WPS-PPT 判分
|
||||
*
|
||||
* @param stuInfoVo 学生信息
|
||||
* @return 分数
|
||||
* @throws Exception 异常信息
|
||||
@@ -120,10 +125,11 @@ public class AutoController {
|
||||
|
||||
/**
|
||||
* Mysql 判分
|
||||
*
|
||||
* @param stuInfoVo 学生信息
|
||||
* @return 分数
|
||||
* @throws SQLException 异常信息
|
||||
* @throws IOException 异常信息
|
||||
* @throws IOException 异常信息
|
||||
*/
|
||||
@PostMapping("/judgementForMysql")
|
||||
public Result<BigDecimal> judgementForMysql(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException {
|
||||
@@ -132,10 +138,11 @@ public class AutoController {
|
||||
|
||||
/**
|
||||
* Mysql 文件
|
||||
*
|
||||
* @param stuInfoVo 学生信息
|
||||
* @return 分数
|
||||
* @throws SQLException 异常信息
|
||||
* @throws IOException 异常信息
|
||||
* @throws IOException 异常信息
|
||||
*/
|
||||
@PostMapping("/judgementForMysqlFile")
|
||||
public Result judgementForMysqlFile(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException {
|
||||
@@ -155,10 +162,11 @@ public class AutoController {
|
||||
|
||||
/**
|
||||
* 文件提 判分
|
||||
*
|
||||
* @param stuInfoVo 学生信息
|
||||
* @return 分数
|
||||
* @throws SQLException 异常信息
|
||||
* @throws IOException 异常信息
|
||||
* @throws IOException 异常信息
|
||||
*/
|
||||
@PostMapping("/judgementForFile")
|
||||
public Result<BigDecimal> judgementForFile(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException {
|
||||
@@ -167,15 +175,17 @@ public class AutoController {
|
||||
|
||||
/**
|
||||
* 浏览器题 判分
|
||||
*
|
||||
* @param stuInfoVo 学生信息
|
||||
* @return 分数
|
||||
* @throws SQLException 异常信息
|
||||
* @throws IOException 异常信息
|
||||
* @throws IOException 异常信息
|
||||
*/
|
||||
@PostMapping("/judgementForBrower")
|
||||
public Result<BigDecimal> judgementForBrower(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException {
|
||||
return Result.success(autoForBrowerService.autoForBrower(stuInfoVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将浏览器的页面写入到JSON文件中
|
||||
*
|
||||
@@ -187,6 +197,17 @@ public class AutoController {
|
||||
return Result.success(autoForWinEdgeSettingService.autoForEdgeToJson(stuInfoVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* windows网络设置判分
|
||||
*
|
||||
* @param stuInfoVo 学生信息
|
||||
* @return String
|
||||
*/
|
||||
@PostMapping("/judgementForEdgeDummy")
|
||||
public Result<BigDecimal> judgementForEdgeDummy(@RequestBody StuInfoVo stuInfoVo) throws IOException {
|
||||
return Result.success(autoForWinEdgeSettingService.autoForEdge(stuInfoVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮箱设置判分
|
||||
*
|
||||
@@ -209,25 +230,16 @@ public class AutoController {
|
||||
return Result.success(autoForWinEmailSettingService.autoForEmailToJson(stuInfoVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* windows网络设置判分
|
||||
*
|
||||
* @param stuInfoVo 学生信息
|
||||
* @return String
|
||||
*/
|
||||
@PostMapping("/judgementForEdgeDummy")
|
||||
public Result<BigDecimal> judgementForEdgeDummy(@RequestBody StuInfoVo stuInfoVo) throws IOException {
|
||||
return Result.success(autoForWinEmailSettingService.autoForEmail(stuInfoVo));
|
||||
}
|
||||
|
||||
// win10虚拟界面
|
||||
|
||||
/**
|
||||
* PS 判分
|
||||
*
|
||||
* @param stuInfoVo 学生信息
|
||||
* @return 分数
|
||||
* @throws SQLException 异常信息
|
||||
* @throws IOException 异常信息
|
||||
* @throws IOException 异常信息
|
||||
*/
|
||||
@PostMapping("/judgementForPS")
|
||||
public Result<BigDecimal> judgementForPS(@RequestBody StuInfoVo stuInfoVo) throws SQLException, IOException {
|
||||
|
@@ -12,7 +12,6 @@ import org.pptx4j.pml.Pic;
|
||||
import org.pptx4j.pml.Shape;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -26,6 +25,7 @@ public class SlideMaster {
|
||||
List<JudgementSlidesVO> judgementSlidesVOS = new ArrayList<>();
|
||||
// 1、获取想要判断的文件地址(文件流)
|
||||
try (InputStream inputStream = file.getInputStream()) {
|
||||
// try {
|
||||
// 加载 .pptx 文件
|
||||
PresentationMLPackage ppt =
|
||||
(PresentationMLPackage) OpcPackage.load(inputStream);
|
||||
@@ -44,14 +44,15 @@ public class SlideMaster {
|
||||
String examCode = wpsSlideInfoVo.getExamCode();
|
||||
// 方式方法
|
||||
String method = wpsSlideInfoVo.getMethod();
|
||||
|
||||
String content = wpsSlideInfoVo.getSlideIndex() + "@" + firstName + "@" + function + "@" + examName + "@" + examCode + "@" + method;
|
||||
// 查询幻灯片图片
|
||||
List<SlidePart> slideParts = ppt.getMainPresentationPart().getSlideParts();
|
||||
int slideIndexFoFile = 0;
|
||||
for (SlidePart slidePart : slideParts) {
|
||||
slideIndexFoFile++;
|
||||
if (method.equals("shape")) {
|
||||
// 获取幻灯片内容
|
||||
slideIndexFoFile++;
|
||||
if (slideIndex.equals(String.valueOf(slideIndexFoFile))) {
|
||||
// 查询幻灯片
|
||||
// 遍历 shape tree 中的 sp(shape)元素
|
||||
@@ -72,11 +73,13 @@ public class SlideMaster {
|
||||
// 实际参数值
|
||||
Object[] arguments = {shape, timing};
|
||||
String value = (String) methodWithArgs.invoke(shapeFunction, arguments);
|
||||
JudgementSlidesVO judgementSlidesVO = new JudgementSlidesVO();
|
||||
judgementSlidesVO.setContent(content + "@" + value);
|
||||
judgementSlidesVO.setContentIn(firstName + examName + value);
|
||||
judgementSlidesVO.setScoreRate(1);
|
||||
judgementSlidesVOS.add(judgementSlidesVO);
|
||||
if (!value.isEmpty()) {
|
||||
JudgementSlidesVO judgementSlidesVO = new JudgementSlidesVO();
|
||||
judgementSlidesVO.setContent(content + "@" + value);
|
||||
judgementSlidesVO.setContentIn(firstName + examName + value);
|
||||
judgementSlidesVO.setScoreRate(1);
|
||||
judgementSlidesVOS.add(judgementSlidesVO);
|
||||
}
|
||||
}
|
||||
} else if (shapeObj instanceof Pic pic) {
|
||||
if (shapeIndex.equals(String.valueOf(shapeIndexFoFile))) {
|
||||
@@ -89,38 +92,39 @@ public class SlideMaster {
|
||||
// 实际参数值
|
||||
Object[] arguments = {pic, timing};
|
||||
String value = (String) methodWithArgs.invoke(shapePicFunction, arguments);
|
||||
JudgementSlidesVO judgementSlidesVO = new JudgementSlidesVO();
|
||||
judgementSlidesVO.setContent(content + "@" + value);
|
||||
judgementSlidesVO.setContentIn(firstName + examName + value);
|
||||
judgementSlidesVO.setScoreRate(1);
|
||||
judgementSlidesVOS.add(judgementSlidesVO);
|
||||
if (!value.isEmpty()) {
|
||||
JudgementSlidesVO judgementSlidesVO = new JudgementSlidesVO();
|
||||
judgementSlidesVO.setContent(content + "@" + value);
|
||||
judgementSlidesVO.setContentIn(firstName + examName + value);
|
||||
judgementSlidesVO.setScoreRate(1);
|
||||
judgementSlidesVOS.add(judgementSlidesVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (method.equals("slideSetting")) {
|
||||
SlideSetting slideSettingFunction = new SlideSetting();
|
||||
Class<?>[] paramTypes = {SlidePart.class, PresentationMLPackage.class};
|
||||
Method methodWithArgs = slideSettingFunction.getClass().getMethod(function, paramTypes);
|
||||
Object[] arguments = {slidePart, ppt};
|
||||
String value = (String) methodWithArgs.invoke(slideSettingFunction, arguments);
|
||||
JudgementSlidesVO judgementSlidesVO = new JudgementSlidesVO();
|
||||
judgementSlidesVO.setContent(content + "@" + value);
|
||||
judgementSlidesVO.setContentIn(firstName + examName + value);
|
||||
judgementSlidesVO.setScoreRate(1);
|
||||
judgementSlidesVOS.add(judgementSlidesVO);
|
||||
if (slideIndex.equals(String.valueOf(slideIndexFoFile))) {
|
||||
SlideSetting slideSettingFunction = new SlideSetting();
|
||||
Class<?>[] paramTypes = {SlidePart.class, PresentationMLPackage.class};
|
||||
Method methodWithArgs = slideSettingFunction.getClass().getMethod(function, paramTypes);
|
||||
Object[] arguments = {slidePart, ppt};
|
||||
String value = (String) methodWithArgs.invoke(slideSettingFunction, arguments);
|
||||
if (!value.isEmpty()) {
|
||||
JudgementSlidesVO judgementSlidesVO = new JudgementSlidesVO();
|
||||
judgementSlidesVO.setContent(content + "@" + value);
|
||||
judgementSlidesVO.setContentIn(firstName + examName + value);
|
||||
judgementSlidesVO.setScoreRate(1);
|
||||
judgementSlidesVOS.add(judgementSlidesVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return judgementSlidesVOS;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user