feat: 带文件导出PDF带水印
This commit is contained in:
@@ -26,13 +26,4 @@ public interface IOSSFileService extends IService<OSSFile> {
|
||||
void updateFileInfo(List<OSSFile> ossFileList);
|
||||
|
||||
OSSFile uploadLocalOfCos(MultipartFile mf, String bizPath, String state, String cut);
|
||||
|
||||
|
||||
/**
|
||||
* 获取文件内容
|
||||
* @param file
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
byte[] getMinioFileContent(OSSFile file) throws Exception;
|
||||
}
|
||||
|
||||
-22
@@ -332,26 +332,4 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
|
||||
oSSFile.setUrl(null);
|
||||
return oSSFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getMinioFileContent(OSSFile file) throws Exception {
|
||||
String fileUrl = file.getUrl();
|
||||
String minioUrl = MinioUtil.getMinioUrl();
|
||||
minioUrl = minioUrl + MinioUtil.getBucketName() + "/";
|
||||
String url = fileUrl.replace(minioUrl, "");
|
||||
|
||||
try (InputStream inputStream = MinioUtil.getMinioFile(MinioUtil.getBucketName(), url);
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()
|
||||
) {
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = inputStream.read(buf)) > 0) {
|
||||
outputStream.write(buf, 0, len);
|
||||
}
|
||||
return outputStream.toByteArray();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user