mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -792,7 +792,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
* @see #writeRow(Map, boolean)
|
||||
* @since 4.1.5
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public ExcelWriter writeRow(Object rowBean, boolean isWriteKeyAsHead) {
|
||||
if (rowBean instanceof Iterable) {
|
||||
return writeRow((Iterable<?>) rowBean);
|
||||
@@ -806,7 +806,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
}
|
||||
} else if (BeanUtil.isBean(rowBean.getClass())) {
|
||||
if (MapUtil.isEmpty(this.headerAlias)) {
|
||||
rowMap = BeanUtil.beanToMap(rowBean, new LinkedHashMap<String, Object>(), false, false);
|
||||
rowMap = BeanUtil.beanToMap(rowBean, new LinkedHashMap<>(), false, false);
|
||||
} else {
|
||||
// 别名存在情况下按照别名的添加顺序排序Bean数据
|
||||
rowMap = BeanUtil.beanToMap(rowBean, new TreeMap<>(getInitedAliasComparator()), false, false);
|
||||
@@ -1018,7 +1018,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
|
||||
final Map<Object, Object> filteredMap = new LinkedHashMap<>();
|
||||
String aliasName;
|
||||
for (Entry<?, ?> entry : rowMap.entrySet()) {
|
||||
aliasName = this.headerAlias.get(entry.getKey());
|
||||
aliasName = this.headerAlias.get(StrUtil.toString(entry.getKey()));
|
||||
if (null != aliasName) {
|
||||
// 别名键值对加入
|
||||
filteredMap.put(aliasName, entry.getValue());
|
||||
|
@@ -25,7 +25,7 @@ public enum CellDataType {
|
||||
NULL("");
|
||||
|
||||
/** 属性值 */
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
|
@@ -149,6 +149,7 @@ public class ExcelSaxUtil {
|
||||
// 普通数字
|
||||
if (null != numFmtString && numFmtString.indexOf(StrUtil.C_DOT) < 0) {
|
||||
final long longPart = (long) numValue;
|
||||
//noinspection RedundantIfStatement
|
||||
if (longPart == numValue) {
|
||||
// 对于无小数部分的数字类型,转为Long
|
||||
return longPart;
|
||||
|
@@ -184,9 +184,6 @@ public class StyleUtil {
|
||||
* @since 4.6.3
|
||||
*/
|
||||
public static boolean isNullOrDefaultStyle(Workbook workbook, CellStyle style) {
|
||||
if(null == style || style.equals(workbook.getCellStyleAt(0))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return (null == style) || style.equals(workbook.getCellStyleAt(0));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user