拆分bug处理

This commit is contained in:
wangchengjun
2022-06-07 15:38:14 +08:00
parent 535caca2b4
commit 6474e869fd
@@ -2,6 +2,7 @@ package com.jero.modules.split.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.document.utils.ReadPdfUtil;
import com.jero.modules.ocr.util.UUIDUtils;
import com.jero.modules.oss.entity.OSSFile;
@@ -17,6 +18,7 @@ import com.jero.modules.split.util.ReadWordTable;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.xwpf.usermodel.*;
import org.apache.shiro.SecurityUtils;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObject;
@@ -156,6 +158,15 @@ public class FileSpiltService {
paragraphString = paragraphString.replace((char) 12288, ' ');
paragraphString = paragraphString.trim();
}
if(StringUtils.isEmpty(paragraphString)){
continue;
}
paragraphString = paragraphString.replaceAll("\r\n","");
paragraphString = paragraphString.replaceAll("\n","");
paragraphString = paragraphString.trim();
if(StringUtils.isEmpty(paragraphString)){
continue;
}
if (StringUtils.isNotEmpty(p.getNumLevelText()) && p.getNumLevelText().indexOf(".") > 0) {
String numberParent = p.getNumLevelText().substring(0, p.getNumLevelText().lastIndexOf("."));
if (numberMap.containsKey(numberParent)) {
@@ -477,6 +488,15 @@ public class FileSpiltService {
paragraphString = paragraphString.replace((char) 12288, ' ');
paragraphString = paragraphString.trim();
}
if(StringUtils.isEmpty(paragraphString)){
continue;
}
paragraphString = paragraphString.replaceAll("\r\n","");
paragraphString = paragraphString.replaceAll("\n","");
paragraphString = paragraphString.trim();
if(StringUtils.isEmpty(paragraphString)){
continue;
}
// if (StringUtils.isNotEmpty(p.getNumLevelText())&& p.getNumLevelText().indexOf(".")>0) {
// String numberParent = p.getNumLevelText().substring(0,p.getNumLevelText().lastIndexOf("."));
// if (numberMap.containsKey(numberParent)){
@@ -650,6 +670,15 @@ public class FileSpiltService {
paragraphString = paragraphString.replace((char) 12288, ' ');
paragraphString = paragraphString.trim();
}
if(StringUtils.isEmpty(paragraphString)){
continue;
}
paragraphString = paragraphString.replaceAll("\r\n","");
paragraphString = paragraphString.replaceAll("\n","");
paragraphString = paragraphString.trim();
if(StringUtils.isEmpty(paragraphString)){
continue;
}
// if (StringUtils.isNotEmpty(p.getNumLevelText())&& p.getNumLevelText().indexOf(".")>0) {
// String numberParent = p.getNumLevelText().substring(0,p.getNumLevelText().lastIndexOf("."));
// if (numberMap.containsKey(numberParent)){
@@ -821,6 +850,15 @@ public class FileSpiltService {
paragraphString = paragraphString.replace((char) 12288, ' ');
paragraphString = paragraphString.trim();
}
if(StringUtils.isEmpty(paragraphString)){
continue;
}
paragraphString = paragraphString.replaceAll("\r\n","");
paragraphString = paragraphString.replaceAll("\n","");
paragraphString = paragraphString.trim();
if(StringUtils.isEmpty(paragraphString)){
continue;
}
// if (StringUtils.isNotEmpty(p.getNumLevelText())&& p.getNumLevelText().indexOf(".")>0) {
// String numberParent = p.getNumLevelText().substring(0,p.getNumLevelText().lastIndexOf("."));
// if (numberMap.containsKey(numberParent)){
@@ -846,6 +884,8 @@ public class FileSpiltService {
// 判断名称,如果大于10位,取十位,
// String itemName = paragraphString.substring(nowStart.get(i).length()).length()>10?paragraphString.substring(nowStart.get(i).length(),nowStart.get(i).length()+10):paragraphString.substring(nowStart.get(i).length());
String itemName = FileSplitUtils.getItemName(paragraphString, nowStart.get(i));
List<String> clauseContent = new ArrayList<>();
clauseContent.add(paragraphString);
SarFileSplitItemsEO message = getSarFileSplitItemsEO(sarFileSplitInfoEO.getId(), nowStart.get(i), itemName, clauseContent);
@@ -865,12 +905,15 @@ public class FileSpiltService {
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList(nowStart.get(i), treeList, generalCatalogueId, sarFileSplitInfoEO, treeListDisplay++, itemName, enumByValue);
treeList.add(sarFileSplitMenuEO);
message.setMenuId(sarFileSplitMenuEO.getId());
addItermsConditionsText(message, itemValList, paragraphString.substring(nowStart.get(i).length()));
if(!StringUtils.isEmpty(itemName)){
addItermsConditionsText(message, itemValList, paragraphString.substring(nowStart.get(i).length()));
}
messageList.add(message);
nowStart = getNewNowStartJapanOne("", nowStart.get(i));
menuCanAdd = true;
}
hasGoIf = true;
break;
}
@@ -994,10 +1037,20 @@ public class FileSpiltService {
// 处理段落生成编号不识别问题
String paragraphString = p.getText();
if (StringUtils.isNotBlank(paragraphString)) {
paragraphString = paragraphString.replace((char) 12288, ' ');
paragraphString = paragraphString.trim();
}
if(StringUtils.isEmpty(paragraphString)){
continue;
}
paragraphString = paragraphString.replaceAll("\r\n","");
paragraphString = paragraphString.replaceAll("\n","");
paragraphString = paragraphString.trim();
if(StringUtils.isEmpty(paragraphString)){
continue;
}
// if (StringUtils.isNotEmpty(p.getNumLevelText())&& p.getNumLevelText().indexOf(".")>0) {
// String numberParent = p.getNumLevelText().substring(0,p.getNumLevelText().lastIndexOf("."));
// if (numberMap.containsKey(numberParent)){
@@ -1171,6 +1224,15 @@ public class FileSpiltService {
paragraphString = paragraphString.replace((char) 12288, ' ');
paragraphString = paragraphString.trim();
}
if(StringUtils.isEmpty(paragraphString)){
continue;
}
paragraphString = paragraphString.replaceAll("\r\n","");
paragraphString = paragraphString.replaceAll("\n","");
paragraphString = paragraphString.trim();
if(StringUtils.isEmpty(paragraphString)){
continue;
}
// if (StringUtils.isNotEmpty(p.getNumLevelText())&& p.getNumLevelText().indexOf(".")>0) {
// String numberParent = p.getNumLevelText().substring(0,p.getNumLevelText().lastIndexOf("."));
// if (numberMap.containsKey(numberParent)){
@@ -1344,6 +1406,15 @@ public class FileSpiltService {
paragraphString = paragraphString.replace((char) 12288, ' ');
paragraphString = paragraphString.trim();
}
if(StringUtils.isEmpty(paragraphString)){
continue;
}
paragraphString = paragraphString.replaceAll("\r\n","");
paragraphString = paragraphString.replaceAll("\n","");
paragraphString = paragraphString.trim();
if(StringUtils.isEmpty(paragraphString)){
continue;
}
// if (StringUtils.isNotEmpty(p.getNumLevelText())&& p.getNumLevelText().indexOf(".")>0) {
// String numberParent = p.getNumLevelText().substring(0,p.getNumLevelText().lastIndexOf("."));
// if (numberMap.containsKey(numberParent)){
@@ -1527,6 +1598,15 @@ public class FileSpiltService {
paragraphString = paragraphString.replace((char) 12288, ' ');
paragraphString = paragraphString.trim();
}
if(StringUtils.isEmpty(paragraphString)){
continue;
}
paragraphString = paragraphString.replaceAll("\r\n","");
paragraphString = paragraphString.replaceAll("\n","");
paragraphString = paragraphString.trim();
if(StringUtils.isEmpty(paragraphString)){
continue;
}
if (filterFlag) {
boolean noteFlag = false;
@@ -2249,11 +2329,10 @@ public class FileSpiltService {
sarFileSplitItemsEO.setId(UUIDUtils.randomUUID20());
sarFileSplitItemsEO.setValidFlag(0);
sarFileSplitItemsEO.setCreationTime(new Date());
//TODO 需要修改
// sarFileSplitItemsEO.setCreationUser(LoginUserUtil.getUserId());
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // 获取当前登录用户
sarFileSplitItemsEO.setCreationUser(loginUser.getUsername());
sarFileSplitItemsEO.setModifyTime(new Date());
//TODO 需要修改
// sarFileSplitItemsEO.setModifyUser(LoginUserUtil.getUserId());
sarFileSplitItemsEO.setModifyUser(loginUser.getUsername());
return sarFileSplitItemsEO;
}
@@ -2508,11 +2587,10 @@ public class FileSpiltService {
sarFileSplitItemsValEO.setId(UUIDUtils.randomUUID20());
sarFileSplitItemsValEO.setValidFlag(0);
sarFileSplitItemsValEO.setCreationTime(new Date());
//TODO 需要修改
// sarFileSplitItemsValEO.setCreationUser(LoginUserUtil.getUserId());
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // 获取当前登录用户
sarFileSplitItemsValEO.setCreationUser(loginUser.getUsername());
sarFileSplitItemsValEO.setModifyTime(new Date());
//TODO 需要修改
// sarFileSplitItemsValEO.setModifyUser(LoginUserUtil.getUserId());
sarFileSplitItemsValEO.setModifyUser(loginUser.getUsername());
sarFileSplitItemsValEO.setItemId(itemId);
sarFileSplitItemsValEO.setType(type);
sarFileSplitItemsValEO.setDisplaySeq(disPlaySql);