From a30695d15a46ef43dc59e4d1c7ddd948d16094a0 Mon Sep 17 00:00:00 2001 From: fwq <582742538@qq.com> Date: 星期四, 26 十月 2023 11:27:11 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/main/java/com/hx/util/ExcelUtil.java | 3 +++ src/main/java/com/hx/util/MapUtil.java | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/hx/util/ExcelUtil.java b/src/main/java/com/hx/util/ExcelUtil.java index cb92bab..da09b9b 100644 --- a/src/main/java/com/hx/util/ExcelUtil.java +++ b/src/main/java/com/hx/util/ExcelUtil.java @@ -944,6 +944,9 @@ .open(file); listData =readhandle(book); + }catch (OLE2NotOfficeXmlFileException ex){ + ex.printStackTrace(); + throw new RuntimeException("excel鐗堟湰涓嶄负2007鍙婁互涓�"); }catch (Exception e){ e.printStackTrace(); throw new RuntimeException(e.getMessage()); diff --git a/src/main/java/com/hx/util/MapUtil.java b/src/main/java/com/hx/util/MapUtil.java index 2bdd0cd..1fba6e0 100644 --- a/src/main/java/com/hx/util/MapUtil.java +++ b/src/main/java/com/hx/util/MapUtil.java @@ -74,4 +74,20 @@ return null == map.get(key) ? BigDecimal.ZERO : new BigDecimal(map.get(key).toString()); } + + /** + * 鑾峰彇娴偣鏁帮紝榛樿杩斿洖0 + * @param map + * @param key + * @return + */ + public static Double getDoubleZero(Map<String, Object> map, String key) + { + if(map == null || StringUtils.isEmpty(key)) + { + return 0D; + } + + return null == map.get(key) ? 0D : Double.parseDouble(map.get(key).toString()); + } } -- Gitblit v1.8.0