From 578784e9608dc596fd47d9ecc1d952df47a60c03 Mon Sep 17 00:00:00 2001 From: khw <11910710@mail.sustech.edu.cn> Date: Sun, 24 Apr 2022 21:53:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86int=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E4=BF=9D=E7=95=99=E5=B0=8F=E6=95=B0=E7=B2=BE=E5=BA=A6?= =?UTF-8?q?=E6=95=B4=E6=95=B0=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/alibaba/excel/util/NumberUtils.java | 13 +++++++ .../test/temp/issue2443/Issue2443.java | 15 ++++++++ .../test/temp/issue2443/Issue2443Test.java | 36 ++++++++++++++++++ src/test/resources/temp/issue2443/date1.xlsx | Bin 0 -> 10195 bytes src/test/resources/temp/issue2443/date2.xlsx | Bin 0 -> 10213 bytes 5 files changed, 64 insertions(+) create mode 100644 src/test/java/com/alibaba/easyexcel/test/temp/issue2443/Issue2443.java create mode 100644 src/test/java/com/alibaba/easyexcel/test/temp/issue2443/Issue2443Test.java create mode 100644 src/test/resources/temp/issue2443/date1.xlsx create mode 100644 src/test/resources/temp/issue2443/date2.xlsx diff --git a/src/main/java/com/alibaba/excel/util/NumberUtils.java b/src/main/java/com/alibaba/excel/util/NumberUtils.java index c467762c6..a5f1c512e 100644 --- a/src/main/java/com/alibaba/excel/util/NumberUtils.java +++ b/src/main/java/com/alibaba/excel/util/NumberUtils.java @@ -103,6 +103,19 @@ public static Long parseLong(String string, ExcelContentProperty contentProperty */ public static Integer parseInteger(String string, ExcelContentProperty contentProperty) throws ParseException { if (!hasFormat(contentProperty)) { + // CS304 Issue link: https://github.com/alibaba/easyexcel/issues/2443 + int stringLength = string.length(); + if(stringLength>0){ + int pointer = stringLength; + for(int i=0;i(dataList -> { + for (Issue2443 issueData : dataList) { + log.info("读取到一条数据{}", JSON.toJSONString(issueData)); + } + })).sheet().doRead(); + } + //CS304 (manually written) Issue link: https://github.com/alibaba/easyexcel/issues/2443 + @Test + public void IssueTest2() { + String fileName = TestFileUtil.getPath() + "temp/issue2443" + File.separator + "date2.xlsx"; + EasyExcel.read(fileName, Issue2443.class, new PageReadListener(dataList -> { + for (Issue2443 issueData : dataList) { + log.info("读取到一条数据{}", JSON.toJSONString(issueData)); + } + })).sheet().doRead(); + } +} diff --git a/src/test/resources/temp/issue2443/date1.xlsx b/src/test/resources/temp/issue2443/date1.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..92ef811d9e90289f076a5aefdc30e266ed7bd0cd GIT binary patch literal 10195 zcmeHtbx@qk(l_q1I01sY1a}WC4ncy2;O_43?h@QxgS)!~P0-*32~Kc*A-VVDgnQmw z@4sKwH&wgO*0U`${hR6Tnr>N1a0ob%rx7T#Ch+w9_kex;p=YTpYh!6;OE3FKhW_{h z<|kRgN8T%LP!JFkFc1*H-^sMCtX?^po2A8cN`Nz>1223Y09BUE=D=J%c?c9oq?+$s z21_;GNqS=GLc8@1c|Ag%H#IVAd6yUY8bxIoJ9~Tx)-nwu0NG z4%W7lGzfi7!%_J?AI#S*l{64x8iqX3P1X|JSSpq6a(Vn~al)A9D>i!&%-e=?$uiP_ zgf;4v*s;KZ$Q!KD>#bV^y#?;rdFM{tRJP1U~3iDzGd7V*T%X_n? z^!F!%FSh#YXPT{G4Lc(Z)AlOPYxw}N7DPddy=;Uw5V{|%vMM1wHS{J|={sWitoi}g zB%^MSUO9Zr2{qMyo@&uG%f+q*9T&bq?w+W}kbfHb&Y#Ro<qhM-L z76hz8Z7cDjm`A6c4VV;#V0OF+0D}Ql}jDf@wS$sty3A*M6bI9WLEbtpUQ@KHMZlkS5wE_M=wX;u2}3NMu)o z#%u>koOEYrqqTq3H)tYU-0Rwt6dBw(4*q1`N%a|9ITJqdEWB*&F_etbDbxr}4y)C& zh=Ym&r61L4WsU_Cy9R?4x9E10XXb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mI{U^PkK~czN*R=FyCwAL|@AkI%;g`-|-F zyZonhTVsb!x}T1%|GjUbJKch@5NvccmA~1-DYzf62SAM}d8gZRxihpOV8ud;%_m9l zB7FjQ)BR?qm>%J?lObWSj_kILCQCWfk+qAv6BN))U0dyNyu%A3aPQvYA)rjZQP_Se z78OGj%4E}{fb|=zLjv(~POSKjkfG|3?9S4rp<0&Ax>HHFCgOlW@^=+%n0_7j?<}Wl zx9xTG!{q%~8J-T?mm&W7^H8))oC7YTU2Ja$pbYlKf&?`Ko!?;u1S)CRW@GP?-So5W zt1@*By3?LHkxL?^u)b(>=THbAK2bk~FT{7^Z0v}J=T^!rs1VKv1pQ(^8> z8eA8&orGbi@vKpm7=*Zp6%|mi@!(R0^ICl&fUn?NlVU~L#HUZ1q&E}K%|Q|k?`yJ&wJO0+7c&V$*AqYsgxIysaN9$rUdSl1z|`!A#~H*j`jK(E-y-3uuJ{By{UOs(^-%CIG19e z@#soF-RpVxV&mnr^5~{^%CF<14_)53U;6hwZ&r@22|U1MB|*W^f5x0&O)$?8>Ze)3|LvOoRQlXGJ@Ncf3PJF1o}Y*5zbShT zvZwL4KA%7JJ@52+BL1b1;_qz#>ic@%}m0c`o7kh1_om45+^({B=F|-;DL=+9e;u;9qsA=Ng|EuzqW_`8(V1a@KPJ z&l8~E0&HLY)cbd{{kKU!b%^{LPY6f;LimaKuYQp~_xAISktg0?s5Sow@9+MR=hJ^) z*ZnQU6#B2}|7!+6A3v-5|92^Bk61h!|8MK~DdlIaSXL79r{h3-3=^@BbEYPF(*8e# CIG+9h literal 0 HcmV?d00001 diff --git a/src/test/resources/temp/issue2443/date2.xlsx b/src/test/resources/temp/issue2443/date2.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..c6feb3251b27aa297c7636f90a562b116de71316 GIT binary patch literal 10213 zcmeHtbx@qk(l_qzA!rtN4+NLR-CY8UyK8U{?(XhRf~RFkt_nOp|2^OzJ{Z{;%G=x6IxxyVkYPRi z0QZwDv6}aa8ypP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va{t{ByAL9}=EqLB^^Y(MQGdF1_tTFZa%{_ZGwy8New-QQ9?VgFkGzgF<`@w2S|f0ttUfW?FI|F(~x bQhpYT<)xq>qnHOLfe9A(ux1{> Date: Sun, 24 Apr 2022 23:03:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86javadoc=E5=92=8C?= =?UTF-8?q?=E5=AF=B9method=E7=9A=84=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/alibaba/excel/util/NumberUtils.java | 8 +++---- .../test/temp/issue2443/Issue2443Test.java | 22 ++++++++++++++++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/alibaba/excel/util/NumberUtils.java b/src/main/java/com/alibaba/excel/util/NumberUtils.java index a5f1c512e..d52a3299d 100644 --- a/src/main/java/com/alibaba/excel/util/NumberUtils.java +++ b/src/main/java/com/alibaba/excel/util/NumberUtils.java @@ -95,11 +95,11 @@ public static Long parseLong(String string, ExcelContentProperty contentProperty } /** - * parse + * parse Integer from string * - * @param string - * @param contentProperty - * @return + * @param string An integer read in string format + * @param contentProperty Properties of the content read in + * @return An integer converted from a string */ public static Integer parseInteger(String string, ExcelContentProperty contentProperty) throws ParseException { if (!hasFormat(contentProperty)) { diff --git a/src/test/java/com/alibaba/easyexcel/test/temp/issue2443/Issue2443Test.java b/src/test/java/com/alibaba/easyexcel/test/temp/issue2443/Issue2443Test.java index 4695f2934..57484b745 100644 --- a/src/test/java/com/alibaba/easyexcel/test/temp/issue2443/Issue2443Test.java +++ b/src/test/java/com/alibaba/easyexcel/test/temp/issue2443/Issue2443Test.java @@ -1,14 +1,17 @@ package com.alibaba.easyexcel.test.temp.issue2443; import com.alibaba.easyexcel.test.util.TestFileUtil; +import com.alibaba.excel.metadata.property.ExcelContentProperty; +import com.alibaba.excel.util.NumberUtils; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.read.listener.PageReadListener; import com.alibaba.fastjson.JSON; import lombok.extern.slf4j.Slf4j; import org.junit.Ignore; import org.junit.Test; - +import static org.junit.Assert.*; import java.io.File; +import java.text.ParseException; @Ignore @Slf4j @@ -33,4 +36,21 @@ public void IssueTest2() { } })).sheet().doRead(); } + + @Test + public void parseIntegerTest1() throws ParseException { + String string = "1.00"; + ExcelContentProperty contentProperty = null; + int Int = NumberUtils.parseInteger(string,contentProperty); + assertEquals(1, Int); + } + + @Test + public void parseIntegerTest2() throws ParseException { + String string = "2.00"; + ExcelContentProperty contentProperty = null; + int Int = NumberUtils.parseInteger(string,contentProperty); + assertEquals(2, Int); + } + }