From fd831d5a9024f46328be4f8794ac39b0072189bd Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 28 Nov 2020 12:08:55 +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/utils/poi/ExcelUtil.java | 4 ++++ .../java/com/ruoyi/common/utils/reflect/ReflectUtils.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index 6d57f22ae..d9f4efd77 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -274,6 +274,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/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java index 5241101be..9befe41ae 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/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);