【新增】 Xlsx相关页面方法

This commit is contained in:
dlaren
2025-08-10 02:28:33 +08:00
parent 9907e9aa36
commit a74076a3cc
41 changed files with 1838 additions and 3553 deletions

View File

@@ -1,87 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.module.judgement.controller.admin.Wps.dto.WpsPptxJudgementDto;
import pc.exam.pp.module.judgement.service.wps_excel.JudgementWpsExcelService;
import pc.exam.pp.module.judgement.service.wps_pptx.JudgementWpsPptxService;
import pc.exam.pp.module.judgement.service.wps_word.JudgementWpsWordService;
import pc.exam.pp.module.judgement.utils.wps_pptx.judgementVO.JudgementReqVo;
import pc.exam.pp.module.judgement.utils.wps_pptx.vo.PptxInfoReqVo;
import java.util.List;
/**
* wps word
* rwb
* @author REN
*/
@RestController
@RequestMapping("/tool/wps")
@Tag( name = "测试判分 - wps相关操作")
@Validated
public class WpsController {
@Resource
JudgementWpsWordService judgementWpsWordService;
@Resource
JudgementWpsPptxService judgementWpsPptxService;
@Resource
JudgementWpsExcelService judgementWpsExcelService;
// @PostMapping("/docxMaster")
// public CommonResult<List<JudgementWordsVO>> docxMaster(@RequestBody List<WpsDocxInfoVo> wpsDocxInfoVos) throws Exception {
// return CommonResult.success(judgementWpsWordService.docxMaster(wpsDocxInfoVos));
// }
// /**
// * wps word
// * @return 判分
// */
// @PostMapping("/runWpsWordInfo")
// public CommonResult<List<WpsWordJudgementDto>> runWpsWordInfo(@RequestBody List<WpsWordReqDto> wordReqDto) throws Exception {
// return CommonResult.success(judgementWpsWordService.programmingInfo(wordReqDto));
// }
//
// /**
// * wps word
// * @return 判分
// */
// @GetMapping("/runWpsWord")
// public CommonResult<List<WordInfoReqVo>> runWpsWord(String path) throws Exception {
// return CommonResult.success(judgementWpsWordService.programmingWpsWord(path));
// }
// /**
// * wps xlsx
// * @return 判分
// */
// @GetMapping("/runWpsPptx")
// public CommonResult<List<PptxInfoReqVo>> runWpsPptx(String path) throws Exception {
// return CommonResult.success(judgementWpsPptxService.programmingWpsPptx(path));
// }
//
// /**
// * wps xlsx
// * @return 判分
// */
// @PostMapping("/runTestpptx")
// public CommonResult<List<WpsPptxJudgementDto>> runTestpptx(@RequestBody List<JudgementReqVo> judgementReq, String path) throws Exception {
// return CommonResult.success(judgementWpsPptxService.judgementWpsPptx(judgementReq, path));
// }
/**
* wps xlsx
* @return 判分
*/
@GetMapping("/runWpsXlsx")
public CommonResult<List<WpsPptxJudgementDto>> runWpsXlsx(String path) throws Exception {
return CommonResult.success(judgementWpsExcelService.programmingWpsExcel(path));
}
}

View File

@@ -1,75 +0,0 @@
//package pc.exam.pp.module.judgement.controller.admin.Wps;
//
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.Parameter;
//import io.swagger.v3.oas.annotations.tags.Tag;
//import jakarta.annotation.Resource;
//import jakarta.validation.Valid;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//import pc.exam.pp.framework.common.enums.CommonStatusEnum;
//import pc.exam.pp.framework.common.pojo.CommonResult;
//import pc.exam.pp.framework.common.util.object.BeanUtils;
//import pc.exam.pp.module.judgement.controller.admin.Wps.vo.*;
//import pc.exam.pp.module.judgement.dal.dataobject.wpsxlsx.WpsXlsxLinkDO;
//import pc.exam.pp.module.judgement.service.wps_excel.WpsXlsxLinkService;
//
//import java.util.List;
//
//import static pc.exam.pp.framework.common.pojo.CommonResult.success;
//
//@Tag(name = "管理后台 - wps_xlsx")
//@RestController
//@RequestMapping("/wps/xlsx")
//@Validated
//public class XlsxController {
//
// @Resource
// private WpsXlsxLinkService wpsXlsxLinkService;
//
// @PostMapping("create")
// @Operation(summary = "创建wps_xlsx")
// public CommonResult<Long> createXlsx(@Valid @RequestBody XlsxSaveReqVO createReqVO) {
// Long xlsxId = wpsXlsxLinkService.createXlsx(createReqVO);
// return success(xlsxId);
// }
//
// @PutMapping("update")
// @Operation(summary = "更新wps_xlsx")
// public CommonResult<Boolean> updateXlsx(@Valid @RequestBody XlsxSaveReqVO updateReqVO) {
// wpsXlsxLinkService.updateXlsx(updateReqVO);
// return success(true);
// }
//
// @DeleteMapping("delete")
// @Operation(summary = "删除wps_xlsx")
// @Parameter(name = "id", description = "编号", required = true, example = "1024")
// public CommonResult<Boolean> deleteXlsx(@RequestParam("id") Long id) {
// wpsXlsxLinkService.deleteXlsx(id);
// return success(true);
// }
//
// @GetMapping("/list")
// @Operation(summary = "获取wps_xlsx列表")
// public CommonResult<List<XlsxRespVO>> getXlsxList(XlsxListReqVO reqVO) {
// List<WpsXlsxLinkDO> list = wpsXlsxLinkService.getXlsxList(reqVO);
// return success(BeanUtils.toBean(list, XlsxRespVO.class));
// }
//
// @GetMapping(value = {"/list-all-simple", "/simple-list"})
// @Operation(summary = "获取wps_xlsx精简信息列表", description = "只包含被开启的wps_xlsx主要用于前端的下拉选项")
// public CommonResult<List<XlsxSimpleRespVO>> getSimpleXlsxList() {
// List<WpsXlsxLinkDO> list = wpsXlsxLinkService.getXlsxList(
// new XlsxListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
// return success(BeanUtils.toBean(list, XlsxSimpleRespVO.class));
// }
//
// @GetMapping("/get")
// @Operation(summary = "获得wps_xlsx信息")
// @Parameter(name = "id", description = "编号", required = true, example = "1024")
// public CommonResult<XlsxRespVO> getPptx(@RequestParam("id") Long id) {
// WpsXlsxLinkDO xlsx = wpsXlsxLinkService.getXlsx(id);
// return success(BeanUtils.toBean(xlsx, XlsxRespVO.class));
// }
//
//}

View File

@@ -1,14 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps.dto;
import lombok.Data;
/**
* @author REN
*/
@Data
public class WpsPptxJudgementDto {
private String content;
private String contentIn;
private String image;
private String scoreRate;
}

View File

@@ -1,14 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps.dto;
import lombok.Data;
/**
* @author REN
*/
@Data
public class WpsWordChineseFunctionDto {
private String chineseName;
private String function;
}

View File

@@ -1,14 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps.dto;
import lombok.Data;
/**
* @author REN
*/
@Data
public class WpsWordJudgementDto {
private String content;
private String contentIn;
private String image;
private String scoreRate;
}

View File

@@ -1,39 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
* @author REN
*/
@Data
public class WpsWordReqDto {
@Schema(description = "主中文名称")
private String name;
@Schema(description = "主英文名称")
private String englishName;
@Schema(description = "文件路径")
private String filePath;
@Schema(description = "内外参数0内参数1外参数")
private String type;
@Schema(description = "归属0段落1页眉页脚2图形")
private String belongTo;
@Schema(description = "参数类型01判断")
private String isboo;
@Schema(description = "子标签")
private String function;
private String unit;
private String isExam;
}

View File

@@ -1,26 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - WpsWord对应关系 Request VO")
@Data
public class WordListReqVO {
@Schema(description = "节点名称模糊匹配", example = "芋道")
private String name;
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
private Integer status;
/**
* 类型
*/
private Integer type;
private String nodeFunction;
private Integer isboo;
private Integer belongTo;
private Integer titleType;
private String unit;
private String page;
}

View File

@@ -1,44 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 节点信息 Response VO")
@Data
public class WordRespVO {
@Schema(description = "节点编号", example = "1024")
private Long id;
@Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
private String name;
@Schema(description = "父节点 ID", example = "1024")
private Long parentId;
@Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Integer sort;
@Schema(description = "节点方法")
private String nodeFunction;
@Schema(description = "转中文")
private String toChinese;
@Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
private LocalDateTime createTime;
/**
* 类型
*/
private Integer type;
private Integer belongTo;
private Integer isboo;
private Integer titleType;
private String unit;
private String page;
}

View File

@@ -1,49 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import pc.exam.pp.framework.common.enums.CommonStatusEnum;
import pc.exam.pp.framework.common.validation.InEnum;
@Schema(description = "管理后台 - 节点创建/修改 Request VO")
@Data
public class WordSaveReqVO {
@Schema(description = "节点编号", example = "1024")
private Long id;
@Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
@NotBlank(message = "节点名称不能为空")
private String name;
/**
* 类型
*/
private Integer type;
private Integer belongTo;
@Schema(description = "父节点 ID", example = "1024")
private Long parentId;
@Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "显示顺序不能为空")
private Integer sort;
@Schema(description = "节点方法")
private String nodeFunction;
@Schema(description = "转中文")
private String toChinese;
@Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
private Integer isboo;
private Integer titleType;
private String unit;
private String page;
}

View File

