Commit f411eff0 by s_guodong

update

parent 32582570
......@@ -72,25 +72,6 @@ public class ValidatorUtil {
if (bigDecimal.length() > max) {
return "参数校验错误[" + message + "]";
}
if (f.isAnnotationPresent(DecimalLength.class)) {
DecimalLength annotation = f.getAnnotation(DecimalLength.class);
int i = bigDecimal.indexOf(".");
if (i > -1) {
String substring = bigDecimal.substring(i + 1);
if (substring.length() > annotation.value()) {
return "参数校验错误[" + annotation.message() + "]";
}
String integerString = bigDecimal.substring(0, i);
if (integerString.length() > annotation.zsvalue() && annotation.zsvalue() > 0) {
return "参数校验错误[" + annotation.zsmessage() + "]";
}
} else {
if (annotation.zsvalue() > 0 && bigDecimal.length() > annotation.zsvalue()) {
return "参数校验错误[" + annotation.zsmessage() + "]";
}
}
}
} else if (type.isAssignableFrom(Integer.TYPE) || type.isAssignableFrom(Integer.class)) {
int min = length.min();
String stringValue = String.valueOf(o);
......@@ -99,7 +80,25 @@ public class ValidatorUtil {
}
}
}
}
if (f.isAnnotationPresent(DecimalLength.class)) {
String bigDecimal = ((BigDecimal) o).toPlainString();
DecimalLength annotation = f.getAnnotation(DecimalLength.class);
int i = bigDecimal.indexOf(".");
if (i > -1) {
String substring = bigDecimal.substring(i + 1);
if (substring.length() > annotation.value()) {
return "参数校验错误[" + annotation.message() + "]";
}
String integerString = bigDecimal.substring(0, i);
if (integerString.length() > annotation.zsvalue() && annotation.zsvalue() > 0) {
return "参数校验错误[" + annotation.zsmessage() + "]";
}
} else {
if (annotation.zsvalue() > 0 && bigDecimal.length() > annotation.zsvalue()) {
return "参数校验错误[" + annotation.zsmessage() + "]";
}
}
}
if (f.isAnnotationPresent(NotEmpty.class) && type.isAssignableFrom(String.class)) {
NotEmpty annotation = f.getAnnotation(NotEmpty.class);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment