|
@@ -50,8 +50,8 @@ public class OssClient {
|
|
|
|
|
|
return ossFileUrl;
|
|
|
} catch (Exception e) {
|
|
|
- log.error("OSS文件上传异常!{}", e.getMessage());
|
|
|
- throw new StatusException("OSS文件上传异常!");
|
|
|
+ log.error("文件上传异常! ossFilePath:{} err:{}", ossFilePath, e.getMessage());
|
|
|
+ throw new StatusException("文件上传异常!");
|
|
|
} finally {
|
|
|
try {
|
|
|
ossClient.shutdown();
|
|
@@ -79,8 +79,8 @@ public class OssClient {
|
|
|
|
|
|
return ossFileUrl;
|
|
|
} catch (Exception e) {
|
|
|
- log.error("OSS文件上传异常!{}", e.getMessage());
|
|
|
- throw new StatusException("OSS文件上传异常!");
|
|
|
+ log.error("文件上传异常! ossFilePath:{} err:{}", ossFilePath, e.getMessage());
|
|
|
+ throw new StatusException("文件上传异常!");
|
|
|
} finally {
|
|
|
try {
|
|
|
ossClient.shutdown();
|
|
@@ -98,8 +98,8 @@ public class OssClient {
|
|
|
GetObjectRequest request = new GetObjectRequest(properties.getAliyunBucketName(), ossFilePath);
|
|
|
ossClient.getObject(request, toFile);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("OSS文件下载异常!{}", e.getMessage());
|
|
|
- throw new StatusException("OSS文件下载异常!");
|
|
|
+ log.error("文件下载异常! ossFilePath:{} err:{}", ossFilePath, e.getMessage());
|
|
|
+ throw new StatusException("文件下载异常!");
|
|
|
} finally {
|
|
|
try {
|
|
|
ossClient.shutdown();
|
|
@@ -132,8 +132,8 @@ public class OssClient {
|
|
|
|
|
|
return bos.toByteArray();
|
|
|
} catch (Exception e) {
|
|
|
- log.error("OSS文件下载异常!{}", e.getMessage());
|
|
|
- throw new StatusException("OSS文件下载异常!");
|
|
|
+ log.error("文件下载异常! ossFilePath:{} err:{}", ossFilePath, e.getMessage());
|
|
|
+ throw new StatusException("文件下载异常!");
|
|
|
} finally {
|
|
|
try {
|
|
|
ossClient.shutdown();
|
|
@@ -156,7 +156,10 @@ public class OssClient {
|
|
|
* 3、每秒最多50次请求
|
|
|
*/
|
|
|
public void refreshCDNCache(String ossFileUrls) {
|
|
|
- DefaultProfile profile = DefaultProfile.getProfile("oss-cn-shenzhen",
|
|
|
+ // 默认OSS区域ID,注意要和“外网Endpoint”保持一致(后续改为可配置!)
|
|
|
+ final String regionId = "oss-cn-shenzhen";
|
|
|
+
|
|
|
+ DefaultProfile profile = DefaultProfile.getProfile(regionId,
|
|
|
properties.getAccessKeyId(), properties.getAccessKeySecret());
|
|
|
IAcsClient client = new DefaultAcsClient(profile);
|
|
|
|