刘韬 3 年之前
父節點
當前提交
20093ab108
共有 2 個文件被更改,包括 30 次插入2 次删除
  1. 22 0
      DataFusion/src/com/zskk/control/ViewController.java
  2. 8 2
      DataFusion/src/com/zskk/service/DataService.java

+ 22 - 0
DataFusion/src/com/zskk/control/ViewController.java

@@ -1,5 +1,6 @@
 package com.zskk.control;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -202,6 +203,27 @@ public class ViewController extends Controller {
 
 	}
 	
+	public void dld() {
+		try {
+			Map<String, String> annex_params = new HashMap<>();
+			annex_params.put("institution_id", PropKit.get("institution_id"));
+			annex_params.put("type", "4");
+			annex_params.put("code", "1.2.8.20200820.1245.20220704114231427");
+			//附件类型1.mp4 2.pdf 3.jpeg
+			annex_params.put("annex_class_code", "3");
+			DataService dService = ServiceFactory.getService(DataService.class);
+	  		dService.saveAnnex(annex_params, "http://200.200.200.59/bgdata/DJ202207A/DJ20220704A1142/BG2022070400422.jpg");
+			renderText("succ");
+
+		} catch (Exception e) {
+			// TODO: handle exception
+			renderText(e.toString());
+
+		}
+		
+		
+	}
+	
 	public static DruidPlugin createConnectedDruidPlugin() {
 
 		return new DruidPlugin(PropKit.get("jdbcUrl_connected"), PropKit.get("user_connected"),PropKit.get("password_connected").trim());

+ 8 - 2
DataFusion/src/com/zskk/service/DataService.java

@@ -116,7 +116,7 @@ public class DataService {
 	 * @param number
 	 * @throws FileNotFoundException 
 	 */
-	public void saveAnnex(Map<String, String> map, String filePath) throws FileNotFoundException {
+	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("/");
@@ -124,7 +124,13 @@ public class DataService {
 		String fileStorePath = getFileWithUrl(filePath, fileName);
 		File file = new File(fileStorePath);
 		String key = PropKit.get("institution_id") + "/" + fileName;
-        InputStream inputStream = new FileInputStream(fileStorePath);            
+        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);