feat():测试

yuan
yuan 2024-09-06 01:18:15 +08:00
parent 4190277076
commit 90809ec693
2 changed files with 4 additions and 4 deletions

View File

@ -100,17 +100,17 @@ public class OSSFileLoad {
System.out.println("bucket不存在"); System.out.println("bucket不存在");
return Result.error("bucket不存在"); return Result.error("bucket不存在");
} }
Boolean flag_file = ossClient.doesObjectExist(bucketName, fileClassPath+fileName+ MethodSuffix.CLASSSUFFIX); Boolean flag_file = ossClient.doesObjectExist(bucketName, fileClassPath+fileName);
if (!flag_file) { if (!flag_file) {
System.out.println("预下载文件不存在"); System.out.println("预下载文件不存在");
return Result.error("预下载文件不存在"); return Result.error("预下载文件不存在");
} }
// 本地文件下载路径 // 本地文件下载路径
String localPath = "home/class/" + fileName + MethodSuffix.CLASSSUFFIX; String localPath = "home/class/" + fileName ;
try { try {
// 从OSS下载文件 // 从OSS下载文件
InputStream inputStream = ossClient.getObject(bucketName, fileClassPath + fileName + MethodSuffix.CLASSSUFFIX).getObjectContent(); InputStream inputStream = ossClient.getObject(bucketName, fileClassPath + fileName ).getObjectContent();
File downloadFile = new File(localPath); File downloadFile = new File(localPath);
FileOutputStream outputStream = new FileOutputStream(downloadFile); FileOutputStream outputStream = new FileOutputStream(downloadFile);

View File

@ -87,7 +87,7 @@ public class ALiYunUpload {
ossClient.putObject(putObjectRequest); ossClient.putObject(putObjectRequest);
OSSFileLoad.streamingClassDownload(fileName); OSSFileLoad.streamingClassDownload(fileName);
System.out.println(fileName);
return Result.success(null,"文件"+fileName+".class"+"存储成功"); return Result.success(null,"文件"+fileName+".class"+"存储成功");
} catch (Exception e) { } catch (Exception e) {