fix(文档拆分): 图片上传问题修复
This commit is contained in:
+4
-6
@@ -19,9 +19,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
@@ -169,22 +167,22 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 将文件上传至腾讯云 cos
|
||||
MinioUtil.upload(mf, filePath);
|
||||
String upload = MinioUtil.upload(mf, "/" + uploadCospath);
|
||||
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//存入文件表
|
||||
oSSFile.setFileName(orgName);
|
||||
oSSFile.setId(UuidUtils.getUUID());
|
||||
oSSFile.setUrl(filePath);
|
||||
oSSFile.setCreateBy(loginUser.getUsername());
|
||||
oSSFile.setCreateTime(new Date());
|
||||
this.save(oSSFile);
|
||||
// 文件路径做特殊处理
|
||||
// BASE64Encoder base64Encoder = new BASE64Encoder();
|
||||
// String encode = base64Encoder.encode(filePath.getBytes(StandardCharsets.UTF_8));
|
||||
String imgUrl = splitUrl + filePath;
|
||||
oSSFile.setUrl(imgUrl);
|
||||
String imgUrl = upload.split("/")[1];
|
||||
oSSFile.setUrl(splitUrl + imgUrl);
|
||||
return oSSFile;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user