| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * cell NULL 체크 함수 |
| | | * @param cell Cell |
| | | * @return boolean |
| | | */ |
| | | private Boolean cellNullCheck (Cell cell) { |
| | | return cell != null && cell.getStringCellValue() != null && cell.getCellType() != Cell.CELL_TYPE_BLANK; |
| | | } |
| | | |
| | | // 엑셀 필드에 있는 정보를 업체 form 으로 옮긴다. |
| | | private CompanyFieldForm setCompanyFieldFormToExcelField(Row row, int rowIndex, Map<String, IspField> ispFieldMaps, Map<String, HostingField> hostingFieldMaps, |
| | | Map<String, Map<String, Object>> companyTypeMaps, Map<String, Map<String, Object>> parentSectorMaps, |
| | |
| | | |
| | | case 2: |
| | | // isp명 |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | if (cellNullCheck(cell)) { |
| | | this.setCompanyFormIspName(cell, ispFieldMaps, companyFieldForm, rowIndex); |
| | | } |
| | | break; |
| | | |
| | | case 3: |
| | | // 호스팅명 |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | if (cellNullCheck(cell)) { |
| | | this.setCompanyFormHostingName(cell, hostingFieldMaps, companyFieldForm, rowIndex); |
| | | } |
| | | break; |
| | | |
| | | case 4: |
| | | // 연락처 |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | if (cellNullCheck(cell)) { |
| | | this.setCompanyFormTel(cell, companyFieldForm, rowIndex); |
| | | } |
| | | break; |
| | | |
| | | case 5: |
| | | // 이메일 |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | if (cellNullCheck(cell)) { |
| | | this.setCompanyFormEmail(cell, companyFieldForm, rowIndex); |
| | | } |
| | | break; |
| | | |
| | | case 6: |
| | | // 담당자 |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | if (cellNullCheck(cell)) { |
| | | this.setCompanyFormManager(cell, companyFieldForm, rowIndex); |
| | | } |
| | | break; |
| | | |
| | | case 7: |
| | | // 기업구분 |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | if (cellNullCheck(cell)) { |
| | | this.setCompanyFormCompanyType(cell, companyTypeMaps, companyFieldForm, rowIndex); |
| | | } |
| | | break; |
| | | |
| | | case 8: |
| | | // 업종(대분류) |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | if (cellNullCheck(cell)) { |
| | | this.setCompanyFormParentSector(cell, parentSectorMaps, companyFieldForm, rowIndex); |
| | | } |
| | | break; |
| | | |
| | | case 9: |
| | | // 업종(중분류) |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | if (cellNullCheck(cell)) { |
| | | this.setCompanyFormChildSector(cell, childSectorMaps, companyFieldForm, rowIndex); |
| | | } |
| | | break; |
| | | |
| | | case 10: |
| | | // 지역 |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | if (cellNullCheck(cell)) { |
| | | this.setCompanyFormRegion(cell, regionMaps, companyFieldForm, rowIndex); |
| | | } |
| | | break; |
| | | |
| | | case 11: |
| | | // 상태 |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | if (cellNullCheck(cell)) { |
| | | this.setCompanyFormStatus(cell, statusMaps, companyFieldForm, rowIndex); |
| | | } |
| | | |
| | | case 12: |
| | | // 비고 |
| | | if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK) { |
| | | if (cellNullCheck(cell)) { |
| | | this.setCompanyFormMemo(cell, companyFieldForm, rowIndex); |
| | | } |
| | | break; |
| | |
| | | |
| | | private void setCompanyFormEmail(Cell cell, CompanyFieldForm companyFieldForm, int rowIndex) { |
| | | if (cell != null) { |
| | | companyFieldForm.setEmail(CommonUtil.convertExcelStringToCell(cell)); |
| | | String email = CommonUtil.convertExcelStringToCell(cell); |
| | | if (CommonUtil.convertExcelStringToCell(cell).contains(" ")) { |
| | | email = CommonUtil.convertExcelStringToCell(cell).replace(" ", ""); |
| | | } |
| | | companyFieldForm.setEmail(email); |
| | | } |
| | | } |
| | | |
| | | private void setCompanyFormTel(Cell cell, CompanyFieldForm companyFieldForm, int rowIndex) { |
| | | if (cell != null) { |
| | | companyFieldForm.setTel(CommonUtil.convertExcelStringToCell(cell)); |
| | | String tel = CommonUtil.convertExcelStringToCell(cell); |
| | | if (tel.contains("-")) { |
| | | tel = tel.replace("-", ""); |
| | | } |
| | | if (tel.contains(" ")) { |
| | | tel = tel.replace(" ", ""); |
| | | } |
| | | companyFieldForm.setTel(tel); |
| | | } |
| | | } |
| | | |
| | | private void setCompanyFormHostingName(Cell cell, Map<String, HostingField> hostingFieldMaps, CompanyFieldForm companyFieldForm, int rowIndex) { |
| | | if (cell != null) { |
| | | |
| | | HostingField hostingField = hostingFieldMaps.get(CommonUtil.convertExcelStringToCell(cell)); |
| | | if (hostingField == null) { |
| | | throw new OwlRuntimeException( |
| | |
| | | |
| | | private void setCompanyFormIspName(Cell cell, Map<String, IspField> ispFieldMaps, CompanyFieldForm companyFieldForm, int rowIndex) { |
| | | if (cell != null) { |
| | | |
| | | IspField ispField = ispFieldMaps.get(CommonUtil.convertExcelStringToCell(cell)); |
| | | if (ispField == 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 유효성 검사 |
| | | |
| | | companyFieldForm.setUrl(url); |