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 | 21 +++++++++++++++++---- 1 files changed, 17 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 62f8272..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,10 @@ * @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());//�� 媛� 怨듬갚 �젣嫄� } @@ -3505,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; @@ -3684,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; @@ -3715,7 +3724,7 @@ // �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� IssueForm �뿉 ���옣�븳�떎.- private void setIssueFormCustomFieldValue(Cell cell, Map<String, CustomField> customFieldMaps, IssueForm issueForm, String customFieldName, int rowIndex) { - if (!cellNullCheck(cell)) { + if (cell != null) { String cellValue = CommonUtil.convertExcelStringToCell(cell); Map<String, Object> issueCustomFieldMap = new HashMap<>(); CustomField customField = customFieldMaps.get(customFieldName); @@ -3745,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