From e9291da3cb563edd96090e50c3262c3009f23564 Mon Sep 17 00:00:00 2001 From: 25067 <250678106@qq.com> Date: Wed, 31 Jul 2024 11:12:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?---author:liusq---date:2024/7/31-----for:[T?= =?UTF-8?q?V360X-1953]execl=E8=BD=AChtml=E6=8A=A5=E9=94=99d=20!=3D=20org.a?= =?UTF-8?q?pache.poi.ss.usermodel.FillPatternType---?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/java/ExcelToHtmlTest.java | 21 ++++++++++++++++++ ...6\347\224\263\350\257\267\344\271\246.xls" | Bin 0 -> 30720 bytes .../poi/excel/html/helper/StylerHelper.java | 4 +++- ...6\346\224\271\346\227\245\345\277\227.log" | 8 ++++++- 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 autopoi-web/src/test/java/ExcelToHtmlTest.java create mode 100644 "autopoi-web/src/test/resources/templates/\344\270\223\351\241\271\346\224\257\345\207\272\347\224\250\346\254\276\347\224\263\350\257\267\344\271\246.xls" diff --git a/autopoi-web/src/test/java/ExcelToHtmlTest.java b/autopoi-web/src/test/java/ExcelToHtmlTest.java new file mode 100644 index 0000000..4de4849 --- /dev/null +++ b/autopoi-web/src/test/java/ExcelToHtmlTest.java @@ -0,0 +1,21 @@ +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Workbook; +import org.jeecgframework.poi.excel.ExcelToHtmlUtil; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; + +public class ExcelToHtmlTest { + + private static final String basePath = "D:\\idea_project_2023\\autopoi_lsq\\autopoi-web\\src\\test\\resources\\templates\\"; + + public static void main(String[] args) throws Exception { + File file = new File(basePath + "专项支出用款申请书.xls"); + Workbook wb = new HSSFWorkbook(new FileInputStream(file)); + String html = ExcelToHtmlUtil.toTableHtml(wb); + FileWriter fw = new FileWriter("D:/home/excel/专项支出用款申请书.html"); + fw.write(html); + fw.close(); + } +} diff --git "a/autopoi-web/src/test/resources/templates/\344\270\223\351\241\271\346\224\257\345\207\272\347\224\250\346\254\276\347\224\263\350\257\267\344\271\246.xls" "b/autopoi-web/src/test/resources/templates/\344\270\223\351\241\271\346\224\257\345\207\272\347\224\250\346\254\276\347\224\263\350\257\267\344\271\246.xls" new file mode 100644 index 0000000000000000000000000000000000000000..1f3e881890fa4200d28e8a1cdd3faf6ebc8180ec GIT binary patch literal 30720 zcmeHw2V4}%@^H_xz=EJ4hzN>H5|kWN?hK$}LUQo*PzkaGMNt$pf{Fn-5yTAYsi$(D zIiEQzil?ZES<%DO!~E_J!|DF3W;V>u&hqg8z3=_L_daHRJu_WhT~%FOT^*)p_sV7C zhii9QR1?n8ooJEIQaz%>f>ZGPwLES_AYCfOsQmsFJOill_z%*6o(L*ZN1H_YT+%H& zP7xhlLaK>?>=2%SD$(T55(2waV1xkaEfF#qasNP8AT*y91)XX zxKD(8I7tIo92reKh$~@HYETYSb`BMp?gDQSk?Dvib%by|9(Xcnvl9>88Oq#=$jZ#3 zBh&!D3-!f^k9i7fylv>U@#Dw+6T#FI+%c^3o?nUjy7*1H3CQoFcxwdcacS9@+bi|E;e+;FGg%7bS3TKgskj*9mMQR z9mFa*e2Fu5N^E8zgp#~0s|pMV`1&fDb|OyDI+RT1xC*{X04Jvf)O`zZkakQV+jkk_ zD0?2#-b&aO^liaTrIn?EA_k3HDo~IQiv~oIj6Dz$b8u8C(TESh{_*%z3Laf?92X-T z8Xp7yL!MAS99TpILbvPrBI$RU|owS_l_&?KdZRo3L zdEU{r1sA4W7|P}3*nd+w{5lCGBpci*gWpUAPR!(Rv=Ey9b!@>ra1MQAIle+aTWL9) ztHGK21z#_xA4kYeg*@8e6#2@f4W5|~ZYrm<*w}bklVweakkK>vHU@ujV&bv3$J!F% zep((VAOq*f-%F!c@u892z#$jQhL zu2lhN%B9J!G}*~s4fez6LEWx)YrsFM0WP;gnVcoY#%4{-K>tj87lHf~0c-RzG6D+{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3rm*ef%nHiPo75`uu$VD zp%%bX08dwjDIz1llH{0rkPmf^n831YT({evrp>ArESsp)P`j*i_(#m{^8zdOU#o#9%v3tB6K z$+xmI8a!hkIQz;{QA;r-R(8gLmqhR9FXN4RiicW6%JeouSbAp81QsT8LCa-xK|1|N zf0~OKt;sO>87<}A#0QrW{FB7l^3;=&94L5``HG?0QVRUW?*n#+ktSn6g zY54IXQox!R20wSjlpdDWA%>?Gtc2STSEzn-ssk)8`jaV8PaWX&gWvG6g1Z&?_ztAI zpgGxx)d6rqy29uXDdxe5Gf%~rLfb-nrZIsDIyRzLLv}$W(oPL31Mj#O1DzTUYYph) z;mb-SsRe~Yb!&srs90@K8mf)K!#kch^wFY?7IVNGB{;E3;4gn+98a1zO$*TB&U6as zs)(q#T^w?VdjALu&cukM3<afPe#>5(sFTr4Z1Q?}32* z#T5wHjo*cUZt5un>Z4@#L(TE!yShic5ufY1DAxb^MxNBp?Uhj9bcdJgFEsq z1*TSTmp6y{o^gOyReJg5jZM4%5??!Y>}A>S=V~uJt2aN&8jv9woFP%?gM*`QLL ziHRx0A>9w+^1}}vvQHLntg^mBp0q5=4A>iEnAp~3xzj60b$2m4GCg6I22=2HJU<7wu?8fx~Tml!v z9aoAS;cf(XTo=G~09+TqjiZJT1paIk>@h_y Date: Wed, 31 Jul 2024 11:13:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?---author:liusq---date:2024/7/31-----for:[T?= =?UTF-8?q?V360X-1292]=20=E5=AF=B9=E8=B1=A1=E7=9A=84=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E4=B8=BALocalDate=E3=80=81LocalDateTIme=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E5=85=BC=E5=AE=B9---?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/java/ImportExcelTest.java | 33 +++++++++++++++++ autopoi-web/src/test/java/TestDateEntity.java | 34 ++++++++++++++++++ .../templates/ExcelImportDateTest.xlsx | Bin 0 -> 10642 bytes .../poi/excel/imports/CellValueServer.java | 10 +++++- .../poi/util/PoiPublicUtil.java | 8 ++++- ...6\346\224\271\346\227\245\345\277\227.log" | 8 +++++ 6 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 autopoi-web/src/test/java/ImportExcelTest.java create mode 100644 autopoi-web/src/test/java/TestDateEntity.java create mode 100644 autopoi-web/src/test/resources/templates/ExcelImportDateTest.xlsx diff --git a/autopoi-web/src/test/java/ImportExcelTest.java b/autopoi-web/src/test/java/ImportExcelTest.java new file mode 100644 index 0000000..32d9f38 --- /dev/null +++ b/autopoi-web/src/test/java/ImportExcelTest.java @@ -0,0 +1,33 @@ +import org.apache.commons.lang3.builder.ReflectionToStringBuilder; +import org.apache.poi.ss.usermodel.Workbook; +import org.jeecgframework.poi.excel.ExcelExportUtil; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.entity.TemplateExportParams; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Description: TODO + * @author: scott + * @date: 2020年09月16日 11:46 + */ +public class ImportExcelTest { + private static final String basePath = "D:\\idea_project_2023\\autopoi_lsq\\autopoi-web\\src\\test\\resources\\templates\\"; + + public static void main(String[] args) throws Exception { + ImportParams params = new ImportParams(); + params.setTitleRows(1); + params.setHeadRows(1); + File importFile = new File(basePath+"ExcelImportDateTest.xlsx"); + List list = ExcelImportUtil.importExcel(importFile, TestDateEntity.class, params); + System.out.println(list.size()); + System.out.println(ReflectionToStringBuilder.toString(list.get(1))); + } +} diff --git a/autopoi-web/src/test/java/TestDateEntity.java b/autopoi-web/src/test/java/TestDateEntity.java new file mode 100644 index 0000000..cb5dddf --- /dev/null +++ b/autopoi-web/src/test/java/TestDateEntity.java @@ -0,0 +1,34 @@ +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * @Description: TODO + * @author: lsq + * @date: 2024年07月31日 10:31 + */ +public class TestDateEntity { + @Excel(name = "localdate", format = "yyyy-MM-dd") + private LocalDate localDate; + + @Excel(name = "localdatetime", format = "yyyy-MM-dd") + private LocalDateTime localDateTime; + + + public LocalDate getLocalDate() { + return localDate; + } + + public void setLocalDate(LocalDate localDate) { + this.localDate = localDate; + } + + public LocalDateTime getLocalDateTime() { + return localDateTime; + } + + public void setLocalDateTime(LocalDateTime localDateTime) { + this.localDateTime = localDateTime; + } +} diff --git a/autopoi-web/src/test/resources/templates/ExcelImportDateTest.xlsx b/autopoi-web/src/test/resources/templates/ExcelImportDateTest.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..51b3bd28399f6b444eec1bf9f723414689bf8cb6 GIT binary patch literal 10642 zcmb_iWk6Ni5~fi?@Q~6V-AIFU2+|=)H`3iH-AD*Xqeyp4cXxMp9Qx4l4(h$$>$~s$ zy6eX}`^^4kX04gMXRozpWF??s5Fj2}fb#(#n=W77RlN6CQns zAyRj}V1|T%V1a^wK>aIB$I6P{$=obCvP8O-5naTQ^sf1Mp(Y1aFlIFuAjrrnq{BWS zVMBR+qE^|)leqOX@)nKdL6wS2w?2l zn4wj0Y2bK-G9f6b1%rMP!+)TahdzzPF+E-AK+Ff4_QXaXC9)JmC{jXt3a zSlx;1!}L?KG8=yb3pee=!lhp<%E-9}eU2ek+a?}%kKA8ia?#SRyGl~L#Ju^sfV3l4 zcSB#8bowT=>@GRg+sx&i{56qNSTqj0s*HC-cz@?d^&SW*-Pfku6)f1%xN249w%brH zM|a1EXD(Iso@=x_^9A_V6LMM^sffiv$QdIu&{g7;_FsM?DhlL z#m{REQZwP(uVk~c^6-P>E(f|9 zHr+_^=*z}jpmL(rg}dw@mGT!SQRotUPTcO|6^$KHv`W~3A}NRR^FLY^=n8(n4j_NQ zz`q0Y(LhWPHa~DkaF?X%Z3(QtB4-D2C`Ye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JlzW}Tl56t|XBfqD>t152B9f-~;9+Y6wE$jV0Ax|8M; zJ+>Qgynuv4|GwDxQBU=|XTZ*ZfP^3d_w&#H(N8}F{Bw=OL&*8j9!j%Bi2n#KzbpMc z1U>NlP-^@q&-Yj6|0#QTCx5gDWe@EyC1Zb|%+I2ghw1*aOa5-9NRqz< zsNVt`WaqV|GzprY4$vMUQ=QZx{5`I6W{UyN=@I%6%XSV;(Sbv{8 zGtzg~KQe@We?orG5&qJs`d7AJ8N=U){QC;*mjE8Z?|T1gw*NQihdQGl?ZLwze|Y$T q`Om7OzmNR)x}yi)A6{$vFWz5ONU{>J-(S|J;2J-8FwUOrf$u*6Q334$ literal 0 HcmV?d00001 diff --git a/autopoi/src/main/java/org/jeecgframework/poi/excel/imports/CellValueServer.java b/autopoi/src/main/java/org/jeecgframework/poi/excel/imports/CellValueServer.java index d41c6ff..bf56f68 100644 --- a/autopoi/src/main/java/org/jeecgframework/poi/excel/imports/CellValueServer.java +++ b/autopoi/src/main/java/org/jeecgframework/poi/excel/imports/CellValueServer.java @@ -35,6 +35,7 @@ import java.sql.Time; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.time.ZoneId; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -66,7 +67,10 @@ private Object getCellValue(String xclass, Cell cell, ExcelImportEntity entity) } Object result = null; // 日期格式比较特殊,和cell格式不一致 - if ("class java.util.Date".equals(xclass) || ("class java.sql.Time").equals(xclass)) { + if ("class java.util.Date".equals(xclass) + || ("class java.sql.Time").equals(xclass) + || ("class java.time.LocalDate").equals(xclass) + || ("class java.time.LocalDateTime").equals(xclass)) { if ( CellType.NUMERIC == cell.getCellTypeEnum()) { // 日期格式 result = cell.getDateCellValue(); @@ -76,6 +80,10 @@ private Object getCellValue(String xclass, Cell cell, ExcelImportEntity entity) } if (("class java.sql.Time").equals(xclass)) { result = new Time(((Date) result).getTime()); + }else if (("class java.time.LocalDate").equals(xclass)) { + result = ((Date) result).toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + } else if (("class java.time.LocalDateTime").equals(xclass)) { + result = ((Date) result).toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); } } else if ( CellType.NUMERIC == cell.getCellTypeEnum()) { result = cell.getNumericCellValue(); diff --git a/autopoi/src/main/java/org/jeecgframework/poi/util/PoiPublicUtil.java b/autopoi/src/main/java/org/jeecgframework/poi/util/PoiPublicUtil.java index e8c3fb9..45b84d1 100644 --- a/autopoi/src/main/java/org/jeecgframework/poi/util/PoiPublicUtil.java +++ b/autopoi/src/main/java/org/jeecgframework/poi/util/PoiPublicUtil.java @@ -564,7 +564,13 @@ public static boolean isJavaClass(Field field) { boolean isBaseClass = false; if (fieldType.isArray()) { isBaseClass = false; - } else if (fieldType.isPrimitive() || fieldType.getPackage() == null || fieldType.getPackage().getName().equals("java.lang") || fieldType.getPackage().getName().equals("java.math") || fieldType.getPackage().getName().equals("java.sql") || fieldType.getPackage().getName().equals("java.util")) { + } else if (fieldType.isPrimitive() + || fieldType.getPackage() == null + || fieldType.getPackage().getName().equals("java.lang") + || fieldType.getPackage().getName().equals("java.math") + || fieldType.getPackage().getName().equals("java.sql") + || fieldType.getPackage().getName().equals("java.util") + || fieldType.getPackage().getName().equals("java.time")) { isBaseClass = true; } return isBaseClass; diff --git "a/docs/\344\277\256\346\224\271\346\227\245\345\277\227.log" "b/docs/\344\277\256\346\224\271\346\227\245\345\277\227.log" index 3ffa1ab..ed3393b 100644 --- "a/docs/\344\277\256\346\224\271\346\227\245\345\277\227.log" +++ "b/docs/\344\277\256\346\224\271\346\227\245\345\277\227.log" @@ -74,3 +74,11 @@ src\main\java\org\jeecgframework\poi\excel\html\helper\StylerHelper.java src\test\resources\templates\专项支出用款申请书.xls src\test\java\ExcelToHtmlTest.java ---author:liusq---date:2024/7/30-----for:TV360X-1953 execl转html报错d != org.apache.poi.ss.usermodel.FillPatternType--- + +---author:liusq---date:2024/7/30-----for:TV360X-1292 对象的属性为LocalDate、LocalDateTIme类型对象兼容--- +autopoi\src\main\java\org\jeecgframework\poi\util\PoiPublicUtil.java +autopoi\src\main\java\org\jeecgframework\poi\excel\imports\CellValueServer.java +src\test\resources\templates\ExcelImportDateTest.xlsx +src\test\java\TestDateEntity.java +src\test\java\ImportExcelTest.java +---author:liusq---date:2024/7/30-----for:TV360X-1292 对象的属性为LocalDate、LocalDateTIme类型对象兼容--- \ No newline at end of file