Commit 48ea6d30 authored by huyuchen's avatar huyuchen

薪资审核页面接口修改

parent 29b53fd9
...@@ -18,6 +18,7 @@ import java.time.LocalDate; ...@@ -18,6 +18,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.regex.Pattern;
/** /**
* @Author fxj * @Author fxj
...@@ -266,7 +267,7 @@ public class ExcelUtil <T> implements Serializable { ...@@ -266,7 +267,7 @@ public class ExcelUtil <T> implements Serializable {
//如果是需要从字典表取值数据的话在这里处理即可 //如果是需要从字典表取值数据的话在这里处理即可
if (Common.isNotNull(attr.readConverterExp())) { if (Common.isNotNull(attr.readConverterExp())) {
tempStr= reverseByExp( c, attr.readConverterExp()); tempStr= reverseByExp( c, attr.readConverterExp());
if (Common.isEmpty(tempStr)){ if (Common.isEmpty(tempStr)){
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "未找到:" + c + "的字典数据"), errorTemp); errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(rowNum, "未找到:" + c + "的字典数据"), errorTemp);
continue; continue;
...@@ -689,13 +690,21 @@ public class ExcelUtil <T> implements Serializable { ...@@ -689,13 +690,21 @@ public class ExcelUtil <T> implements Serializable {
return errorInfo(attr, "_小于最小值", i); return errorInfo(attr, "_小于最小值", i);
} }
}else{ }else{
if (Float.valueOf(c).intValue() < attr.min()) { if (String.valueOf(Float.valueOf(c).intValue()).length() < attr.min()) {
return errorInfo(attr, "_小于最小值", i); return errorInfo(attr, "_长度小于" + Float.valueOf(attr.min()).intValue() + "位", i);
} }
} }
} else { } else {
return errorInfo(attr, "_必须为数字且最多两位小数", i); return errorInfo(attr, "_必须为数字且最多两位小数", i);
} }
} else if (attr.min() == 0) {
if (Common.isNumber(c)) {
if (attr.isFloat()){
if (Float.valueOf(c).compareTo(attr.min()) < CommonConstants.ZERO_INT) {
return errorInfo(attr, "_小于最小值", i);
}
}
}
} }
} }
return null; return null;
...@@ -821,6 +830,17 @@ public class ExcelUtil <T> implements Serializable { ...@@ -821,6 +830,17 @@ public class ExcelUtil <T> implements Serializable {
} }
//校验字段是否符合要求 返回错误信息 //校验字段是否符合要求 返回错误信息
error = validateUtil(c, attr, i + 2); error = validateUtil(c, attr, i + 2);
if (null == error && attr.isDate() && Common.isNotNull(c)) {
c.replace("/","-").replace(CommonConstants.YEAR,"-")
.replace(CommonConstants.MONTH,"-").replace(CommonConstants.DAY,"");
Pattern pattern = Pattern.compile("[0-9]*");
if (pattern.matcher(c).matches()) {
StringBuilder sb = new StringBuilder(c);
sb.insert(4, "-");
sb.insert(7,"-");
c = sb.toString();
}
}
if (null != error) { if (null != error) {
errorList.add(new ErrorMessage(i + 2, error)); errorList.add(new ErrorMessage(i + 2, error));
errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(i + 2, error), errorTemp); errorMessageHashMap = initErrorMessage(errorMessageHashMap, new ErrorMessage(i + 2, error), errorTemp);
......
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