LAPTOP-5NTQJPUS\LT 8 months ago
parent
commit
5a1b3fad33

+ 50 - 50
DataFusion/src/com/zskk/service/DataService.java

@@ -74,56 +74,56 @@ public class DataService {
      * @param instutionId
      * @param number
      */
-    public void saveAnnex(Map <String,String> map, String filePath) {
-    	String newUrl = filePath.replaceAll("\\\\", "/") ;
-    	String fileNameStr[] = newUrl.split("/"); 
-        String fileName = fileNameStr[fileNameStr.length-1];
-        String fileStorePath =getFileWithUrl(newUrl, fileName);
-    	File file =new File(fileStorePath);
-        String eTag = getFileMd5(file); 
-        String key = PropKit.get("institution_id")+"/"+eTag+".pdf"; 
-
-        Boolean eBoolean = OSS_CLIENT.doesObjectExist(PropKit.get("oss_bucketName"), key);
-        if (!eBoolean) {
-        	OSS_CLIENT.putObject(PropKit.get("oss_bucketName"), key, file);
-            Boolean bBoolean = OSS_CLIENT.doesObjectExist(PropKit.get("oss_bucketName"), key);
-            if (bBoolean) {
-            	file.delete();
-            	map.put("url", "https://annex.oss.cn-north-3.inspurcloudoss.com/"+key);
-            	map.put("name", key);
-        		postWithParameters(SAVE_ANNEX_URL, map);
-			}
-		}
-		
-	}
-    
-    private String getFileMd5(File file) {
-    	StringBuffer sb = new StringBuffer("");
-        try {
-            MessageDigest md = MessageDigest.getInstance("MD5");
-            md.update(FileUtils.readFileToByteArray(file));
-            byte b[] = md.digest();
-            int d;
-            for (int i = 0; i < b.length; i++) {
-                d = b[i];
-                if (d < 0) {
-                    d = b[i] & 0xff;
-                    // 与上一行效果等同
-                    // i += 256;
-                }
-                if (d < 16)
-                    sb.append("0");
-                sb.append(Integer.toHexString(d));
-            }
-        	System.out.println(sb);
-
-        } catch (NoSuchAlgorithmException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        return sb.toString();
-	}
+//    public void saveAnnex(Map <String,String> map, String filePath) {
+//    	String newUrl = filePath.replaceAll("\\\\", "/") ;
+//    	String fileNameStr[] = newUrl.split("/"); 
+//        String fileName = fileNameStr[fileNameStr.length-1];
+//        String fileStorePath =getFileWithUrl(newUrl, fileName);
+//    	File file =new File(fileStorePath);
+//        String eTag = getFileMd5(file); 
+//        String key = PropKit.get("institution_id")+"/"+eTag+".pdf"; 
+//
+//        Boolean eBoolean = OSS_CLIENT.doesObjectExist(PropKit.get("oss_bucketName"), key);
+//        if (!eBoolean) {
+//        	OSS_CLIENT.putObject(PropKit.get("oss_bucketName"), key, file);
+//            Boolean bBoolean = OSS_CLIENT.doesObjectExist(PropKit.get("oss_bucketName"), key);
+//            if (bBoolean) {
+//            	file.delete();
+//            	map.put("url", "https://annex.oss.cn-north-3.inspurcloudoss.com/"+key);
+//            	map.put("name", key);
+//        		postWithParameters(SAVE_ANNEX_URL, map);
+//			}
+//		}
+//		
+//	}
+//    
+//    private String getFileMd5(File file) {
+//    	StringBuffer sb = new StringBuffer("");
+//        try {
+//            MessageDigest md = MessageDigest.getInstance("MD5");
+//            md.update(FileUtils.readFileToByteArray(file));
+//            byte b[] = md.digest();
+//            int d;
+//            for (int i = 0; i < b.length; i++) {
+//                d = b[i];
+//                if (d < 0) {
+//                    d = b[i] & 0xff;
+//                    // 与上一行效果等同
+//                    // i += 256;
+//                }
+//                if (d < 16)
+//                    sb.append("0");
+//                sb.append(Integer.toHexString(d));
+//            }
+//        	System.out.println(sb);
+//
+//        } catch (NoSuchAlgorithmException e) {
+//            e.printStackTrace();
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//        }
+//        return sb.toString();
+//	}
     
     public static String postWithParameters(String url, Map<String, String> map) {
     	

+ 7 - 7
DataFusion/src/com/zskk/task/DataTask.java

@@ -79,13 +79,13 @@ public class DataTask implements ITask {
 			tService.execute(() -> {
 				dService.saveReport(params);
 			});	
-			Map<String, String> annex_params = new HashMap<>();
-			annex_params.put("institution_id", PropKit.get("institution_id"));
-			annex_params.put("type", "1");
-			annex_params.put("code", jsonObject.getString("id"));
-			//附件类型1.mp4 2.pdf 3.jpeg
-			annex_params.put("annex_class_code", "2");
-      		dService.saveAnnex(annex_params, record.getStr("PDF"));
+//			Map<String, String> annex_params = new HashMap<>();
+//			annex_params.put("institution_id", PropKit.get("institution_id"));
+//			annex_params.put("type", "1");
+//			annex_params.put("code", jsonObject.getString("id"));
+//			//附件类型1.mp4 2.pdf 3.jpeg
+//			annex_params.put("annex_class_code", "2");
+//      		dService.saveAnnex(annex_params, record.getStr("PDF"));
         }
 	}
 

+ 8 - 8
DataFusion/src/com/zskk/task/UpdateTask.java

@@ -21,14 +21,14 @@ public class UpdateTask implements ITask {
 		// TODO Auto-generated method stub
 		List<Record> records = Db.use("connected").find("select * from reportinfo where REPORTDATE>?",parseStringToDate());
 		for (Record record : records) {
-			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", record.getStr("STUDYUID"));
-			//附件类型1.mp4 2.pdf 3.jpeg
-			annex_params.put("annex_class_code", "2");
-			DataService dService = ServiceFactory.getService(DataService.class);
-      		dService.saveAnnex(annex_params, record.getStr("PDF"));
+//			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", record.getStr("STUDYUID"));
+//			//附件类型1.mp4 2.pdf 3.jpeg
+//			annex_params.put("annex_class_code", "2");
+//			DataService dService = ServiceFactory.getService(DataService.class);
+//      		dService.saveAnnex(annex_params, record.getStr("PDF"));
 		}
 
 	}