update 优化文档拆分目录获取
This commit is contained in:
@@ -8,10 +8,8 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.poi.xwpf.usermodel.VerticalAlign;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author liJiaRao
|
||||
@@ -28,6 +26,7 @@ public class AsposeUtil {
|
||||
TitleNumberVO titleNumberVO = new TitleNumberVO();
|
||||
Map<String, List<String>> titleNumberMap = new HashMap<>();
|
||||
List<String> emptyTitleList = new ArrayList<>();
|
||||
List<String> titleNumberList = new ArrayList<>();
|
||||
try {
|
||||
Document doc = new Document(is);
|
||||
|
||||
@@ -60,7 +59,9 @@ public class AsposeUtil {
|
||||
labelString = listLabel.getLabelString().trim();
|
||||
labelString = labelString.replaceAll("\t", "").replaceAll("\b", "")
|
||||
.replaceAll(" ", "").replaceAll("\"", "").replaceAll("'", "").replaceAll(" ", "");
|
||||
|
||||
if (StringUtils.isBlank(labelString)){
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isNotBlank(text)) {
|
||||
if (titleNumberMap.containsKey(text)) {
|
||||
List<String> strings = titleNumberMap.get(text);
|
||||
@@ -70,6 +71,7 @@ public class AsposeUtil {
|
||||
strings.add(labelString);
|
||||
titleNumberMap.put(text, strings);
|
||||
}
|
||||
titleNumberList.add(labelString);
|
||||
} else {
|
||||
emptyTitleList.add(labelString);
|
||||
}
|
||||
@@ -80,6 +82,7 @@ public class AsposeUtil {
|
||||
e.printStackTrace();
|
||||
}
|
||||
titleNumberVO.setTitleNumberMap(titleNumberMap);
|
||||
emptyTitleList.removeIf(titleNumberList::contains);
|
||||
titleNumberVO.setEmptyTitleList(emptyTitleList);
|
||||
return titleNumberVO;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user