valList, String itemId) {
+ StringBuilder valContent = new StringBuilder();
+ if (!Objects.isNull(valList) && !valList.isEmpty()){
+ int index = 0;
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+ for (SarFileSplitItemsValEO sarFileSplitItemsValEO : valList) {
+ String translation = sarFileSplitItemsValEO.getTranslation();
+ // 条文内容拼接
+ if (DocumentSplitCommon.TEXT.equals(sarFileSplitItemsValEO.getType())) {
+ if (StringUtils.isNotBlank(translation)){
+ sarFileSplitItemsValEO.setTranslation(translation
+ .replace("<", "<").replace(">", ">"));
+ }
+ valContent.append("").append(translation).append("
");
+ } else if (DocumentSplitCommon.IMG.equals(sarFileSplitItemsValEO.getType())) {
+ valContent.append("
");
+ } else if (DocumentSplitCommon.TABLE.equals(sarFileSplitItemsValEO.getType())) {
+ valContent.append(translation);
+ }
+
+ // 条目信息
+ index += 1;
+ sarFileSplitItemsValEO.setId(UUIDUtils.randomUUID20());
+ sarFileSplitItemsValEO.setItemId(itemId);
+ sarFileSplitItemsValEO.setDisplaySeq(index);
+ sarFileSplitItemsValEO.setValidFlag(0);
+ sarFileSplitItemsValEO.setCreationTime(new Date());
+ sarFileSplitItemsValEO.setModifyTime(new Date());
+ sarFileSplitItemsValEO.setCreationUser(sysUser.getId());
+ sarFileSplitItemsValEO.setModifyUser(sysUser.getId());
+ }
+ }
+ return valContent.toString();
+ }
+
private String itemContentJoin(List valList, String itemId) {
StringBuilder valContent = new StringBuilder();
if (!Objects.isNull(valList) && !valList.isEmpty()){
diff --git a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java
index 8ef94218..d974d31c 100644
--- a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java
+++ b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java
@@ -1445,6 +1445,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl addItemValList = new ArrayList<>();
if (addItemsEOList != null && !addItemsEOList.isEmpty()) {
Map oldItems = addItemsEOList.get(addItemsEOList.size()-1);
@@ -1456,7 +1459,6 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl) oldItems.get("itemValEOList");
String itemContent = oldItems.get("item_content").toString() + importDto.get("item_content").toString();
oldItems.put("item_content", itemContent);
- String[] valArr = importDto.get("item_content").toString().split("\n");
if (valArr != null && valArr.length > 0) {
for (int i=0;i nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
if (nowfilelist != null && !nowfilelist.isEmpty()) {
@@ -1508,6 +1517,20 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl translationfilelist = FileUnZip.readFileByFilename(filepath, translationArr[i]);
+ if (CollectionUtil.isNotEmpty(translationfilelist)) {
+ String urlTranslation = translationfilelist.get(0).getPath();
+ MultipartFile multipartFileTranslation = createMfileByPath(urlTranslation);
+ String uploadTranslation = ObsBootUtil.upload(multipartFileTranslation, "temp");
+ OSSFile ossFileTranslation = new OSSFile();
+ ossFileTranslation.setId(String.valueOf(SnowflakeUtils.snowflake()));
+ ossFileTranslation.setFileName(multipartFileTranslation.getName());
+ ossFileTranslation.setUrl(uploadTranslation);
+ ossFileService.save(ossFileTranslation);
+ valEO.setTranslation(splitUrl+uploadTranslation.replace("temp\\", ""));
+ }
+ }
} catch (Exception e) {
e.printStackTrace();
}
@@ -1516,6 +1539,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl 0) {
for (int i = 0; i < valArr.length; i++) {
SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO();
@@ -1536,6 +1561,13 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
if (nowfilelist != null && !nowfilelist.isEmpty()) {
@@ -1575,6 +1607,20 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl translationfilelist = FileUnZip.readFileByFilename(filepath, translationArr[i]);
+ if (CollectionUtil.isNotEmpty(translationfilelist)) {
+ String urlTranslation = translationfilelist.get(0).getPath();
+ MultipartFile multipartFileTranslation = createMfileByPath(urlTranslation);
+ String uploadTranslation = ObsBootUtil.upload(multipartFileTranslation, "temp");
+ OSSFile ossFileTranslation = new OSSFile();
+ ossFileTranslation.setId(String.valueOf(SnowflakeUtils.snowflake()));
+ ossFileTranslation.setFileName(multipartFileTranslation.getName());
+ ossFileTranslation.setUrl(uploadTranslation);
+ ossFileService.save(ossFileTranslation);
+ valEO.setTranslation(splitUrl+uploadTranslation.replace("temp\\", ""));
+ }
+ }
} catch (Exception e) {
e.printStackTrace();
}
@@ -1582,6 +1628,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl 0) {
for (int i = 0; i < valArr.length; i++) {
SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO();
@@ -1605,6 +1653,13 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
if (nowfilelist != null && !nowfilelist.isEmpty()) {
@@ -1638,6 +1693,20 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl translationfilelist = FileUnZip.readFileByFilename(filepath, translationArr[i]);
+ if (CollectionUtil.isNotEmpty(translationfilelist)) {
+ String urlTranslation = translationfilelist.get(0).getPath();
+ MultipartFile multipartFileTranslation = createMfileByPath(urlTranslation);
+ String uploadTranslation = ObsBootUtil.upload(multipartFileTranslation, "temp");
+ OSSFile ossFileTranslation = new OSSFile();
+ ossFileTranslation.setId(String.valueOf(SnowflakeUtils.snowflake()));
+ ossFileTranslation.setFileName(multipartFileTranslation.getName());
+ ossFileTranslation.setUrl(uploadTranslation);
+ ossFileService.save(ossFileTranslation);
+ valEO.setTranslation(splitUrl+uploadTranslation.replace("temp\\", ""));
+ }
+ }
} catch (Exception e) {
e.printStackTrace();
}
@@ -1645,6 +1714,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl getValList = (List) sarFileSplitItemsEO.get("itemValEOList");
String itemConditions = "";
+ String itemConditionsTranslation = "";
int ind = 1;
if (getValList != null && !getValList.isEmpty()) {
for (SarFileSplitItemsValEO valEO : getValList) {
+ String type = valEO.getType();
+ String itemContent = valEO.getItemContent();
+ String translation = valEO.getTranslation();
// 当前段内容
String valContent = "";
- if ("TEXT".equals(valEO.getType())) {
- valContent += "" + valEO.getItemContent() + "
";
- } else if ("IMG".equals(valEO.getType())) {
- valContent += "
";
-// valContent += valEO.getItemContent();
- } else if ("TABLE".equals(valEO.getType())) {
- valContent += valEO.getItemContent();
+ String valContentTranslation = "";
+ if ("TEXT".equals(type)) {
+ valContent += "" + itemContent + "
";
+ if (StringUtils.isNotBlank(translation)){
+ valContentTranslation += "" + translation + "
";
+ }
+ } else if ("IMG".equals(type)) {
+ valContent += "
";
+ if (StringUtils.isNotBlank(translation)){
+ valContentTranslation += "
";
+ }
+ } else if ("TABLE".equals(type)) {
+ valContent += itemContent;
+ if (StringUtils.isNotBlank(translation)){
+ valContentTranslation += translation;
+ }
}
itemConditions += valContent;
+ itemConditionsTranslation += valContentTranslation;
// val表信息
valEO.setId(UUIDUtils.randomUUID20());
// valEO.setItemId(itemsId);
@@ -3023,6 +3109,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl allImgList, String fileNowPath) {
for(FileSplitValImgExportDto imgExportDto : allImgList){
- String oldPath = "temp\\" + imgExportDto.getImgPath();
- String newPath = fileNowPath + File.separator + "附件" + File.separator + imgExportDto.getImgName();
-// if (MinioUtil.doesObjectExist(oldPath)){
- try (InputStream in = ObsBootUtil.getOssFile(oldPath);) {
- File file = new File(fileNowPath + File.separator + "附件");
- if (!file.exists()){
- file.mkdir();
- }
- copyFile1(in, newPath);
+ String imgName = imgExportDto.getImgName();
+ String fileName = imgExportDto.getImgPath();
+ String oldPath = getPath(fileName);
+ String newPath = fileNowPath + File.separator + "附件" + File.separator + imgName;
+ try (InputStream in = ObsBootUtil.getOssFile(oldPath)) {
+ File file = new File(fileNowPath + File.separator + "附件");
+ if (!file.exists()){
+ file.mkdir();
+ }
+ copyFile1(in, newPath);
+ } catch (IOException e) {
+ log.error(e.getMessage(), e);
+ }
+ String fileNameTranslation = imgExportDto.getImgPathTranslation();
+ if (StringUtils.isNotBlank(fileNameTranslation)){
+ String imgNameTranslation = imgName.substring(0,imgName.indexOf("."))+"translation.png";
+ String oldPathTranslation = getPath(fileNameTranslation);
+ String newPathTranslation = fileNowPath + File.separator + "附件" + File.separator + imgNameTranslation;
+ try (InputStream in = ObsBootUtil.getOssFile(oldPathTranslation)) {
+ copyFile1(in, newPathTranslation);
} catch (IOException e) {
- e.printStackTrace();
log.error(e.getMessage(), e);
}
-// }
+ }
}
+ }
+ private String getPath(String fileName){
+ if (!fileName.contains("temp")){
+ fileName = "temp\\" + fileName;
+ }
+ return fileName.replace("\\\\", "\\");
}
@Override
@@ -4182,12 +4289,15 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl ossFileList = ossFileService.getFileInfosByConnectId(connectId);
List fileNameList = new ArrayList<>();
if (ossFileList != null && !ossFileList.isEmpty()) {
@@ -4212,15 +4322,16 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl -1) {
@@ -4228,7 +4339,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl -1) {
+ content = content.substring(0,content.lastIndexOf("\n"));
+ }
+ }
+
+ if("TABLE".equals(fileSplitValExportDto.getValType())){
+ /* 连接跳转*/
+ content = fileSplitValExportDto.getValContent()+"translation";
+ CreationHelper createHelper = workbook.getCreationHelper();
+ Hyperlink hyperlink1 = createHelper.createHyperlink(HyperlinkType.DOCUMENT);
+ String tableName = "#\'"+ content + "\'!A1";
+ hyperlink1.setAddress(tableName);
+ cell2.setHyperlink(hyperlink1);// 链接
+ row1.getCell(cellNum).setCellStyle(cellStyleLink);
+ } else if ("IMG".equals(fileSplitValExportDto.getValType())) {
+ /* 连接跳转*/
+ content = fileSplitValExportDto.getValContent();
+ content = content.substring(0,content.indexOf("."))+"translation.png";
+ CreationHelper createHelper = workbook.getCreationHelper();
// Hyperlink hyperlink1 = createHelper.createHyperlink(HyperlinkType.FILE);
String imgName = content;
// hyperlink1.setAddress("附件\\" + imgName);
@@ -4249,7 +4394,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl startRow) {
for(int cellNum = 0; cellNum < fieldList.size(); cellNum++) {
- if (!"item_content".equals(fieldList.get(cellNum))) {
+ String s = fieldList.get(cellNum);
+ if (!"item_content".equals(s) && !"translation".equals(s)) {
sheetItems.addMergedRegion(new CellRangeAddress(startRow, allRow, cellNum, cellNum));
}
}
@@ -4333,6 +4480,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl") < 0) {
if (tableHtml.indexOf("") < 0) {
tableHtml = tableHtml.replaceFirst("","
");
@@ -4345,6 +4494,18 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl]*?>|<[\\s]*?\\/[\\s]*?br[\\s]*?>", cnt);
workbook = ConvertHtml2Excel.table2Excel(tableHtml,workbook,tableName);
+
+ if (StringUtils.isNotEmpty(tableHtmlTranslation) && tableHtmlTranslation.indexOf("") < 0) {
+ if (tableHtmlTranslation.indexOf("") < 0) {
+ tableHtmlTranslation = tableHtmlTranslation.replaceFirst("","
");
+ tableHtmlTranslation = tableHtmlTranslation.replaceFirst("","
");
+ } else {
+ tableHtmlTranslation = tableHtmlTranslation.replaceFirst("","");
+ tableHtmlTranslation = tableHtmlTranslation.replaceFirst("","");
+ }
+ }
+ tableHtmlTranslation = tableHtmlTranslation.replaceAll("<[\\s]*?br[^>]*?>|<[\\s]*?\\/[\\s]*?br[\\s]*?>", cnt);
+ workbook = ConvertHtml2Excel.table2Excel(tableHtmlTranslation,workbook,tableName+"translation");
// for (int r=0;r colTableList = rowtableList.get(r);
// HSSFRow tRow = sheetTable.createRow(colTableList.get(0).getRowNum()-1);