@@ -1,31 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Schema(description = "管理后台 - 节点精简信息 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WordSimpleRespVO {
@Schema(description = "节点编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
private String name;
@Schema(description = "父节点 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long parentId;
/**
* 类型
*/
private Integer type;
private Integer belongTo;
private Integer isboo;
private Integer titleType;
private String unit;
private String page;
}

View File

@@ -1,21 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - WpsWord对应关系 Request VO")
@Data
public class XlsxListReqVO {
@Schema(description = "节点名称模糊匹配", example = "芋道")
private String name;
@Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1")
private Integer status;
/**
* 类型
*/
private Integer type;
private Integer belongTo;
}

View File

@@ -1,40 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 节点信息 Response VO")
@Data
public class XlsxRespVO {
@Schema(description = "节点编号", example = "1024")
private Long id;
@Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
private String name;
@Schema(description = "父节点 ID", example = "1024")
private Long parentId;
@Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Integer sort;
@Schema(description = "节点方法")
private String nodeFunction;
@Schema(description = "转中文")
private String toChinese;
@Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
private LocalDateTime createTime;
/**
* 类型
*/
private Integer type;
private Integer belongTo;
}

View File

@@ -1,45 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import pc.exam.pp.framework.common.enums.CommonStatusEnum;
import pc.exam.pp.framework.common.validation.InEnum;
@Schema(description = "管理后台 - 节点创建/修改 Request VO")
@Data
public class XlsxSaveReqVO {
@Schema(description = "节点编号", example = "1024")
private Long id;
@Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
@NotBlank(message = "节点名称不能为空")
private String name;
/**
* 类型
*/
private Integer type;
private Integer belongTo;
@Schema(description = "父节点 ID", example = "1024")
private Long parentId;
@Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "显示顺序不能为空")
private Integer sort;
@Schema(description = "节点方法")
private String nodeFunction;
@Schema(description = "转中文")
private String toChinese;
@Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
}

View File

@@ -1,27 +0,0 @@
package pc.exam.pp.module.judgement.controller.admin.Wps.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Schema(description = "管理后台 - 节点精简信息 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class XlsxSimpleRespVO {
@Schema(description = "节点编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
private String name;
@Schema(description = "父节点 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long parentId;
/**
* 类型
*/
private Integer type;
private Integer belongTo;
}

View File

@@ -1,10 +1,6 @@
package pc.exam.pp.module.judgement.service.wps_excel;
import pc.exam.pp.module.judgement.controller.admin.Wps.dto.WpsPptxJudgementDto;
import java.util.List;
/**
* 判分逻辑集合wps excel
*
@@ -18,6 +14,5 @@ public interface JudgementWpsExcelService {
* @return 文件内得考点及描述
* @throws Exception 异常
*/
List<WpsPptxJudgementDto> programmingWpsExcel(String path) throws Exception;
}

View File

@@ -2,69 +2,10 @@ package pc.exam.pp.module.judgement.service.wps_excel;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import pc.exam.pp.module.infra.dal.dataobject.config.ConfigDO;
import pc.exam.pp.module.infra.service.config.ConfigService;
import pc.exam.pp.module.judgement.controller.admin.Wps.dto.WpsPptxJudgementDto;
import pc.exam.pp.module.judgement.utils.wps_excel.WpsExcelUtils;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.util.List;
@Service
public class JudgementWpsExcelServiceImpl implements JudgementWpsExcelService {
// @Resource
// AutoToolsService autoToolsService;
@Resource
ConfigService configService;
@Override
public List<WpsPptxJudgementDto> programmingWpsExcel(String path) throws Exception {
// 1、获取文件临时下载路径
ConfigDO config = configService.getConfigByKey("file_down_path");
// 2、下载文件并返回文件完整路径
String pathName = downloadStudentFile(path, config.getValue());
List<WpsPptxJudgementDto> margins = WpsExcelUtils.wpsExcel(pathName, "1");
// 5、已经读取完得考点删除源文件
File file = new File(pathName);
file.delete();
return margins;
}
public String downloadStudentFile(String fileUrl, String filePath) {
try {
URL url = new URL(fileUrl);
URLConnection connection = url.openConnection();
String fileName = new File(url.getPath()).getName();
File dir = new File(filePath);
if (!dir.exists()) dir.mkdirs();
File saveFile = new File(dir, fileName);
try (InputStream in = connection.getInputStream();
FileOutputStream out = new FileOutputStream(saveFile)) {
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = in.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
System.out.println("✅ 下载成功: " + saveFile.getAbsolutePath());
return saveFile.getAbsolutePath();
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
} catch (IOException e) {
System.err.println("❌ 下载失败: " + e.getMessage());
return null;
}
}
}

View File

@@ -1,29 +1,15 @@
package pc.exam.pp.module.judgement.service.wps_pptx;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import pc.exam.pp.module.infra.dal.dataobject.config.ConfigDO;
import pc.exam.pp.module.infra.service.config.ConfigService;
import pc.exam.pp.module.judgement.controller.admin.AutoWps.vo.WpsSlideInfoVo;
import pc.exam.pp.module.judgement.controller.admin.Wps.dto.WpsPptxJudgementDto;
//import pc.exam.pp.module.judgement.service.auto_tools.AutoToolsService;
import pc.exam.pp.module.judgement.utils.wps_pptx.JudgementWpsPPT;
import pc.exam.pp.module.judgement.utils.wps_pptx.judgementVO.JudgementReqVo;
import pc.exam.pp.module.judgement.utils.wps_pptx.pptx4j.SlideConversion;
import pc.exam.pp.module.judgement.utils.wps_pptx.pptx4j.SlideMaster;
import pc.exam.pp.module.judgement.utils.wps_pptx.pptx4j.vo.JudgementSlidesVO;
import pc.exam.pp.module.judgement.utils.wps_pptx.pptx4j.vo.SlideDataInfoVO;
import pc.exam.pp.module.judgement.utils.wps_pptx.vo.PptxInfoReqVo;
import pc.exam.pp.module.system.dal.dataobject.user.AdminUserDO;
import pc.exam.pp.module.system.service.user.AdminUserService;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.util.List;
import static pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
/**
* @author REN

View File

@@ -1,40 +0,0 @@
package pc.exam.pp.module.judgement.utils.wps_pptx;
/**
* @author REN
*/
public class DeclareNamespaceForPPT {
public static String getNameSpace(String titleName) {
if ("p".equals(titleName)) {
return "http://schemas.openxmlformats.org/presentationml/2006/main";
}
if ("a".equals(titleName)) {
return "http://schemas.openxmlformats.org/drawingml/2006/main";
}
if ("pic".equals(titleName)) {
return "http://schemas.openxmlformats.org/drawingml/2006/picture";
}
if ("c".equals(titleName)) {
return "http://schemas.openxmlformats.org/drawingml/2006/chart";
}
if ("dgm".equals(titleName)) {
return "http://schemas.openxmlformats.org/drawingml/2006/diagram";
}
if ("lc".equals(titleName)) {
return "http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas";
}
if ("v".equals(titleName)) {
return "urn:schemas-microsoft-com:vml";
}
if ("m".equals(titleName)) {
return "http://schemas.openxmlformats.org/officeDocument/2006/math";
}
if ("mc".equals(titleName)) {
return "http://schemas.openxmlformats.org/markup-compatibility/2006";
}
if ("a14".equals(titleName)) {
return "http://schemas.microsoft.com/office/drawing/2010/main";
}
return "";
}
}

View File

@@ -1,161 +0,0 @@
package pc.exam.pp.module.judgement.utils.wps_pptx;
import java.util.List;
/**
* @author REN
*/
public class JudgementConvert {
public static String getConvert(List<String> valueList, String formula){
String value = "";
if ("NULL".equals(formula)) {
value = valueList.get(0);
} else if (formula.contains("PageSize")) {
value = pageSize(valueList.get(0), valueList.get(1));
} else if (formula.contains("timing")) {
// 查询自定义动画效果
value = getTiming(valueList.get(0), valueList.get(1));
} else if (formula.contains("Timing_filter")) {
// 动画方向查询
value = getTimingFilter(valueList.get(0));
} else if (formula.contains("Timing_Evt")) {
// 动画触发方式
value = getTimingEvt(valueList.get(0));
}
// 继续转换
return value;
}
private static String getTimingEvt(String evt) {
String evtValue = "";
if (evt.contains("onBegin")) {
if (evt.contains("downRight")) {
evtValue += "自动开始";
}
if (evt.contains("onClick")) {
evtValue += "鼠标点击时开始";
}
if (evt.contains("afterPrevious")) {
evtValue += "在上一个动画之后开始";
}
if (evt.contains("withPrevious")) {
evtValue += "与上一个动画同时开始";
}
if (evt.contains("onEnd")) {
evtValue += "在另一个动画结束时开始";
}
if (evt.contains("onNext")) {
evtValue += "在下一动画前触发";
}
if (evt.contains("onPrev")) {
evtValue += "在上一动画前触发";
}
}
return evtValue;
}
private static String getTimingFilter(String filter) {
String filterValue = "";
if (filter.contains("strips")) {
if (filter.contains("downRight")) {
filterValue += "从左上往右下飞入";
}
if (filter.contains("upLeft")) {
filterValue += "从右下往左上飞入";
}
if (filter.contains("upRight")) {
filterValue += "从左下往右上飞入";
}
if (filter.contains("downLeft")) {
filterValue += "从右上往左下飞入";
}
}
return filterValue;
}
private static String getTiming(String transition, String filter){
String transitionValue = "";
String filterValue = "";
if ("in".equals(transition)) {
transitionValue = "进入动画";
if ("fade".equals(filter)) {
filterValue = "淡入淡出";
} else if ("fly(fromLeft)".equals(filter)) {
filterValue = "飞入(从左)";
} else if ("fly(fromRight)".equals(filter)) {
filterValue = "飞入(从右)";
} else if ("fly(fromTop)".equals(filter)) {
filterValue = "飞入(从上)";
} else if ("fly(fromBottom)".equals(filter)) {
filterValue = "飞入(从下)";
} else if ("strips(downRight)".equals(filter)) {
filterValue = "条纹(右下)";
} else if ("strips(upLeft)".equals(filter)) {
filterValue = "条纹(左上)";
} else if ("checkerboard(across)".equals(filter)) {
filterValue = "棋盘格(横向)";
} else if ("wipe(right)".equals(filter)) {
filterValue = "擦除(从左向右)";
} else if ("wipe(left)".equals(filter)) {
filterValue = "擦除(从右向左)";
} else if ("randomBars(vertical)".equals(filter)) {
filterValue = "随机条形(垂直)";
} else if ("zoom".equals(filter)) {
filterValue = "缩放";
} else if ("circle(out)".equals(filter)) {
filterValue = "圆形展开";
} else if ("plus(out)".equals(filter)) {
filterValue = "十字形展开";
} else if ("diamond(out)".equals(filter)) {
filterValue = "菱形展开";
} else if ("shape(circle)".equals(filter)) {
filterValue = "使用形状(圆形)";
}
} else if ("out".equals(transition)) {
transitionValue = "退出动画";
if ("fade".equals(filter)) {
filterValue = "淡出";
} else if ("fly(toLeft)".equals(filter)) {
filterValue = "飞出(向左)";
} else if ("fly(toRight)".equals(filter)) {
filterValue = "飞出(向右)";
} else if ("strips(upLeft)".equals(filter)) {
filterValue = "条纹(左上)";
} else if ("wipe(left)".equals(filter)) {
filterValue = "擦除(向左)";
} else if ("zoom".equals(filter)) {
filterValue = "缩小";
} else if ("shape(diamond)".equals(filter)) {
filterValue = "菱形消失";
}
} else if ("emph".equals(transition)) {
transitionValue = "强调动画";
} else if ("path".equals(transition)) {
transitionValue = "动作路径动画";
}
return transitionValue + filterValue;
}
private static String pageSize(String widthTwip, String heightTwip){
// 转换为 cm1 twip = 1/1440 英寸 = 2.54 / 1440 cm
double widthCm = Double.parseDouble(widthTwip) / 360000;
double heightCm = Double.parseDouble(heightTwip) / 360000;
// 四舍五入保留一位小数
widthCm = Math.round(widthCm * 10) / 10.0;
heightCm = Math.round(heightCm * 10) / 10.0;
// 判断标准纸型(以 cm 为单位进行匹配)
String paperType = "自定义";
if (approx(widthCm, 21.0) && approx(heightCm, 29.7)) {
paperType = "A4";
} else if (approx(widthCm, 29.7) && approx(heightCm, 42.0)) {
paperType = "A3";
} else if (approx(widthCm, 14.8) && approx(heightCm, 21.0)) {
paperType = "A5";
}
return paperType;
}
private static boolean approx(double a, double b) {
return Math.abs(a - b) < 0.5; // 误差范围 0.5cm 内
}
}

View File

@@ -1,413 +0,0 @@
package pc.exam.pp.module.judgement.utils.wps_pptx;
import org.apache.commons.io.IOUtils;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import pc.exam.pp.module.judgement.controller.admin.Wps.dto.WpsPptxJudgementDto;
import pc.exam.pp.module.judgement.utils.wps_pptx.judgementVO.JudgementReqVo;
import pc.exam.pp.module.judgement.utils.wps_pptx.vo.PptxInfoReqVo;
import pc.exam.pp.module.judgement.utils.wps_pptx.vo.PptxSlidesVo;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.*;
/**
* @author REN
*/
public class JudgementWpsPPT {
public static List<WpsPptxJudgementDto> getValues(List<JudgementReqVo> judgementReq) throws InvalidFormatException, IOException, ParserConfigurationException, SAXException {
// 1、文件路径或者文件的属性
// 2、查找文件的属性其中字段为name firstFunction SecondFunction ThirdFunction FourthFunction isboo betong 转换
// 3、名称 标签 标签段落 值标签 关联关系 关联文件名称 )
// 4、逻辑关系 通过name查询文档数据根据标签段落查询对应的段落值再根据标签地址查询对应在查询对应的值标签外部文件暂定
// String fileNama = "presentation";
// String functions = "(//p:presentation)[1]";
// String slide = "p:sldSz";
// String values = "cx#cy";
// 创建返回值
List<WpsPptxJudgementDto> judgementList = new ArrayList<>();
for (JudgementReqVo reqVo : judgementReq) {
String path = reqVo.getPath();
String chineseName = reqVo.getChineseName();
String fileNama = reqVo.getFileNama();
String paragraph = reqVo.getParagraph();
String title = reqVo.getTitle();
String values = reqVo.getValueList();
String type = reqVo.getType();
String isText = reqVo.getIsText();
String isTrue = reqVo.getIsTrue();
String isParameter = reqVo.getIsParameter();
String firstName = paragraph.split(":")[0].split("/")[paragraph.split(":")[0].split("/").length -1];
// 组合之后可能用到的考点信息
String englishName = fileNama + "@!" + paragraph + "@!" + title + "@!" + values + "@!" + type + "@!" + isText + "@!" + isTrue + "@!" + isParameter;
XmlCursor cursor = getXmlCursor(path, fileNama, null);
System.out.println(cursor.xmlText());
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
XmlCursor slideCursor = cursor;
if (title.contains(">")) {
// 说明想要
title = title.replace(">", "");
judgementList = setData(judgementList, chineseName + "正在开发中", englishName + "@!" + "正在开发中");
} else
// 当标签存在特定值得时候,不需要继续第一段得查询,直接用所有得进行查找
if (title.contains("?")) {
title = title.replace("?", "");
// 条件成立
// 获取 XML 字符串
String xmlText = slideCursor.getObject().xmlText();
InputStream is = new ByteArrayInputStream(xmlText.getBytes(StandardCharsets.UTF_8));
// 然后再用 builder.parse
Document doc = builder.parse(is);
System.out.println(xmlText);
// 通过递归调用 查询标签位置,可能出现得层级关系,避免出现一层不对得情况查询多个标签地址
Element element = XmlRecursiveFinder.findElement(doc, title);
List<String> valuesList = new ArrayList<>();
if ("1".equals(isTrue)) {
String value = element == null ? "" : "" ;
judgementList = setData(judgementList, chineseName + value, englishName + "@!" + value);
} else {
if (element == null) {
return null;
}
String[] valuesArr = values.split("#");
String oneValue = "";
for (String yivalue : valuesArr) {
if ("0".equals(isText)) {
oneValue = element.getAttribute(yivalue);
} else {
oneValue = element.getTextContent();
}
valuesList.add(oneValue);
}
// 开始进行考点等的判断
String pointValue = JudgementConvert.getConvert(valuesList, type);
if ("1".equals(isTrue)) {
pointValue = pointValue != null ? "" : "";
}
judgementList = setData(judgementList, chineseName + pointValue, englishName + "@!" + pointValue);
}
} else {
if (!paragraph.isEmpty()) {
slideCursor.selectPath("declare namespace " + firstName + "='" + DeclareNamespaceForPPT.getNameSpace(firstName) + "' " + paragraph);
}
// 当查询到或者说不需要查询的时候进入
if (slideCursor.toNextSelection() || paragraph.isEmpty()) {
// 获取 XML 字符串
String xmlText = slideCursor.getObject().xmlText();
InputStream is = new ByteArrayInputStream(xmlText.getBytes(StandardCharsets.UTF_8));
// 然后再用 builder.parse
Document doc = builder.parse(is);
if ("Filling_Method".equals(type)) {
// 说明判断填充方式
String value = getFillingMethod(doc, slideCursor, title);
judgementList = setData(judgementList, chineseName + value, englishName + "@!" + value);
} else if ("Filling_Bg".equals(type)) {
// 说明判断背景填充方式
String value = getFillingBg(doc, slideCursor, title);
judgementList = setData(judgementList, chineseName + value, englishName + "@!" + value);
} else if ("Line_Spacing".equals(type)) {
// 行距类型
String value = getLineSpacing(doc, slideCursor, title);
judgementList = setData(judgementList, chineseName + value, englishName + "@!" + value);
}
else {
// 通过递归调用 查询标签位置,可能出现得层级关系,避免出现一层不对得情况查询多个标签地址
Element element = XmlRecursiveFinder.findElement(doc, title);
List<String> valuesList = new ArrayList<>();
if ("1".equals(isTrue)) {
String value = element == null ? "" : "" ;
judgementList = setData(judgementList, chineseName + value, englishName + "@!" + value);
} else {
if (element == null) {
return null;
}
String[] valuesArr = values.split("#");
String oneValue = "";
for (String yivalue : valuesArr) {
if ("0".equals(isText)) {
oneValue = element.getAttribute(yivalue);
} else {
oneValue = element.getTextContent();
}
valuesList.add(oneValue);
}
// 开始进行考点等的判断
String pointValue = JudgementConvert.getConvert(valuesList, type);
if ("1".equals(isTrue)) {
pointValue = pointValue != null ? "" : "";
}
judgementList = setData(judgementList, chineseName + pointValue, englishName + "@!" + pointValue);
}
}
} else {
// 如果存在备选方案,使用备选的参数
// 先过去RID的对应的值所有方法中带有了#区分第一段是获取值,第二段是获取外文件的参数
}
}
}
return judgementList;
}
// 大纲
// 1、获取第一层目录 幻灯片 - 母版 - 设置 - 其他
// 2、获取第二层目录 第x页 - 幻灯片母版/备注母版 - 幻灯片设置 - 文件操作
// 3、获取第三层目录 幻灯片设置/形状 - 幻灯片母版 - 幻灯片设置 - 文件操作
public static List<PptxInfoReqVo> wpsPptxInfo(String filePath) throws FileNotFoundException {
List<PptxInfoReqVo> pptxInfoReqVos = new ArrayList<>();
try (FileInputStream fis = new FileInputStream(filePath);
XMLSlideShow pptxXml = new XMLSlideShow(fis)) {
int index = 0;
String firstId = getStringRandom();
setPptxInfo("幻灯片", "p:sld", "p:sld", filePath, firstId, "0", "", pptxInfoReqVos);
for (XSLFSlide slides : pptxXml.getSlides()){
index += 1;
String secondId = getStringRandom();
setPptxInfo(""+index+"", "slide"+index, "slide"+index, filePath, secondId, firstId, "", pptxInfoReqVos);
// 第三层
String thirdId = getStringRandom();
int indexCnvPr = 1;
setPptxInfo("幻灯片设置", "slide"+index, "(//p:bg)["+indexCnvPr+"]", filePath, thirdId, secondId,
"slide@setting", pptxInfoReqVos);
XmlCursor spCursor = slides.getXmlObject().newCursor();
spCursor.selectPath("declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//p:sp");
while (spCursor.toNextSelection()) {
XmlCursor cNvPrXml = spCursor.newCursor();
cNvPrXml.selectPath("declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//p:cNvPr/@name");
if (cNvPrXml.toNextSelection()) {
String name = cNvPrXml.getTextValue();
String fourId = getStringRandom();
setPptxInfo("形状"+indexCnvPr+"->"+name,
"slide"+index,
"(//p:sp)["+indexCnvPr+"]",
filePath,
fourId,
secondId,
"p:sp@p:pic", pptxInfoReqVos);
indexCnvPr += 1;
}
}
XmlCursor picCursor = slides.getXmlObject().newCursor();
System.out.println(picCursor.xmlText());
picCursor.selectPath("declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//p:pic");
int indexCnvPrPic = 1;
while (picCursor.toNextSelection()) {
String fourId = getStringRandom();
setPptxInfo("图像"+indexCnvPrPic+"->图像", "slide"+index, "(//p:pic)["+indexCnvPrPic+"]", filePath, fourId, secondId,
"p:sp@p:pic", pptxInfoReqVos);
indexCnvPrPic += 1;
}
}
// 设置
String firstIds = getStringRandom();
setPptxInfo("设置", "p:presentation", "p:presentation", filePath, firstIds, "0",
"p:sp@p:pic", pptxInfoReqVos);
String secondIds = getStringRandom();
setPptxInfo("幻灯片设置", "p:presentation", "p:presentation", filePath, secondIds, firstIds,
"p:sp@p:pic", pptxInfoReqVos);
// 母版
// String dFirstId = getStringRandom();
// setPptxInfo("母版", "p:sld", "p:sld", filePath, dFirstId, "0", pptxInfoReqVos);
} catch (Exception e) {
throw new RuntimeException(e);
}
return pptxInfoReqVos;
}
public static String getFillingMethod(Document doc, XmlCursor cursor, String titleName) {
String value = "";
for (String title : titleName.split("#")) {
// 获取填充方法
NodeList nodeList = doc.getElementsByTagNameNS(DeclareNamespaceForPPT.getNameSpace(title.split(":")[0]), title.split(":")[1]);
if (nodeList.getLength() > 0) {
if (title.equals("a:solidFill")) {
value = "纯色填充";
}
}
}
return value;
}
public static String getLineSpacing(Document doc, XmlCursor cursor, String titleName) {
String value = "";
for (String title : titleName.split("#")) {
// 获取填充方法
NodeList nodeList = doc.getElementsByTagNameNS(DeclareNamespaceForPPT.getNameSpace(title.split(":")[0]), title.split(":")[1]);
if (nodeList.getLength() > 0) {
if (title.equals("a:spcPts")) {
value = "固定行距";
}
if (title.equals("a:spcPct")) {
value = "多倍行距";
}
}
}
return value;
}
public static String getProjectSymbols(Document doc, XmlCursor cursor, String titleName) {
String value = "";
for (String title : titleName.split("#")) {
// 获取填充方法
NodeList nodeList = doc.getElementsByTagNameNS(DeclareNamespaceForPPT.getNameSpace(title.split(":")[0]), title.split(":")[1]);
if (nodeList.getLength() > 0) {
if (title.equals("a:buChar")) {
value = "普通圆点";
}
if (title.equals("a:buBlip")) {
value = "图片项目符号";
}
if (title.equals("a:buAutoNum")) {
value = "自动编号";
}
}
}
return value;
}
public static String getFillingBg(Document doc, XmlCursor cursor, String titleName) {
String value = "";
for (String title : titleName.split("#")) {
// 获取填充方法
NodeList nodeList = doc.getElementsByTagNameNS(DeclareNamespaceForPPT.getNameSpace(title.split(":")[0]), title.split(":")[1]);
if (nodeList.getLength() > 0) {
if (title.equals("a:solidFill")) {
value = "纯色填充";
}
if (title.equals("a:gradFill")) {
value = "渐变填充";
}
if (title.equals("a:blipFill")) {
value = "图片填充";
}
if (title.equals("a:pattFill")) {
value = "图案填充";
}
if (title.equals("a:grpFill")) {
value = "分组填充";
}
}
}
return value;
}
public static XmlCursor getXmlCursor(String path, String titleName, String value) throws IOException, InvalidFormatException {
XmlCursor cursor = null;
try (OPCPackage pkg = OPCPackage.open(path)) {
for (PackagePart part : pkg.getParts()) {
String entryName = part.getPartName().getName();
if (value == null) {
// 如果说明是空的话,直接查询文件名称
if (entryName.contains(titleName) && entryName.contains(".xml") && !entryName.contains(".rels")) {
try (InputStream is = part.getInputStream()) {
String xmlContent = IOUtils.toString(is, StandardCharsets.UTF_8);
XmlObject xmlObject = XmlObject.Factory.parse(xmlContent);
cursor = xmlObject.newCursor();
break;
} catch (XmlException e) {
throw new RuntimeException(e);
}
}
} else {
// 想查询外置文件
if (entryName.contains(titleName) && entryName.contains(".xml") && entryName.contains(".rels")) {
try (InputStream is = part.getInputStream()) {
String xmlContent = IOUtils.toString(is, StandardCharsets.UTF_8);
XmlObject xmlObject = XmlObject.Factory.parse(xmlContent);
xmlObject.newCursor().selectPath("declare namespace r='http://schemas.openxmlformats.org/package/2006/relationships' .//r:Relationships/r:Relationship");
if (xmlObject.newCursor().toNextSelection()) {
String id = xmlObject.newCursor().getAttributeText(new QName("Id"));
if (id.equals(value)) {
String target = xmlObject.newCursor().getAttributeText(new QName("Target"));
getXmlCursor(path, target.split("/")[target.split("/").length-1], null);
}
}
} catch (XmlException e) {
throw new RuntimeException(e);
}
}
}
}
}
return cursor;
}
/**
* 生成随机码
* @return 随机码
*/
public static String getStringRandom() {
String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
Random random = new Random();
StringBuilder sb = new StringBuilder();
// 生成指定长度的随机字符字符串
for (int i = 0; i < 10; i++) {
int randomIndex = random.nextInt(characters.length());
// 随机字符
sb.append(characters.charAt(randomIndex));
}
return sb.toString();
}
/**
*
* @param chineseName
* @param englishName
* @param selectName
* @param filePath
* @param id
* @param parentId
* @param pptxInfoReqVos
* @throws Exception
*/
public static void setPptxInfo(String chineseName, String englishName, String selectName, String filePath, String id, String parentId, String title, List<PptxInfoReqVo> pptxInfoReqVos) throws Exception {
PptxInfoReqVo pptxInfos = new PptxInfoReqVo();
pptxInfos.setName(chineseName);
pptxInfos.setEnglishName(englishName);
pptxInfos.setFilePath(filePath);
pptxInfos.setId(id);
pptxInfos.setSelectName(selectName);
pptxInfos.setParentId(parentId);
pptxInfos.setTitle(title);
pptxInfoReqVos.add(pptxInfos);
}
/**
* 向考点对象存放数据
* @param wpsPptxJudgementDtoList 考点对象数组
* @param chineseName 给考点对象添加的中文描述
* @param englishName 给考点对象添加的英文描述
* @return 考点对象数组
*/
private static List<WpsPptxJudgementDto> setData(List<WpsPptxJudgementDto> wpsPptxJudgementDtoList,
String chineseName,
String englishName) {
WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
judgementDto.setContentIn(chineseName);
judgementDto.setContent(englishName);
judgementDto.setScoreRate("1");
wpsPptxJudgementDtoList.add(judgementDto);
return wpsPptxJudgementDtoList;
}
}

View File

@@ -1,57 +0,0 @@
package pc.exam.pp.module.judgement.utils.wps_pptx;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ReflectionAnalyzer {
public static String analyzeReflection(String reflectionTag) {
Map<String, String> attrMap = new HashMap<>();
// 提取属性
Pattern pattern = Pattern.compile("(\\w+)=\"([^\"]+)\"");
Matcher matcher = pattern.matcher(reflectionTag);
while (matcher.find()) {
attrMap.put(matcher.group(1), matcher.group(2));
}
// 读取关键属性
int sy = Integer.parseInt(attrMap.getOrDefault("sy", "0"));
String algn = attrMap.getOrDefault("algn", "");
// 分类 sy 类型
String scaleType;
if (sy == -100000) {
scaleType = "镜像倒影";
} else if (sy < -100000) {
scaleType = "放大倒影";
} else if (sy < 0) {
scaleType = "缩小倒影";
} else {
scaleType = "非倒影或非法值";
}
// 分类 algn 类型
String contactType = switch (algn) {
case "bl", "b" -> "接触";
case "ctr", "t", "tl", "tr" -> "不接触";
default -> "未知";
};
return scaleType + "" + contactType;
}
public static void main(String[] args) {
String input1 = "<a:reflection blurRad=\"6350\" stA=\"52000\" endA=\"300\" endPos=\"35000\" dir=\"5400000\" sy=\"-100000\" algn=\"bl\" rotWithShape=\"0\"/>";
String input2 = "<a:reflection blurRad=\"4000\" stA=\"60000\" endA=\"5000\" endPos=\"20000\" dir=\"5400000\" sy=\"-80000\" algn=\"ctr\"/>";
String input3 = "<a:reflection sy=\"-120000\" algn=\"b\"/>";
String input4 = "<a:reflection sy=\"50000\" algn=\"tr\"/>";
System.out.println(analyzeReflection(input1)); // 镜像倒影,接触
System.out.println(analyzeReflection(input2)); // 缩小倒影,不接触
System.out.println(analyzeReflection(input3)); // 放大倒影,接触
System.out.println(analyzeReflection(input4)); // 非倒影或非法值,不接触
}
}

View File

@@ -1,74 +0,0 @@
package pc.exam.pp.module.judgement.utils.wps_pptx;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
public class SlideAnimationQueryByCursor {
public static String getAnimationInfoForSpid(XmlCursor cursor, String spid, String infoType) {
cursor.toStartDoc();
cursor.selectPath("declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " +
"declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' " +
"declare namespace r='http://schemas.openxmlformats.org/officeDocument/2006/relationships' " +
"$this//p: ");
while (cursor.toNextSelection()) {
XmlObject spTgtObj = cursor.getObject();
XmlCursor spTgtCursor = spTgtObj.newCursor();
String spidAttr = spTgtCursor.getAttributeText(new javax.xml.namespace.QName("", "spid"));
if (!spid.equals(spidAttr)) continue;
// 当前 spTgt 的祖先就是动画节点(通常为 anim, set, 或 cTn
XmlCursor animCursor = spTgtObj.newCursor();
animCursor.toParent(); // tgtEl
animCursor.toParent(); // anim, set, etc.
String tag = animCursor.getName().getLocalPart();
String dur = animCursor.getAttributeText(new javax.xml.namespace.QName("", "dur"));
String presetClass = animCursor.getAttributeText(new javax.xml.namespace.QName("", "presetClass"));
switch (infoType) {
case "效果":
return (presetClass != null && !presetClass.isEmpty()) ? presetClass : tag;
case "方向":
// 查找 <p:pull dir="x"/>
cursor.toStartDoc();
cursor.selectPath("declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " +
"$this//p:pull");
while (cursor.toNextSelection()) {
String dir = cursor.getAttributeText(new javax.xml.namespace.QName("", "dir"));
if (dir != null) return dir;
}
return "无方向设置";
case "触发方式":
animCursor.selectPath("declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " +
"$this/p:stCondLst/p:cond");
while (animCursor.toNextSelection()) {
String evt = animCursor.getAttributeText(new javax.xml.namespace.QName("", "evt"));
String delay = animCursor.getAttributeText(new javax.xml.namespace.QName("", "delay"));
if (evt != null) return evt;
if (delay != null) return "延迟:" + delay;
}
return "无触发信息";
case "持续时间":
if (dur != null) return dur + " ms";
// 也许 <p:cTn> 有 dur
animCursor.selectPath("declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " +
"$this//p:cTn");
while (animCursor.toNextSelection()) {
String d = animCursor.getAttributeText(new javax.xml.namespace.QName("", "dur"));
if (d != null) return d + " ms";
}
return "无持续时间信息";
default:
return "不支持的查询类型:" + infoType;
}
}
return "未找到 spid=" + spid + " 的动画";
}
}

View File

@@ -1,35 +0,0 @@
package pc.exam.pp.module.judgement.utils.wps_pptx;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@SuppressWarnings("all")
public class WpsPptxNameSpaces {
public static String getNameSpace(String xmlString) {
// 2、创建最全的命名空间
// Pattern pattern = Pattern.compile("xmlns:(\\w+)='([^']+)'");
// Matcher matcher = pattern.matcher(xmlString);
// Map<String, String> namespaces = new HashMap<>();
// while (matcher.find()) {
// // 如 w, wp, a
// String prefix = matcher.group(1);
// // 如 http://schemas.openxmlformats.org/...
// String uri = matcher.group(2);
// namespaces.put(prefix, uri);
// }
// StringBuilder xpathBuilder = new StringBuilder();
// namespaces.forEach((prefix, uri) ->
// xpathBuilder.append("declare namespace ")
// .append(prefix)
// .append("='")
// .append(uri)
// .append("' ")
// );
// // 2-1、获取出来最全的命名空间
// String allPathx = xpathBuilder.toString();
return "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' declare namespace r='http://schemas.openxmlformats.org/officeDocument/2006/relationships' declare namespace pic='http://schemas.openxmlformats.org/drawingml/2006/picture' declare namespace c='http://schemas.openxmlformats.org/drawingml/2006/chart' declare namespace dgm='http://schemas.openxmlformats.org/drawingml/2006/diagram' declare namespace lc='http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas' declare namespace v='urn:schemas-microsoft-com:vml' declare namespace o='urn:schemas-microsoft-com:office:office' declare namespace m='http://schemas.openxmlformats.org/officeDocument/2006/math' declare namespace mc='http://schemas.openxmlformats.org/markup-compatibility/2006' declare namespace a14='http://schemas.microsoft.com/office/drawing/2010/main' declare namespace a15='http://schemas.microsoft.com/office/drawing/2012/main' declare namespace a16='http://schemas.microsoft.com/office/drawing/2014/main' declare namespace c14='http://schemas.microsoft.com/office/drawing/2007/8/chart' declare namespace p14='http://schemas.microsoft.com/office/powerpoint/2010/main' declare namespace p15='http://schemas.microsoft.com/office/powerpoint/2012/main' declare namespace p16='http://schemas.microsoft.com/office/powerpoint/2015/main' declare namespace pvml='urn:schemas-microsoft-com:office:powerpoint' declare namespace svg='http://schemas.microsoft.com/office/drawing/2016/SVG/main' declare namespace am3d='http://schemas.microsoft.com/office/drawing/2017/model3D' ";
}
}

View File

@@ -1,808 +0,0 @@
//package pc.exam.pp.module.judgement.utils.wps_pptx;
//
//import org.apache.commons.io.IOUtils;
//import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
//import org.apache.poi.openxml4j.opc.OPCPackage;
//import org.apache.poi.openxml4j.opc.PackagePart;
//import org.apache.poi.xslf.usermodel.XMLSlideShow;
//import org.apache.poi.xslf.usermodel.XSLFSlide;
//import org.apache.poi.xwpf.usermodel.XWPFDocument;
//import org.apache.xmlbeans.XmlCursor;
//import org.apache.xmlbeans.XmlException;
//import org.apache.xmlbeans.XmlObject;
//import pc.exam.pp.module.judgement.controller.admin.Wps.dto.WpsPptxJudgementDto;
//import pc.exam.pp.module.judgement.controller.admin.Wps.dto.WpsWordJudgementDto;
//import pc.exam.pp.module.judgement.controller.admin.Wps.dto.WpsWordReqDto;
//import pc.exam.pp.module.judgement.dal.dataobject.wpspptx.WpsPptxLinkDO;
//import pc.exam.pp.module.judgement.utils.TwipConverter;
//import pc.exam.pp.module.judgement.utils.tree.TreeUtils;
//import pc.exam.pp.module.judgement.utils.wps_excel.vo.XlsxCharVO;
//import pc.exam.pp.module.judgement.utils.wps_pptx.vo.*;
//import pc.exam.pp.module.judgement.utils.wps_word.ColorNameFinder;
//import pc.exam.pp.module.judgement.utils.wps_word.PageSizeDetector;
//import pc.exam.pp.module.judgement.utils.wps_word.ShadowDirectionUtils;
//import pc.exam.pp.module.judgement.utils.wps_word.vo.WordInfoReqVo;
//import pc.exam.pp.module.judgement.utils.zipfile.ZipXmlUtils;
//
//import javax.xml.namespace.QName;
//import java.io.FileInputStream;
//import java.io.FileNotFoundException;
//import java.io.IOException;
//import java.io.InputStream;
//import java.nio.charset.StandardCharsets;
//import java.util.*;
//import java.util.regex.Matcher;
//import java.util.regex.Pattern;
//import java.util.zip.ZipEntry;
//import java.util.zip.ZipFile;
//
///**
// * @author REN
// */
//public class WpsPptxUtils {
//
// public static List<WpsPptxJudgementDto>getWpsPptxInfos(List<PptxInfoPointsVo> pptxInfoPointsVos) throws IOException {
// List<WpsPptxJudgementDto> judgementList = new ArrayList<>();
// String filePath = pptxInfoPointsVos.get(0).getFilePath();
// List<PptxSlidesVo> pptxSlidesVos = new ArrayList<>();
// List<PptxSlidesVo> pptxSlidesOrgVos = new ArrayList<>();
// // 获取所有相关res得记录
// List<Map<String, String>> slideList = new ArrayList<>();
// try (OPCPackage pkg = OPCPackage.open(filePath)) {
// for (PackagePart part : pkg.getParts()) {
// String entryName = part.getPartName().getName();
// if (entryName.contains("ppt/slides/_rels") && entryName.contains(".xml.rels")) {
// try (InputStream is = part.getInputStream()) {
// String xmlContent = IOUtils.toString(is, StandardCharsets.UTF_8);
// PptxSlidesVo pptxSlidesVo = new PptxSlidesVo();
// String[] names = entryName.split("/");
// pptxSlidesVo.setSlideName(names[entryName.split("/").length-1]);
// XmlObject xmlObject = XmlObject.Factory.parse(xmlContent);
// XmlCursor cursor = xmlObject.newCursor();
// cursor.selectPath("declare namespace r='http://schemas.openxmlformats.org/package/2006/relationships' .//r:Relationships/r:Relationship");
// // 存放数据
// while (cursor.toNextSelection()) {
// Map<String, String> map = new HashMap<>();
// String rId = cursor.getAttributeText(new QName("Id"));
// String target = cursor.getAttributeText(new QName("Target"));
// map.put(rId, target);
// slideList.add(map);
// }
// pptxSlidesVo.setSlideResList(slideList);
// pptxSlidesOrgVos.add(pptxSlidesVo);
// }
// }
// if (entryName.contains("ppt/slides") && entryName.contains(".xml") && !entryName.contains(".rels")) {
// try (InputStream is = part.getInputStream()) {
// String xmlContent = IOUtils.toString(is, StandardCharsets.UTF_8);
// String[] names = entryName.split("/");
// Optional<PptxSlidesVo> result = pptxSlidesOrgVos.stream().filter(pptxSlidesVo -> pptxSlidesVo.getSlideName().contains(names[entryName.split("/").length-1])).findFirst();
// PptxSlidesVo pptxSlidesVo = result.get();
// pptxSlidesVo.setSlideName(names[entryName.split("/").length-1]);
// XmlObject xmlObject = XmlObject.Factory.parse(xmlContent);
// XmlCursor cursor = xmlObject.newCursor();
// pptxSlidesVo.setXmlCursor(cursor);
// pptxSlidesVos.add(pptxSlidesVo);
// }
//
// }
// }
// for (PptxInfoPointsVo pptxInfoPointsVo : pptxInfoPointsVos) {
// // 判断幻灯片形状
// if ("0".equals(pptxInfoPointsVo.getBelongTo())) {
// Optional<PptxSlidesVo> result = pptxSlidesVos.stream().filter(pptxSlidesVo -> pptxSlidesVo.getSlideName().contains(pptxInfoPointsVo.getEnglishName())).findFirst();
// PptxSlidesVo pptxSlidesVo = result.get();
// XmlCursor slideCursor = pptxSlidesVo.getXmlCursor();
// String namespace = WpsPptxNameSpaces.getNameSpace(slideCursor.xmlText());
// if (pptxInfoPointsVo.getName().contains("动画")) {
// String[] functions = pptxInfoPointsVo.getFunction().split("#");
// String functionStr = functions[0];
// if (pptxInfoPointsVo.getFunction().contains("pic")) {
// functionStr = functionStr.replace("nvSpPr", "nvPicPr");
// }
// XmlCursor dongCursor = slideCursor;
// XmlCursor cTnCursor = slideCursor;
// dongCursor.selectPath(namespace + functionStr);
// if (dongCursor.toNextSelection()) {
// String number = dongCursor.getTextValue();
// cTnCursor.selectPath(namespace + "//p:cTn[@id='"+number+"']");
// if (cTnCursor.toNextSelection()) {
// System.out.println(cTnCursor.xmlText());
// if (pptxInfoPointsVo.getName().contains("效果")) {
// if (pptxInfoPointsVo.getFunction().contains("pic")) {
// String results = SlideAnimationQueryByCursor.getAnimationInfoForSpid(cTnCursor, number, "效果");
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + results);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ results);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// } else {
// cTnCursor.selectPath(namespace + "//p:animEffect");
// if (cTnCursor.toNextSelection()) {
// String value = "";
// String transition = cTnCursor.getAttributeText(new QName("transition"));
// String filter = cTnCursor.getAttributeText(new QName("filter"));
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// if (transition.contains("in")) {
// value += "进入效果";
// }
// if (filter.contains("strips")) {
// value += "->阶梯状";
// }
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// }
// }
// if (pptxInfoPointsVo.getName().contains("方向")) {
// cTnCursor.selectPath(namespace + "//p:animEffect");
// if (pptxInfoPointsVo.getFunction().contains("pic")) {
// String results = SlideAnimationQueryByCursor.getAnimationInfoForSpid(cTnCursor, number, "方向");
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + results);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ results);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// } else {
// if (cTnCursor.toNextSelection()) {
// String value = "";
// String filter = cTnCursor.getAttributeText(new QName("filter"));
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// if (filter.contains("downRight")) {
// value += "右下";
// }
// if (filter.contains("plus(out)")) {
// value += "十字形扩展";
// }
// if (filter.contains("plus(in)")) {
// value += "十字形聚合";
// }
// if (filter.contains("blinds(vertical)")) {
// value += "百叶窗 - 垂直";
// }
// if (filter.contains("blinds(horizontal)")) {
// value += "百叶窗 - 水平";
// }
// if (filter.contains("circle(in)")) {
// value += "圆形聚焦进入";
// }
// if (filter.contains("circle(out)")) {
// value += "圆形扩散";
// }
// if (filter.contains("diamond(out)")) {
// value += "菱形扩散";
// }
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// }
// }
// if (pptxInfoPointsVo.getName().contains("触发方式")) {
// if (pptxInfoPointsVo.getFunction().contains("pic")) {
// String results = SlideAnimationQueryByCursor.getAnimationInfoForSpid(cTnCursor, number, "触发方式");
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + results);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ results);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// } else {
//
// }
// }
// if (pptxInfoPointsVo.getName().contains("持续时间")) {
// if (pptxInfoPointsVo.getFunction().contains("pic")) {
// String results = SlideAnimationQueryByCursor.getAnimationInfoForSpid(cTnCursor, number, "持续时间");
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + results);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ results);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// } else {
// cTnCursor.selectPath(namespace + "//p:animEffect/p:cBhvr/p:cTn");
// if (cTnCursor.toNextSelection()) {
// String value = "";
// String dur = cTnCursor.getAttributeText(new QName("dur"));
// if (dur == null) {
// value = "0秒";
// } else {
// value = String.valueOf((double) Integer.parseInt(dur) / 1000);
// }
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// }
// }
// }
// }
// } else if (pptxInfoPointsVo.getUnit().contains("Filling_method")) {
// // 查询
// XmlCursor otherSlideCurors = slideCursor.newCursor();
// slideCursor.selectPath(namespace + pptxInfoPointsVo.getFunction().replace("-", ""));
// // 判断填充方式的
// if (slideCursor.toNextSelection()) {
// String value = slideCursor.xmlText();
// value = getValueType(pptxInfoPointsVo, value);
// if (value.contains("未知填充")) {
// otherSlideCurors.selectPath(namespace + pptxInfoPointsVo.getFunction().split("]")[0] + "]/p:txBody");
// if (otherSlideCurors.toNextSelection()) {
// value = otherSlideCurors.xmlText();
// value = getValueType(pptxInfoPointsVo, value);
// }
// }
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// } else if (pptxInfoPointsVo.getName().contains("形状效果") && pptxInfoPointsVo.getName().contains("预设")) {
// slideCursor.selectPath(namespace + pptxInfoPointsVo.getFunction().replace("-", ""));
// if (slideCursor.toNextSelection()) {
// String value = slideCursor.xmlText();
// value = ReflectionAnalyzer.analyzeReflection(value);
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// } else if (pptxInfoPointsVo.getName().contains("纯色填充-颜色")) {
// String[] functionList = pptxInfoPointsVo.getFunction().split("#");
// slideCursor.selectPath(namespace + functionList[0]);
// String english = functionList[0].split("]")[0] + "]";
// if (slideCursor.toNextSelection()) {
// String value = slideCursor.getTextValue();
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// } else {
// slideCursor.selectPath(namespace + english + functionList[1]);
// if (slideCursor.toNextSelection()) {
// String value = slideCursor.getTextValue();
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// }
// } else if (pptxInfoPointsVo.getName().contains("锁定横纵比")) {
// slideCursor.selectPath(namespace + pptxInfoPointsVo.getFunction().replace("-", ""));
// String value = "";
// if (slideCursor.toNextSelection()) {
// System.out.println(slideCursor.xmlText());
// String values = slideCursor.getTextValue();
// value = values.equals("1") ? "是" : "否";
// } else {
// // 没有查询到说明没有
// value = "否";
// }
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// } else if (pptxInfoPointsVo.getName().contains("短划线类型")){
// slideCursor.selectPath(namespace + pptxInfoPointsVo.getFunction().replace("-", ""));
// if (slideCursor.toNextSelection()) {
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + slideCursor.getTextValue());
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ slideCursor.getTextValue());
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// } else {
// // 如果没有查询到说明使用了默认值
// String value = "实线";
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// } else {
// slideCursor.selectPath(namespace + pptxInfoPointsVo.getFunction().replace("-", ""));
// if (slideCursor.toNextSelection()) {
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// // 判断是值还是类型
// if ("1".equals(pptxInfoPointsVo.getIsboo())) {
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + "是");
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName() + "?" + pptxInfoPointsVo.getFunction() + "?" + "true");
// } else {
// String value = slideCursor.getTextValue();
// value = getValueType(pptxInfoPointsVo, value);
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName() + "?" + pptxInfoPointsVo.getFunction() + "?" + value);
//
// }
// judgementDto.setImage(pptxInfoPointsVo.getType() + "-" + pptxInfoPointsVo.getBelongTo() + "-" + pptxInfoPointsVo.getIsboo() + "-" + pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// } else {
// if ("1".equals(pptxInfoPointsVo.getIsboo())) {
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + "否");
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName() + "?" + pptxInfoPointsVo.getFunction() + "?" + "false");
// judgementDto.setImage(pptxInfoPointsVo.getType() + "-" + pptxInfoPointsVo.getBelongTo() + "-" + pptxInfoPointsVo.getIsboo() + "-" + pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// }
// }
// }
// // 单个幻灯片设置
// if ("1".equals(pptxInfoPointsVo.getBelongTo())) {
// Optional<PptxSlidesVo> result = pptxSlidesVos.stream().filter(pptxSlidesVo -> pptxSlidesVo.getSlideName().contains(pptxInfoPointsVo.getEnglishName())).findFirst();
// PptxSlidesVo pptxSlidesVo = result.get();
// XmlCursor slideCursor = pptxSlidesVo.getXmlCursor();
// String namespace = WpsPptxNameSpaces.getNameSpace(slideCursor.xmlText());
// // 查询
// if (pptxInfoPointsVo.getUnit().contains("Filling_method")) {
// // 判断填充方式的
// slideCursor.selectPath(namespace + pptxInfoPointsVo.getFunction().replace("-", ""));
// if (slideCursor.toNextSelection()) {
// String value = slideCursor.xmlText();
// value = getValueType(pptxInfoPointsVo, value);
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// } else if (pptxInfoPointsVo.getName().contains("幻灯片切换")){
// if (pptxInfoPointsVo.getName().contains("切换效果")) {
// slideCursor.selectPath(namespace + "./" + pptxInfoPointsVo.getFunction().split("]")[1]);
// if (slideCursor.toNextSelection()) {
// String value = slideCursor.xmlText();
// if (value.contains("p:fade")) {
// value = "淡入淡出";
// } else if (value.contains("p:push")) {
// value = "推入";
// } else if (value.contains("p:wipe")) {
// value = " 擦除";
// } else if (value.contains("p:split")) {
// value = "分割";
// }else if (value.contains("p:cut")) {
// value = "瞬间切换(无动画)";
// } else if (value.contains("p:random")) {
// value = " 随机一种切换效果";
// } else if (value.contains("p:pull")) {
// value = "拉出";
// }
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// }
// if (pptxInfoPointsVo.getName().contains("切换声音")) {
// slideCursor.selectPath(namespace + "./" + pptxInfoPointsVo.getFunction().split("]")[1]);
// if (slideCursor.toNextSelection()) {
// String value = slideCursor.getTextValue();
// if (value.contains("wind.wav")) {
// value = "风声";
// } else if (value.contains("water.wav")) {
// value = "水声";
// } else if (value.contains("fire.wav")) {
// value = "火声";
// } else if (value.contains("thunder.wav")) {
// value = "雷声";
// } else if (value.contains("applause.wav")) {
// value = "掌声";
// }
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// }
//// if (pptxInfoPointsVo.getName().contains("单机鼠标换片")) {
////
//// }
// if (pptxInfoPointsVo.getName().contains("换片间隔时间")){
// slideCursor.selectPath(namespace + "./" + pptxInfoPointsVo.getFunction().split("]")[1]);
// if (slideCursor.toNextSelection()) {
// String value = slideCursor.getTextValue();
// int values = Integer.parseInt(value) / 1000;
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + values);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ values);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// }
// }
// }
// // 幻灯片设置
// if ("2".equals(pptxInfoPointsVo.getBelongTo())) {
// XmlCursor presentationcursor = null;
// String namespace = "";
// for (PackagePart part : pkg.getParts()) {
// String entryName = part.getPartName().getName();
// if (entryName.contains("ppt/presentation") && entryName.contains(".xml")) {
// try (InputStream is = part.getInputStream()) {
// String xmlContent = IOUtils.toString(is, StandardCharsets.UTF_8);
// XmlObject xmlObject = XmlObject.Factory.parse(xmlContent);
// presentationcursor = xmlObject.newCursor();
// namespace = WpsPptxNameSpaces.getNameSpace(presentationcursor.xmlText());
// }
// }
// }
// if ("1".equals(pptxInfoPointsVo.getType())) {
// // 如果是外参数
// if (pptxInfoPointsVo.getName().contains("幻灯片大小")) {
// presentationcursor.selectPath(namespace + "//p:presentation/p:sldSz");
// if (presentationcursor.toNextSelection()) {
// String value = PageSizeDetector.detectPaperPPTSize(presentationcursor.xmlText());
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// }
// if (pptxInfoPointsVo.getName().contains("放映类型")) {
// presentationcursor.selectPath(namespace + "//p:presentation/p:showPr");
// if (presentationcursor.toNextSelection()) {
// System.out.println("放映类型" + presentationcursor.xmlText());
// } else {
// // 如果没有标签的话说明是默认的ppt方式
// String value = "演示者放映(全屏)";
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() +value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// }
// if (pptxInfoPointsVo.getName().contains("放映范围")) {
// presentationcursor.selectPath(namespace + "//p:presentation/p:showPr");
// if (presentationcursor.toNextSelection()) {
// System.out.println("放映范围" + presentationcursor.xmlText());
// } else {
// // 说明全页面放映,查询有多少页
// presentationcursor.selectPath(namespace + "//p:presentation/p:sldIdLst/p:sldId");
// int count = 0;
// String value = "";
// while (presentationcursor.toNextSelection()) {
// count ++;
// value += "第" + count + "页 ";
// }
// WpsPptxJudgementDto judgementDto = new WpsPptxJudgementDto();
// judgementDto.setContentIn(getStringName(pptxInfoPointsVo.getEnglishName()) + pptxInfoPointsVo.getName() + value);
// judgementDto.setContent(pptxInfoPointsVo.getEnglishName()+"?"+pptxInfoPointsVo.getFunction()+"?"+ value);
// judgementDto.setImage(pptxInfoPointsVo.getType()+"-"+pptxInfoPointsVo.getBelongTo()+"-"+pptxInfoPointsVo.getIsboo()+"-"+pptxInfoPointsVo.getUnit());
// judgementDto.setScoreRate("1");
// judgementList.add(judgementDto);
// }
// }
// }
// }
// }
//
// } catch (IOException e) {
// e.printStackTrace();
// } catch (XmlException e) {
// throw new RuntimeException(e);
// } catch (InvalidFormatException e) {
// throw new RuntimeException(e);
// }
// return judgementList;
// }
//
// public static String getValueType(PptxInfoPointsVo pptxInfoPointsVo, String value) {
// String values = value;
// if (pptxInfoPointsVo.getUnit().contains("twiptopt")) {
// values = TwipConverter.formatDouble(TwipConverter.toPoints(Integer.parseInt(value))) + "磅";
// }
// if (pptxInfoPointsVo.getUnit().contains("emustopt")) {
// values = TwipConverter.formatDouble(TwipConverter.toEmus(Integer.parseInt(value))) + "磅";
// }
// if (pptxInfoPointsVo.getUnit().contains("color")) {
// values = ColorNameFinder.getColorName(value);
// }
// if (pptxInfoPointsVo.getUnit().contains("direction")) {
// // 方向英文转换
// if ("landscape".equals(value)) {
// values = "横向";
// } else if ("portrait".equals(value)) {
// values = "纵向";
// } else if ("up".equals(value)) {
// values = "上对齐";
// } else if ("down".equals(value)) {
// values = "下对齐";
// }
// }
// if (value.contains("center")) {
// values = "居中对齐";
// }
// if (pptxInfoPointsVo.getUnit().contains("textdirection")) {
// // 方向英文转换
// if ("left".equals(value)) {
// values = "左对齐";
// } else if ("center".equals(value)) {
// values = "居中对齐";
// } else if ("right".equals(value)) {
// values = "右对齐";
// } else if ("both".equals(value)) {
// values = "两端对齐";
// }
// }
// if (pptxInfoPointsVo.getUnit().contains("halfpt")) {
// values = String.valueOf (Integer.parseInt(value) / 2);
// }
// if (pptxInfoPointsVo.getUnit().contains("baipt")) {
// values = String.valueOf (Integer.parseInt(value) / 100);
// }
// if (pptxInfoPointsVo.getUnit().contains("milli")) {
// values = String.valueOf (Integer.parseInt(value) / 1000);
// }
// if (pptxInfoPointsVo.getUnit().contains("shadowdirection")) {
// ShadowDirectionUtils.ShadowDirection direction = ShadowDirectionUtils.getShadowDirection(Long.valueOf(value));
// values = direction.getLabel();
// }
// if (pptxInfoPointsVo.getUnit().contains("Filling_method")) {
// if (value.contains("solidFill")) {
// values = "纯色填充";
// } else if (value.contains("gradFill")) {
// values = "渐变填充";
// } else if (value.contains("pattFill")) {
// values = "图案填充";
// } else if (value.contains("blipFill")) {
// values = "图片填充";
// } else {
// values = "未知填充";
// }
// }
// return values;
// }
//
// public static String getStringName(String name) {
// // 提取字母部分
// String letters = name.replaceAll("[^a-zA-Z]", "");
// // 提取数字部分
// String digits = name.replaceAll("[^0-9]", "");
// String chineseName = "";
// if ("slide".equalsIgnoreCase(letters)) {
// try {
// int slideNumber = Integer.parseInt(digits);
// chineseName = "【第 " + slideNumber + " 页】";
// } catch (NumberFormatException e) {
// System.out.println("数字解析失败:" + e.getMessage());
// }
// }
// return chineseName;
// }
//
// // 大纲
// // 1、获取第一层目录 幻灯片 - 母版 - 设置 - 其他
// // 2、获取第二层目录 第x页 - 幻灯片母版/备注母版 - 幻灯片设置 - 文件操作
// // 3、获取第三层目录 幻灯片设置/形状 - 幻灯片母版 - 幻灯片设置 - 文件操作
// public static List<PptxInfoReqVo> wpsPptxInfo(String filePath) throws FileNotFoundException {
// List<PptxInfoReqVo> pptxInfoReqVos = new ArrayList<>();
// try (FileInputStream fis = new FileInputStream(filePath);
// XMLSlideShow pptxXml = new XMLSlideShow(fis)) {
// int index = 0;
// String firstId = getStringRandom();
// setPptxInfo("幻灯片", "p:sld", "p:sld", filePath, firstId, "0", pptxInfoReqVos);
// for (XSLFSlide slides : pptxXml.getSlides()){
// index += 1;
// String secondId = getStringRandom();
// setPptxInfo("第"+index+"页", "p:sld"+index, "p:sld"+index, filePath, secondId, firstId, pptxInfoReqVos);
// // 第三层
// String thirdId = getStringRandom();
// int indexCnvPr = 1;
// setPptxInfo("幻灯片设置", "slide"+index, "(//p:bg)["+indexCnvPr+"]", filePath, thirdId, secondId, pptxInfoReqVos);
// XmlCursor spCursor = slides.getXmlObject().newCursor();
// spCursor.selectPath("declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//p:sp");
// while (spCursor.toNextSelection()) {
// XmlCursor cNvPrXml = spCursor.newCursor();
// cNvPrXml.selectPath("declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//p:cNvPr/@name");
// if (cNvPrXml.toNextSelection()) {
// String name = cNvPrXml.getTextValue();
// String fourId = getStringRandom();
// setPptxInfo("形状"+indexCnvPr+"->"+name, "slide"+index, "(//p:sp)["+indexCnvPr+"]", filePath, fourId, secondId, pptxInfoReqVos);
// indexCnvPr += 1;
// }
// }
// XmlCursor picCursor = slides.getXmlObject().newCursor();
// System.out.println(picCursor.xmlText());
// picCursor.selectPath("declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' .//p:pic");
// int indexCnvPrPic = 1;
// while (picCursor.toNextSelection()) {
// String fourId = getStringRandom();
// setPptxInfo("图像"+indexCnvPrPic+"->图像", "slide"+index, "(//p:pic)["+indexCnvPrPic+"]", filePath, fourId, secondId, pptxInfoReqVos);
// indexCnvPrPic += 1;
// }
// }
// // 设置
// String firstIds = getStringRandom();
// setPptxInfo("设置", "p:presentation", "p:presentation", filePath, firstIds, "0", pptxInfoReqVos);
// String secondIds = getStringRandom();
// setPptxInfo("幻灯片设置", "p:presentation", "p:presentation", filePath, secondIds, firstIds, pptxInfoReqVos);
//
// // 母版
//// String dFirstId = getStringRandom();
//// setPptxInfo("母版", "p:sld", "p:sld", filePath, dFirstId, "0", pptxInfoReqVos);
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
// return pptxInfoReqVos;
// }
//
//
// public static List<PptxVO> wpsPptx(String filePath, List<WpsPptxLinkDO> cSldList) {
// List<PptxVO> pptxVOS = new ArrayList<>();
// // 转换数据
// List<WpsPptxLinkDO> cSldTree = TreeUtils.buildTreePptx(cSldList);
// // 1、读取文件内容
// try (FileInputStream fis = new FileInputStream(filePath);
// XMLSlideShow pptxXml = new XMLSlideShow(fis)) {
// // 索引
// int index = 0;
// // 获取了所有的幻灯片
// for (XSLFSlide slides : pptxXml.getSlides()){
// index += 1;
// String xmlText = slides.getXmlObject().xmlText();
// // 1-1、创建最全的命名空间
// Pattern pattern = Pattern.compile("xmlns:(\\w+)=\"([^\"]+)\"");
// Matcher matcher = pattern.matcher(xmlText);
// Map<String, String> namespaces = new HashMap<>();
// while (matcher.find()) {
// String prefix = matcher.group(1);
// String uri = matcher.group(2);
// namespaces.put(prefix, uri);
// }
// StringBuilder xpathBuilder = new StringBuilder();
// namespaces.forEach((prefix, uri) ->
// xpathBuilder.append("declare namespace ")
// .append(prefix)
// .append("='")
// .append(uri)
// .append("' ")
// );
// // 2-1、获取出来最全的命名空间
// String allPathx = xpathBuilder.toString();
// // 3、获取CTDocument对象
// XmlObject docXml = slides.getXmlObject();
// // 命名
// String typeName = "【第" + index + "页】";
// String englishName = "@" + index;
// for (WpsPptxLinkDO node : cSldTree) {
// // 4、查询形状下的所有数据 先查询有多少个形状
// XmlCursor xmlCursor = docXml.newCursor();
// xmlCursor.selectPath(allPathx + "//" + node.getName());
// System.out.println(xmlCursor.xmlText());
// // 获取p:sp形状下的数据
// int pIndex = 0;
// while (xmlCursor.toNextSelection()) {
// pIndex += 1;
// for (WpsPptxLinkDO anchor :node.getChildren()) {
// String spName = "【第" + pIndex + "个形状】";
// String englishSpName = "@" + pIndex;
// XmlCursor pXmlCursor = xmlCursor.getObject().newCursor();
// String nextString = allPathx + anchor.getName();
// pXmlCursor.selectPath(nextString);
// while (pXmlCursor.toNextSelection()) {
// XmlCursor pXmlCursors = pXmlCursor.getObject().newCursor();
// String textValue = pXmlCursors.getTextValue();
// PptxVO pptxVO = new PptxVO();
// pptxVO.setExamKeynote(englishName + englishSpName + anchor.getName()+ " " + textValue);
// pptxVO.setKeynoteChinese(typeName + spName + "【" + anchor.getChineseName() + "】" + textValue);
// pptxVOS.add(pptxVO);
//// System.out.println(typeName + spName + "【" + anchor.getToChinese() + "】" + textValue);
// }
// pXmlCursor.dispose();
// }
// // traverseTreeAndQueryXml(pptxVOS, typeName + "-第" + pIndex + "个形状", allPathx, node, pXmlObject, new ArrayList<>(), new ArrayList<>(), index, 1);
// }
// xmlCursor.dispose();
// }
// }
//
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// return pptxVOS;
// }
//
// public static void setPptxInfo(String chineseName, String englishName, String selectName, String filePath, String id, String parentId, List<PptxInfoReqVo> pptxInfoReqVos) throws Exception {
// PptxInfoReqVo pptxInfos = new PptxInfoReqVo();
// pptxInfos.setName(chineseName);
// pptxInfos.setEnglishName(englishName);
// pptxInfos.setFilePath(filePath);
// pptxInfos.setId(id);
// pptxInfos.setSelectName(selectName);
// pptxInfos.setParentId(parentId);
// pptxInfoReqVos.add(pptxInfos);
// }
//
// public static String getStringRandom() {
// String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
// Random random = new Random();
// StringBuilder sb = new StringBuilder();
//
// // 生成指定长度的随机字符字符串
// for (int i = 0; i < 10; i++) {
// int randomIndex = random.nextInt(characters.length());
// // 随机字符
// sb.append(characters.charAt(randomIndex));
// }
// return sb.toString();
// }
//
// /**
// * @param pptxVOS List<PptxVO> 用来存放结果
// * @param firstTitle String 用来存放一级标题
// * @param xpath String 用来存放xpath
// * @param node WpsWordLinkDO 用来存放节点
// * @param currentXml XmlObject 用来存放当前xml
// * @param pathSoFar List<String> 用来存放路径
// * @param pathChinese List<String> 用来存放中文路径
// * @param index int 用来存放索引
// * @param beginIndex int 用来存放开始索引
// */
// public static void traverseTreeAndQueryXml(List<PptxVO> pptxVOS, String firstTitle, String xpath, WpsPptxLinkDO node, XmlObject currentXml, List<String> pathSoFar, List<String> pathChinese, int index, int beginIndex) {
// // 到达参数节点,构造 XPath 路径查询它的值
// if (beginIndex == 1) {
// xpath += "./";
// }
// if (beginIndex > 1) {
// pathSoFar.add(node.getName());
// pathChinese.add(node.getChineseName() + index);
// }
//
// if (node.getType() == 1 || node.getType() == 2) {
// xpath += String.join("/", pathSoFar);
// try (XmlCursor cursors = currentXml.newCursor()) {
// System.out.println(cursors.xmlText());
// System.out.println(xpath);
// cursors.selectPath(xpath);
// if (cursors.toNextSelection()) {
// String textValue = cursors.getTextValue();
// cursors.dispose();
// }
// }
// } else {
// for (WpsPptxLinkDO child : node.getChildren()) {
// traverseTreeAndQueryXml(pptxVOS, firstTitle, xpath, child, currentXml, new ArrayList<>(pathSoFar), new ArrayList<>(pathChinese), index,2);
// }
// }
// if (!pathSoFar.isEmpty()) {
// pathSoFar.remove(pathSoFar.size() - 1);
// pathChinese.remove(pathChinese.size() - 1);
// }
//
// }
//
//}

