From 25b132a852872ab5a0f33fb36d5c1da8ff984ff5 Mon Sep 17 00:00:00 2001 From: Jiaju Zhuang Date: Tue, 14 Sep 2021 20:39:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9url=E8=B6=85=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 ++++++++++++++ .../excel/converters/url/UrlImageConverter.java | 13 ++++++++----- .../easyexcel/test/demo/write/WriteTest.java | 1 + update.md | 15 ++++++++------- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 604823f9..f0e070c3 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,20 @@ Java解析、生成Excel比较有名的框架有Apache poi、jxl。但他们都 当然还有极速模式能更快,但是内存占用会在100M多一点 ![img](img/readme/large.png) +## 版本支持 +* 2+ 版本支持 Java7和Java6 +* 3+ 版本至少 Java8 + +## 人员招募 +由于工作较忙,有意愿做开源的同学可以报名,主要负责群里回答&issue处理,当然也可以做一些PR. +由于开源没有任何物质回报,然后现在的维护同学也是课余时间维护的,所以想加入的同学需要持之以恒,而不是一时兴起. +要求如下: +* 有一定java编码能力 & 良好的编码习惯 +* 了解easyexcel 读&写的原理 +* 热爱开源项目 +* 能长期坚持的去做 +* 相对工作没那么忙 + ## 相关文档 * [快速开始](https://www.yuque.com/easyexcel/doc/easyexcel) * [关于软件](/abouteasyexcel.md) diff --git a/src/main/java/com/alibaba/excel/converters/url/UrlImageConverter.java b/src/main/java/com/alibaba/excel/converters/url/UrlImageConverter.java index 65f9035f..7daa7cab 100644 --- a/src/main/java/com/alibaba/excel/converters/url/UrlImageConverter.java +++ b/src/main/java/com/alibaba/excel/converters/url/UrlImageConverter.java @@ -18,6 +18,9 @@ import com.alibaba.excel.util.IoUtils; * @since 2.1.1 */ public class UrlImageConverter implements Converter { + public static int urlConnectTimeout = 1000; + public static int urlReadTimeout = 5000; + @Override public Class supportJavaTypeKey() { return URL.class; @@ -28,11 +31,11 @@ public class UrlImageConverter implements Converter { GlobalConfiguration globalConfiguration) throws IOException { InputStream inputStream = null; try { - URLConnection conn = value.openConnection(); - conn.setConnectTimeout(1000); - conn.setReadTimeout(5000); - inputStream = con.getInputStream(); - byte[] bytes = IoUtils.toByteArray(inputStream); + URLConnection urlConnection = value.openConnection(); + urlConnection.setConnectTimeout(urlConnectTimeout); + urlConnection.setReadTimeout(urlReadTimeout); + inputStream = urlConnection.getInputStream(); + byte[] bytes = IoUtils.toByteArray(inputStream); return new WriteCellData<>(bytes); } finally { if (inputStream != null) { diff --git a/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java b/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java index 00d1b059..1bf11fe4 100644 --- a/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java +++ b/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java @@ -95,6 +95,7 @@ public class WriteTest { @Test public void excludeOrIncludeWrite() { String fileName = TestFileUtil.getPath() + "excludeOrIncludeWrite" + System.currentTimeMillis() + ".xlsx"; + // 这里需要注意 在使用ExcelProperty注解的使用,如果想不空列则需要加入order字段,而不是index,order会忽略空列,然后继续往后,而index,不会忽略空列,在第几列就是第几列。 // 根据用户传入字段 假设我们要忽略 date Set excludeColumnFiledNames = new HashSet(); diff --git a/update.md b/update.md index b777133f..a6a8208d 100644 --- a/update.md +++ b/update.md @@ -1,11 +1,5 @@ -# 2.2.10 -* 修复读取的时候用string接收数字 可能四舍五入不一致的bug - -# 2.2.9 -* 修复读取的时候用string接收数字 可能四舍五入不一致的bug - # 3.0.0-beta1 -* 升级jdk8 不再支持jdk6 jdk7 +* 升级jdk8 不再支持jdk6 jdk7 * 升级poi 到 4.1.2 * 升级cglib 到 3.3.0 * 升级ehcache 到 3.8.1 @@ -21,6 +15,13 @@ * 修改读的关闭流无效 [Issue #1840](https://github.com/alibaba/easyexcel/issues/1840) * 写入支持Collection [Issue #1834](https://github.com/alibaba/easyexcel/issues/1834) * `Converter`支持null转换 [Issue #1776](https://github.com/alibaba/easyexcel/issues/1776) +* cglib 新增命名策略,防止和`spring`的冲突 [Issue #2064](https://github.com/alibaba/easyexcel/issues/2064) + +# 2.2.10 +* 修复读取的时候用string接收数字 可能四舍五入不一致的bug + +# 2.2.9 +* 修复读取的时候用string接收数字 可能四舍五入不一致的bug # 2.2.8 * 兼容07在特殊的excel的情况下,读取数据异常