傅行帆 пре 6 година
родитељ
комит
4f896a2197

+ 0
- 21
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/ImageServiceimpl.java Прегледај датотеку

@@ -6,9 +6,6 @@ import org.springframework.stereotype.Service;
6 6
 import org.springframework.web.multipart.MultipartFile;
7 7
 
8 8
 import java.io.ByteArrayInputStream;
9
-import java.io.File;
10
-import java.io.FileInputStream;
11
-import java.io.FileNotFoundException;
12 9
 import java.io.IOException;
13 10
 import java.util.Date;
14 11
 
@@ -43,22 +40,4 @@ public class ImageServiceimpl implements ImageServiceI {
43 40
         String url = ossClient.generatePresignedUrl(bucketName, imgName, expiration).toString();
44 41
         return url;
45 42
     }
46
-    
47
-    public static void main(String[] args) throws FileNotFoundException {
48
-        String imgName = "楼栋库模板.xlsx";
49
-        // 创建OSSClient实例
50
-        OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
51
-        // 上传
52
-        long time = System.currentTimeMillis();
53
-    
54
-        File file = new File("D:\\楼栋库模板.xlsx");
55
-        FileInputStream fileInputStream = new FileInputStream(file);
56
-        ossClient.putObject(bucketName, imgName,fileInputStream);
57
-    
58
-        // 关闭client
59
-        ossClient.shutdown();
60
-        Date expiration = new Date(time + 3600 * 1000 * 24 * 365 * 10);
61
-        String url = ossClient.generatePresignedUrl(bucketName, imgName, expiration).toString();
62
-        System.out.println(url);
63
-    }
64 43
 }