excel导入数字不需要格式化,导入允许列和属性个数不一致。

This commit is contained in:
RuoYi 2020-07-23 21:54:53 +08:00
parent 865d5114f0
commit 6e990603ca
3 changed files with 13 additions and 13 deletions

View File

@ -41,8 +41,8 @@ public class DictUtils
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(cacheObj))
{
List<SysDictData> DictDatas = StringUtils.cast(cacheObj);
return DictDatas;
List<SysDictData> dictDatas = StringUtils.cast(cacheObj);
return dictDatas;
}
return null;
}

View File

@ -8,7 +8,6 @@ import java.io.OutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@ -200,9 +199,12 @@ public class ExcelUtil<T>
// 设置类的私有字段属性可访问.
field.setAccessible(true);
Integer column = cellMap.get(attr.name());
if (column != null)
{
fieldsMap.put(column, field);
}
}
}
for (int i = 1; i < rows; i++)
{
// 从第2行开始取数据,默认第一行是表头.
@ -894,14 +896,7 @@ public class ExcelUtil<T>
}
else
{
if ((Double) val % 1 > 0)
{
val = new DecimalFormat("0.00").format(val);
}
else
{
val = new DecimalFormat("0").format(val);
}
val = new BigDecimal(val.toString()); // 浮点格式处理
}
}
else if (cell.getCellTypeEnum() == CellType.STRING)

View File

@ -11,6 +11,11 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.tool.gen.domain.GenTable;
import com.ruoyi.project.tool.gen.domain.GenTableColumn;
/**
* 模板处理工具类
*
* @author ruoyi
*/
public class VelocityUtils
{
/** 项目空间路径 */