From 11e27ddf54f5b4e2310591f74e8dd446e65a18ac Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 월, 07 2월 2022 14:31:37 +0900 Subject: [PATCH] 이슈 엑셀 임포트시 상위이슈 null 체크 및 코드 보완 --- src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java | 28 ++++++++++++++++++++++------ 1 files changed, 22 insertions(+), 6 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 8d3e1be..1802cb4 100644 --- a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java +++ b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java @@ -3455,6 +3455,13 @@ * @return boolean */ private Boolean cellNullCheck (Cell cell) { + if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK && cell.getCellType() != Cell.CELL_TYPE_STRING) { + throw new OwlRuntimeException( + this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_NOT_STRING_TYPE)); + } + if (cell != null && cell.getStringCellValue() != null) { + cell.setCellValue(cell.getStringCellValue().trim());//�� 媛� 怨듬갚 �젣嫄� + } return cell != null && cell.getStringCellValue() != null && !cell.getStringCellValue().equals("") && cell.getCellType() != Cell.CELL_TYPE_BLANK; } @@ -3502,13 +3509,13 @@ break;*/ case 4: // �떆�옉�씪�쓣 IssueForm �뿉 ���옣�븳�떎. - if (cellNullCheck(cell)) { + if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { this.setIssueFormPeriod(cell, issueForm, true, rowIndex); } break; case 5: // 醫낅즺�씪�쓣 IssueForm �뿉 ���옣�븳�떎. - if (cellNullCheck(cell)) { + if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { this.setIssueFormPeriod(cell, issueForm, false, rowIndex); } break; @@ -3580,7 +3587,7 @@ // �씠�뒋 �젣紐⑹쓣 IssueForm �뿉 ���옣�븳�떎. private void setIssueFormTitle(Cell cell, IssueForm issueForm, int rowIndex) { - if (cell == null) { + if (!cellNullCheck(cell)) { throw new OwlRuntimeException( this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_ISSUE_TITLE_IS_NULL, rowIndex)); } @@ -3628,7 +3635,7 @@ // �슦�꽑�닚�쐞瑜� IssueForm �뿉 ���옣�븳�떎. private void setIssueFormPriority(Cell cell, Map<String, Priority> priorityMaps, IssueForm issueForm, int rowIndex) { - if (cell == null) { + if (!cellNullCheck(cell)) { throw new OwlRuntimeException( this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_PRIORITY_IS_NULL, rowIndex)); } @@ -3645,7 +3652,7 @@ // 以묒슂�룄瑜� IssueForm �뿉 ���옣�븳�떎. private void setIssueFormSeverity(Cell cell, Map<String, Severity> severityMaps, IssueForm issueForm, int rowIndex) { - if (cell == null) { + if (!cellNullCheck(cell)) { throw new OwlRuntimeException( this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_SEVERITY_IS_NULL, rowIndex)); } @@ -3681,8 +3688,13 @@ // 媛믪씠 怨듬갚�씠硫� 以묒� String cellValue = CommonUtil.convertExcelStringToCell(cell); - if (StringUtils.isEmpty(cellValue) || !cell.toString().equals("null")) { + if (StringUtils.isEmpty(cellValue) || cell.toString().equals("null")) { return; + } + + if (cell.toString().length() < 10 && cell.toString().contains("-")) { //�궇吏� �삎�떇 泥댄겕 + throw new OwlRuntimeException( + this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_PERIOD_NOT_DASH, rowIndex)); } Date startDate; @@ -3742,6 +3754,10 @@ } if (customField.getCustomFieldType() == DATETIME) { //DATETIME�씪 寃쎌슦 format 蹂�寃� + if (cell.toString().length() < 10 && cell.toString().contains("-")) { //�궇吏� �삎�떇 泥댄겕 + throw new OwlRuntimeException( + this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_DATETIME_NOT_DASH, rowIndex)); + } Date date = cell.getDateCellValue(); cellValue = new SimpleDateFormat("yyyy-MM-dd H:mm:ss").format(date); } -- Gitblit v1.8.0