fix(文档拆分):判断逻辑

This commit is contained in:
yjz
2024-07-23 19:23:42 +08:00
parent 37214aab97
commit dcdba8bc1c
@@ -2,8 +2,6 @@ package com.jero.modules.split.service.impl;
import cn.hutool.core.lang.RegexPool;
import cn.hutool.core.util.ReUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
@@ -41,8 +39,6 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObject;
import org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture;
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTAnchor;
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline;
import org.openxmlformats.schemas.officeDocument.x2006.math.CTOMath;
import org.openxmlformats.schemas.officeDocument.x2006.math.CTOMathPara;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDrawing;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLevelText;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR;
@@ -222,34 +218,34 @@ public class FileSpiltService {
// //处理段落中的文本以及图片
// handleParagraphRun(content, (XWPFRun) child, imageParser);
//} else
if (child instanceof CTOMath) {
CTOMath ctoMath = (CTOMath) child;
String xmlText = ctoMath.xmlText().replaceAll("xml-fragment","m:oMath");
Map<String, Object> map = new HashMap<>();
map.put("encode", xmlText);
String post = HttpRequest.post(mathToImgUrl)
.header(Header.CONTENT_TYPE, "application/json")
.body(xmlText)
.execute().body();
//String post = HttpUtil.post(mathToImgUrl, map);
if (messageList.size() > 0) {
addItermsMathImage(messageList.get(messageList.size() - 1), itemValList, post);
}
}
else if (child instanceof CTOMathPara) {
CTOMathPara ctoMathPara = (CTOMathPara) child;
String xmlText = ctoMathPara.xmlText().replaceAll("xml-fragment","m:oMath");;
Map<String,Object> map = new HashMap<>();
map.put("encode",xmlText);
String post = HttpRequest.post(mathToImgUrl)
.header(Header.CONTENT_TYPE, "application/json")
.body(xmlText)
.execute().body();
//String post = HttpUtil.post(mathToImgUrl, map);
if (messageList.size() > 0) {
addItermsMathImage(messageList.get(messageList.size() - 1), itemValList, post);
}
}
// if (child instanceof CTOMath) {
// CTOMath ctoMath = (CTOMath) child;
// String xmlText = ctoMath.xmlText().replaceAll("xml-fragment","m:oMath");
// Map<String, Object> map = new HashMap<>();
// map.put("encode", xmlText);
// String post = HttpRequest.post(mathToImgUrl)
// .header(Header.CONTENT_TYPE, "application/json")
// .body(xmlText)
// .execute().body();
// //String post = HttpUtil.post(mathToImgUrl, map);
// if (messageList.size() > 0) {
// addItermsMathImage(messageList.get(messageList.size() - 1), itemValList, post);
// }
// }
// else if (child instanceof CTOMathPara) {
// CTOMathPara ctoMathPara = (CTOMathPara) child;
// String xmlText = ctoMathPara.xmlText().replaceAll("xml-fragment","m:oMath");;
// Map<String,Object> map = new HashMap<>();
// map.put("encode",xmlText);
// String post = HttpRequest.post(mathToImgUrl)
// .header(Header.CONTENT_TYPE, "application/json")
// .body(xmlText)
// .execute().body();
// //String post = HttpUtil.post(mathToImgUrl, map);
// if (messageList.size() > 0) {
// addItermsMathImage(messageList.get(messageList.size() - 1), itemValList, post);
// }
// }
}
for (XWPFRun xwrun : p.getRuns()) {
@@ -376,8 +372,8 @@ public class FileSpiltService {
startDigit = getOneStartDigit(paragraphString, enumByValue);
}
for (int i = 0; i < nowStart.size(); i++) {
if (paragraphString.startsWith(nowStart.get(i))) {
//if (startDigit.equals(nowStart.get(i))) {
// if (paragraphString.startsWith(nowStart.get(i))) {
if (startDigit.equals(nowStart.get(i))) {
// 判断真的是标题还是干扰项 TODO
if (nowStart.get(i).matches(regex)) {
boolean result = fileSplitPdfService.judge(preName, preNameNum, startDigit, g, startDigitList, ".");