From 079da7d7e3c08c4c38898d508b7568b5e451f5b3 Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 화, 08 2월 2022 15:37:03 +0900 Subject: [PATCH] - 이슈 임포트 시 cell null 이중체크 --- src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java | 43 +++++++++++++++++++++++++++++-------------- 1 files changed, 29 insertions(+), 14 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 7724e79..12306c7 100644 --- a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java +++ b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java @@ -49,9 +49,9 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; +import java.util.regex.Pattern; -import static kr.wisestone.owl.domain.enumType.CustomFieldType.DATETIME; -import static kr.wisestone.owl.domain.enumType.CustomFieldType.INPUT; +import static kr.wisestone.owl.domain.enumType.CustomFieldType.*; @Service public class IssueServiceImpl extends AbstractServiceImpl<Issue, Long, JpaRepository<Issue, Long>> implements IssueService { @@ -3481,7 +3481,7 @@ if (cellType < Cell.CELL_TYPE_BLANK) { if (cellType == Cell.CELL_TYPE_STRING) { - if (cell.getStringCellValue() != null) { + if (cell.getStringCellValue() != null && !cell.getStringCellValue().equals("")) { return false; } } else { @@ -3491,9 +3491,6 @@ } return true; } - - - // �뿊�� �븘�뱶�뿉 �엳�뒗 �젙蹂대�� �씠�뒋 form �쑝濡� �삷湲대떎. private IssueForm setIssueFormToExcelField(Row row, int rowIndex, Map<String, Priority> priorityMaps, @@ -3508,17 +3505,21 @@ // �젣紐�, �궡�슜, �봽濡쒖젥�듃 �궎, �씠�뒋 ���엯, �슦�꽑�닚�쐞, 以묒슂�룄, �떞�떦�옄, �떆�옉�씪, 醫낅즺�씪, �궗�슜�옄 �젙�쓽 �븘�뱶 for (int cellIndex = 0; cellIndex < headers.size(); cellIndex++) { Cell cell = row.getCell(cellIndex); - boolean isNull = cellNullCheck(cell); + boolean isNull = true; String cellStr = ""; - if (!isNull) { - cellStr = CommonUtil.convertExcelStringToCell(cell); + if (cell != null) { + isNull = cellNullCheck(cell); - // 怨듬갚 �젣嫄� - cell.setCellValue(cellStr.trim()); - } else { - cell.setCellValue(cellStr); + if (!isNull) { + cellStr = CommonUtil.convertExcelStringToCell(cell); + + // 怨듬갚 �젣嫄� + cell.setCellValue(cellStr.trim()); + } else { + cell.setCellValue(cellStr); + } } switch (cellIndex) { @@ -3765,7 +3766,8 @@ this.messageAccessor.getMessage(MsgConstants.CUSTOM_FIELD_TEXT_TYPE_MAX_LENGTH_OUT)); } - if (customField.getCustomFieldType() == DATETIME) { //DATETIME�씪 寃쎌슦 format 蹂�寃� + //DATETIME�씪 寃쎌슦 format 蹂�寃� + if (customField.getCustomFieldType() == DATETIME) { Date date = DateUtil.convertStrToDate(cellValue); if (date == null) { throw new OwlRuntimeException( @@ -3773,6 +3775,19 @@ } } + //IP_ADDRESS�씪 寃쎌슦 �젙洹쒗몴�쁽�떇 泥댄겕 + if (customField.getCustomFieldType() == IP_ADDRESS) { + String regExp = "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\." + + "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\." + + "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\." + + "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"; + + if (!cellValue.matches(regExp)) { + throw new OwlRuntimeException( + this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_IP_ADDRESS_NOT_VALIDITY, rowIndex)); + } + } + issueCustomFieldMap.put("customFieldId", customField.getId()); issueCustomFieldMap.put("useValue", cellValue); issueForm.addIssueCustomFields(issueCustomFieldMap); -- Gitblit v1.8.0