|
@@ -226,6 +226,9 @@ public class OssServiceImpl implements OssService {
|
|
|
case 10:
|
|
|
RandomFilename = "file" + "/" +(sdf.format(new Date())) + "/" + now + ".zip";
|
|
|
break;
|
|
|
+ case 11:
|
|
|
+ RandomFilename = "file/nuonuo" + "/" +(sdf.format(new Date())) + "/" + now + ".pdf";
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
return RandomFilename;
|
|
@@ -287,7 +290,7 @@ public class OssServiceImpl implements OssService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String uploadWithUrl(OssRequest base, String urlString) throws Exception {
|
|
|
+ public String uploadWithUrl(OssRequest base, String urlString){
|
|
|
String path = null;
|
|
|
InputStream inputStream = null;
|
|
|
try {
|
|
@@ -295,7 +298,7 @@ public class OssServiceImpl implements OssService {
|
|
|
URLConnection con = url.openConnection();
|
|
|
//获取上传文件输入流
|
|
|
inputStream =con.getInputStream();
|
|
|
- path = uploadInputStream(inputStream,10);
|
|
|
+ path = uploadInputStream(inputStream,11);
|
|
|
|
|
|
// 关闭OSSClient。
|
|
|
//ossClient.shutdown();
|
|
@@ -303,8 +306,12 @@ public class OssServiceImpl implements OssService {
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
}finally {
|
|
|
- if (null != inputStream) {
|
|
|
- inputStream.close();
|
|
|
+ try {
|
|
|
+ if (null != inputStream) {
|
|
|
+ inputStream.close();
|
|
|
+ }
|
|
|
+ }catch (IOException e){
|
|
|
+
|
|
|
}
|
|
|
return path;
|
|
|
}
|
|
@@ -329,7 +336,12 @@ public class OssServiceImpl implements OssService {
|
|
|
try {
|
|
|
OssRequest ossRequest = new OssRequest();
|
|
|
ossRequest.setImageStatus(imageStatus);
|
|
|
- String fileName = generateRandomFilename(ossRequest) + ".jpg";
|
|
|
+ String fileName = null;
|
|
|
+ if(imageStatus<10){
|
|
|
+ fileName = generateRandomFilename(ossRequest) + ".jpg";
|
|
|
+ }else{
|
|
|
+ fileName = generateRandomFilename(ossRequest);
|
|
|
+ }
|
|
|
|
|
|
//调用oss方法实现上传
|
|
|
//第一个参数 Bucket名称
|