From 446558ce46f9cf4d6d6e9d64f5bbf89b4ff86550 Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 월, 24 1월 2022 17:54:43 +0900
Subject: [PATCH] - 이슈 excel import 오류 수정 및 유효성 검사 추가 - 이슈 excel import시 프로젝트에 속한 이슈유형 리스트만 보여주도록 수정

---
 src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
index a0bd6ab..a772639 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
@@ -46,8 +46,10 @@
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
+import static kr.wisestone.owl.domain.enumType.CustomFieldType.DATETIME;
 import static kr.wisestone.owl.domain.enumType.CustomFieldType.INPUT;
 
 @Service
@@ -3338,6 +3340,15 @@
         }
     }
 
+    /**
+     * cell NULL 泥댄겕 �븿�닔
+     * @param cell Cell
+     * @return boolean
+     */
+    private Boolean cellNullCheck (Cell cell) {
+        return cell != null && cell.getStringCellValue() != null && cell.getCellType() != Cell.CELL_TYPE_BLANK;
+    }
+
     //  �뿊�� �븘�뱶�뿉 �엳�뒗 �젙蹂대�� �씠�뒋 form �쑝濡� �삷湲대떎.
     private IssueForm setIssueFormToExcelField(Row row, int rowIndex, Map<String, Priority> priorityMaps,
                                                Map<String, Severity> severityMaps, Map<String, DepartmentVo> departmentMaps,
@@ -3356,7 +3367,7 @@
                     break;
 
                 case 1:    //  �궡�슜
-                    if (cell != null) {
+                    if (cellNullCheck(cell)) {
                         issueForm.setDescription(CommonUtil.convertExcelStringToCell(cell));
                     } else {
                         //  null �엯�젰 諛⑹�
@@ -3380,13 +3391,13 @@
                     break;*/
                 case 4:
                     //  �떆�옉�씪�쓣 IssueForm �뿉 ���옣�븳�떎.
-                    if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) {
+                    if (cellNullCheck(cell)) {
                         this.setIssueFormPeriod(cell, issueForm, true, rowIndex);
                     }
                     break;
                 case 5:
                     //  醫낅즺�씪�쓣 IssueForm �뿉 ���옣�븳�떎.
-                    if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) {
+                    if (cellNullCheck(cell)) {
                         this.setIssueFormPeriod(cell, issueForm, false, rowIndex);
                     }
                     break;
@@ -3557,11 +3568,16 @@
                 case EMAIL:
                 case SITE:
                 case TEL:
-                    if (customField.getCustomFieldType() != INPUT && cellValue.length() > 100) {
+                    if (customField.getCustomFieldType() != INPUT && cellValue.length() > 100) { //INPUT ���엯�� 100�옄 �젣�븳 �뾾�쓬
                         throw new OwlRuntimeException(
                                 this.messageAccessor.getMessage(MsgConstants.CUSTOM_FIELD_TEXT_TYPE_MAX_LENGTH_OUT));
                     }
 
+                    if (customField.getCustomFieldType() == DATETIME) { //DATETIME�씪 寃쎌슦 format 蹂�寃�
+                        Date date = cell.getDateCellValue();
+                        cellValue = new SimpleDateFormat("yyyy-MM-dd H:mm:ss").format(date);
+                    }
+
                     issueCustomFieldMap.put("customFieldId", customField.getId());
                     issueCustomFieldMap.put("useValue", cellValue);
                     issueForm.addIssueCustomFields(issueCustomFieldMap);

--
Gitblit v1.8.0