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