From f756d21478766ae1599e51d53e04f2d57ad44b38 Mon Sep 17 00:00:00 2001 From: caihaohan Date: Fri, 6 Sep 2024 21:02:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=87=E6=A1=A3=E9=99=84=E5=BD=95?= =?UTF-8?q?=E6=8B=86=E5=88=86=E6=B2=A1=E6=9C=89=E5=B0=86=E5=AD=90=E9=9B=86?= =?UTF-8?q?=E5=BD=92=E6=8B=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../split/service/impl/FileSpiltService.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java index 05bd1fd2..cf45e36b 100644 --- a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java +++ b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java @@ -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: