OWL ITS + 탐지시스템(인터넷 진흥원)
이민희
2022-02-07 4ab15ca2bb74d0d33d1325d849422635b9d415b1
src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java
@@ -442,16 +442,34 @@
     * @param cell Cell
     * @return boolean
     */
    private Boolean cellNullCheck (Cell cell) {
        return cell != null && cell.getStringCellValue() != null && cell.getCellType() != Cell.CELL_TYPE_BLANK;
    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));
        }
        //  공백 제거
        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,
@@ -471,86 +489,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:
                    // 연락처
                    this.telTypeCheck(cell, rowIndex); // 텍스트 형식 체크
                    if (cellNullCheck(cell)) {
                    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;
@@ -681,7 +698,7 @@
    }
    private void setCompanyFormName(Cell cell, CompanyFieldForm companyFieldForm, int rowIndex) {
        if (cell == null) {
        if (!cellNullCheck(cell, rowIndex)) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_COMPANY_NAME_IS_NULL, rowIndex));
        }