OWL ITS + 탐지시스템(인터넷 진흥원)
src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java
@@ -116,16 +116,18 @@
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.COMPANY_NOT_URL));
        }*/
        CompanyField companyField;
        if(id == null){
            companyField = this.companyFieldRepository.findByUrl(url);
        } else {
            companyField = this.companyFieldRepository.findByUrlAndIdNot(url,id);
        }
        if (!StringUtils.isEmpty(url)) {
            CompanyField companyField;
            if(id == null){
                companyField = this.companyFieldRepository.findByUrl(url);
            } else {
                companyField = this.companyFieldRepository.findByUrlAndIdNot(url,id);
            }
        if (companyField != null) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.COMPANY_USED_URL));
            if (companyField != null) {
                throw new OwlRuntimeException(
                        this.messageAccessor.getMessage(MsgConstants.COMPANY_USED_URL));
            }
        }
    }
@@ -442,19 +444,34 @@
     * @param cell Cell
     * @return boolean
     */
    private Boolean cellNullCheck (Cell cell) {
        if (cell != null && cell.getStringCellValue() != null) {
            cell.setCellValue(cell.getStringCellValue().trim());//셀 값 공백 제거
    private Boolean cellNullCheck (Cell cell, int rowIndex) {
        boolean result = false;
        //  문자형식인지 체크
        if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK && cell.getCellType() != cell.CELL_TYPE_STRING) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_NOT_STRING_TYPE, rowIndex));
        }
        return cell != null && cell.getStringCellValue() != null && !cell.getStringCellValue().equals("") && cell.getCellType() != Cell.CELL_TYPE_BLANK;
        //  공백 제거
        if (cell != null && cell.getCellType() == cell.CELL_TYPE_STRING && cell.getStringCellValue() != null) {
            cell.setCellValue(cell.getStringCellValue().trim());
        }
        if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK && cell.getCellType() == cell.CELL_TYPE_STRING
                && cell.getStringCellValue() != null && !cell.getStringCellValue().equals("")) {
            result = true;
        }
        return result;
    }
    private void telTypeCheck (Cell cell, int rowIndex) {
        if (cell.getCellType() != cell.CELL_TYPE_STRING) {
    /*private void telTypeCheck (Cell cell, int rowIndex) {
        if (cell != null && cell.getCellType() != cell.CELL_TYPE_STRING) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_TEL_NOT_STRING_TYPE, rowIndex));
        }
    }
    }*/
    //  엑셀 필드에 있는 정보를 업체 form 으로 옮긴다.
    private CompanyFieldForm setCompanyFieldFormToExcelField(Row row, int rowIndex, Map<String, IspField> ispFieldMaps, Map<String, HostingField> hostingFieldMaps,
@@ -474,85 +491,85 @@
                case 1:
                    //  url
                    if (cellNullCheck(cell)) {
                    if (cellNullCheck(cell, rowIndex)) {
                        this.setCompanyFormUrl(cell, companyFieldForm, rowIndex);
                    }
                    break;
                case 2:
                    // isp명
                    if (cellNullCheck(cell)) {
                    if (cellNullCheck(cell, rowIndex)) {
                        this.setCompanyFormIspName(cell, ispFieldMaps, companyFieldForm, rowIndex);
                    }
                    break;
                case 3:
                    // 호스팅명
                    if (cellNullCheck(cell)) {
                    if (cellNullCheck(cell, rowIndex)) {
                        this.setCompanyFormHostingName(cell, hostingFieldMaps, companyFieldForm, rowIndex);
                    }
                    break;
                case 4:
                    // 연락처
                    if (cellNullCheck(cell)) {
                        this.telTypeCheck(cell, rowIndex); // 텍스트 형식 체크
                    if (cellNullCheck(cell, rowIndex)) {
                        //this.telTypeCheck(cell, rowIndex);
                        this.setCompanyFormTel(cell, companyFieldForm, rowIndex);
                    }
                    break;
                case 5:
                    // 이메일
                    if (cellNullCheck(cell)) {
                    if (cellNullCheck(cell, rowIndex)) {
                        this.setCompanyFormEmail(cell, companyFieldForm, rowIndex);
                    }
                    break;
                case 6:
                    // 담당자
                    if (cellNullCheck(cell)) {
                    if (cellNullCheck(cell, rowIndex)) {
                        this.setCompanyFormManager(cell, companyFieldForm, rowIndex);
                    }
                    break;
                case 7:
                    // 기업구분
                    if (cellNullCheck(cell)) {
                    if (cellNullCheck(cell, rowIndex)) {
                        this.setCompanyFormCompanyType(cell, companyTypeMaps, companyFieldForm, rowIndex);
                    }
                    break;
                case 8:
                    // 업종(대분류)
                    if (cellNullCheck(cell)) {
                    if (cellNullCheck(cell, rowIndex)) {
                        this.setCompanyFormParentSector(cell, parentSectorMaps, companyFieldForm, rowIndex);
                    }
                    break;
                case 9:
                    // 업종(중분류)
                    if (cellNullCheck(cell)) {
                    if (cellNullCheck(cell, rowIndex)) {
                        this.setCompanyFormChildSector(cell, childSectorMaps, companyFieldForm, rowIndex);
                    }
                    break;
                case 10:
                    // 지역
                    if (cellNullCheck(cell)) {
                    if (cellNullCheck(cell, rowIndex)) {
                        this.setCompanyFormRegion(cell, regionMaps, companyFieldForm, rowIndex);
                    }
                    break;
                case 11:
                    // 상태
                    if (cellNullCheck(cell)) {
                    if (cellNullCheck(cell, rowIndex)) {
                        this.setCompanyFormStatus(cell, statusMaps, companyFieldForm, rowIndex);
                    }
                    break;
                case 12:
                    // 비고
                    if (cellNullCheck(cell)) {
                    if (cellNullCheck(cell, rowIndex)) {
                        this.setCompanyFormMemo(cell, companyFieldForm, rowIndex);
                    }
                    break;
@@ -683,7 +700,7 @@
    }
    private void setCompanyFormName(Cell cell, CompanyFieldForm companyFieldForm, int rowIndex) {
        if (!cellNullCheck(cell)) {
        if (!cellNullCheck(cell, rowIndex)) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_COMPANY_NAME_IS_NULL, rowIndex));
        }