From 1157a16f1be979f062ef49f7b76a545ecc231dc9 Mon Sep 17 00:00:00 2001 From: cmg <527198563@qq.com> Date: 星期五, 16 八月 2024 11:01:00 +0800 Subject: [PATCH] 杭州全民健康数据 --- src/main/java/com/hx/util/MapUtil.java | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/hx/util/MapUtil.java b/src/main/java/com/hx/util/MapUtil.java index 1fba6e0..392bae2 100644 --- a/src/main/java/com/hx/util/MapUtil.java +++ b/src/main/java/com/hx/util/MapUtil.java @@ -35,12 +35,12 @@ */ public static int getInt(Map<String, Object> map, String key) { - if(map == null || StringUtils.isEmpty(key)) + if(map == null || StringUtils.isEmpty(key) || null == map.get(key) || StringUtils.isEmpty(map.get(key).toString())) { return -1; } - return null == map.get(key) ? -1 : Integer.parseInt(map.get(key).toString()); + return Integer.parseInt(map.get(key).toString()); } /** @@ -51,12 +51,12 @@ */ public static int getIntZero(Map<String, Object> map, String key) { - if(map == null || StringUtils.isEmpty(key)) + if(map == null || StringUtils.isEmpty(key) || null == map.get(key) || StringUtils.isEmpty(map.get(key).toString())) { return 0; } - return null == map.get(key) ? 0 : Integer.parseInt(map.get(key).toString()); + return Integer.parseInt(map.get(key).toString()); } /** -- Gitblit v1.8.0