添加读取资源文件功能

main
seaon 2 months ago
parent 8132f8174f
commit 28f621551a

@ -13,10 +13,13 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import weaver.conn.RecordSetTrans;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.company.DepartmentComInfo;
import weaver.soa.workflow.request.*;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.time.ZoneOffset;
import java.util.*;
import java.util.stream.Collectors;
@ -1037,6 +1040,33 @@ public class CommonUtil {
}
}
/**
*
*
* @param propFile
* @param itemName
* @param defaultInfo
* @param value
* @return
*/
public static String readResource(String propFile,String itemName,int language,String defaultInfo,Object...value) {
String str_res = "";
String charsetName = new BaseBean().getPropValue(propFile, "charsetName");
try {
if ("".equals(charsetName))
charsetName = "UTF-8";
str_res = new String(Util.null2String(new BaseBean().getPropValue(propFile, itemName)).trim().getBytes(charsetName), "GBK");
if (value.length > 0) {
for (int i = 0; i < value.length; i++) {
str_res = str_res.replace("$" + i + "$", value[i].toString());
}
}
} catch (Exception ex) {
return defaultInfo;
}
return str_res;
}
/**
* id
* @return

Loading…
Cancel
Save