package com.vci.client.common;
|
|
import com.vci.client.framework.delegate.SystemCfgClientDelegate;
|
import com.vci.client.ui.exception.VCIException;
|
|
/**
|
* 配置信息统一读取类
|
* <p>Title: </p>
|
* <p>Description: </p>
|
* <p>Copyright: Copyright (c) 2012</p>
|
* <p>Company: VCI</p>
|
* @author xchao
|
* @time 2013-3-20
|
* @version 1.0
|
*/
|
public class ConfigUtils extends BaseConfitUtils {
|
|
|
/**
|
* 根据KEY,从远程服务器端conf.properties中配置值
|
* <p>Description: 根据未找到相应的值,则返回KEY</p>
|
*
|
* @author xchao
|
* @time 2013-3-20
|
* @param key
|
* @return
|
*/
|
public static String getConfigValue(String key){
|
String res = key;
|
try{
|
res = new SystemCfgClientDelegate().getConfigValue(key);
|
}catch(VCIException e){
|
|
}
|
return res;
|
}
|
|
/**
|
* 在指定文件中读取配置信息
|
* 如果文件名称是一个相对路径,将先在工作目录下查找文件,
|
* 如果没有到包中查找文件,当文件或key不存在时返回""
|
* @param propertyPath 文件路径名称
|
* @param key
|
* @return
|
*/
|
// public static String getConfigValue(String propertyPath, String key){
|
// String res = "";
|
// try{
|
// res = new SystemCfgClientDelegate().getConfigValue(propertyPath, key);
|
// }catch(VCIException e){
|
// e.printStackTrace();
|
// }
|
// return res;
|
// }
|
|
/**
|
* 将导入文件Excel第几列数字转换成字母
|
* 仅支持1--701,转换为 A--Z,AA--ZY
|
*
|
* @param input 传递过来的第几列数字,如 1,2,...,701;
|
* @return 字符A, B, C,..., Z, AA, AB, ...,ZY
|
*/
|
public static String numToLetter(int input) {
|
String res = "";
|
int n = input / 26;
|
int m = input / 27;
|
int M = input % 26;
|
if (n <= 1 && m == 0){
|
res += ""+(char) (input +64);
|
}else if ( n >= 1 && n <= 26 && M != 0){
|
res += ""+(char) (n + 64) + ""+(char) (input - n*26 +64);
|
}else if(n >= 1 && n <= 26 && M == 0){
|
res += ""+(char) (n-1 + 64) + ""+(char) (input - (n-1)*26 +64);
|
}
|
return res;
|
}
|
}
|