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