From bd78ee158df93958380a6cc2460316fd87ed9713 Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 화, 08 2월 2022 11:39:08 +0900 Subject: [PATCH] - 이슈 임포트 시 IP주소 정규식 표현 체크 - 업체 추가 시 url을 입력하지 않을 경우 중복 체크 하는 오류 수정 --- src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 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..d5410b4 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 { @@ -3765,7 +3765,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 +3774,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