|
@@ -218,8 +218,36 @@ public class ViewController extends Controller {
|
|
|
annex_params.put("code", "1.2.8.20200820.1245.20220704114231427");
|
|
|
//附件类型1.mp4 2.pdf 3.jpeg
|
|
|
annex_params.put("annex_class_code", "3");
|
|
|
+ String filePath="http://200.200.200.59/bgdata/DJ202207A/DJ20220704A1142/BG2022070400422.jpg";
|
|
|
// DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
- saveAnnex(annex_params, "http://200.200.200.59/bgdata/DJ202207A/DJ20220704A1142/BG2022070400422.jpg");
|
|
|
+// saveAnnex(annex_params, "http://200.200.200.59/bgdata/DJ202207A/DJ20220704A1142/BG2022070400422.jpg");
|
|
|
+ OSS OSS_CLIENT = new OSSClientBuilder().build(PropKit.get("oss_endpoint"), PropKit.get("oss_accessKey"), PropKit.get("oss_secretKey"));
|
|
|
+
|
|
|
+ String fileNameStr[] = filePath.split("/");
|
|
|
+ String fileName = fileNameStr[fileNameStr.length - 1];
|
|
|
+ String fileStorePath = getFileWithUrl(filePath, fileName);
|
|
|
+ File file = new File(fileStorePath);
|
|
|
+ String key = PropKit.get("institution_id") + "/" + fileName;
|
|
|
+ InputStream inputStream = null;
|
|
|
+ try {
|
|
|
+ inputStream = new FileInputStream(fileStorePath);
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ renderText(e.toString());
|
|
|
+
|
|
|
+ }
|
|
|
+ Boolean eBoolean = OSS_CLIENT.doesObjectExist(PropKit.get("oss_bucketName"), key);
|
|
|
+ if (!eBoolean) {
|
|
|
+ OSS_CLIENT.putObject(PropKit.get("oss_bucketName"), key, inputStream);
|
|
|
+ Boolean bBoolean = OSS_CLIENT.doesObjectExist(PropKit.get("oss_bucketName"), key);
|
|
|
+ if (bBoolean) {
|
|
|
+ file.delete();
|
|
|
+// map.put("url", "https://zskk-image.oss-cn-beijing.aliyuncs.com/" + key);
|
|
|
+// map.put("name", key);
|
|
|
+// postWithParameters(SAVE_ANNEX_URL, map);
|
|
|
+ }
|
|
|
+ }
|
|
|
renderText("succ");
|
|
|
|
|
|
} catch (Exception e) {
|
|
@@ -232,31 +260,7 @@ public class ViewController extends Controller {
|
|
|
}
|
|
|
|
|
|
public void saveAnnex(Map<String, String> map, String filePath) {
|
|
|
- OSS OSS_CLIENT = new OSSClientBuilder().build(PropKit.get("oss_endpoint"), PropKit.get("oss_accessKey"), PropKit.get("oss_secretKey"));
|
|
|
-
|
|
|
- String fileNameStr[] = filePath.split("/");
|
|
|
- String fileName = fileNameStr[fileNameStr.length - 1];
|
|
|
- String fileStorePath = getFileWithUrl(filePath, fileName);
|
|
|
- File file = new File(fileStorePath);
|
|
|
- String key = PropKit.get("institution_id") + "/" + fileName;
|
|
|
- InputStream inputStream = null;
|
|
|
- try {
|
|
|
- inputStream = new FileInputStream(fileStorePath);
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- Boolean eBoolean = OSS_CLIENT.doesObjectExist(PropKit.get("oss_bucketName"), key);
|
|
|
- if (!eBoolean) {
|
|
|
- OSS_CLIENT.putObject(PropKit.get("oss_bucketName"), key, inputStream);
|
|
|
- Boolean bBoolean = OSS_CLIENT.doesObjectExist(PropKit.get("oss_bucketName"), key);
|
|
|
- if (bBoolean) {
|
|
|
- file.delete();
|
|
|
- map.put("url", "https://zskk-image.oss-cn-beijing.aliyuncs.com/" + key);
|
|
|
- map.put("name", key);
|
|
|
-// postWithParameters(SAVE_ANNEX_URL, map);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|