Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage
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
+44
-7
@@ -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:
|
||||||
result = fileSpiltService.fileEU(sarFileSplitInfoEO,enumByValue);
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
|
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:
|
||||||
result = fileSpiltService.fileGSO(sarFileSplitInfoEO,enumByValue);
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
|
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:
|
||||||
result = fileSpiltService.fileJapanTwo(sarFileSplitInfoEO,enumByValue);
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSpiltService.fileJapanTwo(sarFileSplitInfoEO, enumByValue);
|
||||||
|
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSplitPdfService.fileJapanTwo(sarFileSplitInfoEO, enumByValue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case KMVSS_ARTICLE:
|
case KMVSS_ARTICLE:
|
||||||
result = fileSpiltService.fileKmvssArticle(sarFileSplitInfoEO,enumByValue);
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSpiltService.fileKmvssArticle(sarFileSplitInfoEO, enumByValue);
|
||||||
|
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSplitPdfService.fileKmvssArticle(sarFileSplitInfoEO, enumByValue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case KMVSS_TABLE:
|
case KMVSS_TABLE:
|
||||||
result = fileSpiltService.fileKmvssTable(sarFileSplitInfoEO,enumByValue);
|
if ("docx".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSpiltService.fileKmvssTable(sarFileSplitInfoEO, enumByValue);
|
||||||
|
} else if ("pdf".equals(fileSuffix.toLowerCase())) {
|
||||||
|
result = fileSplitPdfService.fileKmvssTable(sarFileSplitInfoEO, enumByValue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,37 +32,40 @@
|
|||||||
v-model="searchModel" @search="onSearch"/>
|
v-model="searchModel" @search="onSearch"/>
|
||||||
<div class="drawer-content">
|
<div class="drawer-content">
|
||||||
<JLoading :loading="loading">{{$t('dataLoading')}}</JLoading>
|
<JLoading :loading="loading">{{$t('dataLoading')}}</JLoading>
|
||||||
<virtualNodeTree
|
<!-- <virtualNodeTree-->
|
||||||
v-if="treeVisible"
|
|
||||||
:keeps="40"
|
|
||||||
show-checkbox
|
|
||||||
v-model="checkboxList"
|
|
||||||
class="treeWrap"
|
|
||||||
:props="{
|
|
||||||
isLeaf: 'leaf'
|
|
||||||
}"
|
|
||||||
:defaultCheckedKeys="defaultCheckedKeys"
|
|
||||||
:check-strictly="false"
|
|
||||||
node-key="id"
|
|
||||||
@check-change="handleCheckChange"
|
|
||||||
:data.sync="gData">
|
|
||||||
<span slot-scope="{ data }">
|
|
||||||
<span>{{ data.title }}</span>
|
|
||||||
</span>
|
|
||||||
</virtualNodeTree>
|
|
||||||
<!-- <a-tree-->
|
|
||||||
<!-- style="margin-bottom: 60px;height: 600px"-->
|
|
||||||
<!-- v-if="treeVisible"-->
|
<!-- v-if="treeVisible"-->
|
||||||
<!-- checkable-->
|
<!-- :keeps="40"-->
|
||||||
<!-- checkStrictly-->
|
<!-- show-checkbox-->
|
||||||
<!-- :loading="loading"-->
|
<!-- v-model="checkboxList"-->
|
||||||
<!-- :tree-data="gData"-->
|
<!-- class="treeWrap"-->
|
||||||
<!-- @check="onCheck"-->
|
<!-- :props="{-->
|
||||||
<!-- @expand="onExpand"-->
|
<!-- isLeaf: 'leaf'-->
|
||||||
<!-- v-model:checkedKeys="defaultCheckedKeys"-->
|
<!-- }"-->
|
||||||
<!-- :defaultExpandedKeys="defaultExpandedKeys"-->
|
<!-- :defaultCheckedKeys="defaultCheckedKeys"-->
|
||||||
<!-- >-->
|
<!-- :defaultExpandAll="defaultExpandAll"-->
|
||||||
<!-- </a-tree>-->
|
<!-- :check-strictly="false"-->
|
||||||
|
<!-- node-key="id"-->
|
||||||
|
<!-- @check-change="handleCheckChange"-->
|
||||||
|
<!-- :data.sync="gData">-->
|
||||||
|
<!-- <span slot-scope="{ data }">-->
|
||||||
|
<!-- <span :class="{'active':data.color ? true:false}">-->
|
||||||
|
<!-- {{ data.title }}-->
|
||||||
|
<!-- </span>-->
|
||||||
|
<!-- </span>-->
|
||||||
|
<!-- </virtualNodeTree>-->
|
||||||
|
<a-tree
|
||||||
|
style="margin-bottom: 60px;height: 600px"
|
||||||
|
v-if="treeVisible"
|
||||||
|
checkable
|
||||||
|
checkStrictly
|
||||||
|
:loading="loading"
|
||||||
|
:tree-data="gData"
|
||||||
|
@check="onCheck"
|
||||||
|
@expand="onExpand"
|
||||||
|
v-model:checkedKeys="defaultCheckedKeys"
|
||||||
|
:defaultExpandedKeys="defaultExpandedKeys"
|
||||||
|
>
|
||||||
|
</a-tree>
|
||||||
</div>
|
</div>
|
||||||
<div class="drawer-bootom-button">
|
<div class="drawer-bootom-button">
|
||||||
<a-button @click="handleCancel" style="margin-right: 16px">{{$t('cancel')}}</a-button>
|
<a-button @click="handleCancel" style="margin-right: 16px">{{$t('cancel')}}</a-button>
|
||||||
@@ -89,7 +92,7 @@
|
|||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
gData: [],
|
gData: [],
|
||||||
autoExpandParent: true,
|
autoExpandParent: false,
|
||||||
checkboxList: [],
|
checkboxList: [],
|
||||||
expandedKeys: [],
|
expandedKeys: [],
|
||||||
visible: false,
|
visible: false,
|
||||||
@@ -103,107 +106,110 @@
|
|||||||
defaultCheckedKeys: [],
|
defaultCheckedKeys: [],
|
||||||
defaultCheckedKeysName: [],
|
defaultCheckedKeysName: [],
|
||||||
content: [],
|
content: [],
|
||||||
dataList: []
|
dataList: [],
|
||||||
|
defaultExpandAll: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleCheckChange(val, checked, indeterminate) {
|
// handleCheckChange(val, checked, indeterminate) {
|
||||||
if (checked) {
|
// if (checked) {
|
||||||
this.userName.push(val.title)
|
// this.userName.push(val.title)
|
||||||
this.userIds.push(val.id)
|
// this.userIds.push(val.id)
|
||||||
} else {
|
// } else {
|
||||||
for (let i = 0; i < this.userName.length; i++) {
|
// for (let i = 0; i < this.userName.length; i++) {
|
||||||
if (this.userName[i] == val.title) {
|
// if (this.userName[i] == val.title) {
|
||||||
this.userName.splice(i, 1)
|
// this.userName.splice(i, 1)
|
||||||
i--
|
// i--
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
for (let i = 0; i < this.userIds.length; i++) {
|
// for (let i = 0; i < this.userIds.length; i++) {
|
||||||
if (this.userIds[i] == val.id) {
|
// if (this.userIds[i] == val.id) {
|
||||||
this.userIds.splice(i, 1)
|
// this.userIds.splice(i, 1)
|
||||||
i--
|
// i--
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
standardClick() {
|
standardClick() {
|
||||||
this.visible = true
|
|
||||||
this.treeVisible = false
|
this.treeVisible = false
|
||||||
this.departId = ''
|
this.departId = ''
|
||||||
this.searchModel = ''
|
this.searchModel = ''
|
||||||
this.userName = []
|
|
||||||
this.userIds = []
|
this.userIds = []
|
||||||
let gData = localStorage.getItem('gData')
|
|
||||||
if (gData) {
|
|
||||||
let dataList = JSON.parse(gData)
|
|
||||||
if (!this.selectDepartment) {
|
|
||||||
dataList.forEach(res => {
|
|
||||||
if (res.type == 'Depart') {
|
|
||||||
res.disabled = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.dataList = this.toTree(dataList)
|
|
||||||
}
|
|
||||||
setTimeout(() => {
|
|
||||||
if (gData) {
|
|
||||||
this.gData = this.dataList
|
|
||||||
this.gData = [...this.gData]
|
|
||||||
// this.treeVisible = true
|
|
||||||
if (this.personneQuery[this.query.db_field_name + 'Name']) {
|
|
||||||
this.userName = this.personneQuery[this.query.db_field_name + 'Name'].split(',')
|
|
||||||
} else if (this.personneQuery[this.query.db_field_name]) {
|
|
||||||
this.userName = this.personneQuery[this.query.db_field_name].split(',')
|
|
||||||
} else {
|
|
||||||
this.userName = []
|
this.userName = []
|
||||||
}
|
|
||||||
if (this.personneQuery[this.query.db_field_name + '_id']) {
|
|
||||||
this.userIds = this.personneQuery[this.query.db_field_name + '_id'].split(',')
|
|
||||||
} else if (this.personneQuery[this.query.db_field_name]) {
|
|
||||||
this.userIds = this.personneQuery[this.query.db_field_name].split(',')
|
|
||||||
} else {
|
|
||||||
this.userIds = []
|
|
||||||
}
|
|
||||||
this.defaultCheckedKeys = this.userIds
|
|
||||||
this.defaultCheckedKeys = [...this.defaultCheckedKeys]
|
|
||||||
this.treeVisible = true
|
|
||||||
} else {
|
|
||||||
this.queryDepartUserTreeList(1)
|
this.queryDepartUserTreeList(1)
|
||||||
}
|
this.visible = true
|
||||||
}, 200)
|
// let gData = localStorage.getItem('gData')
|
||||||
|
// if (gData) {
|
||||||
|
// let dataList = JSON.parse(gData)
|
||||||
|
// if (!this.selectDepartment) {
|
||||||
|
// dataList.forEach(res => {
|
||||||
|
// if (res.type == 'Depart') {
|
||||||
|
// res.disabled = true
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// this.dataList = this.toTree(dataList)
|
||||||
|
// }
|
||||||
|
// setTimeout(() => {
|
||||||
|
// if (gData) {
|
||||||
|
// this.gData = this.dataList
|
||||||
|
// this.gData = [...this.gData]
|
||||||
|
// // this.treeVisible = true
|
||||||
|
// if (this.personneQuery[this.query.db_field_name + 'Name']) {
|
||||||
|
// this.userName = this.personneQuery[this.query.db_field_name + 'Name'].split(',')
|
||||||
|
// } else if (this.personneQuery[this.query.db_field_name]) {
|
||||||
|
// this.userName = this.personneQuery[this.query.db_field_name].split(',')
|
||||||
|
// } else {
|
||||||
|
// this.userName = []
|
||||||
|
// }
|
||||||
|
// if (this.personneQuery[this.query.db_field_name + '_id']) {
|
||||||
|
// this.userIds = this.personneQuery[this.query.db_field_name + '_id'].split(',')
|
||||||
|
// } else if (this.personneQuery[this.query.db_field_name]) {
|
||||||
|
// this.userIds = this.personneQuery[this.query.db_field_name].split(',')
|
||||||
|
// } else {
|
||||||
|
// this.userIds = []
|
||||||
|
// }
|
||||||
|
// this.defaultCheckedKeys = this.userIds
|
||||||
|
// this.defaultCheckedKeys = [...this.defaultCheckedKeys]
|
||||||
|
// this.defaultExpandAll = false
|
||||||
|
// this.treeVisible = true
|
||||||
|
// } else {
|
||||||
|
// this.queryDepartUserTreeList(1)
|
||||||
|
// }
|
||||||
|
// }, 200)
|
||||||
},
|
},
|
||||||
//将数据拼成树形结构
|
//将数据拼成树形结构
|
||||||
toTree(config) {
|
// toTree(config) {
|
||||||
// 删除 所有 children,以防止多次调用
|
// // 删除 所有 children,以防止多次调用
|
||||||
config.forEach(function(item) {
|
// config.forEach(function(item) {
|
||||||
delete item.children
|
// delete item.children
|
||||||
})
|
// })
|
||||||
// 将数据存储为 以 id 为 KEY 的 map 索引数据列
|
// // 将数据存储为 以 id 为 KEY 的 map 索引数据列
|
||||||
let map = {}
|
// let map = {}
|
||||||
config.forEach((item) => {
|
// config.forEach((item) => {
|
||||||
item.label = item.name
|
// item.label = item.name
|
||||||
item.key = item.id
|
// item.key = item.id
|
||||||
|
//
|
||||||
item.title = item.name + (item.itemName ? ' ' + item.itemName : '')
|
// item.title = item.name + (item.itemName ? ' ' + item.itemName : '')
|
||||||
map[item.id] = item
|
// map[item.id] = item
|
||||||
})
|
// })
|
||||||
let val = []
|
// let val = []
|
||||||
config.forEach((item) => {
|
// config.forEach((item) => {
|
||||||
// 以当前遍历项,的pid,去map对象中找到索引的id
|
// // 以当前遍历项,的pid,去map对象中找到索引的id
|
||||||
let parent = map[item.parentId]
|
// let parent = map[item.parentId]
|
||||||
// 如果找到索引,那么说明此项不在顶级当中,那么需要把此项添加到,他对应的父级中
|
// // 如果找到索引,那么说明此项不在顶级当中,那么需要把此项添加到,他对应的父级中
|
||||||
if (parent) {
|
// if (parent) {
|
||||||
(parent.children || (parent.children = [])).push(item)
|
// (parent.children || (parent.children = [])).push(item)
|
||||||
} else {
|
// } else {
|
||||||
//如果没有在map中找到对应的索引ID,那么直接把 当前的item添加到 val结果集中,作为顶级
|
// //如果没有在map中找到对应的索引ID,那么直接把 当前的item添加到 val结果集中,作为顶级
|
||||||
val.push(item)
|
// val.push(item)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
return val
|
// return val
|
||||||
},
|
// },
|
||||||
standardDelete() {
|
standardDelete() {
|
||||||
this.$emit('input', null)
|
this.$emit('input', null)
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
@@ -283,12 +289,12 @@
|
|||||||
}
|
}
|
||||||
let userIds = JSON.parse(JSON.stringify(this.userIds))
|
let userIds = JSON.parse(JSON.stringify(this.userIds))
|
||||||
let userName = JSON.parse(JSON.stringify(this.userName))
|
let userName = JSON.parse(JSON.stringify(this.userName))
|
||||||
userName = userName.filter(function(item, index) {
|
// userName = userName.filter(function(item, index) {
|
||||||
return userName.indexOf(item) === index // 因为indexOf 只能查找到第一个
|
// return userName.indexOf(item) === index // 因为indexOf 只能查找到第一个
|
||||||
})
|
// })
|
||||||
userIds = userIds.filter(function(item, index) {
|
// userIds = userIds.filter(function(item, index) {
|
||||||
return userIds.indexOf(item) === index // 因为indexOf 只能查找到第一个
|
// return userIds.indexOf(item) === index // 因为indexOf 只能查找到第一个
|
||||||
})
|
// })
|
||||||
this.$emit('input', userName.join(','))
|
this.$emit('input', userName.join(','))
|
||||||
this.$emit('change', this.query.db_field_name, userIds.join(','), this.query.subscript)
|
this.$emit('change', this.query.db_field_name, userIds.join(','), this.query.subscript)
|
||||||
this.visible = false
|
this.visible = false
|
||||||
@@ -306,115 +312,118 @@
|
|||||||
this.defaultCheckedKeys = []
|
this.defaultCheckedKeys = []
|
||||||
},
|
},
|
||||||
onSearch(e) {
|
onSearch(e) {
|
||||||
this.loading = true
|
// this.loading = true
|
||||||
// this.treeVisible = false
|
// this.treeVisible = false
|
||||||
let p = new Promise((resolve, reject) => {
|
// let p = new Promise((resolve, reject) => {
|
||||||
resolve()
|
// resolve()
|
||||||
})
|
|
||||||
p.then(() => {
|
|
||||||
let gData = localStorage.getItem('gData')
|
|
||||||
let content = []
|
|
||||||
if (gData) {
|
|
||||||
if (e) {
|
|
||||||
JSON.parse(gData).forEach(res => {
|
|
||||||
if (res.type == 'User') {
|
|
||||||
if (res.name.includes(e)) {
|
|
||||||
content.push(res)
|
|
||||||
}
|
|
||||||
} else if (res.type == 'Depart') {
|
|
||||||
if (!this.selectDepartment) {
|
|
||||||
res.disabled = true
|
|
||||||
}
|
|
||||||
content.push(res)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.gData = this.toTree(content)
|
|
||||||
} else {
|
|
||||||
let content = JSON.parse(gData)
|
|
||||||
if (!this.selectDepartment) {
|
|
||||||
content.forEach(res => {
|
|
||||||
if (res.type == 'Depart') {
|
|
||||||
res.disabled = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.gData = this.toTree(content)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.defaultCheckedKeys = this.userIds
|
|
||||||
this.defaultCheckedKeys = [...this.defaultCheckedKeys]
|
|
||||||
// this.treeVisible = true
|
|
||||||
this.loading = false
|
|
||||||
})
|
|
||||||
// this.gData = []
|
|
||||||
// this.departId = ''
|
|
||||||
// this.visibleTree = false
|
|
||||||
// if (e) {
|
|
||||||
// this.getUserAndDepart()
|
|
||||||
// } else {
|
|
||||||
// this.treeVisible = false
|
|
||||||
// this.queryDepartUserTreeList(2)
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
// getUserAndDepart() {
|
|
||||||
// getAction('sys/user/getUserAndDepart', { name: this.searchModel }).then((res) => {
|
|
||||||
// if (res) {
|
|
||||||
// this.gData = res.filter(ele => ele.flag === 'DEPART')
|
|
||||||
// } else {
|
|
||||||
// this.gData = []
|
|
||||||
// }
|
|
||||||
// this.visibleTree = true
|
|
||||||
// })
|
// })
|
||||||
// },
|
// p.then(() => {
|
||||||
// onExpand(selectedKeys, val) {
|
// let gData = localStorage.getItem('gData')
|
||||||
// if (this.searchModel == '' || !this.searchModel) {
|
// let content = []
|
||||||
// if (val.expanded) {
|
// if (gData) {
|
||||||
// if (this.departId == val.node.value) {
|
// if (e) {
|
||||||
|
// JSON.parse(gData).forEach(res => {
|
||||||
|
// if (res.type == 'User') {
|
||||||
|
// if (res.name.includes(e)) {
|
||||||
|
// res.color = true
|
||||||
|
// content.push(res)
|
||||||
|
// }
|
||||||
|
// } else if (res.type == 'Depart') {
|
||||||
|
// if (!this.selectDepartment) {
|
||||||
|
// res.disabled = true
|
||||||
|
// }
|
||||||
|
// content.push(res)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// this.defaultExpandAll = true
|
||||||
|
// this.gData = this.toTree(content)
|
||||||
// } else {
|
// } else {
|
||||||
// this.departId = val.node.value
|
// let content = JSON.parse(gData)
|
||||||
// this.queryDepartUserTreeList(2)
|
// if (!this.selectDepartment) {
|
||||||
|
// content.forEach(res => {
|
||||||
|
// if (res.type == 'Depart') {
|
||||||
|
// res.disabled = true
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// this.gData = this.toTree(content)
|
||||||
|
// this.defaultExpandAll = false
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// this.defaultCheckedKeys = this.userIds
|
||||||
// },
|
// this.defaultCheckedKeys = [...this.defaultCheckedKeys]
|
||||||
|
// this.treeVisible = true
|
||||||
|
// this.loading = false
|
||||||
|
// })
|
||||||
|
this.gData = []
|
||||||
|
this.departId = ''
|
||||||
|
this.visibleTree = false
|
||||||
|
if (e) {
|
||||||
|
this.getUserAndDepart()
|
||||||
|
} else {
|
||||||
|
this.treeVisible = false
|
||||||
|
this.queryDepartUserTreeList(2)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getUserAndDepart() {
|
||||||
|
getAction('sys/user/getUserAndDepart', { name: this.searchModel }).then((res) => {
|
||||||
|
if (res) {
|
||||||
|
this.gData = res.filter(ele => ele.flag === 'DEPART')
|
||||||
|
} else {
|
||||||
|
this.gData = []
|
||||||
|
}
|
||||||
|
this.visibleTree = true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onExpand(selectedKeys, val) {
|
||||||
|
if (this.searchModel == '' || !this.searchModel) {
|
||||||
|
if (val.expanded) {
|
||||||
|
if (this.departId == val.node.value) {
|
||||||
|
} else {
|
||||||
|
this.departId = val.node.value
|
||||||
|
this.queryDepartUserTreeList(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
queryDepartUserTreeList(num) {
|
queryDepartUserTreeList(num) {
|
||||||
// let gData = JSON.parse(JSON.stringify(this.gData))
|
let gData = JSON.parse(JSON.stringify(this.gData))
|
||||||
// if (gData && gData.length > 0) {
|
if (gData && gData.length > 0) {
|
||||||
// gData = JSON.stringify(gData)
|
gData = JSON.stringify(gData)
|
||||||
// } else {
|
} else {
|
||||||
// gData = ''
|
gData = ''
|
||||||
// }
|
}
|
||||||
this.confirmLoading = true
|
this.confirmLoading = true
|
||||||
this.loading = true
|
this.loading = true
|
||||||
//queryDepartUserTreeList
|
//queryDepartUserTreeList
|
||||||
//queryUserTreeList
|
//queryUserTreeList
|
||||||
getAction('sys/user/queryUserTreeList', {
|
postAction('sys/user/queryDepartUserTreeList', {
|
||||||
// departId: this.departId,
|
departId: this.departId,
|
||||||
// json: gData,
|
json: gData,
|
||||||
// flag: '1'
|
flag: '1'
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
this.confirmLoading = false
|
this.confirmLoading = false
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
// localStorage.setItem('gData', JSON.stringify(res.result))
|
// localStorage.setItem('gData', JSON.stringify(res.result))
|
||||||
// this.toTree(dataList)
|
// this.toTree(dataList)
|
||||||
let content = JSON.parse(JSON.stringify(res.result))
|
// let content = JSON.parse(JSON.stringify(res.result))
|
||||||
if (!this.selectDepartment) {
|
// if (!this.selectDepartment) {
|
||||||
res.result.forEach(res => {
|
// res.result.forEach(res => {
|
||||||
if (res.type == 'Depart') {
|
// if (res.type == 'Depart') {
|
||||||
res.disabled = true
|
// res.disabled = true
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
localStorage.removeItem('gData')
|
// localStorage.removeItem('gData')
|
||||||
localStorage.setItem('gData', JSON.stringify(content))
|
// localStorage.setItem('gData', JSON.stringify(content))
|
||||||
this.gData = this.toTree(res.result)
|
// this.gData = this.toTree(res.result)
|
||||||
console.log(this.gData)
|
this.gData = res.result
|
||||||
this.gData = [...this.gData]
|
this.gData = [...this.gData]
|
||||||
// this.gData[0].isLeaf = false
|
// this.gData[0].isLeaf = false
|
||||||
// this.defaultExpandedKeys = [this.departId]
|
this.defaultExpandedKeys = [this.departId]
|
||||||
if (num == 1) {
|
if (num == 1) {
|
||||||
// if (this.userName && this.userName.length == 0) {
|
if (this.userName && this.userName.length == 0) {
|
||||||
if (this.personneQuery[this.query.db_field_name + 'Name']) {
|
if (this.personneQuery[this.query.db_field_name + 'Name']) {
|
||||||
this.userName = this.personneQuery[this.query.db_field_name + 'Name'].split(',')
|
this.userName = this.personneQuery[this.query.db_field_name + 'Name'].split(',')
|
||||||
} else if (this.personneQuery[this.query.db_field_name]) {
|
} else if (this.personneQuery[this.query.db_field_name]) {
|
||||||
@@ -422,8 +431,8 @@
|
|||||||
} else {
|
} else {
|
||||||
this.userName = []
|
this.userName = []
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
// if (this.userIds && this.userIds.length == 0) {
|
if (this.userIds && this.userIds.length == 0) {
|
||||||
if (this.personneQuery[this.query.db_field_name + '_id']) {
|
if (this.personneQuery[this.query.db_field_name + '_id']) {
|
||||||
this.userIds = this.personneQuery[this.query.db_field_name + '_id'].split(',')
|
this.userIds = this.personneQuery[this.query.db_field_name + '_id'].split(',')
|
||||||
} else if (this.personneQuery[this.query.db_field_name]) {
|
} else if (this.personneQuery[this.query.db_field_name]) {
|
||||||
@@ -431,19 +440,20 @@
|
|||||||
} else {
|
} else {
|
||||||
this.userIds = []
|
this.userIds = []
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
this.defaultCheckedKeys = this.userIds
|
this.defaultCheckedKeys = this.userIds
|
||||||
this.defaultCheckedKeys = [...this.defaultCheckedKeys]
|
this.defaultCheckedKeys = [...this.defaultCheckedKeys]
|
||||||
// this.defaultCheckedKeysName = []
|
this.defaultCheckedKeysName = []
|
||||||
// if (this.defaultCheckedKeys.length > 0) {
|
if (this.defaultCheckedKeys.length > 0) {
|
||||||
// for (let i = 0; i < this.defaultCheckedKeys.length; i++) {
|
for (let i = 0; i < this.defaultCheckedKeys.length; i++) {
|
||||||
// this.defaultCheckedKeysName.push({
|
this.defaultCheckedKeysName.push({
|
||||||
// id: this.defaultCheckedKeys[i],
|
id: this.defaultCheckedKeys[i],
|
||||||
// name: this.userName[i]
|
name: this.userName[i]
|
||||||
// })
|
})
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.defaultExpandAll = false
|
||||||
this.treeVisible = true
|
this.treeVisible = true
|
||||||
} else {
|
} else {
|
||||||
this.gData = []
|
this.gData = []
|
||||||
@@ -537,4 +547,9 @@
|
|||||||
.treeWrap {
|
.treeWrap {
|
||||||
height: calc(100vh - 240px);
|
height: calc(100vh - 240px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.active {
|
||||||
|
color: #21c9cc;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -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