CustomMessageKit.java
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.framework.util;
import java.io.File;
import java.util.Date;
/**
* Depiction:
* <p>
* Modify:
* <p>
* Author: William Lynn
* <p>
* Create Date:2018年6月7日 下午3:45:16
*
*/
public class CustomMessageKit {
// smb://mrz:vmvnv1v2VV@10.50.3.61/nms_customs_xml2/
public static String getMessageSmbRemoteDir() {
StringBuilder sb = new StringBuilder();
sb.append("smb://");
String username = PropertiesLoader.get("custom.message.username", "/application.properties");
sb.append(username + ":");
String password = PropertiesLoader.get("custom.message.password", "/application.properties");
sb.append(password + "@");
String server = PropertiesLoader.get("custom.message.server", "/application.properties");
sb.append(server + "/");
String remotedir = PropertiesLoader.get("custom.message.remotedir", "/application.properties");
sb.append(remotedir + "/");
return sb.toString();
}
public static String getMessageLocalDir() {
String dirPath = PropertiesLoader.get("custom.message.localdir", "/application.properties");
File dir = new File(dirPath);
if (dir == null || !dir.exists()) {
dir.mkdirs();
}
return dirPath;
}
public static String getMessagePath(String prefix) {
return getMessageLocalDir() + "/" + prefix + "_" + getMessageName();
}
// public static String getMessagePath() {
// return getMessageLocalDir() + "/" + getMessageName();
// }
public static String getMessageName() {
return "CN_MT2201_1P0_4604_70678920X_" + TimeUtils.getDate(new Date(), "yyyyMMddHHmmssSSS") + ".xml";
}
}