From f9b62ae9277b9ede21989399fcc06d6f6f939861 Mon Sep 17 00:00:00 2001
From: yjz <3131811435@qq.com>
Date: Fri, 2 Aug 2024 18:25:47 +0800
Subject: [PATCH] =?UTF-8?q?fix(=E6=A0=87=E5=87=86=E6=8B=86=E5=88=86):=20?=
=?UTF-8?q?=E5=9B=BE=E7=89=87=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98=E4=BF=AE?=
=?UTF-8?q?=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../split/service/impl/FileSpiltService.java | 20 ++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java
index a2838f68..c96d3552 100644
--- a/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java
+++ b/laws-modules/src/main/java/com/jero/modules/split/service/impl/FileSpiltService.java
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.IntekeyUtils;
+import com.jero.common.util.SnowflakeUtils;
import com.jero.common.util.UUIDUtils;
import com.jero.common.util.obs.ObsBootUtil;
import com.jero.modules.laws.documenttool.mapper.DocumentSplitMapper;
@@ -94,6 +95,8 @@ public class FileSpiltService {
private ILawsDomesticStandardService lawsDomesticStandardService;
@Autowired
private ILawsEnterpriseStandardService lawsEnterpriseStandardService;
+ @Autowired
+ private IOSSFileService ossFileService;
@Value("${jero.path.upload}")
private String filePath;
@@ -944,13 +947,20 @@ public class FileSpiltService {
XWPFPictureData pictureData = p.getDocument().getPictureDataByID(pictureId);
String imageName = UUIDUtils.randomUUID10() + pictureData.getFileName();
byte[] bytev = pictureData.getData();
- String filepathandname = filePathCos + "/" + imageName;
+// String filepathandname = filePathCos + "/" + imageName;
try {
- String path = splitUrl+imageName;
+// String path = splitUrl+imageName;
// MinioUtil.uploadByte(bytev, filepathandname);
- ObsBootUtil.upload(new ByteArrayInputStream(bytev), filepathandname);
- String imgCon = path;
- String imgConVal = "
";
+ InputStream inputStream = new ByteArrayInputStream(bytev);
+ MultipartFile file = new MockMultipartFile(imageName, imageName,ContentType.APPLICATION_OCTET_STREAM.toString(),inputStream);
+ String upload = ObsBootUtil.upload(file, "temp");
+ OSSFile ossFile = new OSSFile();
+ ossFile.setId(String.valueOf(SnowflakeUtils.snowflake()));
+ ossFile.setFileName(file.getName());
+ ossFile.setUrl(upload);
+ ossFileService.save(ossFile);
+ String imgCon = splitUrl+upload.replace("temp\\", "");
+ String imgConVal = "
";
message.getItemsCondi().add(imgConVal);
message.setItemContent(message.getItemContent() + imgConVal);
itemsValList.add(getSplitItemsValObject(message.getId(), SplitFilePragraTypeEnum.IMG.getValue(), imgCon, message.getItemsCondi().size(), null));