update 文档拆分导出 图片译文

This commit is contained in:
lijiarao
2024-08-01 17:37:59 +08:00
parent 61327952c7
commit 7df9803cd6
@@ -3960,18 +3960,34 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
@Override
public void downLoadImgList(List<FileSplitValImgExportDto> allImgList, String fileNowPath) {
for(FileSplitValImgExportDto imgExportDto : allImgList){
String oldPath = uploadCospath + "/" + imgExportDto.getImgPath();
String newPath = fileNowPath + File.separator + imgExportDto.getImgName();
if (MinioUtil.doesObjectExist(oldPath)){
try (InputStream in = MinioUtil.download(oldPath);) {
copyFile1(in, newPath);
String imgName = imgExportDto.getImgName();
String fileName = imgExportDto.getImgPath();
String oldPath = getPath(fileName);
String newPath = fileNowPath + File.separator + imgName;
try (InputStream in = ObsBootUtil.getOssFile(oldPath)) {
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 + 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
@@ -3979,13 +3995,10 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
for(OSSFile fileExportDto : allRelevFileList){
String oldPath = fileExportDto.getUrl();
String newPath = fileNowPath + File.separator + fileExportDto.getFileName();
if (MinioUtil.doesObjectExist(oldPath)){
try (InputStream in = MinioUtil.download(oldPath);) {
copyFile1(in, newPath);
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
try (InputStream in = ObsBootUtil.getOssFile(oldPath)) {
copyFile1(in, newPath);
} catch (IOException e) {
log.error(e.getMessage(), e);
}
}
@@ -4209,7 +4222,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
row1.getCell(cellNum).setCellStyle(cellStyleLink);
} else if ("IMG".equals(fileSplitValExportDto.getValType())) {
/* 连接跳转*/
content = fileSplitValExportDto.getValContent()+"translation";
content = fileSplitValExportDto.getValContent();
content = content.substring(0,content.indexOf("."))+"translation.png";
CreationHelper createHelper = workbook.getCreationHelper();
Hyperlink hyperlink1 = createHelper.createHyperlink(HyperlinkType.FILE);
String imgName = content;
@@ -4237,7 +4251,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
}
if (allRow > 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));
}
}