| | |
| | | import kr.wisestone.owl.util.MapUtil; |
| | | import kr.wisestone.owl.web.condition.CompanyFieldCondition; |
| | | import kr.wisestone.owl.web.form.CompanyFieldForm; |
| | | import kr.wisestone.owl.web.form.IssueForm; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.*; |
| | | import java.util.regex.Pattern; |
| | | |
| | | @Service |
| | | public class CompanyFieldServiceImpl extends AbstractServiceImpl<CompanyField, Long, JpaRepository<CompanyField, Long>> implements CompanyFieldService { |
| | |
| | | |
| | | private void setCompanyFormEmail(String email, CompanyFieldForm companyFieldForm, boolean isNull) { |
| | | if (!isNull) { |
| | | if (email.contains(" ")) { |
| | | email = email.replace(" ", ""); |
| | | } |
| | | // 이메일 유효성 검사 |
| | | email = this.verifyEmail(email); |
| | | companyFieldForm.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 setCompanyFormTel(String tel, CompanyFieldForm companyFieldForm, boolean isNull) { |
| | | if (!isNull) { |
| | | if (tel.contains("-")) { |
| | | tel = tel.replace("-", ""); |
| | | } |
| | | if (tel.contains(" ")) { |
| | | tel = tel.replace(" ", ""); |
| | | } |
| | | // 연락처 유효성 검사 |
| | | tel = this.verifyTel(tel); |
| | | companyFieldForm.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 setCompanyFormHostingName(String cellStr, Map<String, HostingField> hostingFieldMaps, CompanyFieldForm companyFieldForm, int rowIndex, boolean isNull) { |
| | | if (!isNull) { |
| | | HostingField hostingField = hostingFieldMaps.get(cellStr); |