OWL ITS + 탐지시스템(인터넷 진흥원)
src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java
@@ -85,12 +85,19 @@
        this.verifyUrl(companyFieldForm.getUrl(), null);
        if (companyFieldForm.getTelList() != null && companyFieldForm.getTelList().size() > 0) {
            String[] tels = ConvertUtil.ToArray(companyFieldForm.getTelList());
            companyFieldForm.setTel(Arrays.toString(tels));
            String tels = companyFieldForm.getTelList().toString();
            if (tels.contains("[")) {
                tels = tels.substring(1, tels.indexOf("]"));
            }
            companyFieldForm.setTel(tels.trim());
        }
        if (companyFieldForm.getEmailList() != null && companyFieldForm.getEmailList().size() > 0) {
            String[] emails = ConvertUtil.ToArray(companyFieldForm.getEmailList());
            companyFieldForm.setEmail(Arrays.toString(emails));
            String emails = companyFieldForm.getEmailList().toString();
            String email = "";
            if (emails.contains("[")) {
                email = emails.substring(1, emails.indexOf("]"));
            }
            companyFieldForm.setEmail(email.trim());
        }
        CompanyField companyField = ConvertUtil.copyProperties(companyFieldForm, CompanyField.class);
@@ -135,6 +142,40 @@
        return this.companyFieldMapper.find(condition);
    }
    /**
     * companyFieldCategory Name 설정
     * @param companyFieldVo CompanyFieldVo
     * @param companyField CompanyField
     */
    @Override
    public CompanyFieldVo CreateCompanyFieldCategory(CompanyFieldVo companyFieldVo, CompanyField companyField) {
        if (companyField.getCompanyTypeId() != null && companyField.getCompanyTypeId() != -1) {
            CompanyFieldCategory companyType = this.companyFieldCategoryService.find(companyField.getCompanyTypeId());
            if (companyType != null) {
                companyFieldVo.setCompanyTypeName(companyType.getUseValue());
            }
        }
        if (companyField.getParentSectorId() != null && companyField.getParentSectorId() != -1) {
            CompanyFieldCategory parentSector = this.companyFieldCategoryService.find(companyField.getParentSectorId());
            if (parentSector != null) {
                companyFieldVo.setParentSectorName(parentSector.getUseValue());
            }
        }
        if (companyField.getChildSectorId() != null && companyField.getChildSectorId() != -1) {
            CompanyFieldCategory childSector = this.companyFieldCategoryService.find(companyField.getChildSectorId());
            if (childSector != null) {
                companyFieldVo.setChildSectorName(childSector.getUseValue());
            }
        }
        if (companyField.getRegionId() != null && companyField.getRegionId() != -1) {
            CompanyFieldCategory region = this.companyFieldCategoryService.find(companyField.getRegionId());
            if (region != null) {
                companyFieldVo.setRegionName(region.getUseValue());
            }
        }
        return companyFieldVo;
    }
    // 업체 상세 조회한다.
    @Override
    @Transactional
@@ -159,36 +200,7 @@
            ispFieldVo = ConvertUtil.copyProperties(ispField, IspFieldVo.class);
            hostingFieldVo = ConvertUtil.copyProperties(hostingField, HostingFieldVo.class);
            if (companyField.getCompanyTypeId() != null && companyField.getCompanyTypeId() != -1) {
                CompanyFieldCategory companyType = this.companyFieldCategoryService.find(companyField.getCompanyTypeId());
                if (companyType != null) {
                    companyFieldVo.setCompanyTypeName(companyType.getUseValue());
                }
            }
            if (companyField.getParentSectorId() != null && companyField.getParentSectorId() != -1) {
                CompanyFieldCategory parentSector = this.companyFieldCategoryService.find(companyField.getParentSectorId());
                if (parentSector != null) {
                    companyFieldVo.setParentSectorName(parentSector.getUseValue());
                }
            }
            if (companyField.getChildSectorId() != null && companyField.getChildSectorId() != -1) {
                CompanyFieldCategory childSector = this.companyFieldCategoryService.find(companyField.getChildSectorId());
                if (childSector != null) {
                    companyFieldVo.setChildSectorName(childSector.getUseValue());
                }
            }
            if (companyField.getRegionId() != null && companyField.getRegionId() != -1) {
                CompanyFieldCategory region = this.companyFieldCategoryService.find(companyField.getRegionId());
                if (region != null) {
                    companyFieldVo.setRegionName(region.getUseValue());
                }
            }
            /*if (companyField.getStatusId() != null && companyField.getStatusId() != -1) {
                CompanyFieldCategory status = this.companyFieldCategoryService.find(companyField.getStatusId());
                if (status != null) {
                    companyFieldVo.setStatusName(status.getUseValue());
                }
            }*/
            CreateCompanyFieldCategory(companyFieldVo, companyField);
            companyFieldVo.setIspFieldVo(ispFieldVo);
            companyFieldVo.setHostingFieldVo(hostingFieldVo);
@@ -203,12 +215,24 @@
        this.verifyUrl(companyFieldForm.getUrl(), companyFieldForm.getId());
        if (companyFieldForm.getTelList() != null && companyFieldForm.getTelList().size() > 0) {
            String[] tels = ConvertUtil.ToArray(companyFieldForm.getTelList());
            companyFieldForm.setTel(Arrays.toString(tels));
            String tels = companyFieldForm.getTelList().toString();
            if (tels.contains("[")) {
                tels = tels.substring(1, tels.indexOf("]"));
            }
            companyFieldForm.setTel(tels.trim());
        }
        if (companyFieldForm.getEmailList() != null && companyFieldForm.getEmailList().size() > 0) {
            String[] emails = ConvertUtil.ToArray(companyFieldForm.getEmailList());
            companyFieldForm.setEmail(Arrays.toString(emails));
            String emails = companyFieldForm.getEmailList().toString();
            if (emails.contains("[")) {
                emails = emails.substring(1, emails.indexOf("]"));
            }
            companyFieldForm.setEmail(emails.trim());
        }
        CompanyFieldCategory companyFieldCategory = this.companyFieldCategoryService.find(companyFieldForm.getChildSectorId());
        if (!companyFieldCategory.getParentId().equals(companyFieldForm.getParentSectorId())) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.PARENT_SECTOR_NOT_EQUAL));
        }
        CompanyField companyField = ConvertUtil.copyProperties(companyFieldForm, CompanyField.class);
@@ -654,6 +678,19 @@
        CompanyFieldCondition companyFieldCondition = CompanyFieldCondition.make(conditions);
        List<Map<String, Object>> results = this.companyFieldMapper.find(companyFieldCondition);
        CompanyFieldVo companyFieldVo = new CompanyFieldVo();
        if (results != null && results.size() > 0) {
            for (Map<String, Object> result : results) {
                CompanyField companyField = ConvertUtil.convertMapToClass(result, CompanyField.class);
                CompanyFieldVo companyFieldVo2 = CreateCompanyFieldCategory(companyFieldVo, companyField);
                result.put("companyTypeName", companyFieldVo2.getCompanyTypeName());
                result.put("parentSectorName", companyFieldVo2.getParentSectorName());
                result.put("childSectorName", companyFieldVo2.getChildSectorName());
                result.put("regionName", companyFieldVo2.getRegionName());
            }
        }
        List<CompanyFieldVo> companyFieldVos = ConvertUtil.convertListToListClass(results, CompanyFieldVo.class);
        // code_ko_KR 에 code명 설정