From 2c0532410859c8d390477192f232964676faeacd Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 28 Nov 2020 13:21:02 +0800 Subject: [PATCH] =?UTF-8?q?Excel=E6=94=AF=E6=8C=81=E5=AF=BC=E5=85=A5Boolea?= =?UTF-8?q?n=E5=9E=8B=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java | 4 ++++ .../main/java/com/ruoyi/common/core/utils/reflect/ReflectUtils.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java index da937f4..2c32a4a 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/poi/ExcelUtil.java @@ -268,6 +268,10 @@ public class ExcelUtil val = DateUtil.getJavaDate((Double) val); } } + else if (Boolean.TYPE == fieldType || Boolean.class == fieldType) + { + val = Convert.toBool(val, false); + } if (StringUtils.isNotNull(fieldType)) { Excel attr = field.getAnnotation(Excel.class); diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/reflect/ReflectUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/reflect/ReflectUtils.java index ee27ae0..3d8382b 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/reflect/ReflectUtils.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/reflect/ReflectUtils.java @@ -204,6 +204,10 @@ public class ReflectUtils args[i] = DateUtil.getJavaDate((Double) args[i]); } } + else if (cs[i] == boolean.class || cs[i] == Boolean.class) + { + args[i] = Convert.toBool(args[i]); + } } } return (E) method.invoke(obj, args);