OWL ITS + 탐지시스템(인터넷 진흥원)
박지현
2022-02-22 302112b8c095984fe054bb357cbbd2ef3d88e844
src/main/java/kr/wisestone/owl/service/impl/IspFieldServiceImpl.java
@@ -33,6 +33,7 @@
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.regex.Pattern;
@Service
public class IspFieldServiceImpl extends AbstractServiceImpl<IspField, Long, JpaRepository<IspField, Long>> implements IspFieldService {
@@ -472,23 +473,55 @@
    private void setIspFormEmail(String email, IspFieldForm ispFieldForm, boolean isNull) {
        if (!isNull) {
            if (email.contains(" ")) {
                email = email.replace(" ", "");
            }
            //  이메일 유효성 검사
            email = this.verifyEmail(email);
            ispFieldForm.setEmail(email);
        }
    }
    /**
     * 이메일 유효성 검사
     * @param email String
     * @return String
     */
    private String verifyEmail(String email) {
        if (!Pattern.matches("^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$", email)) {
            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.EMAIL_NOT_INVALID));
        }
        if (email.contains(" ")) {
            email = email.replace(" ", "");
        }
        return email;
    }
    private void setIspFormTel(String tel, IspFieldForm ispFieldForm, int rowIndex, boolean isNull) {
        if (!isNull) {
            if (tel.contains("-")) {
                tel = tel.replace("-", "");
            }
            if (tel.contains(" ")) {
                tel = tel.replace(" ", "");
            }
            //  연락처 유효성 검사
            tel = this.verifyTel(tel);
            ispFieldForm.setTel(tel);
        }
    }
    /**
     * 연락처 유효성 검사
     * @param tel String
     * @return String
     */
    private String verifyTel(String tel) {
        if (!Pattern.matches("^[0-9-]{2,20}$", tel)) {
            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.TEL_NOT_INVALID));
        }
        if (tel.contains("-")) {
            tel = tel.replace("-", "");
        }
        if (tel.contains(" ")) {
            tel = tel.replace(" ", "");
        }
        return tel;
    }
    private void setIspFormManager(String manager, IspFieldForm ispFieldForm, boolean isNull) {
@@ -499,9 +532,20 @@
    private void setIspFormCode(String code, IspFieldForm ispFieldForm) {
        //코드 유효성 체크
        this.verifyCode(code);
        ispFieldForm.setCode(code);
    }
    /**
     * 코드 유효성 검사
     * @param code String
     */
    private void verifyCode(String code) {
        if (!Pattern.matches("^[a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ\\u318D\\u119E\\u11A2\\u2022\\u2025a\\u00B7\\uFE55]+$", code)) {
            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.CODE_NOT_INVALID));
        }
    }
    private void setIspFormName(String title, IspFieldForm ispFieldForm) {
        //  ISP명 유효성 체크
        //this.verifyTitle(title, null);