feat: 文档附录拆分没有将子集归拢的问题

This commit is contained in:
2024-09-06 21:02:22 +08:00
parent 5597b9212e
commit f756d21478
@@ -585,6 +585,28 @@ public class FileSpiltService {
boolean isAppendix = ReUtil.isMatch(RegexPool.WORD, numberStr);
if (isAppendix){
treeName = numberStr;
} else {
// 如果treeName包含“附录”字样
if (treeName.contains("附录")) {
// 找到“附录”在字符串中的索引位置
int appendixIndex = treeName.indexOf("附录");
// 从“附录”之后获取字母及忽略可能存在的空格
String appendixPart = treeName.substring(appendixIndex + 2).trim();
// 提取第一个非空格字符,假定该字符为附录字母
if (!appendixPart.isEmpty()) {
String appendixLetter = appendixPart.substring(0, 1);
// 判断该字符是否为字母
if (ReUtil.isMatch(RegexPool.WORD, appendixLetter)) {
treeName = appendixLetter; // 将附录字母赋值给treeName
} else {
// 如果不是有效字母,可以根据业务逻辑处理
treeName = ""; // 或设定默认值
}
}
}
}
switch (enumByValue) {
case GB: