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