根据04版补全程序更新P19双写程序。
This commit is contained in:
47
src/main/java/com/zdjizhi/utils/general/FileEdit.java
Normal file
47
src/main/java/com/zdjizhi/utils/general/FileEdit.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package com.zdjizhi.utils.general;
|
||||
|
||||
import com.zdjizhi.common.FlowWriteConfig;
|
||||
import com.zdjizhi.utils.ordinary.MD5Utils;
|
||||
|
||||
import static com.zdjizhi.utils.system.FlowWriteConfigurations.judgeFileType;
|
||||
|
||||
|
||||
/**
|
||||
* 文件字段操作工具
|
||||
*/
|
||||
public class FileEdit {
|
||||
|
||||
|
||||
public static String fileUploadUrl(long cfgId,String sIp,int sPort,String dIp,int dPort,long foundTime,String account,String domain, String urlValue,String schemaType,String fileSuffix) throws Exception {
|
||||
String fileType = null;
|
||||
if (judgeFileType(getFileType(urlValue))){
|
||||
fileType = getFileType(urlValue);
|
||||
}else {
|
||||
if (schemaType.equals("HTTP")){
|
||||
fileType = "html";
|
||||
}
|
||||
if (schemaType.equals("MAIL")){
|
||||
fileType = "eml";
|
||||
}
|
||||
}
|
||||
return "http://"+ FlowWriteConfig.OOS_SERVERS+"/upload_v2"+"/"+cfgId+"/"+fileType+"/"+sIp+"/"+sPort+"/"+dIp+"/"+dPort+"/"+foundTime+"/"+account+"/"+domain+"/"+getFileName(urlValue,fileSuffix);
|
||||
}
|
||||
|
||||
public static String fileDownloadUrl( String urlValue,String fileSuffix) throws Exception {
|
||||
return "http://"+ FlowWriteConfig.OOS_SERVERS+"/download_v2"+"/"+getFileName(urlValue,fileSuffix);
|
||||
}
|
||||
|
||||
|
||||
public static String getFileType(String url){
|
||||
String[] split = url.split("\\.");
|
||||
return split[split.length-1];
|
||||
}
|
||||
|
||||
public static String getFileName(String url,String fileSuffix) throws Exception {
|
||||
String[] arr = url.split("/");
|
||||
String filename = arr[arr.length-1].substring(0,arr[arr.length-1].lastIndexOf("_"));
|
||||
String prefix = MD5Utils.md5Encode(filename);
|
||||
// String suffix = arr[arr.length-1].substring(arr[arr.length-1].lastIndexOf("_"),arr[arr.length-1].lastIndexOf("."));
|
||||
return prefix+fileSuffix;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user