文档拆分-PDF拆分
This commit is contained in:
+408
-130
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.jero.common.exception.JeroBootException;
|
import com.jero.common.exception.JeroBootException;
|
||||||
import com.jero.common.system.vo.LoginUser;
|
import com.jero.common.system.vo.LoginUser;
|
||||||
import com.jero.common.util.oss.CosBootUtil;
|
import com.jero.common.util.oss.CosBootUtil;
|
||||||
import com.jero.modules.document.utils.ReadPdfUtil;
|
|
||||||
import com.jero.modules.ocr.util.UUIDUtils;
|
import com.jero.modules.ocr.util.UUIDUtils;
|
||||||
import com.jero.modules.oss.entity.OSSFile;
|
import com.jero.modules.oss.entity.OSSFile;
|
||||||
import com.jero.modules.oss.service.IOSSFileService;
|
import com.jero.modules.oss.service.IOSSFileService;
|
||||||
@@ -61,6 +60,8 @@ public class FileSpiltService {
|
|||||||
private ISarFileSplitItemsValEOService iSarFileSplitItemsValEOService;
|
private ISarFileSplitItemsValEOService iSarFileSplitItemsValEOService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IOSSFileService iossFileService;
|
private IOSSFileService iossFileService;
|
||||||
|
@Autowired
|
||||||
|
private FileSplitPdfService fileSplitPdfService;
|
||||||
|
|
||||||
@Value("${jero.path.upload}")
|
@Value("${jero.path.upload}")
|
||||||
private String filePath;
|
private String filePath;
|
||||||
@@ -110,9 +111,8 @@ public class FileSpiltService {
|
|||||||
|
|
||||||
List<String> nowStart = new ArrayList<>();
|
List<String> nowStart = new ArrayList<>();
|
||||||
// if (sarFileSplitInfoEO.getStartNumber()<4){
|
// if (sarFileSplitInfoEO.getStartNumber()<4){
|
||||||
//从第四个开始拆解
|
//从第二个开始拆解
|
||||||
nowStart.add("3.1");
|
nowStart.add("2");
|
||||||
nowStart.add("4");
|
|
||||||
// } else {
|
// } else {
|
||||||
// nowStart.add(String.valueOf(sarFileSplitInfoEO.getStartNumber()));
|
// nowStart.add(String.valueOf(sarFileSplitInfoEO.getStartNumber()));
|
||||||
// }
|
// }
|
||||||
@@ -154,27 +154,20 @@ public class FileSpiltService {
|
|||||||
// 记录word自动生成的编号数据
|
// 记录word自动生成的编号数据
|
||||||
Map numberMap = new HashMap<String, Integer>();
|
Map numberMap = new HashMap<String, Integer>();
|
||||||
boolean menuCanAdd = false; // 判断当前目录下是否可以正常填写数据
|
boolean menuCanAdd = false; // 判断当前目录下是否可以正常填写数据
|
||||||
boolean startFlag = false; // 判断开始拆分的起始段落,因为需要从标题:范围 开始拆,但会受目录的影响
|
boolean firstFlag = true;
|
||||||
int count = 0; // 记录标题:范围 出现的次数
|
List<String> startDigitList = getStartDigit(elements, enumByValue);
|
||||||
for (IBodyElement element : elements) {
|
String regex = "^[0-9]*$";
|
||||||
|
String preName = "";
|
||||||
|
int preNameNum = 0;
|
||||||
|
// for (IBodyElement element : elements) {
|
||||||
|
for (int g=0; g< elements.size(); g++) {
|
||||||
|
IBodyElement element = elements.get(g);
|
||||||
// 段落
|
// 段落
|
||||||
if (element instanceof XWPFParagraph) {
|
if (element instanceof XWPFParagraph) {
|
||||||
XWPFParagraph p = (XWPFParagraph) element;
|
XWPFParagraph p = (XWPFParagraph) element;
|
||||||
|
|
||||||
// 处理段落生成编号不识别问题
|
// 处理段落生成编号不识别问题
|
||||||
String paragraphString = p.getText();
|
String paragraphString = p.getText();
|
||||||
if ("前言".equals(getChinese(paragraphString))) {
|
|
||||||
count++;
|
|
||||||
if (count > 1) {
|
|
||||||
startFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
if(!startFlag) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotBlank(paragraphString)) {
|
if (StringUtils.isNotBlank(paragraphString)) {
|
||||||
paragraphString = paragraphString.replace((char) 12288, ' ');
|
paragraphString = paragraphString.replace((char) 12288, ' ');
|
||||||
paragraphString = paragraphString.trim();
|
paragraphString = paragraphString.trim();
|
||||||
@@ -192,6 +185,15 @@ public class FileSpiltService {
|
|||||||
paragraphString = paragraphString.replaceAll("\r\n","");
|
paragraphString = paragraphString.replaceAll("\r\n","");
|
||||||
paragraphString = paragraphString.replaceAll("\n","");
|
paragraphString = paragraphString.replaceAll("\n","");
|
||||||
paragraphString = paragraphString.trim();
|
paragraphString = paragraphString.trim();
|
||||||
|
|
||||||
|
if ("前言".equals(getChinese(paragraphString)) && (paragraphString.replaceAll("\t", "")
|
||||||
|
.replaceAll("\b", "").replaceAll(" ", "").length() == 2)) { // 前言后面有文本,判定为是目录中的前言
|
||||||
|
firstFlag = false;
|
||||||
|
}
|
||||||
|
if(firstFlag) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(StringUtils.isEmpty(paragraphString)){
|
if(StringUtils.isEmpty(paragraphString)){
|
||||||
// 处理当前段落仅为图片的情况
|
// 处理当前段落仅为图片的情况
|
||||||
List<String> imageBundleList = readImageInParagraph((XWPFParagraph) p);
|
List<String> imageBundleList = readImageInParagraph((XWPFParagraph) p);
|
||||||
@@ -239,13 +241,16 @@ public class FileSpiltService {
|
|||||||
if (sarFileSplitInfoEO.getStartNumber() <= 1 && sarFileSplitInfoEO.getStopNumber() >= 1) {
|
if (sarFileSplitInfoEO.getStartNumber() <= 1 && sarFileSplitInfoEO.getStopNumber() >= 1) {
|
||||||
messageList.add(message);
|
messageList.add(message);
|
||||||
treeList.add(documentTreeEO1);
|
treeList.add(documentTreeEO1);
|
||||||
|
preName = getOneStartDigit(paragraphString, enumByValue);;
|
||||||
|
preNameNum = g;
|
||||||
menuCanAdd = true;
|
menuCanAdd = true;
|
||||||
} else {
|
} else {
|
||||||
menuCanAdd = false;
|
menuCanAdd = false;
|
||||||
}
|
}
|
||||||
messageNumber++;
|
messageNumber++;
|
||||||
}
|
}
|
||||||
} else if (messageNumber == 1) {
|
}
|
||||||
|
/*else if (messageNumber == 1) {
|
||||||
ptest = Pattern.compile("^2\\s{0,50}规范性引用文件");
|
ptest = Pattern.compile("^2\\s{0,50}规范性引用文件");
|
||||||
matcher = ptest.matcher(paragraphString);
|
matcher = ptest.matcher(paragraphString);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
@@ -312,11 +317,21 @@ public class FileSpiltService {
|
|||||||
addItermsConditionsText(messageList.get(messageList.size() - 1), itemValList, p.getText());
|
addItermsConditionsText(messageList.get(messageList.size() - 1), itemValList, p.getText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (messageNumber >= 3) {
|
} */
|
||||||
|
else if (messageNumber >= 1) {
|
||||||
ptest = Pattern.compile("^[\\d.]*$");
|
ptest = Pattern.compile("^[\\d.]*$");
|
||||||
boolean hasGoIf = false;
|
boolean hasGoIf = false;
|
||||||
|
String startDigit = getOneStartDigit(paragraphString, enumByValue);
|
||||||
for (int i = 0; i < nowStart.size(); i++) {
|
for (int i = 0; i < nowStart.size(); i++) {
|
||||||
if (paragraphString.startsWith(nowStart.get(i))) {
|
// if (paragraphString.startsWith(nowStart.get(i))) {
|
||||||
|
if (startDigit.equals(nowStart.get(i))) {
|
||||||
|
// 判断真的是标题还是干扰项 TODO
|
||||||
|
if (nowStart.get(i).matches(regex)) {
|
||||||
|
boolean result = fileSplitPdfService.judge(preName, preNameNum, startDigit, g, startDigitList, ".");
|
||||||
|
if (result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
// 判断名称,如果大于10位,取十位,
|
// 判断名称,如果大于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 = 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());
|
||||||
List<String> clauseContent = new ArrayList<>();
|
List<String> clauseContent = new ArrayList<>();
|
||||||
@@ -330,6 +345,8 @@ public class FileSpiltService {
|
|||||||
// 增加一条数据,需要在数结构中加一条数据
|
// 增加一条数据,需要在数结构中加一条数据
|
||||||
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList(nowStart.get(i), treeList, generalCatalogueId, sarFileSplitInfoEO, treeListDisplay++, itemName, enumByValue);
|
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList(nowStart.get(i), treeList, generalCatalogueId, sarFileSplitInfoEO, treeListDisplay++, itemName, enumByValue);
|
||||||
treeList.add(sarFileSplitMenuEO);
|
treeList.add(sarFileSplitMenuEO);
|
||||||
|
preName = startDigit;
|
||||||
|
preNameNum = g;
|
||||||
message.setMenuId(sarFileSplitMenuEO.getId());
|
message.setMenuId(sarFileSplitMenuEO.getId());
|
||||||
if(!StringUtils.isEmpty(itemName)){
|
if(!StringUtils.isEmpty(itemName)){
|
||||||
addItermsConditionsText(message, itemValList, paragraphString.substring(nowStart.get(i).length()));
|
addItermsConditionsText(message, itemValList, paragraphString.substring(nowStart.get(i).length()));
|
||||||
@@ -416,18 +433,16 @@ public class FileSpiltService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int fileGSO(SarFileSplitInfoEO sarFileSplitInfoEO, SplitFileTypeTypeEnum enumByValue) {
|
public int fileGSO(SarFileSplitInfoEO sarFileSplitInfoEO, SplitFileTypeTypeEnum enumByValue) {
|
||||||
// 拆分文件主表中插入数据
|
|
||||||
if (sarFileSplitInfoEO.getStopNumber() <= 0) {
|
if (sarFileSplitInfoEO.getStopNumber() <= 0) {
|
||||||
sarFileSplitInfoEO.setStopNumber(200);
|
sarFileSplitInfoEO.setStopNumber(200);
|
||||||
}
|
}
|
||||||
if (sarFileSplitInfoEO.getStartNumber() <= 0) {
|
if (sarFileSplitInfoEO.getStartNumber() <= 0) {
|
||||||
sarFileSplitInfoEO.setStartNumber(1);
|
sarFileSplitInfoEO.setStartNumber(1);
|
||||||
}
|
}
|
||||||
// dao.insertSelective(sarFileSplitInfoEO);
|
|
||||||
|
|
||||||
// 拆分文件条款表中最终插入数据
|
// 拆分文件条款表中最终插入数据
|
||||||
List<SarFileSplitItemsEO> messageList = new ArrayList<>();
|
List<SarFileSplitItemsEO> messageList = new ArrayList<>();
|
||||||
// int messageNumber = 0;
|
int messageNumber = 0;
|
||||||
// 拆分文件目录表中最终插入数据
|
// 拆分文件目录表中最终插入数据
|
||||||
List<SarFileSplitMenuEO> treeList = new ArrayList<>();
|
List<SarFileSplitMenuEO> treeList = new ArrayList<>();
|
||||||
// 拆分文件条款详情表中最终插入数据
|
// 拆分文件条款详情表中最终插入数据
|
||||||
@@ -447,8 +462,10 @@ public class FileSpiltService {
|
|||||||
|
|
||||||
List<String> nowStart = new ArrayList<>();
|
List<String> nowStart = new ArrayList<>();
|
||||||
nowStart.add("1");
|
nowStart.add("1");
|
||||||
try {
|
// if (sarFileSplitInfoEO.getStartNumber()<4){
|
||||||
|
// } else {
|
||||||
|
// nowStart.add(String.valueOf(sarFileSplitInfoEO.getStartNumber()));
|
||||||
|
// }
|
||||||
//获取文件地址
|
//获取文件地址
|
||||||
String connectId = sarFileSplitInfoEO.getConnectId();
|
String connectId = sarFileSplitInfoEO.getConnectId();
|
||||||
String fileName = sarFileSplitInfoEO.getFileName();
|
String fileName = sarFileSplitInfoEO.getFileName();
|
||||||
@@ -465,74 +482,67 @@ public class FileSpiltService {
|
|||||||
}
|
}
|
||||||
OSSFile ossFile = ossFileList.get(0);
|
OSSFile ossFile = ossFileList.get(0);
|
||||||
String readFilePath = ossFile.getUrl();
|
String readFilePath = ossFile.getUrl();
|
||||||
|
|
||||||
if (StringUtils.isEmpty(readFilePath) || !CosBootUtil.doesObjectExist(readFilePath)) {
|
if (StringUtils.isEmpty(readFilePath) || !CosBootUtil.doesObjectExist(readFilePath)) {
|
||||||
throw new JeroBootException("当前文件未找到,请重新选择!");
|
throw new JeroBootException("当前文件未找到,请重新选择!");
|
||||||
}
|
}
|
||||||
|
try (InputStream is = CosBootUtil.download(readFilePath);) {
|
||||||
|
|
||||||
//修改为读取PDF
|
|
||||||
// InputStream is = new FileInputStream(readFilePath); //需要将文件路更改为word文档所在路径。
|
// InputStream is = new FileInputStream(readFilePath); //需要将文件路更改为word文档所在路径。
|
||||||
// XWPFDocument doc = new XWPFDocument(is);
|
XWPFDocument doc = new XWPFDocument(is);
|
||||||
// GSO因为word内容格式读取有问题,对GSO文件进行特殊处理,必须使用PDF文件
|
|
||||||
if (!(readFilePath.endsWith(".pdf") || readFilePath.endsWith(".PDF"))) {
|
|
||||||
throw new JeroBootException("GSO必须选择PDF文件!");
|
|
||||||
}
|
|
||||||
|
|
||||||
String readPdf = ReadPdfUtil.readPdf(readFilePath);
|
Pattern ptest = Pattern.compile("^[\\d.]*$");
|
||||||
if (StringUtils.isEmpty(readPdf)) {
|
|
||||||
throw new JeroBootException("未读取到文件内容,请检查后重试!");
|
|
||||||
}
|
|
||||||
String[] pdfArrays;
|
|
||||||
|
|
||||||
String os = System.getProperty("os.name");
|
|
||||||
//Windows操作系统
|
|
||||||
if (os != null && os.toLowerCase().startsWith("windows")) {
|
|
||||||
pdfArrays = readPdf.split("\r\n");
|
|
||||||
} else if (os != null && os.toLowerCase().startsWith("linux")) {//Linux操作系统
|
|
||||||
pdfArrays = readPdf.split("\n");
|
|
||||||
} else { //其它操作系统
|
|
||||||
pdfArrays = readPdf.split("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pattern ptest ;
|
|
||||||
// Matcher matcher;
|
// Matcher matcher;
|
||||||
|
|
||||||
// 记录拆分后的每一段文字
|
// 记录拆分后的每一段文字
|
||||||
//修改为读取PDF
|
List<IBodyElement> elements = doc.getBodyElements();
|
||||||
// List<IBodyElement> elements = doc.getBodyElements();
|
|
||||||
// 记录word自动生成的编号数据
|
// 记录word自动生成的编号数据
|
||||||
Map numberMap = new HashMap<String, Integer>();
|
Map numberMap = new HashMap<String, Integer>();
|
||||||
boolean menuCanAdd = false; // 判断当前目录下是否可以正常填写数据
|
boolean menuCanAdd = false; // 判断当前目录下是否可以正常填写数据
|
||||||
//修改为读取PDF
|
List<String> startDigitList = getStartDigit(elements, enumByValue);
|
||||||
// for (IBodyElement element : elements) {
|
List<String> newStartDigitList = new ArrayList<>();
|
||||||
//定义初始化数据
|
for (String startDigit : startDigitList) {
|
||||||
|
if(startDigit.endsWith(".")) {
|
||||||
|
startDigit = startDigit.substring(0, startDigit.lastIndexOf("."));
|
||||||
|
}
|
||||||
|
newStartDigitList.add(startDigit);
|
||||||
|
}
|
||||||
|
String regex = "^[0-9]*$";
|
||||||
boolean firstFlag = true;
|
boolean firstFlag = true;
|
||||||
for (String paragraphString : pdfArrays) {
|
String preName = "";
|
||||||
if (paragraphString.contains("SCOPE")) {
|
int preNameNum = 0;
|
||||||
firstFlag = false;
|
// for (IBodyElement element : elements) {
|
||||||
}
|
for (int g=0; g< elements.size(); g++) {
|
||||||
if (firstFlag) {
|
IBodyElement element = elements.get(g);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 段落
|
// 段落
|
||||||
//修改为读取PDF
|
if (element instanceof XWPFParagraph) {
|
||||||
// if (element instanceof XWPFParagraph) {
|
XWPFParagraph p = (XWPFParagraph) element;
|
||||||
// XWPFParagraph p = (XWPFParagraph)element;
|
|
||||||
|
|
||||||
// 处理段落生成编号不识别问题
|
// 处理段落生成编号不识别问题
|
||||||
// String paragraphString = p.getText();
|
String paragraphString = p.getText();
|
||||||
if (StringUtils.isNotBlank(paragraphString)) {
|
if (!StringUtils.isEmpty(paragraphString)) {
|
||||||
paragraphString = paragraphString.replace((char) 12288, ' ');
|
paragraphString = paragraphString.replace((char) 12288, ' ');
|
||||||
paragraphString = paragraphString.trim();
|
|
||||||
}
|
|
||||||
if(StringUtils.isEmpty(paragraphString)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
paragraphString = paragraphString.replaceAll("\r\n","");
|
paragraphString = paragraphString.replaceAll("\r\n","");
|
||||||
paragraphString = paragraphString.replaceAll("\n","");
|
paragraphString = paragraphString.replaceAll("\n","");
|
||||||
paragraphString = paragraphString.trim();
|
paragraphString = paragraphString.trim();
|
||||||
|
}
|
||||||
if(StringUtils.isEmpty(paragraphString)){
|
if(StringUtils.isEmpty(paragraphString)){
|
||||||
|
// 处理当前段落仅为图片的情况
|
||||||
|
List<String> imageBundleList = readImageInParagraph((XWPFParagraph) p);
|
||||||
|
if (CollectionUtils.isNotEmpty(imageBundleList)) {
|
||||||
|
if (messageList.size() > 0) {
|
||||||
|
addItermsConditionsImage(messageList.get(messageList.size() - 1), itemValList, p, imageBundleList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (paragraphString.toLowerCase().contains("scope")) {
|
||||||
|
String pp = paragraphString.replaceAll("\t", "")
|
||||||
|
.replaceAll("\b", "").replaceAll(" ", "");
|
||||||
|
if (!pp.substring(pp.length()-1).matches(regex)) {
|
||||||
|
firstFlag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (firstFlag) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// if (StringUtils.isNotEmpty(p.getNumLevelText())&& p.getNumLevelText().indexOf(".")>0) {
|
// if (StringUtils.isNotEmpty(p.getNumLevelText())&& p.getNumLevelText().indexOf(".")>0) {
|
||||||
@@ -551,28 +561,55 @@ public class FileSpiltService {
|
|||||||
// paragraphString = numberParent+".1"+ p.getText();
|
// paragraphString = numberParent+".1"+ p.getText();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
//^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$
|
||||||
// ptest = Pattern.compile("^[\\d.]*$");
|
ptest = Pattern.compile("^[\\d.]*$");
|
||||||
|
//定义查看是否有编号,没有编号则按照上一个编号放置数据
|
||||||
boolean hasGoIf = false;
|
boolean hasGoIf = false;
|
||||||
|
String startDigit = getOneStartDigit(paragraphString, enumByValue);
|
||||||
for (int i = 0; i < nowStart.size(); i++) {
|
for (int i = 0; i < nowStart.size(); i++) {
|
||||||
if (paragraphString.startsWith(nowStart.get(i))) {
|
// if (paragraphString.startsWith(nowStart.get(i))) {
|
||||||
|
if (startDigit.equals(nowStart.get(i)) || startDigit.equals(nowStart.get(i)+ ".") || startDigit.equals(nowStart.get(i)+ "-") ) {
|
||||||
|
// 判断一级 真的是标题还是干扰项 TODO
|
||||||
|
if (startDigit.matches("^[0-9]*.$") || startDigit.matches("^[0-9]*-$")) {
|
||||||
|
if(startDigit.endsWith(".")) {
|
||||||
|
boolean result = fileSplitPdfService.judge(preName, preNameNum, startDigit.substring(0, startDigit.lastIndexOf(".")), g, newStartDigitList, ".");
|
||||||
|
if (result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else if(startDigit.endsWith("-")) {
|
||||||
|
boolean result = fileSplitPdfService.judge(preName, preNameNum, startDigit.substring(0, startDigit.lastIndexOf("-")), g, newStartDigitList, ".");
|
||||||
|
if (result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
boolean result = fileSplitPdfService.judge(preName, preNameNum, startDigit, g, newStartDigitList, ".");
|
||||||
|
if (result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 判断名称,如果大于10位,取十位,
|
// 判断名称,如果大于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 = 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));
|
String itemName = FileSplitUtils.getItemName(paragraphString, startDigit);
|
||||||
List<String> clauseContent = new ArrayList<>();
|
List<String> clauseContent = new ArrayList<>();
|
||||||
clauseContent.add(paragraphString);
|
clauseContent.add(paragraphString);
|
||||||
SarFileSplitItemsEO message = getSarFileSplitItemsEO(sarFileSplitInfoEO.getId(), nowStart.get(i), itemName, clauseContent);
|
SarFileSplitItemsEO message = getSarFileSplitItemsEO(sarFileSplitInfoEO.getId(), startDigit, itemName, clauseContent);
|
||||||
|
|
||||||
String[] numberStr = nowStart.get(i).split("\\.");
|
String[] numberStr = nowStart.get(i).split("\\.");
|
||||||
|
// String numberStrTemp = numberStr[0].replace("S", "");
|
||||||
|
|
||||||
if (Integer.valueOf(numberStr[0]) > sarFileSplitInfoEO.getStopNumber()) {
|
if (Integer.valueOf(numberStr[0]) > sarFileSplitInfoEO.getStopNumber()) {
|
||||||
menuCanAdd = false;
|
menuCanAdd = false;
|
||||||
} else {
|
} else {
|
||||||
// 增加一条数据,需要在数结构中加一条数据
|
// 增加一条数据,需要在数结构中加一条数据
|
||||||
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList(nowStart.get(i), treeList, generalCatalogueId, sarFileSplitInfoEO, treeListDisplay++, itemName, enumByValue);
|
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList(nowStart.get(i), treeList, generalCatalogueId, sarFileSplitInfoEO, treeListDisplay++, itemName, enumByValue);
|
||||||
treeList.add(sarFileSplitMenuEO);
|
treeList.add(sarFileSplitMenuEO);
|
||||||
|
preName = nowStart.get(i);
|
||||||
|
preNameNum = g;
|
||||||
message.setMenuId(sarFileSplitMenuEO.getId());
|
message.setMenuId(sarFileSplitMenuEO.getId());
|
||||||
|
// addItermsConditionsText(message, itemValList, paragraphString.substring(nowStart.get(i).length()));
|
||||||
if(!StringUtils.isEmpty(itemName)){
|
if(!StringUtils.isEmpty(itemName)){
|
||||||
addItermsConditionsText(message, itemValList, paragraphString.substring(nowStart.get(i).length()));
|
addItermsConditionsText(message, itemValList, paragraphString.substring(startDigit.length()));
|
||||||
}
|
}
|
||||||
messageList.add(message);
|
messageList.add(message);
|
||||||
nowStart = getNewNowStart(nowStart.get(i));
|
nowStart = getNewNowStart(nowStart.get(i));
|
||||||
@@ -582,35 +619,55 @@ public class FileSpiltService {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (!hasGoIf && menuCanAdd) {
|
||||||
|
if ("annex1".equals(paragraphString.toLowerCase().replaceAll("\t", "")
|
||||||
|
.replaceAll("\b", "").replaceAll(" ", ""))
|
||||||
|
&& !messageList.get(messageList.size() - 1).getItemsNum().equals("annex")) {
|
||||||
|
|
||||||
|
String appendixNum = messageList.get(messageList.size() - 1).getItemsNum().split("\\.")[0];
|
||||||
|
if (Integer.valueOf(appendixNum) + 1 <= sarFileSplitInfoEO.getStopNumber()) {
|
||||||
|
String itemName = "annex";
|
||||||
|
List<String> clauseContent = new ArrayList<>();
|
||||||
|
clauseContent.add(paragraphString);
|
||||||
|
SarFileSplitItemsEO message = getSarFileSplitItemsEO(sarFileSplitInfoEO.getId(), "annex", itemName, clauseContent);
|
||||||
|
// 增加一条数据,需要在数结构中加一条数据
|
||||||
|
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList("annex", treeList, generalCatalogueId, sarFileSplitInfoEO, treeListDisplay++, "", enumByValue);
|
||||||
|
addItermsConditionsText(message, itemValList, paragraphString);
|
||||||
|
treeList.add(sarFileSplitMenuEO);
|
||||||
|
message.setMenuId(sarFileSplitMenuEO.getId());
|
||||||
|
messageList.add(message);
|
||||||
|
nowStart = new ArrayList<>();
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasGoIf && menuCanAdd) {
|
} else {
|
||||||
if (!paragraphString.equals("")) {
|
if (!p.getText().equals("")) {
|
||||||
addItermsConditionsText(messageList.get(messageList.size() - 1), itemValList, paragraphString);
|
addItermsConditionsText(messageList.get(messageList.size() - 1), itemValList, p.getText());
|
||||||
|
}
|
||||||
|
List<String> imageBundleList = readImageInParagraph((XWPFParagraph) p);
|
||||||
|
if (CollectionUtils.isNotEmpty(imageBundleList)) {
|
||||||
|
addItermsConditionsImage(messageList.get(messageList.size() - 1), itemValList, p, imageBundleList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// List<String> imageBundleList = readImageInParagraph((XWPFParagraph)p);
|
|
||||||
// if(CollectionUtils.isNotEmpty(imageBundleList)) {
|
|
||||||
// addItermsConditionsImage(messageList.get(messageList.size()-1),itemValList, p,imageBundleList);
|
|
||||||
// }
|
|
||||||
// }
|
// }
|
||||||
hasGoIf = true;
|
hasGoIf = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否直接跳出所有循环
|
// 判断是否直接跳出所有循环
|
||||||
if (!menuCanAdd && messageList.size() > 0) {
|
if (!menuCanAdd && messageList.size() > 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改为读取PDF
|
} else if (element instanceof XWPFTable) {
|
||||||
// } else if (element instanceof XWPFTable){
|
if (messageList != null && !messageList.isEmpty()) {
|
||||||
// if(messageList != null && !messageList.isEmpty()){
|
addItermsConditionsOfTable(messageList.get(messageList.size() - 1), itemValList, (XWPFTable) element);
|
||||||
// addItermsConditionsOfTable(messageList.get(messageList.size()-1),itemValList,(XWPFTable)element);
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (JeroBootException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
throw new JeroBootException(e.getMessage());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return -1;
|
return -1;
|
||||||
@@ -699,7 +756,22 @@ public class FileSpiltService {
|
|||||||
// 记录word自动生成的编号数据
|
// 记录word自动生成的编号数据
|
||||||
Map numberMap = new HashMap<String, Integer>();
|
Map numberMap = new HashMap<String, Integer>();
|
||||||
boolean menuCanAdd = false; // 判断当前目录下是否可以正常填写数据
|
boolean menuCanAdd = false; // 判断当前目录下是否可以正常填写数据
|
||||||
for (IBodyElement element : elements) {
|
List<String> startDigitList = getStartDigit(elements, enumByValue);
|
||||||
|
List<String> newStartDigitList = new ArrayList<>();
|
||||||
|
for (String startDigit : startDigitList) {
|
||||||
|
if(startDigit.endsWith("S")) {
|
||||||
|
startDigit = startDigit.substring(0, startDigit.lastIndexOf("S"));
|
||||||
|
}
|
||||||
|
if(startDigit.endsWith(".")) {
|
||||||
|
startDigit = startDigit.substring(0, startDigit.lastIndexOf("."));
|
||||||
|
}
|
||||||
|
newStartDigitList.add(startDigit);
|
||||||
|
}
|
||||||
|
String preName = "";
|
||||||
|
int preNameNum = 0;
|
||||||
|
// for (IBodyElement element : elements) {
|
||||||
|
for (int g=0; g< elements.size(); g++) {
|
||||||
|
IBodyElement element = elements.get(g);
|
||||||
// 段落
|
// 段落
|
||||||
if (element instanceof XWPFParagraph) {
|
if (element instanceof XWPFParagraph) {
|
||||||
XWPFParagraph p = (XWPFParagraph) element;
|
XWPFParagraph p = (XWPFParagraph) element;
|
||||||
@@ -752,14 +824,33 @@ public class FileSpiltService {
|
|||||||
//^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$
|
//^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$
|
||||||
ptest = Pattern.compile("S^[\\d.]*$");
|
ptest = Pattern.compile("S^[\\d.]*$");
|
||||||
boolean hasGoIf = false;
|
boolean hasGoIf = false;
|
||||||
|
String startDigit = getOneStartDigit(paragraphString,enumByValue);
|
||||||
|
if(startDigit.endsWith("S")) {
|
||||||
|
startDigit = startDigit.substring(0, startDigit.lastIndexOf("S"));
|
||||||
|
}
|
||||||
for (int i = 0; i < nowStart.size(); i++) {
|
for (int i = 0; i < nowStart.size(); i++) {
|
||||||
if (paragraphString.startsWith(nowStart.get(i))) {
|
// if (paragraphString.startsWith(nowStart.get(i))) {
|
||||||
|
if (startDigit.equals(nowStart.get(i)) || startDigit.equals(nowStart.get(i)+ ".") ) {
|
||||||
|
// 判断一级 真的是标题还是干扰项 TODO
|
||||||
|
if (startDigit.matches("^[0-9]*.$")) {
|
||||||
|
if(startDigit.endsWith(".")) {
|
||||||
|
boolean result = fileSplitPdfService.judge(preName, preNameNum, startDigit.substring(0, startDigit.lastIndexOf(".")), g, newStartDigitList, ".");
|
||||||
|
if (result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
boolean result = fileSplitPdfService.judge(preName, preNameNum, startDigit, g, newStartDigitList, ".");
|
||||||
|
if (result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 判断名称,如果大于10位,取十位,
|
// 判断名称,如果大于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 = 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));
|
String itemName = FileSplitUtils.getItemName(paragraphString, startDigit);
|
||||||
List<String> clauseContent = new ArrayList<>();
|
List<String> clauseContent = new ArrayList<>();
|
||||||
clauseContent.add(paragraphString);
|
clauseContent.add(paragraphString);
|
||||||
SarFileSplitItemsEO message = getSarFileSplitItemsEO(sarFileSplitInfoEO.getId(), nowStart.get(i), itemName, clauseContent);
|
SarFileSplitItemsEO message = getSarFileSplitItemsEO(sarFileSplitInfoEO.getId(), startDigit, itemName, clauseContent);
|
||||||
|
|
||||||
String[] numberStr = nowStart.get(i).split("\\.");
|
String[] numberStr = nowStart.get(i).split("\\.");
|
||||||
String numberStrTemp = numberStr[0].replace("S", "");
|
String numberStrTemp = numberStr[0].replace("S", "");
|
||||||
@@ -770,6 +861,8 @@ public class FileSpiltService {
|
|||||||
// 增加一条数据,需要在数结构中加一条数据
|
// 增加一条数据,需要在数结构中加一条数据
|
||||||
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList(nowStart.get(i), treeList, generalCatalogueId, sarFileSplitInfoEO, treeListDisplay++, itemName, enumByValue);
|
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList(nowStart.get(i), treeList, generalCatalogueId, sarFileSplitInfoEO, treeListDisplay++, itemName, enumByValue);
|
||||||
treeList.add(sarFileSplitMenuEO);
|
treeList.add(sarFileSplitMenuEO);
|
||||||
|
preName = nowStart.get(i);
|
||||||
|
preNameNum = g;
|
||||||
message.setMenuId(sarFileSplitMenuEO.getId());
|
message.setMenuId(sarFileSplitMenuEO.getId());
|
||||||
if(!StringUtils.isEmpty(itemName)){
|
if(!StringUtils.isEmpty(itemName)){
|
||||||
addItermsConditionsText(message, itemValList, paragraphString.substring(nowStart.get(i).length()));
|
addItermsConditionsText(message, itemValList, paragraphString.substring(nowStart.get(i).length()));
|
||||||
@@ -1262,7 +1355,7 @@ public class FileSpiltService {
|
|||||||
treeList.add(documentTreeEO);
|
treeList.add(documentTreeEO);
|
||||||
|
|
||||||
List<String> nowStart = new ArrayList<>();
|
List<String> nowStart = new ArrayList<>();
|
||||||
nowStart.add("1.");
|
nowStart.add("1");
|
||||||
// if (sarFileSplitInfoEO.getStartNumber()<4){
|
// if (sarFileSplitInfoEO.getStartNumber()<4){
|
||||||
// } else {
|
// } else {
|
||||||
// nowStart.add(String.valueOf(sarFileSplitInfoEO.getStartNumber()));
|
// nowStart.add(String.valueOf(sarFileSplitInfoEO.getStartNumber()));
|
||||||
@@ -1299,7 +1392,21 @@ public class FileSpiltService {
|
|||||||
// 记录word自动生成的编号数据
|
// 记录word自动生成的编号数据
|
||||||
Map numberMap = new HashMap<String, Integer>();
|
Map numberMap = new HashMap<String, Integer>();
|
||||||
boolean menuCanAdd = false; // 判断当前目录下是否可以正常填写数据
|
boolean menuCanAdd = false; // 判断当前目录下是否可以正常填写数据
|
||||||
for (IBodyElement element : elements) {
|
List<String> startDigitList = getStartDigit(elements, enumByValue);
|
||||||
|
List<String> newStartDigitList = new ArrayList<>();
|
||||||
|
for (String startDigit : startDigitList) {
|
||||||
|
if(startDigit.endsWith(".")) {
|
||||||
|
startDigit = startDigit.substring(0, startDigit.lastIndexOf("."));
|
||||||
|
}
|
||||||
|
newStartDigitList.add(startDigit);
|
||||||
|
}
|
||||||
|
String regex = "^[0-9]*$";
|
||||||
|
boolean firstFlag = true;
|
||||||
|
String preName = "";
|
||||||
|
int preNameNum = 0;
|
||||||
|
// for (IBodyElement element : elements) {
|
||||||
|
for (int g=0; g< elements.size(); g++) {
|
||||||
|
IBodyElement element = elements.get(g);
|
||||||
// 段落
|
// 段落
|
||||||
if (element instanceof XWPFParagraph) {
|
if (element instanceof XWPFParagraph) {
|
||||||
XWPFParagraph p = (XWPFParagraph) element;
|
XWPFParagraph p = (XWPFParagraph) element;
|
||||||
@@ -1312,6 +1419,26 @@ public class FileSpiltService {
|
|||||||
paragraphString = paragraphString.replaceAll("\n","");
|
paragraphString = paragraphString.replaceAll("\n","");
|
||||||
paragraphString = paragraphString.trim();
|
paragraphString = paragraphString.trim();
|
||||||
}
|
}
|
||||||
|
if(StringUtils.isEmpty(paragraphString)){
|
||||||
|
// 处理当前段落仅为图片的情况
|
||||||
|
List<String> imageBundleList = readImageInParagraph((XWPFParagraph) p);
|
||||||
|
if (CollectionUtils.isNotEmpty(imageBundleList)) {
|
||||||
|
if (messageList.size() > 0) {
|
||||||
|
addItermsConditionsImage(messageList.get(messageList.size() - 1), itemValList, p, imageBundleList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (paragraphString.toLowerCase().contains("scope")) {
|
||||||
|
String pp = paragraphString.replaceAll("\t", "")
|
||||||
|
.replaceAll("\b", "").replaceAll(" ", "");
|
||||||
|
if (!pp.substring(pp.length()-1).matches(regex)) {
|
||||||
|
firstFlag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (firstFlag) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// if (StringUtils.isNotEmpty(p.getNumLevelText())&& p.getNumLevelText().indexOf(".")>0) {
|
// if (StringUtils.isNotEmpty(p.getNumLevelText())&& p.getNumLevelText().indexOf(".")>0) {
|
||||||
// String numberParent = p.getNumLevelText().substring(0,p.getNumLevelText().lastIndexOf("."));
|
// String numberParent = p.getNumLevelText().substring(0,p.getNumLevelText().lastIndexOf("."));
|
||||||
// if (numberMap.containsKey(numberParent)){
|
// if (numberMap.containsKey(numberParent)){
|
||||||
@@ -1332,14 +1459,35 @@ public class FileSpiltService {
|
|||||||
ptest = Pattern.compile("^[\\d.]*$");
|
ptest = Pattern.compile("^[\\d.]*$");
|
||||||
//定义查看是否有编号,没有编号则按照上一个编号放置数据
|
//定义查看是否有编号,没有编号则按照上一个编号放置数据
|
||||||
boolean hasGoIf = false;
|
boolean hasGoIf = false;
|
||||||
|
String startDigit = getOneStartDigit(paragraphString, enumByValue);
|
||||||
for (int i = 0; i < nowStart.size(); i++) {
|
for (int i = 0; i < nowStart.size(); i++) {
|
||||||
if (paragraphString.startsWith(nowStart.get(i))) {
|
// if (paragraphString.startsWith(nowStart.get(i))) {
|
||||||
|
if (startDigit.equals(nowStart.get(i)) || startDigit.equals(nowStart.get(i)+ ".") || startDigit.equals(nowStart.get(i)+ "-") ) {
|
||||||
|
// 判断一级 真的是标题还是干扰项 TODO
|
||||||
|
if (startDigit.matches("^[0-9]*.$") || startDigit.matches("^[0-9]*-$")) {
|
||||||
|
if(startDigit.endsWith(".")) {
|
||||||
|
boolean result = fileSplitPdfService.judge(preName, preNameNum, startDigit.substring(0, startDigit.lastIndexOf(".")), g, newStartDigitList, ".");
|
||||||
|
if (result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else if(startDigit.endsWith("-")) {
|
||||||
|
boolean result = fileSplitPdfService.judge(preName, preNameNum, startDigit.substring(0, startDigit.lastIndexOf("-")), g, newStartDigitList, ".");
|
||||||
|
if (result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
boolean result = fileSplitPdfService.judge(preName, preNameNum, startDigit, g, newStartDigitList, ".");
|
||||||
|
if (result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 判断名称,如果大于10位,取十位,
|
// 判断名称,如果大于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 = 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));
|
String itemName = FileSplitUtils.getItemName(paragraphString, startDigit);
|
||||||
List<String> clauseContent = new ArrayList<>();
|
List<String> clauseContent = new ArrayList<>();
|
||||||
clauseContent.add(paragraphString);
|
clauseContent.add(paragraphString);
|
||||||
SarFileSplitItemsEO message = getSarFileSplitItemsEO(sarFileSplitInfoEO.getId(), nowStart.get(i), itemName, clauseContent);
|
SarFileSplitItemsEO message = getSarFileSplitItemsEO(sarFileSplitInfoEO.getId(), startDigit, itemName, clauseContent);
|
||||||
|
|
||||||
String[] numberStr = nowStart.get(i).split("\\.");
|
String[] numberStr = nowStart.get(i).split("\\.");
|
||||||
// String numberStrTemp = numberStr[0].replace("S", "");
|
// String numberStrTemp = numberStr[0].replace("S", "");
|
||||||
@@ -1350,13 +1498,15 @@ public class FileSpiltService {
|
|||||||
// 增加一条数据,需要在数结构中加一条数据
|
// 增加一条数据,需要在数结构中加一条数据
|
||||||
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList(nowStart.get(i), treeList, generalCatalogueId, sarFileSplitInfoEO, treeListDisplay++, itemName, enumByValue);
|
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList(nowStart.get(i), treeList, generalCatalogueId, sarFileSplitInfoEO, treeListDisplay++, itemName, enumByValue);
|
||||||
treeList.add(sarFileSplitMenuEO);
|
treeList.add(sarFileSplitMenuEO);
|
||||||
|
preName = nowStart.get(i);
|
||||||
|
preNameNum = g;
|
||||||
message.setMenuId(sarFileSplitMenuEO.getId());
|
message.setMenuId(sarFileSplitMenuEO.getId());
|
||||||
// addItermsConditionsText(message, itemValList, paragraphString.substring(nowStart.get(i).length()));
|
// addItermsConditionsText(message, itemValList, paragraphString.substring(nowStart.get(i).length()));
|
||||||
if(!StringUtils.isEmpty(itemName)){
|
if(!StringUtils.isEmpty(itemName)){
|
||||||
addItermsConditionsText(message, itemValList, paragraphString.substring(nowStart.get(i).length()));
|
addItermsConditionsText(message, itemValList, paragraphString.substring(startDigit.length()));
|
||||||
}
|
}
|
||||||
messageList.add(message);
|
messageList.add(message);
|
||||||
nowStart = getNewNowStartEU(nowStart.get(i));
|
nowStart = getNewNowStart(nowStart.get(i));
|
||||||
menuCanAdd = true;
|
menuCanAdd = true;
|
||||||
}
|
}
|
||||||
hasGoIf = true;
|
hasGoIf = true;
|
||||||
@@ -1366,6 +1516,30 @@ public class FileSpiltService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (!hasGoIf && menuCanAdd) {
|
if (!hasGoIf && menuCanAdd) {
|
||||||
|
if (("annex1".equals(paragraphString.toLowerCase().replaceAll("\t", "")
|
||||||
|
.replaceAll("\b", "").replaceAll(" ", ""))
|
||||||
|
|| "annex1a".equals(paragraphString.toLowerCase().replaceAll("\t", "")
|
||||||
|
.replaceAll("\b", "").replaceAll(" ", "")))
|
||||||
|
&& !messageList.get(messageList.size() - 1).getItemsNum().equals("annex")) {
|
||||||
|
|
||||||
|
String appendixNum = messageList.get(messageList.size() - 1).getItemsNum().split("\\.")[0];
|
||||||
|
if (Integer.valueOf(appendixNum) + 1 <= sarFileSplitInfoEO.getStopNumber()) {
|
||||||
|
String itemName = "annex";
|
||||||
|
List<String> clauseContent = new ArrayList<>();
|
||||||
|
clauseContent.add(paragraphString);
|
||||||
|
SarFileSplitItemsEO message = getSarFileSplitItemsEO(sarFileSplitInfoEO.getId(), "annex", itemName, clauseContent);
|
||||||
|
// 增加一条数据,需要在数结构中加一条数据
|
||||||
|
SarFileSplitMenuEO sarFileSplitMenuEO = getTreeList("annex", treeList, generalCatalogueId, sarFileSplitInfoEO, treeListDisplay++, "", enumByValue);
|
||||||
|
addItermsConditionsText(message, itemValList, paragraphString);
|
||||||
|
treeList.add(sarFileSplitMenuEO);
|
||||||
|
message.setMenuId(sarFileSplitMenuEO.getId());
|
||||||
|
messageList.add(message);
|
||||||
|
nowStart = new ArrayList<>();
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
if (!p.getText().equals("")) {
|
if (!p.getText().equals("")) {
|
||||||
addItermsConditionsText(messageList.get(messageList.size() - 1), itemValList, p.getText());
|
addItermsConditionsText(messageList.get(messageList.size() - 1), itemValList, p.getText());
|
||||||
}
|
}
|
||||||
@@ -1373,6 +1547,7 @@ public class FileSpiltService {
|
|||||||
if (CollectionUtils.isNotEmpty(imageBundleList)) {
|
if (CollectionUtils.isNotEmpty(imageBundleList)) {
|
||||||
addItermsConditionsImage(messageList.get(messageList.size() - 1), itemValList, p, imageBundleList);
|
addItermsConditionsImage(messageList.get(messageList.size() - 1), itemValList, p, imageBundleList);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// }
|
// }
|
||||||
hasGoIf = true;
|
hasGoIf = true;
|
||||||
}
|
}
|
||||||
@@ -1840,7 +2015,7 @@ public class FileSpiltService {
|
|||||||
* @param nowStart
|
* @param nowStart
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static List<String> getNewNowStartEU(String nowStart) {
|
public static List<String> getNewNowStartEU(String nowStart) {
|
||||||
// List<String> nowStartList = new ArrayList<>();
|
// List<String> nowStartList = new ArrayList<>();
|
||||||
List<String> nowResultStartList = new ArrayList<>();
|
List<String> nowResultStartList = new ArrayList<>();
|
||||||
String[] numberStr = nowStart.split("\\.");
|
String[] numberStr = nowStart.split("\\.");
|
||||||
@@ -1866,7 +2041,7 @@ public class FileSpiltService {
|
|||||||
* @param nowStart
|
* @param nowStart
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static List<String> getNewNowStartUS(String nowStart) {
|
public static List<String> getNewNowStartUS(String nowStart) {
|
||||||
// List<String> nowStartList = new ArrayList<>();
|
// List<String> nowStartList = new ArrayList<>();
|
||||||
List<String> nowResultStartList = new ArrayList<>();
|
List<String> nowResultStartList = new ArrayList<>();
|
||||||
String[] numberStr = nowStart.replace("S", "").split("\\.");
|
String[] numberStr = nowStart.replace("S", "").split("\\.");
|
||||||
@@ -1893,7 +2068,7 @@ public class FileSpiltService {
|
|||||||
* @param nowStart 当前标题内容
|
* @param nowStart 当前标题内容
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static List<String> getNewNowStartJapanOne(String lastStr, String nowStart) {
|
public static List<String> getNewNowStartJapanOne(String lastStr, String nowStart) {
|
||||||
List<String> nowResultStartList = new ArrayList<>();
|
List<String> nowResultStartList = new ArrayList<>();
|
||||||
if (FileSplitUtils.hasDigit(nowStart) && nowStart.contains(".")) {
|
if (FileSplitUtils.hasDigit(nowStart) && nowStart.contains(".")) {
|
||||||
//包含数字且.
|
//包含数字且.
|
||||||
@@ -1934,7 +2109,7 @@ public class FileSpiltService {
|
|||||||
* @param nowStart 当前标题内容
|
* @param nowStart 当前标题内容
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static List<String> getNewNowStartJapanTwo(StringBuilder lastStr, StringBuilder secondStr, String nowStart) {
|
public static List<String> getNewNowStartJapanTwo(StringBuilder lastStr, StringBuilder secondStr, String nowStart) {
|
||||||
List<String> nowResultStartList = new ArrayList<>();
|
List<String> nowResultStartList = new ArrayList<>();
|
||||||
if (FileSplitUtils.hasDigit(nowStart) && nowStart.contains(".")) {
|
if (FileSplitUtils.hasDigit(nowStart) && nowStart.contains(".")) {
|
||||||
//包含数字且.
|
//包含数字且.
|
||||||
@@ -1980,7 +2155,7 @@ public class FileSpiltService {
|
|||||||
* @param nowStart
|
* @param nowStart
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static List<String> getNewNowStartKmvssArticle(StringBuilder lastStr, String nowStart) {
|
public static List<String> getNewNowStartKmvssArticle(StringBuilder lastStr, String nowStart) {
|
||||||
List<String> nowResultStartList = new ArrayList<>();
|
List<String> nowResultStartList = new ArrayList<>();
|
||||||
if (FileSplitUtils.hasDigit(nowStart) && nowStart.contains(")")) {
|
if (FileSplitUtils.hasDigit(nowStart) && nowStart.contains(")")) {
|
||||||
//包含数字且包含括号
|
//包含数字且包含括号
|
||||||
@@ -2014,7 +2189,7 @@ public class FileSpiltService {
|
|||||||
* @param menuLevel
|
* @param menuLevel
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static List<String> getNewNowStartKmvssTable(String[] catalogerArr, String nowStart, int menuLevel) {
|
public static List<String> getNewNowStartKmvssTable(String[] catalogerArr, String nowStart, int menuLevel) {
|
||||||
/*
|
/*
|
||||||
*1.韩国KmvssTable模板处理
|
*1.韩国KmvssTable模板处理
|
||||||
* 分为五级拆分,拆分为以下内容:
|
* 分为五级拆分,拆分为以下内容:
|
||||||
@@ -2111,7 +2286,7 @@ public class FileSpiltService {
|
|||||||
* @param nowStart
|
* @param nowStart
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static List<String> getNewNowStart(String nowStart) {
|
public static List<String> getNewNowStart(String nowStart) {
|
||||||
// List<String> nowStartList = new ArrayList<>();
|
// List<String> nowStartList = new ArrayList<>();
|
||||||
List<String> nowResultStartList = new ArrayList<>();
|
List<String> nowResultStartList = new ArrayList<>();
|
||||||
String[] numberStr = nowStart.split("\\.");
|
String[] numberStr = nowStart.split("\\.");
|
||||||
@@ -2131,7 +2306,7 @@ public class FileSpiltService {
|
|||||||
return nowResultStartList;
|
return nowResultStartList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SarFileSplitMenuEO getTreeList(String name,
|
public static SarFileSplitMenuEO getTreeList(String name,
|
||||||
List<SarFileSplitMenuEO> treeList,
|
List<SarFileSplitMenuEO> treeList,
|
||||||
String generalCatalogueId,
|
String generalCatalogueId,
|
||||||
SarFileSplitInfoEO sarFileSplitInfoEO,
|
SarFileSplitInfoEO sarFileSplitInfoEO,
|
||||||
@@ -2143,14 +2318,14 @@ public class FileSpiltService {
|
|||||||
|
|
||||||
documentTreeEO.setId(UUIDUtils.randomUUID20());
|
documentTreeEO.setId(UUIDUtils.randomUUID20());
|
||||||
documentTreeEO.setItemName(itemName);
|
documentTreeEO.setItemName(itemName);
|
||||||
documentTreeEO.setPId(generalCatalogueId);
|
documentTreeEO.setPId(generalCatalogueId); // 默认情况
|
||||||
documentTreeEO.setInfoId(sarFileSplitInfoEO.getId());
|
documentTreeEO.setInfoId(sarFileSplitInfoEO.getId());
|
||||||
documentTreeEO.setDisplaySeq(treeListDisplay);
|
documentTreeEO.setDisplaySeq(treeListDisplay);
|
||||||
documentTreeEO.setName(name);
|
documentTreeEO.setName(name);
|
||||||
documentTreeEO.setValidFlag(0);
|
documentTreeEO.setValidFlag(0);
|
||||||
|
|
||||||
// 用现在得name 和之前得name 做比较,确定,parentId
|
// 用现在得name 和之前得name 做比较,确定,parentId
|
||||||
|
// List<String> pIdList = new ArrayList<>();
|
||||||
boolean oneFlag = false;
|
boolean oneFlag = false;
|
||||||
boolean twoFlag = false;
|
boolean twoFlag = false;
|
||||||
boolean threeFlag = false;
|
boolean threeFlag = false;
|
||||||
@@ -2159,11 +2334,13 @@ public class FileSpiltService {
|
|||||||
switch (enumByValue) {
|
switch (enumByValue) {
|
||||||
case GB:
|
case GB:
|
||||||
case GBT:
|
case GBT:
|
||||||
|
case EU:
|
||||||
case US:
|
case US:
|
||||||
case GSO:
|
case GSO:
|
||||||
if (name.indexOf(".") >= 0) {
|
if (name.indexOf(".") >= 0) {
|
||||||
if (name.substring(0, name.lastIndexOf(".")).equals(forDocumentTree.getName())) {
|
if (name.substring(0, name.lastIndexOf(".")).equals(forDocumentTree.getName())) {
|
||||||
documentTreeEO.setPId(forDocumentTree.getId());
|
documentTreeEO.setPId(forDocumentTree.getId());
|
||||||
|
// pIdList.add(forDocumentTree.getId());
|
||||||
break a;
|
break a;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2171,36 +2348,41 @@ public class FileSpiltService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EU:
|
// case EU:
|
||||||
|
// if (name.indexOf(".") >= 0) {
|
||||||
if (name.indexOf(".") >= 0) {
|
// if (name.substring(0, name.lastIndexOf(".") - 1).equals(forDocumentTree.getName())) {
|
||||||
if (name.substring(0, name.lastIndexOf(".") - 1).equals(forDocumentTree.getName())) {
|
// documentTreeEO.setPId(forDocumentTree.getId());
|
||||||
documentTreeEO.setPId(forDocumentTree.getId());
|
//// pIdList.add(forDocumentTree.getId());
|
||||||
break a;
|
// break a;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
documentTreeEO.setPId(generalCatalogueId);
|
// documentTreeEO.setPId(generalCatalogueId);
|
||||||
}
|
//// pIdList.add(generalCatalogueId);
|
||||||
break;
|
// }
|
||||||
|
// break;
|
||||||
case JPN_ATTACHMENT:
|
case JPN_ATTACHMENT:
|
||||||
if (name.contains(".")) {
|
if (name.contains(".")) {
|
||||||
if (name.indexOf(".") >= 0) {
|
if (name.indexOf(".") >= 0) {
|
||||||
if (name.substring(0, name.lastIndexOf(".")).equals(forDocumentTree.getName())) {
|
if (name.substring(0, name.lastIndexOf(".")).equals(forDocumentTree.getName())) {
|
||||||
documentTreeEO.setPId(forDocumentTree.getId());
|
documentTreeEO.setPId(forDocumentTree.getId());
|
||||||
|
// pIdList.add(forDocumentTree.getId());
|
||||||
break a;
|
break a;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
documentTreeEO.setPId(generalCatalogueId);
|
documentTreeEO.setPId(generalCatalogueId);
|
||||||
|
// pIdList.add(generalCatalogueId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (name.indexOf("–") >= 0) {
|
if (name.indexOf("–") >= 0) {
|
||||||
if (name.substring(0, name.lastIndexOf("–")).equals(forDocumentTree.getName())
|
if (name.substring(0, name.lastIndexOf("–")).equals(forDocumentTree.getName())
|
||||||
|| (name.substring(0, name.lastIndexOf("–")) + ".").equals(forDocumentTree.getName())) {
|
|| (name.substring(0, name.lastIndexOf("–")) + ".").equals(forDocumentTree.getName())) {
|
||||||
documentTreeEO.setPId(forDocumentTree.getId());
|
documentTreeEO.setPId(forDocumentTree.getId());
|
||||||
|
// pIdList.add(forDocumentTree.getId());
|
||||||
break a;
|
break a;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
documentTreeEO.setPId(generalCatalogueId);
|
documentTreeEO.setPId(generalCatalogueId);
|
||||||
|
// pIdList.add(generalCatalogueId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2226,6 +2408,7 @@ public class FileSpiltService {
|
|||||||
if (firstNameTemp.equals(forDocumentTree.getName())) {
|
if (firstNameTemp.equals(forDocumentTree.getName())) {
|
||||||
documentTreeEO.setName(nameTemp);
|
documentTreeEO.setName(nameTemp);
|
||||||
documentTreeEO.setPId(forDocumentTree.getId());
|
documentTreeEO.setPId(forDocumentTree.getId());
|
||||||
|
// pIdList.add(forDocumentTree.getId());
|
||||||
break a;
|
break a;
|
||||||
}
|
}
|
||||||
} else if (FileSplitUtils.judgeContainsStr(nameTemp)) {
|
} else if (FileSplitUtils.judgeContainsStr(nameTemp)) {
|
||||||
@@ -2250,12 +2433,14 @@ public class FileSpiltService {
|
|||||||
if (oneFlag && secondTemp.equals(forDocumentTree.getName())) {
|
if (oneFlag && secondTemp.equals(forDocumentTree.getName())) {
|
||||||
documentTreeEO.setName(nameTemp);
|
documentTreeEO.setName(nameTemp);
|
||||||
documentTreeEO.setPId(forDocumentTree.getId());
|
documentTreeEO.setPId(forDocumentTree.getId());
|
||||||
|
// pIdList.add(forDocumentTree.getId());
|
||||||
break a;
|
break a;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
documentTreeEO.setPId(generalCatalogueId);
|
documentTreeEO.setPId(generalCatalogueId);
|
||||||
|
// pIdList.add(generalCatalogueId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KMVSS_ARTICLE:
|
case KMVSS_ARTICLE:
|
||||||
@@ -2279,11 +2464,13 @@ public class FileSpiltService {
|
|||||||
if (firstNameTemp.equals(forDocumentTree.getName())) {
|
if (firstNameTemp.equals(forDocumentTree.getName())) {
|
||||||
documentTreeEO.setName(nameTemp);
|
documentTreeEO.setName(nameTemp);
|
||||||
documentTreeEO.setPId(forDocumentTree.getId());
|
documentTreeEO.setPId(forDocumentTree.getId());
|
||||||
|
// pIdList.add(forDocumentTree.getId());
|
||||||
break a;
|
break a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
documentTreeEO.setPId(generalCatalogueId);
|
documentTreeEO.setPId(generalCatalogueId);
|
||||||
|
// pIdList.add(generalCatalogueId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KMVSS_TABLE:
|
case KMVSS_TABLE:
|
||||||
@@ -2310,6 +2497,7 @@ public class FileSpiltService {
|
|||||||
if (firstNameTemp.equals(forDocumentTree.getName())) {
|
if (firstNameTemp.equals(forDocumentTree.getName())) {
|
||||||
documentTreeEO.setName(nameTemp);
|
documentTreeEO.setName(nameTemp);
|
||||||
documentTreeEO.setPId(forDocumentTree.getId());
|
documentTreeEO.setPId(forDocumentTree.getId());
|
||||||
|
// pIdList.add(forDocumentTree.getId());
|
||||||
break a;
|
break a;
|
||||||
}
|
}
|
||||||
} else if (FileSplitUtils.hasDigit(nameTemp) && nameTemp.contains(")") && (!nameTemp.contains("("))) {
|
} else if (FileSplitUtils.hasDigit(nameTemp) && nameTemp.contains(")") && (!nameTemp.contains("("))) {
|
||||||
@@ -2334,6 +2522,7 @@ public class FileSpiltService {
|
|||||||
if (oneFlag && secondTemp.equals(forDocumentTree.getName())) {
|
if (oneFlag && secondTemp.equals(forDocumentTree.getName())) {
|
||||||
documentTreeEO.setName(nameTemp);
|
documentTreeEO.setName(nameTemp);
|
||||||
documentTreeEO.setPId(forDocumentTree.getId());
|
documentTreeEO.setPId(forDocumentTree.getId());
|
||||||
|
// pIdList.add(forDocumentTree.getId());
|
||||||
break a;
|
break a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2368,6 +2557,7 @@ public class FileSpiltService {
|
|||||||
if (oneFlag && twoFlag && threeTemp.equals(forDocumentTree.getName())) {
|
if (oneFlag && twoFlag && threeTemp.equals(forDocumentTree.getName())) {
|
||||||
documentTreeEO.setName(nameTemp);
|
documentTreeEO.setName(nameTemp);
|
||||||
documentTreeEO.setPId(forDocumentTree.getId());
|
documentTreeEO.setPId(forDocumentTree.getId());
|
||||||
|
// pIdList.add(forDocumentTree.getId());
|
||||||
break a;
|
break a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2411,30 +2601,38 @@ public class FileSpiltService {
|
|||||||
if (oneFlag && twoFlag && threeFlag && fourTemp.equals(forDocumentTree.getName())) {
|
if (oneFlag && twoFlag && threeFlag && fourTemp.equals(forDocumentTree.getName())) {
|
||||||
documentTreeEO.setName(nameTemp);
|
documentTreeEO.setName(nameTemp);
|
||||||
documentTreeEO.setPId(forDocumentTree.getId());
|
documentTreeEO.setPId(forDocumentTree.getId());
|
||||||
|
// pIdList.add(forDocumentTree.getId());
|
||||||
break a;
|
break a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
documentTreeEO.setPId(generalCatalogueId);
|
documentTreeEO.setPId(generalCatalogueId);
|
||||||
|
// pIdList.add(generalCatalogueId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (name.indexOf(".") >= 0) {
|
if (name.indexOf(".") >= 0) {
|
||||||
if (name.substring(0, name.lastIndexOf(".")).equals(forDocumentTree.getName())) {
|
if (name.substring(0, name.lastIndexOf(".")).equals(forDocumentTree.getName())) {
|
||||||
documentTreeEO.setPId(forDocumentTree.getId());
|
documentTreeEO.setPId(forDocumentTree.getId());
|
||||||
|
// pIdList.add(forDocumentTree.getId());
|
||||||
break a;
|
break a;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
documentTreeEO.setPId(generalCatalogueId);
|
documentTreeEO.setPId(generalCatalogueId);
|
||||||
|
// pIdList.add(generalCatalogueId);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (CollectionUtils.isNotEmpty(pIdList)) {
|
||||||
|
// documentTreeEO.setPId(pIdList.get(pIdList.size()-1)); // 拿最后一个
|
||||||
|
// }
|
||||||
return documentTreeEO;
|
return documentTreeEO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SarFileSplitItemsEO getSarFileSplitItemsEO(String infoId, String itemsNum, String itemsName, List<String> itemsCondi) {
|
public static SarFileSplitItemsEO getSarFileSplitItemsEO(String infoId, String itemsNum, String itemsName, List<String> itemsCondi) {
|
||||||
SarFileSplitItemsEO sarFileSplitItemsEO = new SarFileSplitItemsEO();
|
SarFileSplitItemsEO sarFileSplitItemsEO = new SarFileSplitItemsEO();
|
||||||
sarFileSplitItemsEO.setInfoId(infoId);
|
sarFileSplitItemsEO.setInfoId(infoId);
|
||||||
sarFileSplitItemsEO.setItemsNum(itemsNum);
|
sarFileSplitItemsEO.setItemsNum(itemsNum);
|
||||||
@@ -3065,7 +3263,7 @@ public class FileSpiltService {
|
|||||||
// return personMsgEO;
|
// return personMsgEO;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private String getChinese(String source) {
|
public String getChinese(String source) {
|
||||||
|
|
||||||
char[] chars = source.toCharArray();
|
char[] chars = source.toCharArray();
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
@@ -3079,4 +3277,84 @@ public class FileSpiltService {
|
|||||||
return stringBuilder.toString();
|
return stringBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getStartDigit(List<IBodyElement> elements, SplitFileTypeTypeEnum enumByValue) {
|
||||||
|
String regex = "[^\\p{Punct}\\p{Space}\\p{Digit}]"; // TODO
|
||||||
|
switch (enumByValue) {
|
||||||
|
case GB:
|
||||||
|
case GBT:
|
||||||
|
case EU:
|
||||||
|
case GSO:
|
||||||
|
case JPN_ARTICLE:
|
||||||
|
regex = "[^\\p{Punct}\\p{Space}\\p{Digit}]";
|
||||||
|
break;
|
||||||
|
case KMVSS_ARTICLE:
|
||||||
|
case JPN_ATTACHMENT:
|
||||||
|
regex = "[^\\p{Punct}\\p{Space}\\p{Digit}–]";
|
||||||
|
break;
|
||||||
|
case US:
|
||||||
|
regex = "[^\\p{Punct}\\p{Space}\\p{Digit}S]";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Matcher matcher;
|
||||||
|
List<String> startDigitList = new ArrayList<>();
|
||||||
|
for (int l=0; l< elements.size(); l++) {
|
||||||
|
IBodyElement element = elements.get(l);
|
||||||
|
if (element instanceof XWPFParagraph) {
|
||||||
|
XWPFParagraph p = (XWPFParagraph) element;
|
||||||
|
String arr = p.getText();
|
||||||
|
|
||||||
|
matcher = Pattern.compile(regex).matcher(arr);
|
||||||
|
if(matcher.find()) {
|
||||||
|
int index = matcher.start();
|
||||||
|
String startDigit = arr.substring(0, index);
|
||||||
|
startDigit = startDigit.replaceAll("\t", "").replaceAll("\b", "")
|
||||||
|
.replaceAll(" ", "").replaceAll("\"", "").replaceAll("\'", "");
|
||||||
|
startDigitList.add(startDigit);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
startDigitList.add(arr.replaceAll("\t", "").replaceAll("\b", "")
|
||||||
|
.replaceAll(" ", "").replaceAll("\"", "").replaceAll("\'", ""));
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if (element instanceof XWPFTable) {
|
||||||
|
startDigitList.add("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return startDigitList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOneStartDigit(String arr, SplitFileTypeTypeEnum enumByValue) {
|
||||||
|
String regex="[^\\p{Punct}\\p{Space}\\p{Digit}]"; // TODO
|
||||||
|
switch (enumByValue) {
|
||||||
|
case GB:
|
||||||
|
case GBT:
|
||||||
|
case EU:
|
||||||
|
case GSO:
|
||||||
|
case JPN_ARTICLE:
|
||||||
|
regex = "[^\\p{Punct}\\p{Space}\\p{Digit}]";
|
||||||
|
break;
|
||||||
|
case KMVSS_ARTICLE:
|
||||||
|
case JPN_ATTACHMENT:
|
||||||
|
regex = "[^\\p{Punct}\\p{Space}\\p{Digit}–]";
|
||||||
|
break;
|
||||||
|
case US:
|
||||||
|
regex = "[^\\p{Punct}\\p{Space}\\p{Digit}S]";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Matcher matcher;
|
||||||
|
matcher = Pattern.compile(regex).matcher(arr);
|
||||||
|
if(matcher.find()) {
|
||||||
|
int index = matcher.start();
|
||||||
|
String startDigit = arr.substring(0, index);
|
||||||
|
startDigit = startDigit.replaceAll(" ", "");
|
||||||
|
if(StringUtils.isNotBlank(startDigit)) {
|
||||||
|
return startDigit.replaceAll("\t", "").replaceAll("\b", "")
|
||||||
|
.replaceAll("\"", "").replaceAll("\'", "");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return arr.replaceAll("\t", "").replaceAll("\b", "")
|
||||||
|
.replaceAll(" ", "").replaceAll("\"", "").replaceAll("\'", "");
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1849
File diff suppressed because it is too large
Load Diff
+39
-2
@@ -12,7 +12,6 @@ import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
|||||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||||
import com.jero.modules.document.enums.FieldTypeEnum;
|
import com.jero.modules.document.enums.FieldTypeEnum;
|
||||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||||
import com.jero.modules.ocr.entity.OcrRecordEO;
|
|
||||||
import com.jero.modules.ocr.util.LineHumpUtil;
|
import com.jero.modules.ocr.util.LineHumpUtil;
|
||||||
import com.jero.modules.oss.entity.OSSFile;
|
import com.jero.modules.oss.entity.OSSFile;
|
||||||
import com.jero.modules.oss.service.IOSSFileService;
|
import com.jero.modules.oss.service.IOSSFileService;
|
||||||
@@ -58,6 +57,8 @@ public class SarFileSplitInfoServiceImpl extends ServiceImpl<SarFileSplitInfoMap
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FileSpiltService fileSpiltService;
|
private FileSpiltService fileSpiltService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private FileSplitPdfService fileSplitPdfService;
|
||||||
|
@Autowired
|
||||||
private ISarFileSplitMenuEOService sarFileSplitMenuEOService;
|
private ISarFileSplitMenuEOService sarFileSplitMenuEOService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||||
@@ -81,33 +82,69 @@ public class SarFileSplitInfoServiceImpl extends ServiceImpl<SarFileSplitInfoMap
|
|||||||
save(sarFileSplitInfoEO);
|
save(sarFileSplitInfoEO);
|
||||||
|
|
||||||
SplitFileTypeTypeEnum enumByValue = SplitFileTypeTypeEnum.getEnumByValue(sarFileSplitInfoEO.getFileGroup());
|
SplitFileTypeTypeEnum enumByValue = SplitFileTypeTypeEnum.getEnumByValue(sarFileSplitInfoEO.getFileGroup());
|
||||||
|
String fileSuffix = "docx";
|
||||||
|
if (StringUtils.isNotEmpty(sarFileSplitInfoEO.getFileName())) {
|
||||||
|
String fileName = sarFileSplitInfoEO.getFileName();
|
||||||
|
fileSuffix = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||||
|
}
|
||||||
int result = 0;
|
int result = 0;
|
||||||
switch (enumByValue){
|
switch (enumByValue){
|
||||||
case GB:
|
case GB:
|
||||||
case GBT:
|
case GBT:
|
||||||
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
result = fileSpiltService.fileCHN(sarFileSplitInfoEO,enumByValue);
|
result = fileSpiltService.fileCHN(sarFileSplitInfoEO,enumByValue);
|
||||||
|
} else if("pdf".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSplitPdfService.fileCHN(sarFileSplitInfoEO, enumByValue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case EU:
|
case EU:
|
||||||
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
result = fileSpiltService.fileEU(sarFileSplitInfoEO, enumByValue);
|
result = fileSpiltService.fileEU(sarFileSplitInfoEO, enumByValue);
|
||||||
|
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSplitPdfService.fileEU(sarFileSplitInfoEO, enumByValue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case US:
|
case US:
|
||||||
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
result = fileSpiltService.fileUSA(sarFileSplitInfoEO,enumByValue);
|
result = fileSpiltService.fileUSA(sarFileSplitInfoEO,enumByValue);
|
||||||
|
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSplitPdfService.fileUSA(sarFileSplitInfoEO, enumByValue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GSO:
|
case GSO:
|
||||||
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
result = fileSpiltService.fileGSO(sarFileSplitInfoEO, enumByValue);
|
result = fileSpiltService.fileGSO(sarFileSplitInfoEO, enumByValue);
|
||||||
|
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSplitPdfService.fileGSO(sarFileSplitInfoEO, enumByValue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case JPN_ATTACHMENT:
|
case JPN_ATTACHMENT:
|
||||||
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
result = fileSpiltService.fileJapanOne(sarFileSplitInfoEO,enumByValue);
|
result = fileSpiltService.fileJapanOne(sarFileSplitInfoEO,enumByValue);
|
||||||
|
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSplitPdfService.fileJapanOne(sarFileSplitInfoEO, enumByValue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case JPN_ARTICLE:
|
case JPN_ARTICLE:
|
||||||
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
result = fileSpiltService.fileJapanTwo(sarFileSplitInfoEO, enumByValue);
|
result = fileSpiltService.fileJapanTwo(sarFileSplitInfoEO, enumByValue);
|
||||||
|
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSplitPdfService.fileJapanTwo(sarFileSplitInfoEO, enumByValue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case KMVSS_ARTICLE:
|
case KMVSS_ARTICLE:
|
||||||
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
result = fileSpiltService.fileKmvssArticle(sarFileSplitInfoEO, enumByValue);
|
result = fileSpiltService.fileKmvssArticle(sarFileSplitInfoEO, enumByValue);
|
||||||
|
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSplitPdfService.fileKmvssArticle(sarFileSplitInfoEO, enumByValue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case KMVSS_TABLE:
|
case KMVSS_TABLE:
|
||||||
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
result = fileSpiltService.fileKmvssTable(sarFileSplitInfoEO, enumByValue);
|
result = fileSpiltService.fileKmvssTable(sarFileSplitInfoEO, enumByValue);
|
||||||
|
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSplitPdfService.fileKmvssTable(sarFileSplitInfoEO, enumByValue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,7 +262,7 @@
|
|||||||
this.$message.warning(this.$t('OnlyWord'))
|
this.$message.warning(this.$t('OnlyWord'))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (nameSuffix.toLowerCase() === 'doc' || nameSuffix.toLowerCase() === 'docx') {
|
// if (nameSuffix.toLowerCase() === 'doc' || nameSuffix.toLowerCase() === 'docx') {
|
||||||
let params = {
|
let params = {
|
||||||
attId: file.id,
|
attId: file.id,
|
||||||
title: file.title,
|
title: file.title,
|
||||||
@@ -294,9 +294,9 @@
|
|||||||
})
|
})
|
||||||
this.$emit('exportVisible', true)
|
this.$emit('exportVisible', true)
|
||||||
}
|
}
|
||||||
} else {
|
/*} else {
|
||||||
this.$message.warning(this.$t('OnlyWordItem'))
|
this.$message.warning(this.$t('OnlyWordItem'))
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user