| | |
| | | public CompanyField addCompany(CompanyFieldForm companyFieldForm) { |
| | | // 업체명 중복 체크 |
| | | this.verifyTitle(companyFieldForm.getName(), null); |
| | | // url 유효성 체크 |
| | | this.verifyUrl(companyFieldForm.getUrl(), null); |
| | | |
| | | if (companyFieldForm.getUrl() != null) { |
| | | // url 유효성 체크 |
| | | this.verifyUrl(companyFieldForm.getUrl(), null); |
| | | } |
| | | |
| | | if (companyFieldForm.getTelList() != null && companyFieldForm.getTelList().size() > 0) { |
| | | String tels = companyFieldForm.getTelList().toString(); |
| | |
| | | |
| | | // url 유효성 체크 |
| | | private void verifyUrl(String url, Long id) { |
| | | if (StringUtils.isEmpty(url)) { |
| | | /*if (StringUtils.isEmpty(url)) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.COMPANY_NOT_URL)); |
| | | } |
| | | }*/ |
| | | CompanyField companyField; |
| | | |
| | | if(id == null){ |
| | | companyField = this.companyFieldRepository.findByUrl(url); |
| | | } else { |
| | |
| | | public void modifyCompany(CompanyFieldForm companyFieldForm) { |
| | | // 업체명 유효성 체크 |
| | | this.verifyTitle(companyFieldForm.getName(), companyFieldForm.getId()); |
| | | // url 유효성 체크 |
| | | this.verifyUrl(companyFieldForm.getUrl(), companyFieldForm.getId()); |
| | | |
| | | if (companyFieldForm.getUrl() != null) { |
| | | // url 유효성 체크 |
| | | this.verifyUrl(companyFieldForm.getUrl(), companyFieldForm.getId()); |
| | | } |
| | | |
| | | if (companyFieldForm.getTelList() != null && companyFieldForm.getTelList().size() > 0) { |
| | | String tels = companyFieldForm.getTelList().toString(); |
| | |
| | | * @return boolean |
| | | */ |
| | | private Boolean cellNullCheck (Cell cell) { |
| | | return cell != null && cell.getStringCellValue() != null && cell.getCellType() != Cell.CELL_TYPE_BLANK; |
| | | if (cell != null && cell.getStringCellValue() != null) { |
| | | cell.setCellValue(cell.getStringCellValue().trim());//셀 값 공백 제거 |
| | | } |
| | | return cell != null && cell.getStringCellValue() != null && !cell.getStringCellValue().equals("") && cell.getCellType() != Cell.CELL_TYPE_BLANK; |
| | | } |
| | | |
| | | private void telTypeCheck (Cell cell, int rowIndex) { |
| | | if (cell.getCellType() != cell.CELL_TYPE_STRING) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_TEL_NOT_STRING_TYPE, rowIndex)); |
| | | } |
| | | } |
| | | |
| | | // 엑셀 필드에 있는 정보를 업체 form 으로 옮긴다. |
| | |
| | | |
| | | case 1: |
| | | // url |
| | | this.setCompanyFormUrl(cell, companyFieldForm, rowIndex); |
| | | if (cellNullCheck(cell)) { |
| | | this.setCompanyFormUrl(cell, companyFieldForm, rowIndex); |
| | | } |
| | | break; |
| | | |
| | | case 2: |
| | |
| | | case 4: |
| | | // 연락처 |
| | | if (cellNullCheck(cell)) { |
| | | this.telTypeCheck(cell, rowIndex); // 텍스트 형식 체크 |
| | | this.setCompanyFormTel(cell, companyFieldForm, rowIndex); |
| | | } |
| | | break; |
| | |
| | | } |
| | | |
| | | private void setCompanyFormName(Cell cell, CompanyFieldForm companyFieldForm, int rowIndex) { |
| | | if (cell == null) { |
| | | if (!cellNullCheck(cell)) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_COMPANY_NAME_IS_NULL, rowIndex)); |
| | | } |
| | |
| | | } |
| | | |
| | | private void setCompanyFormUrl(Cell cell, CompanyFieldForm companyFieldForm, int rowIndex) { |
| | | if (cell == null) { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_URL_IS_NULL, rowIndex)); |
| | | } |
| | | String url = CommonUtil.convertExcelStringToCell(cell); |
| | | if (url.contains(" ")) { |
| | | url = url.replace(" ", ""); |
| | | } |
| | | this.verifyUrl(url, null); //url 유효성 검사 |
| | | if (cell != null) { |
| | | String url = CommonUtil.convertExcelStringToCell(cell); |
| | | if (url.contains(" ")) { |
| | | url = url.replace(" ", ""); |
| | | } |
| | | this.verifyUrl(url, null); //url 유효성 검사 |
| | | |
| | | companyFieldForm.setUrl(url); |
| | | companyFieldForm.setUrl(url); |
| | | } |
| | | } |
| | | |
| | | // 업체명 유효성 체크 |