//转换成Integer类型
public static Integer TryParseToInteger(Object obj, String name) throws ApiSrvException {
Integer result = null;
if (obj != null&&!obj.equals("")) {
try {
result = Integer.valueOf(obj.toString());
}catch (Exception ex){
throw new ApiSrvException(name + "类型转换失败", ExCode.MSG_RESOLVE_ERR, new IllegalArgumentException());
}
}
return result;
}
//转换成BigDecimal类型
public static BigDecimal TryParseToBigDecimal(Object obj, String name) throws ApiSrvException {
BigDecimal result = null;
if (obj != null&&!obj.equals("")) {
try {
result = new BigDecimal(obj.toString());
} catch (Exception ex){
throw new ApiSrvException(name + "类型转换失败", ExCode.MSG_RESOLVE_ERR, new IllegalArgumentException());
}
}