审查视图

src/main/java/com/framework/util/MessageKit.java 1.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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
 * 
 */
16
public class MessageKit {
17
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
	// 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();
	}
33 34
	public static String getMessageLocalDir(MessageType type) {
		String dirPath = PropertiesLoader.get("custom.message.localdir." + type.getName(), "/application.properties");
35 36 37 38 39 40 41
		File dir = new File(dirPath);
		if (dir == null || !dir.exists()) {
			dir.mkdirs();
		}
		return dirPath;
	}
42 43
	public static String getMessagePath(MessageType type) {
		return getMessageLocalDir(type) + "/" + getMessageName();
44 45 46 47 48 49 50
	}

	public static String getMessageName() {
		return "CN_MT2201_1P0_4604_70678920X_" + TimeUtils.getDate(new Date(), "yyyyMMddHHmmssSSS") + ".xml";
	}

}