From 0176fa59653ca24db2149d7e0948c508912e491b Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 07 十一月 2023 16:02:04 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/crm/common/service/OssService.java |   41 ++++++++++++++++-------------------------
 1 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/src/main/java/com/zy/crm/common/service/OssService.java b/src/main/java/com/zy/crm/common/service/OssService.java
index c947e85..7695aa6 100644
--- a/src/main/java/com/zy/crm/common/service/OssService.java
+++ b/src/main/java/com/zy/crm/common/service/OssService.java
@@ -1,7 +1,6 @@
 package com.zy.crm.common.service;
 
 import com.aliyun.oss.OSSClient;
-import com.aliyun.oss.model.OSSObject;
 import com.aliyun.oss.model.ObjectMetadata;
 import com.aliyun.oss.model.PutObjectRequest;
 import com.aliyun.oss.model.PutObjectResult;
@@ -12,20 +11,12 @@
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.core.io.InputStreamResource;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 
 import java.io.*;
 import java.net.URL;
-import java.nio.file.Path;
 import java.text.SimpleDateFormat;
 import java.util.Date;
-import java.nio.file.StandardCopyOption;
-import java.nio.file.Files;
-import java.nio.file.Paths;
 
 /**
  * 闃块噷浜慜SS鏈嶅姟绫�
@@ -37,7 +28,7 @@
 
     private static Logger log = LoggerFactory.getLogger(OssService.class);
 
-    private static final String OSS_ENDPOINT = "http://zhongyang-ftpserver.oss-cn-hangzhou-internal.aliyuncs.com";
+//    private static final String OSS_ENDPOINT = "http://oss-cn-hangzhou-internal.aliyuncs.com";
 
     @Value("${aliyun.oss.id}")
     private String accessKeyId;
@@ -49,7 +40,7 @@
     private String bucket;
 
     @Value("${aliyun.oss.endpoint}")
-    private String endpoint;
+    private String OSS_ENDPOINT;
 
     @Autowired
     private SnowflakeIdWorker snowflakeIdWorker;
@@ -192,20 +183,20 @@
     }
 
     public static void main(String[] args) {
-        File file = new File("E:\\tmp\\v2-fbbb97b977b5cebc66dc3cefab0ac981_r.jpg");
-        try {
-            InputStream in = new FileInputStream(file);
-            OssService ossService = new OssService();
-            ossService.setAccessKeyId("LTAI4GDzr6ioSHuRw2mk22ug");
-            ossService.setAccessKeySecret("84CHL7tF21LbU1qpaP0jn9mIAZP9bv");
-            ossService.setBucket("tjdt");
-            ossService.setEndpoint("http://oss-cn-hangzhou.aliyuncs.com");
-            ossService.setSnowflakeIdWorker(new SnowflakeIdWorker());
-            System.out.println(ossService.upload(in));
-
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        }
+//        File file = new File("E:\\tmp\\v2-fbbb97b977b5cebc66dc3cefab0ac981_r.jpg");
+//        try {
+//            InputStream in = new FileInputStream(file);
+//            OssService ossService = new OssService();
+//            ossService.setAccessKeyId("LTAI4GDzr6ioSHuRw2mk22ug");
+//            ossService.setAccessKeySecret("84CHL7tF21LbU1qpaP0jn9mIAZP9bv");
+//            ossService.setBucket("tjdt");
+//            ossService.setEndpoint("http://oss-cn-hangzhou.aliyuncs.com");
+//            ossService.setSnowflakeIdWorker(new SnowflakeIdWorker());
+//            System.out.println(ossService.upload(in));
+//
+//        } catch (FileNotFoundException e) {
+//            e.printStackTrace();
+//        }
     }
 
 }

--
Gitblit v1.9.1