chenjiahe
2024-06-14 1898bc40ca08ca02be9ac74a9c353dea3d17f120
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());
    }
}