调整客户端获取方式
This commit is contained in:
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/huawei-obs-springboot-starter.iml" filepath="$PROJECT_DIR$/huawei-obs-springboot-starter.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.njcn.huawei.obs.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2023年09月23日 14:11
|
||||||
|
*/
|
||||||
|
public interface ExceptionConstant {
|
||||||
|
|
||||||
|
String UPLOAD_ERROR = "上传异常";
|
||||||
|
|
||||||
|
String BUCKET_ERROR ="bucket桶异常";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.njcn.huawei.obs.util;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.huawei.obs.config.HuaweiObsProperties;
|
import com.njcn.huawei.obs.config.HuaweiObsProperties;
|
||||||
|
import com.njcn.huawei.obs.constant.ExceptionConstant;
|
||||||
import com.obs.services.ObsClient;
|
import com.obs.services.ObsClient;
|
||||||
import com.obs.services.exception.ObsException;
|
import com.obs.services.exception.ObsException;
|
||||||
import com.obs.services.model.*;
|
import com.obs.services.model.*;
|
||||||
@@ -10,12 +11,9 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -94,14 +92,12 @@ public class OBSUtil {
|
|||||||
// 读取该已上传对象的URL
|
// 读取该已上传对象的URL
|
||||||
log.info("已上传对象的URL" + result.getObjectUrl());
|
log.info("已上传对象的URL" + result.getObjectUrl());
|
||||||
return result.getObjectUrl();
|
return result.getObjectUrl();
|
||||||
} catch (ObsException e) {
|
} catch (ObsException | IOException e) {
|
||||||
log.error("obs上传失败", e);
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("上传失败", e);
|
log.error("上传失败", e);
|
||||||
|
throw new RuntimeException(ExceptionConstant.UPLOAD_ERROR);
|
||||||
} finally {
|
} finally {
|
||||||
huaweiObsProperties.destroy(obsClient);
|
huaweiObsProperties.destroy(obsClient);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@@ -243,6 +239,7 @@ public class OBSUtil {
|
|||||||
log.info("Error Message: " + e.getErrorMessage());
|
log.info("Error Message: " + e.getErrorMessage());
|
||||||
log.info("Request ID:" + e.getErrorRequestId());
|
log.info("Request ID:" + e.getErrorRequestId());
|
||||||
log.info("Host ID:" + e.getErrorHostId());
|
log.info("Host ID:" + e.getErrorHostId());
|
||||||
|
throw new RuntimeException(ExceptionConstant.BUCKET_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#Generated by Maven
|
#Generated by Maven
|
||||||
#Wed Mar 08 15:30:34 CST 2023
|
#Sat Sep 23 14:16:08 CST 2023
|
||||||
version=1.0.0
|
version=1.0.0
|
||||||
groupId=com.njcn
|
groupId=com.njcn
|
||||||
artifactId=huawei-obs-springboot-starter
|
artifactId=huawei-obs-springboot-starter
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
com\njcn\huawei\obs\config\HuaweiObsProperties.class
|
com\njcn\huawei\obs\config\HuaweiObsProperties.class
|
||||||
com\njcn\Main.class
|
|
||||||
com\njcn\huawei\obs\util\OBSUtil.class
|
com\njcn\huawei\obs\util\OBSUtil.class
|
||||||
|
com\njcn\huawei\obs\constant\ExceptionConstant.class
|
||||||
|
com\njcn\Main.class
|
||||||
META-INF\spring-configuration-metadata.json
|
META-INF\spring-configuration-metadata.json
|
||||||
com\njcn\huawei\obs\config\HuaweiObsProperties$Obs.class
|
com\njcn\huawei\obs\config\HuaweiObsProperties$Obs.class
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
E:\gitea\huawei-obs-springboot-starter\src\main\java\com\njcn\huawei\obs\util\OBSUtil.java
|
E:\gitea\huawei-obs-springboot-starter\src\main\java\com\njcn\huawei\obs\util\OBSUtil.java
|
||||||
E:\gitea\huawei-obs-springboot-starter\src\main\java\com\njcn\Main.java
|
E:\gitea\huawei-obs-springboot-starter\src\main\java\com\njcn\Main.java
|
||||||
|
E:\gitea\huawei-obs-springboot-starter\src\main\java\com\njcn\huawei\obs\constant\ExceptionConstant.java
|
||||||
E:\gitea\huawei-obs-springboot-starter\src\main\java\com\njcn\huawei\obs\config\HuaweiObsProperties.java
|
E:\gitea\huawei-obs-springboot-starter\src\main\java\com\njcn\huawei\obs\config\HuaweiObsProperties.java
|
||||||
|
|||||||
Reference in New Issue
Block a user