View File

@@ -1,39 +0,0 @@
package pc.exam.pp.module.judgement.utils.wps_pptx;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class XmlRecursiveFinder {
// 递归入口
public static Element findElementRecursive(Node startNode, String[] tags, int index) {
if (index >= tags.length || startNode == null) return null;
String tag = tags[index].split(":")[1];
String namespace = tags[index].split(":")[0];
NodeList children;
if (startNode instanceof Document) {
children = ((Document) startNode).getElementsByTagNameNS(DeclareNamespaceForPPT.getNameSpace(namespace), tag);
} else {
children = ((Element) startNode).getElementsByTagNameNS(DeclareNamespaceForPPT.getNameSpace(namespace), tag);
}
if (children.getLength() == 0) return null;
Element child = (Element) children.item(0);
if (index == tags.length - 1) {
// 最后一层,返回当前节点
return child;
}
return findElementRecursive(child, tags, index + 1);
}
// 封装外部调用
public static Element findElement(Document doc, String titleName) {
String[] title = titleName.split("@");
return findElementRecursive(doc, title, 0);
}
}

View File

@@ -1,24 +0,0 @@
package pc.exam.pp.module.judgement.utils.wps_pptx.vo;
import lombok.Data;
@Data
public class PptxInfoPointsVo {
private String name;
private String englishName;
private String filePath;
private String function;
private String belongTo;
private String isboo;
private String type;
private String unit;
}

