|
@@ -219,44 +219,37 @@ public class ViewController extends Controller {
|
|
|
//附件类型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");
|
|
|
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);
|
|
|
- }
|
|
|
- }
|
|
|
+// 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();
|
|
|
+// }
|
|
|
+// }
|
|
|
renderText("succ");
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
// TODO: handle exception
|
|
|
renderText(e.toString());
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void saveAnnex(Map<String, String> map, String filePath) {
|