拆分GSO问题处理,选择框名称修改
This commit is contained in:
+3
@@ -2796,6 +2796,9 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
} else if ("doc".equals(type)) {
|
||||
//查询条件
|
||||
conditionSb.append(" and osf.file_name like '%.doc%'");
|
||||
}else if ("pdfdoc".equals(type)) {
|
||||
//查询条件
|
||||
conditionSb.append(" and osf.file_name like '%.doc%'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
+6
-5
@@ -10,15 +10,16 @@ public enum SplitFileTypeTypeEnum {
|
||||
GSO("GSO","GSO"),
|
||||
KMVSS_TABLE("KMVSS_Table","KMVSS_Table"),
|
||||
KMVSS_ARTICLE("KMVSS_Article","KMVSS_Article"),
|
||||
US("US","美国"),
|
||||
EU("EU","欧洲"),
|
||||
US("CFR","美国"),
|
||||
EU("UNECE","欧洲"),
|
||||
/**
|
||||
* Japan Attachment
|
||||
*/
|
||||
JAPAN_ONE("Japan_one","Japan Attachment"),
|
||||
JPN_ATTACHMENT("JPN_Attachment","Japan Attachment"),
|
||||
|
||||
JAPAN_TWO("Japan_two","Japan Article"),
|
||||
CN("CN","中国");
|
||||
JPN_ARTICLE("JPN_Article","Japan Article"),
|
||||
GB("GB","中国"),
|
||||
GBT("GBT","中国");
|
||||
|
||||
private String value;
|
||||
private String lable;
|
||||
|
||||
+47
-22
@@ -2,6 +2,7 @@ package com.jero.modules.split.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.modules.document.utils.ReadPdfUtil;
|
||||
import com.jero.modules.ocr.util.UUIDUtils;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
@@ -404,24 +405,44 @@ public class FileSpiltService {
|
||||
throw new JeroBootException("当前文件未找到,请重新选择!");
|
||||
}
|
||||
|
||||
InputStream is = new FileInputStream(readFilePath); //需要将文件路更改为word文档所在路径。
|
||||
XWPFDocument doc = new XWPFDocument(is);
|
||||
//修改为读取PDF
|
||||
// InputStream is = new FileInputStream(readFilePath); //需要将文件路更改为word文档所在路径。
|
||||
// XWPFDocument doc = new XWPFDocument(is);
|
||||
|
||||
String readPdf = ReadPdfUtil.readPdf(readFilePath);
|
||||
if(StringUtils.isEmpty(readPdf)){
|
||||
throw new JeroBootException("未读取到文件内容,请检查后重试!");
|
||||
}
|
||||
String[] pdfArrays = readPdf.split("\r\n");
|
||||
|
||||
// Pattern ptest ;
|
||||
// Matcher matcher;
|
||||
|
||||
// 记录拆分后的每一段文字
|
||||
List<IBodyElement> elements = doc.getBodyElements();
|
||||
//修改为读取PDF
|
||||
// List<IBodyElement> elements = doc.getBodyElements();
|
||||
// 记录word自动生成的编号数据
|
||||
Map numberMap = new HashMap<String,Integer>();
|
||||
boolean menuCanAdd = false; // 判断当前目录下是否可以正常填写数据
|
||||
for (IBodyElement element : elements) {
|
||||
//修改为读取PDF
|
||||
// for (IBodyElement element : elements) {
|
||||
//定义初始化数据
|
||||
boolean firstFlag = true;
|
||||
for (String paragraphString : pdfArrays) {
|
||||
if(paragraphString.contains("SCOPE")){
|
||||
firstFlag = false;
|
||||
}
|
||||
if(firstFlag){
|
||||
continue;
|
||||
}
|
||||
|
||||
// 段落
|
||||
if (element instanceof XWPFParagraph) {
|
||||
XWPFParagraph p = (XWPFParagraph)element;
|
||||
//修改为读取PDF
|
||||
// if (element instanceof XWPFParagraph) {
|
||||
// XWPFParagraph p = (XWPFParagraph)element;
|
||||
|
||||
// 处理段落生成编号不识别问题
|
||||
String paragraphString = p.getText();
|
||||
// String paragraphString = p.getText();
|
||||
if (StringUtils.isNotBlank(paragraphString)) {
|
||||
paragraphString = paragraphString.replace((char) 12288, ' ');
|
||||
paragraphString = paragraphString.trim();
|
||||
@@ -475,13 +496,13 @@ public class FileSpiltService {
|
||||
}
|
||||
|
||||
if(!hasGoIf && menuCanAdd) {
|
||||
if (!p.getText().equals("") ){
|
||||
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);
|
||||
if (!paragraphString.equals("") ){
|
||||
addItermsConditionsText(messageList.get(messageList.size()-1),itemValList,paragraphString);
|
||||
}
|
||||
// List<String> imageBundleList = readImageInParagraph((XWPFParagraph)p);
|
||||
// if(CollectionUtils.isNotEmpty(imageBundleList)) {
|
||||
// addItermsConditionsImage(messageList.get(messageList.size()-1),itemValList, p,imageBundleList);
|
||||
// }
|
||||
// }
|
||||
hasGoIf = true;
|
||||
}
|
||||
@@ -490,14 +511,17 @@ public class FileSpiltService {
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (element instanceof XWPFTable){
|
||||
if(messageList != null && !messageList.isEmpty()){
|
||||
addItermsConditionsOfTable(messageList.get(messageList.size()-1),itemValList,(XWPFTable)element);
|
||||
}
|
||||
}
|
||||
//修改为读取PDF
|
||||
// } else if (element instanceof XWPFTable){
|
||||
// if(messageList != null && !messageList.isEmpty()){
|
||||
// addItermsConditionsOfTable(messageList.get(messageList.size()-1),itemValList,(XWPFTable)element);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
}catch (JeroBootException e){
|
||||
throw new JeroBootException(e.getMessage());
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
@@ -1845,7 +1869,8 @@ public class FileSpiltService {
|
||||
a:
|
||||
for (SarFileSplitMenuEO forDocumentTree : treeList) {
|
||||
switch (enumByValue) {
|
||||
case CN:
|
||||
case GB:
|
||||
case GBT:
|
||||
case US:
|
||||
case GSO:
|
||||
if (name.indexOf(".") >= 0) {
|
||||
@@ -1869,7 +1894,7 @@ public class FileSpiltService {
|
||||
documentTreeEO.setPId(generalCatalogueId);
|
||||
}
|
||||
break;
|
||||
case JAPAN_ONE:
|
||||
case JPN_ATTACHMENT:
|
||||
if (name.contains(".")) {
|
||||
if (name.indexOf(".") >= 0) {
|
||||
if (name.substring(0, name.lastIndexOf(".")).equals(forDocumentTree.getName())) {
|
||||
@@ -1891,7 +1916,7 @@ public class FileSpiltService {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case JAPAN_TWO:
|
||||
case JPN_ARTICLE:
|
||||
if (name.indexOf("=") >= 0) {
|
||||
String[] nameSplit = name.split("=");
|
||||
|
||||
|
||||
+4
-3
@@ -78,7 +78,8 @@ public class SarFileSplitInfoServiceImpl extends ServiceImpl<SarFileSplitInfoMap
|
||||
|
||||
int result = 0;
|
||||
switch (enumByValue){
|
||||
case CN:
|
||||
case GB:
|
||||
case GBT:
|
||||
result = fileSpiltService.fileCHN(sarFileSplitInfoEO,enumByValue);
|
||||
break;
|
||||
case EU:
|
||||
@@ -90,10 +91,10 @@ public class SarFileSplitInfoServiceImpl extends ServiceImpl<SarFileSplitInfoMap
|
||||
case GSO:
|
||||
result = fileSpiltService.fileGSO(sarFileSplitInfoEO,enumByValue);
|
||||
break;
|
||||
case JAPAN_ONE:
|
||||
case JPN_ATTACHMENT:
|
||||
result = fileSpiltService.fileJapanOne(sarFileSplitInfoEO,enumByValue);
|
||||
break;
|
||||
case JAPAN_TWO:
|
||||
case JPN_ARTICLE:
|
||||
result = fileSpiltService.fileJapanTwo(sarFileSplitInfoEO,enumByValue);
|
||||
break;
|
||||
case KMVSS_ARTICLE:
|
||||
|
||||
Reference in New Issue
Block a user