excel导入数字不需要格式化,导入允许列和属性个数不一致。
This commit is contained in:
parent
865d5114f0
commit
6e990603ca
@ -41,8 +41,8 @@ public class DictUtils
|
|||||||
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
|
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
|
||||||
if (StringUtils.isNotNull(cacheObj))
|
if (StringUtils.isNotNull(cacheObj))
|
||||||
{
|
{
|
||||||
List<SysDictData> DictDatas = StringUtils.cast(cacheObj);
|
List<SysDictData> dictDatas = StringUtils.cast(cacheObj);
|
||||||
return DictDatas;
|
return dictDatas;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import java.io.OutputStream;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -200,7 +199,10 @@ public class ExcelUtil<T>
|
|||||||
// 设置类的私有字段属性可访问.
|
// 设置类的私有字段属性可访问.
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
Integer column = cellMap.get(attr.name());
|
Integer column = cellMap.get(attr.name());
|
||||||
fieldsMap.put(column, field);
|
if (column != null)
|
||||||
|
{
|
||||||
|
fieldsMap.put(column, field);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 1; i < rows; i++)
|
for (int i = 1; i < rows; i++)
|
||||||
@ -692,7 +694,7 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
return StringUtils.stripEnd(propertyString.toString(), separator);
|
return StringUtils.stripEnd(propertyString.toString(), separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析字典值
|
* 解析字典值
|
||||||
*
|
*
|
||||||
@ -894,14 +896,7 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((Double) val % 1 > 0)
|
val = new BigDecimal(val.toString()); // 浮点格式处理
|
||||||
{
|
|
||||||
val = new DecimalFormat("0.00").format(val);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
val = new DecimalFormat("0").format(val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cell.getCellTypeEnum() == CellType.STRING)
|
else if (cell.getCellTypeEnum() == CellType.STRING)
|
||||||
|
@ -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.GenTable;
|
||||||
import com.ruoyi.project.tool.gen.domain.GenTableColumn;
|
import com.ruoyi.project.tool.gen.domain.GenTableColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板处理工具类
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
public class VelocityUtils
|
public class VelocityUtils
|
||||||
{
|
{
|
||||||
/** 项目空间路径 */
|
/** 项目空间路径 */
|
||||||
|
Loading…
Reference in New Issue
Block a user