View File

@@ -1,30 +0,0 @@
package pc.exam.pp.module.judgement.utils.wps_pptx.vo;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author REN
*/
@Data
public class PptxInfoReqVo {
private String name;
private String englishName;
private String filePath;
private String parentId;
private String selectName;
private String title;
private String id;
private List<PptxInfoReqVo> children = new ArrayList<>();
}

View File

@@ -1,23 +0,0 @@
package pc.exam.pp.module.judgement.utils.wps_pptx.vo;
import lombok.Data;
import org.apache.xmlbeans.XmlCursor;
import java.util.ArrayList;
import java.util.List;
/**
* @author REN
*/
@Data
public class PptxListVo {
private String name;
private XmlCursor xmlCursor;
private String target;
private XmlCursor resXmlCursor;
}

View File

@@ -1,17 +0,0 @@
package pc.exam.pp.module.judgement.utils.wps_pptx.vo;
import lombok.Data;
import org.apache.xmlbeans.XmlCursor;
import java.util.List;
import java.util.Map;
@Data
public class PptxSlidesVo {
private String slideName;
private XmlCursor xmlCursor;
private List<Map<String, String>> slideResList;
}

View File

@@ -1,19 +0,0 @@
package pc.exam.pp.module.judgement.utils.wps_pptx.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
public class PptxVO {
@Schema(description = "考试考点")
private String examKeynote;
@Schema(description = "考点汉化")
private String keynoteChinese;
@Schema(description = "代码")
private String code;
}