From 00d836c9a224c78fb0cf89d3f2b69ab05c28cff8 Mon Sep 17 00:00:00 2001
From: jhjang <jhjang@maprex.co.kr>
Date: 화, 08 2월 2022 09:55:05 +0900
Subject: [PATCH] - 임포트 날짜 코드 예외처리 추가

---
 src/main/java/kr/wisestone/owl/util/CommonUtil.java |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/util/CommonUtil.java b/src/main/java/kr/wisestone/owl/util/CommonUtil.java
index af20eb8..801fff6 100644
--- a/src/main/java/kr/wisestone/owl/util/CommonUtil.java
+++ b/src/main/java/kr/wisestone/owl/util/CommonUtil.java
@@ -12,6 +12,7 @@
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
 import org.apache.poi.ss.usermodel.Cell;
 import org.jsoup.Jsoup;
 import org.slf4j.Logger;
@@ -960,17 +961,22 @@
 
         switch (cell.getCellType()) {
             case Cell.CELL_TYPE_NUMERIC :
-                double doubleValue = cell.getNumericCellValue();
-                int intValue;
+                if (HSSFDateUtil.isCellDateFormatted(cell)) {
+                    Date date = cell.getDateCellValue();
+                    cellValue = DateUtil.convertDateToStr(date, "yyyy-MM-dd hh:mm:ss");
 
-                if (doubleValue % 1 == 0) {
-                    intValue = (int)doubleValue;
-                    cellValue = intValue + "";
-                }
-                else {
-                    cellValue = doubleValue + "";
-                }
+                } else {
+                    double doubleValue = cell.getNumericCellValue();
+                    int intValue;
 
+                    if (doubleValue % 1 == 0) {
+                        intValue = (int)doubleValue;
+                        cellValue = intValue + "";
+                    }
+                    else {
+                        cellValue = doubleValue + "";
+                    }
+                }
                 break;
 
             case Cell.CELL_TYPE_STRING :

--
Gitblit v1.8.0