|
@@ -1,5 +1,7 @@
|
|
|
package com.gis.common.util;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.gis.common.exception.BaseRuntimeException;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.qiniu.common.QiniuException;
|
|
|
import com.qiniu.common.Zone;
|
|
@@ -55,7 +57,21 @@ public class QiniuOssUtil {
|
|
|
// 覆盖需要把ossKey放到uploadToken里
|
|
|
String upToken = auth.uploadToken(bucketName, ossFilePath);
|
|
|
Response response = uploadManager.put(localFilePath, ossFilePath, upToken);
|
|
|
- log.info("七牛云响应值:{}", response.toString());
|
|
|
+ if (response.statusCode!=200){
|
|
|
+ String errorMsg = response.toString();
|
|
|
+ log.error("七牛云响应值:{}", errorMsg);
|
|
|
+ BaseRuntimeException.isTrue(true, null, "七牛云返回上传失败: " + errorMsg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static void main(String[] args) throws QiniuException {
|
|
|
+ String localFilePath = "F:\\test\\ngin\\11.txt";
|
|
|
+ String ossFilePath = "data/owen/11.txt";
|
|
|
+ upload(localFilePath, ossFilePath);
|
|
|
+ System.out.println("11111");
|
|
|
+
|
|
|
+// getInfo(ossFilePath);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -122,14 +138,6 @@ public class QiniuOssUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) throws QiniuException {
|
|
|
- String localFilePath = "F:\\test\\ngin\\11.txt";
|
|
|
- String ossFilePath = "data/owen/11.txt";
|
|
|
- upload(localFilePath, ossFilePath);
|
|
|
- System.out.println("11111");
|
|
|
-
|
|
|
-// getInfo(ossFilePath);
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 测试demo
|