导入excel整形值校验优化

This commit is contained in:
RuoYi 2020-09-17 18:22:50 +08:00
parent a948affb2d
commit 497f98ba90

View File

@ -243,19 +243,19 @@ public class ExcelUtil<T>
val = Convert.toStr(val); val = Convert.toStr(val);
} }
} }
else if ((Integer.TYPE == fieldType) || (Integer.class == fieldType)) else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val)))
{ {
val = Convert.toInt(val); val = Convert.toInt(val);
} }
else if ((Long.TYPE == fieldType) || (Long.class == fieldType)) else if (Long.TYPE == fieldType || Long.class == fieldType)
{ {
val = Convert.toLong(val); val = Convert.toLong(val);
} }
else if ((Double.TYPE == fieldType) || (Double.class == fieldType)) else if (Double.TYPE == fieldType || Double.class == fieldType)
{ {
val = Convert.toDouble(val); val = Convert.toDouble(val);
} }
else if ((Float.TYPE == fieldType) || (Float.class == fieldType)) else if (Float.TYPE == fieldType || Float.class == fieldType)
{ {
val = Convert.toFloat(val); val = Convert.toFloat(val);
} }