From c5ce099b314be4b296137415a146c610095ae92e Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 금, 11 3월 2022 13:54:09 +0900
Subject: [PATCH] - api로 이슈 추가 시 하위이슈기준이 2개 일 경우 코드 수정 - 업체 추가/수정 시 ip대역대 중복 체크 - 이슈 추가/수정 시 ip대역대 수정불가

---
 src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java |  874 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 852 insertions(+), 22 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java
index 06d7e86..a261137 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/CompanyFieldServiceImpl.java
@@ -1,11 +1,17 @@
 package kr.wisestone.owl.service.impl;
 
-import kr.wisestone.owl.domain.CompanyField;
-import kr.wisestone.owl.domain.CustomField;
-import kr.wisestone.owl.service.UserService;
+import kr.wisestone.owl.domain.*;
+import kr.wisestone.owl.domain.enumType.CompanyFieldCategoryType;
+import kr.wisestone.owl.repository.HostingFieldRepository;
+import kr.wisestone.owl.repository.IspFieldRepository;
+import kr.wisestone.owl.service.*;
+import kr.wisestone.owl.util.CommonUtil;
+import kr.wisestone.owl.util.MapUtil;
 import kr.wisestone.owl.web.condition.CompanyFieldCondition;
 import kr.wisestone.owl.web.form.CompanyFieldForm;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.ui.Model;
 import com.google.common.collect.Lists;
 import kr.wisestone.owl.common.ExcelConditionCheck;
@@ -14,8 +20,6 @@
 import kr.wisestone.owl.exception.OwlRuntimeException;
 import kr.wisestone.owl.mapper.CompanyFieldMapper;
 import kr.wisestone.owl.repository.CompanyFieldRepository;
-import kr.wisestone.owl.service.CompanyFieldService;
-import kr.wisestone.owl.service.WorkspaceService;
 import kr.wisestone.owl.util.ConvertUtil;
 import kr.wisestone.owl.vo.*;
 import kr.wisestone.owl.web.view.ExcelView;
@@ -23,12 +27,12 @@
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.regex.Pattern;
 
 @Service
 public class CompanyFieldServiceImpl extends AbstractServiceImpl<CompanyField, Long, JpaRepository<CompanyField, Long>> implements CompanyFieldService {
@@ -38,6 +42,21 @@
 
     @Autowired
     private CompanyFieldMapper companyFieldMapper;
+
+    @Autowired
+    private IspFieldRepository ispFieldRepository;
+
+    @Autowired
+    private HostingFieldRepository hostingFieldRepository;
+
+    @Autowired
+    private IspFieldService ispFieldService;
+
+    @Autowired
+    private HostingFieldService hostingFieldService;
+
+    @Autowired
+    private CompanyFieldCategoryService companyFieldCategoryService;
 
     @Autowired
     private UserService userService;
@@ -56,28 +75,126 @@
         return this.companyFieldRepository;
     }
 
+    private static final int EXCEL_DOWNLOAD_MAX_ROWS = 10000;   //  excel download �젣�븳
+    private static final int EXCEL_IMPORT_MAX_ROWS = 10000; //  excel import �젣�븳
+
     // �뾽泥� 異붽�
     @Override
     public CompanyField addCompany(CompanyFieldForm companyFieldForm) {
-        //  url �쑀�슚�꽦 泥댄겕
-        this.verifyUrl(companyFieldForm.getUrl());
+        //  �뾽泥대챸 以묐났 泥댄겕
+        this.verifyTitle(companyFieldForm.getName(), null);
+
+        if (companyFieldForm.getIpStart() != null && companyFieldForm.getIpEnd() != null) {
+            //  �븘�씠�뵾 �쑀�슚�꽦 泥댄겕
+            this.verifyIp(companyFieldForm.getIpStart(), companyFieldForm.getIpEnd(), null);
+        }
+
+        if (companyFieldForm.getUrl() != null) {
+            //  url �쑀�슚�꽦 泥댄겕
+            this.verifyUrl(companyFieldForm.getUrl(), null);
+        }
+
+        if (companyFieldForm.getTelList() != null && companyFieldForm.getTelList().size() > 0) {
+            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 = 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);
         companyFieldRepository.saveAndFlush(companyField);
         return companyField;
     }
 
-    //  url �쑀�슚�꽦 泥댄겕
-    private void verifyUrl(String url) {
-        if (StringUtils.isEmpty(url)) {
-            throw new OwlRuntimeException(
-                    this.messageAccessor.getMessage(MsgConstants.COMPANYFIELD_NOT_URL));
+    /**
+     * IP �쑀�슚�꽦 泥댄겕
+     * @param ip String
+     */
+    private void verifyIp(String ip, String ip2, Long id) {
+        if (!StringUtils.isEmpty(ip)) {
+            if (!Pattern.matches("^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\" +
+                    ".(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", ip)) {
+                throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.IP_NOT_INVALID));
+            }
         }
-        CompanyField companyField = this.companyFieldRepository.findByUrl(url);
+        if (!StringUtils.isEmpty(ip2)) {
+            if (!Pattern.matches("^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\" +
+                    ".(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", ip2)) {
+                throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.IP_NOT_INVALID));
+            }
+        }
 
-        if (companyField != null) {
+        if (!StringUtils.isEmpty(ip) && !StringUtils.isEmpty(ip2)) {
+            long ipStart = ConvertUtil.ipToLong(ip);
+            long ipEnd = ConvertUtil.ipToLong(ip2);
+            if (ipEnd < ipStart) {
+                throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.IP_START_NOT_LARGER_THAN_END));
+            }
+
+            List<CompanyField> companyFields = Lists.newArrayList();
+            CompanyFieldCondition condition = new CompanyFieldCondition();
+            condition.setIpStart(String.valueOf(ipStart));
+            condition.setIpEnd(String.valueOf(ipEnd));
+            if (id != null) {
+                condition.setId(id);
+                companyFields = this.companyFieldMapper.findByIpsAndIdNot(condition);
+            } else {
+                companyFields = this.companyFieldMapper.findByIps(condition);
+            }
+
+            //  IP���뿭�� 以묐났 泥댄겕
+            if (companyFields != null && companyFields.size() > 0) {
+                throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.COMPANY_EXIST_IP));
+            }
+        }
+    }
+
+    //  url �쑀�슚�꽦 泥댄겕
+    private void verifyUrl(String url, Long id) {
+        /*if (StringUtils.isEmpty(url)) {
             throw new OwlRuntimeException(
-                    this.messageAccessor.getMessage(MsgConstants.COMPANYFIELD_USED_URL));
+                    this.messageAccessor.getMessage(MsgConstants.COMPANY_NOT_URL));
+        }*/
+        if (!StringUtils.isEmpty(url)) {
+            List<CompanyField> companyFieldList = Lists.newArrayList();
+            CompanyFieldCondition condition = new CompanyFieldCondition();
+            String[] urlArr = null;
+            List<String> urls = Lists.newArrayList();
+
+            if (url.contains(" ")) {
+                url = url.replace(" ","");
+            }
+            if (url.contains(",")) {
+                urlArr = url.split(",");
+                urls.addAll(Arrays.asList(urlArr));
+            } else {
+                urls.add(url);
+            }
+
+            if (urls.size() > 0) {
+                condition.setUrl(urls);
+
+                if(id == null){
+                    companyFieldList = this.companyFieldMapper.findByUrls(condition);
+                } else {
+                    condition.setId(id);
+                    companyFieldList = this.companyFieldMapper.findByUrlsAndIdNot(condition);
+                }
+            }
+
+            if (companyFieldList != null && companyFieldList.size() > 0) {
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.COMPANY_USED_URL));
+            }
         }
     }
 
@@ -94,16 +211,82 @@
         return this.convertCompanyVoToMap(results, totalCompanyCount, pageable, resJsonData);
     }
 
+    public List<Map<String, Object>> find(CompanyFieldCondition condition) {
+        return this.companyFieldMapper.find(condition);
+    }
+
+    //  紐⑤뱺 �뾽泥댁젙蹂대�� 議고쉶�븳�떎. �씠�뒋 �뿊�� import �뿉�꽌 �궗�슜
+    @Override
+    @Transactional(readOnly = true)
+    public List<CompanyField> findAll() {
+        return this.companyFieldRepository.findAll();
+    }
+
+    /**
+     * 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());
+            }
+        }
+        if (companyField.getStatusName() != null && !companyField.getStatusName().equals("")) {
+            companyFieldVo.setStatusName(companyField.getStatusName());
+        }
+        return companyFieldVo;
+    }
 
     // �뾽泥� �긽�꽭 議고쉶�븳�떎.
     @Override
+    @Transactional
     public void detailCompany(Map<String, Object> resJsonData, CompanyFieldCondition companyFieldCondition) {
         CompanyFieldVo companyFieldVo = new CompanyFieldVo();
+        IspFieldVo ispFieldVo = new IspFieldVo();
+        HostingFieldVo hostingFieldVo = new HostingFieldVo();
+
+        IspField ispField = new IspField();
+        HostingField hostingField = new HostingField();
 
         Long companyId = companyFieldCondition.getId();
         if (companyId != null) {
             CompanyField companyField = this.getCompany(companyId);
+            if(companyField.getIspId() != null && companyField.getIspId() != -1){
+                ispField = this.ispFieldRepository.getOne(companyField.getIspId());
+            }
+            if(companyField.getHostingId() != null && companyField.getHostingId() != -1){
+                hostingField = this.hostingFieldRepository.getOne(companyField.getHostingId());
+            }
             companyFieldVo = ConvertUtil.copyProperties(companyField, CompanyFieldVo.class);
+            ispFieldVo = ConvertUtil.copyProperties(ispField, IspFieldVo.class);
+            hostingFieldVo = ConvertUtil.copyProperties(hostingField, HostingFieldVo.class);
+
+            CreateCompanyFieldCategory(companyFieldVo, companyField);
+
+            companyFieldVo.setIspFieldVo(ispFieldVo);
+            companyFieldVo.setHostingFieldVo(hostingFieldVo);
         }
         resJsonData.put(Constants.REQ_KEY_CONTENT, companyFieldVo);
     }
@@ -111,8 +294,41 @@
     // �뾽泥� �젙濡쒕�� �닔�젙�븳�떎.
     @Override
     public void modifyCompany(CompanyFieldForm companyFieldForm) {
-        //  url �쑀�슚�꽦 泥댄겕
-        this.verifyUrl(companyFieldForm.getUrl());
+        //  �뾽泥대챸 �쑀�슚�꽦 泥댄겕
+        this.verifyTitle(companyFieldForm.getName(), companyFieldForm.getId());
+
+        if (companyFieldForm.getIpStart() != null && companyFieldForm.getIpEnd() != null) {
+            //  �븘�씠�뵾 �쑀�슚�꽦 泥댄겕
+            this.verifyIp(companyFieldForm.getIpStart(), companyFieldForm.getIpEnd(), 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();
+            if (tels.contains("[")) {
+                tels = tels.substring(1, tels.indexOf("]"));
+            }
+            companyFieldForm.setTel(tels.trim());
+        }
+        if (companyFieldForm.getEmailList() != null && companyFieldForm.getEmailList().size() > 0) {
+            String emails = companyFieldForm.getEmailList().toString();
+            if (emails.contains("[")) {
+                emails = emails.substring(1, emails.indexOf("]"));
+            }
+            companyFieldForm.setEmail(emails.trim());
+        }
+
+        if (companyFieldForm.getChildSectorId() != null) {
+            CompanyFieldCategory companyFieldCategory = this.companyFieldCategoryService.find(companyFieldForm.getChildSectorId());
+            if (companyFieldCategory != null && !companyFieldCategory.getParentId().equals(companyFieldForm.getParentSectorId())) {
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.PARENT_SECTOR_NOT_EQUAL));
+            }
+        }
 
         CompanyField companyField = ConvertUtil.copyProperties(companyFieldForm, CompanyField.class);
         companyFieldRepository.saveAndFlush(companyField);
@@ -129,6 +345,549 @@
         for (Long id : companyFieldForm.getRemoveIds()) {
             this.companyFieldRepository.deleteById(id);
             this.companyFieldRepository.flush();
+        }
+    }
+
+    //  �뾽泥� Import �슜 �뿊�� �뀥�뵆由� �떎�슫濡쒕뱶
+    @Override
+    @Transactional
+    public ModelAndView downloadExcelTemplate(HttpServletRequest request, Model model) {
+
+        ExportExcelVo excelInfo = new ExportExcelVo();
+        excelInfo.setHideCount(true);
+        excelInfo.setFileName(this.messageAccessor.message("common.registerExcelCompanyField")); // �뿊��濡� �뾽泥� �벑濡앺븯湲�
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.companyName"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // �뾽泥대챸
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.companyUrl"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // url
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.companyIpStart"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // ip �떆�옉 二쇱냼
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.companyIpEnd"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // ip 醫낅즺 二쇱냼
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("isp.ispName"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // isp紐�
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("Hosting.HostingName"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // �샇�뒪�똿紐�
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.companyTel"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �뿰�씫泥�
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.companyEmail"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �씠硫붿씪
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.companyManager"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �떞�떦�옄
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.companyTypeName"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // 湲곗뾽援щ텇
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.parentSectorName"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �뾽醫�(��遺꾨쪟)
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.childSectorName"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �뾽醫�(以묐텇瑜�)
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.regionName"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // 吏��뿭
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.statusName"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �긽�깭
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("companyField.companyMemo"), 40, ExportExcelAttrVo.ALIGN_CENTER)); // 鍮꾧퀬
+
+        //  �뿊���뿉 �꽔�쓣 �뜲�씠�꽣 - CompanyFieldVos �뜲�씠�꽣瑜� �뿊���뿉�꽌 �몴�떆�븷 �닔 �엳�뒗 �뜲�씠�꽣濡� 蹂�寃쏀븳�떎.
+        excelInfo.setDatas(Lists.newArrayList(new CompanyFieldVo()));
+
+        model.addAttribute(Constants.EXCEL, excelInfo);
+        return new ModelAndView(this.excelView);
+    }
+
+    //  �뾽濡쒕뱶 �뙆�씪 �솗�옣�옄 泥댄겕
+    private void verifyMultipartFileExtension(MultipartFile multipartFile) {
+        multipartFile.getOriginalFilename();
+
+        int pos = multipartFile.getOriginalFilename().lastIndexOf(".");
+        String ext = multipartFile.getOriginalFilename().substring(pos + 1);
+
+        if (!ext.equals("xlsx")) {
+            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.EXCEL_NOT_EXTENSION));
+        }
+    }
+
+    //  �뾽泥댁쓽 二쇱슂 �냽�꽦�쓣 map �뿉 ���옣�븯�뿬 �뿊�� import �뿉�꽌 吏��젙�븳 ���긽(�뾽泥� �냽�꽦)�쓣 鍮좊Ⅴ寃� 李얠쓣 �닔 �엳寃� �븳�떎.
+    private void CompanyFieldAttributeMapToList(Map<String, IspField> ispFieldMaps, Map<String, HostingField> hostingFieldMaps,
+                                                             Map<String, Map<String, Object>> companyTypeMaps, Map<String, Map<String, Object>> parentSectorMaps,
+                                                             Map<String, Map<String, Object>> childSectorMaps, Map<String, Map<String, Object>> regionMaps, Map<String, Map<String, Object>> statusMaps) {
+
+        List<IspField> ispFields = this.ispFieldService.findAll();
+        for (IspField ispField : ispFields) {
+            ispFieldMaps.put(ispField.getName(), ispField);
+        }
+
+        List<HostingField> hostingFields = this.hostingFieldService.findAll();
+        for (HostingField hostingField : hostingFields) {
+            hostingFieldMaps.put(hostingField.getName(), hostingField);
+        }
+
+        List<Map<String, Object>> companyTypes = this.companyFieldCategoryService.findByType(CompanyFieldCategoryType.COMPANYTYPE);
+        for (Map<String, Object> companyType : companyTypes) {
+            companyTypeMaps.put(MapUtil.getString(companyType, "useValue"), companyType);
+        }
+
+        List<Map<String, Object>> parentSectors = this.companyFieldCategoryService.findByType(CompanyFieldCategoryType.PARENTSECTOR);
+        for (Map<String, Object> parentSector : parentSectors) {
+            parentSectorMaps.put(MapUtil.getString(parentSector, "useValue"), parentSector);
+        }
+
+        List<Map<String, Object>> childSectors = this.companyFieldCategoryService.findByType(CompanyFieldCategoryType.CHILDSECTOR);
+        for (Map<String, Object> childSector : childSectors) {
+            childSectorMaps.put(MapUtil.getString(childSector, "useValue"), childSector);
+        }
+
+        List<Map<String, Object>> regions = this.companyFieldCategoryService.findByType(CompanyFieldCategoryType.REGION);
+        for (Map<String, Object> region : regions) {
+            regionMaps.put(MapUtil.getString(region, "useValue"), region);
+        }
+
+        List<Map<String, Object>> statuses = this.companyFieldCategoryService.findByType(CompanyFieldCategoryType.STATUS);
+        for (Map<String, Object> status : statuses) {
+            statusMaps.put(MapUtil.getString(status, "useValue"), status);
+        }
+    }
+
+    //  �뿊�� import 濡� �뾽泥대�� �벑濡앺븳�떎.
+    @Override
+    @Transactional
+    public void importExcel(MultipartFile multipartFile) throws Exception {
+        //  �궗�슜�븯怨� �엳�뒗 �뾽臾� 怨듦컙�씠 �솢�꽦 �긽�깭�씤吏� �솗�씤�븳�떎. �궗�슜 怨듦컙�뿉�꽌 濡쒓렇�씤�븳 �궗�슜�옄媛� 鍮꾪솢�꽦�씤吏� �솗�씤�븳�떎.
+        this.workspaceService.checkUseWorkspace();
+
+        if (multipartFile != null) {
+            //  �뾽濡쒕뱶 �뙆�씪 �솗�옣�옄 泥댄겕
+            this.verifyMultipartFileExtension(multipartFile);
+
+            Map<String, IspField> ispFieldMaps = new HashMap<>();   //  ISP 紐⑥쓬
+            Map<String, HostingField> hostingFieldMaps = new HashMap<>();   //  �샇�뒪�똿 紐⑥쓬
+            Map<String, Map<String, Object>> companyTypeMaps = new HashMap<>(); //  移댄뀒怨좊━ 紐⑥쓬
+            Map<String, Map<String, Object>> parentSectorMaps = new HashMap<>(); //  移댄뀒怨좊━ 紐⑥쓬
+            Map<String, Map<String, Object>> childSectorMaps = new HashMap<>(); //  移댄뀒怨좊━ 紐⑥쓬
+            Map<String, Map<String, Object>> regionMaps = new HashMap<>(); //  移댄뀒怨좊━ 紐⑥쓬
+            Map<String, Map<String, Object>> statusMaps = new HashMap<>(); //  移댄뀒怨좊━ 紐⑥쓬
+
+            //  �뾽泥댁쓽 二쇱슂 �냽�꽦�쓣 map �뿉 ���옣�븯�뿬 �뿊�� import �뿉�꽌 吏��젙�븳 ���긽(�씠�뒋 �냽�꽦)�쓣 鍮좊Ⅴ寃� 李얠쓣 �닔 �엳寃� �븳�떎.
+            this.CompanyFieldAttributeMapToList(ispFieldMaps, hostingFieldMaps, companyTypeMaps, parentSectorMaps, childSectorMaps, regionMaps, statusMaps);
+            //  0.237 - 0.230
+
+            List<CompanyFieldForm> companyFieldForms = Lists.newArrayList();
+            List<String> headers = Lists.newArrayList();
+
+            Workbook workbook;
+
+            workbook = WorkbookFactory.create(multipartFile.getInputStream());
+            Sheet sheet = workbook.getSheetAt(0);
+            int lastRowNum = sheet.getLastRowNum() + 1;
+
+            //  2嫄� - �젣紐�, �뿤�뜑 - �꽦�뒫�쓣 �쐞�빐 理쒕� 1留뚭굔�쑝濡� �젣�븳
+            if (lastRowNum > (EXCEL_IMPORT_MAX_ROWS + 2)) {
+                throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_MAX_ROWS_OVER));
+            }
+
+            for (int rowIndex = 0; rowIndex < lastRowNum; rowIndex++) {
+                //  0踰덉� �뿤�뜑�뒗 臾댁떆�븳�떎.
+                Row row = sheet.getRow(rowIndex);
+                //  �뿤�뜑 �젙蹂대�� 異붿텧�븳�떎
+                if (rowIndex == 1) {
+                    for (int cellIndex = 0; cellIndex < row.getLastCellNum(); cellIndex++) {
+                        Cell cell = row.getCell(cellIndex);
+
+                        if (cell == null) {
+                            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.EXCEL_EMPTY_CELL));
+                        }
+
+                        //  �뿊�� import �뜲�씠�꽣�뿉�꽌 cell 媛믪쓣 臾몄옄�뿴濡� 蹂��솚�븳�떎.
+                        String cellValue = CommonUtil.convertExcelStringToCell(cell);
+
+                        if (StringUtils.isEmpty(cellValue)) {
+                            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.EXCEL_HEADER_EMPTY_CELL));
+                        }
+
+                        headers.add(cellValue);
+                    }
+                }
+
+                //  1踰� �뿤�뜑遺��꽣 �뜲�씠�꽣 �쁺�뿭
+                if (rowIndex > 1) {
+                    //  �뾽泥대줈 �벑濡앺븯湲� �쐞�빐 CompanyFieldForm �뿉 �뜲�씠�꽣瑜� �뀑�똿�븳�떎.
+                    CompanyFieldForm newCompanyFieldForm = this.setCompanyFieldFormToExcelField(row, (rowIndex + 1), ispFieldMaps, hostingFieldMaps, companyTypeMaps, parentSectorMaps, childSectorMaps, regionMaps, statusMaps, headers);
+                    //  ip �쑀�슚�꽦 泥댄겕
+                    this.verifyIp(newCompanyFieldForm.getIpStart(), newCompanyFieldForm.getIpEnd(), null);
+
+                    companyFieldForms.add(newCompanyFieldForm);
+                }
+            }
+
+            if (companyFieldForms.size() < 1) {
+                return;
+            }
+
+            for (CompanyFieldForm saveCompanyFieldForm : companyFieldForms) {
+                CompanyField companyField = new CompanyField();
+                ConvertUtil.copyProperties(saveCompanyFieldForm, companyField);
+
+                companyField = this.companyFieldRepository.saveAndFlush(companyField);
+
+                saveCompanyFieldForm.setId(companyField.getId());
+            }
+        }
+    }
+
+    /**
+     * cell String�쑝濡� 蹂��솚 �븿�닔
+     * @param cell Cell
+     * @param isNull boolean
+     * @return String
+     */
+    private String stringToCell (Cell cell, boolean isNull) {
+        String cellStr = "";
+        if (!isNull) {
+            cellStr = CommonUtil.convertExcelStringToCell(cell);
+            //  怨듬갚 �젣嫄�
+            cell.setCellValue(cellStr.trim());
+        } else {
+            cell.setCellValue(cellStr);
+        }
+        return cellStr;
+    }
+
+    /**
+     * cell NULL 泥댄겕 �븿�닔
+     * @param cell Cell
+     * @return boolean
+     */
+    private Boolean cellNullCheck (Cell cell) {
+        int cellType = cell.getCellType();
+        if (cellType < Cell.CELL_TYPE_BLANK) {
+            if (cellType == Cell.CELL_TYPE_STRING) {
+                if (cell.getStringCellValue() != null && !cell.getStringCellValue().equals("")) {
+                    return false;
+                }
+            } else {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * �쟾�솕踰덊샇 CellType 泥댄겕 �븿�닔
+     * @param cell Cell
+     * @param rowIndex int
+     */
+    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,
+                                                             Map<String, Map<String, Object>> companyTypeMaps, Map<String, Map<String, Object>> parentSectorMaps,
+                                                             Map<String, Map<String, Object>> childSectorMaps, Map<String, Map<String, Object>> regionMaps,
+                                                             Map<String, Map<String, Object>> statusMaps, List<String> headers) {
+        CompanyFieldForm companyFieldForm = new CompanyFieldForm();
+        companyFieldForm.setRegisterId(this.webAppUtil.getLoginId());
+
+        for (int cellIndex = 0; cellIndex < headers.size(); cellIndex++) {
+            Cell cell = row.getCell(cellIndex);
+
+            String cellStr = "";
+            boolean isNull = true;
+
+            if (cell != null) {
+                isNull = cellNullCheck(cell);
+                cellStr = stringToCell(cell, isNull); //cell�쓣 String�쑝濡� 蹂��솚
+            }
+
+            switch (cellIndex) {
+                case 0:
+                    //  �뾽泥대챸
+                    if (isNull) {
+                        throw new OwlRuntimeException(
+                                this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_COMPANY_NAME_IS_NULL, rowIndex));
+                    }
+                    this.setCompanyFormName(cellStr, companyFieldForm);
+                    break;
+
+                case 1:
+                    //  url
+                    this.setCompanyFormUrl(cellStr, companyFieldForm, isNull);
+                    break;
+
+                case 2:
+                    //  ip�떆�옉二쇱냼
+                    this.setCompanyFormIpStart(cellStr, companyFieldForm, isNull);
+                    break;
+
+                case 3:
+                    //  ip醫낅즺二쇱냼
+                    this.setCompanyFormIpEnd(cellStr, companyFieldForm, isNull);
+                    break;
+
+                case 4:
+                    // isp紐�
+                    this.setCompanyFormIspName(cellStr, ispFieldMaps, companyFieldForm, rowIndex, isNull);
+                    break;
+
+                case 5:
+                    // �샇�뒪�똿紐�
+                    this.setCompanyFormHostingName(cellStr, hostingFieldMaps, companyFieldForm, rowIndex, isNull);
+                    break;
+
+                case 6:
+                    // �뿰�씫泥�
+                    telTypeCheck(cell, rowIndex);
+                    this.setCompanyFormTel(cellStr, companyFieldForm, isNull);
+                    break;
+
+                case 7:
+                    // �씠硫붿씪
+                    this.setCompanyFormEmail(cellStr, companyFieldForm, isNull);
+                    break;
+
+                case 8:
+                    // �떞�떦�옄
+                    this.setCompanyFormManager(cellStr, companyFieldForm, isNull);
+                    break;
+
+                case 9:
+                    // 湲곗뾽援щ텇
+                    this.setCompanyFormCompanyType(cellStr, companyTypeMaps, companyFieldForm, rowIndex, isNull);
+                    break;
+
+                case 10:
+                    // �뾽醫�(��遺꾨쪟)
+                    this.setCompanyFormParentSector(cellStr, parentSectorMaps, companyFieldForm, rowIndex, isNull);
+                    break;
+
+                case 11:
+                    // �뾽醫�(以묐텇瑜�)
+                    this.setCompanyFormChildSector(cellStr, childSectorMaps, companyFieldForm, rowIndex, isNull);
+                    break;
+
+                case 12:
+                    // 吏��뿭
+                    this.setCompanyFormRegion(cellStr, regionMaps, companyFieldForm, rowIndex, isNull);
+                    break;
+
+                case 13:
+                    // �긽�깭
+                    this.setCompanyFormStatus(cellStr, statusMaps, companyFieldForm, isNull);
+                    break;
+
+                case 14:
+                    // 鍮꾧퀬
+                    this.setCompanyFormMemo(cellStr, companyFieldForm, isNull);
+            }
+        }
+
+        return companyFieldForm;
+    }
+
+    private void setCompanyFormIpEnd(String ipEnd, CompanyFieldForm companyFieldForm, boolean isNull) {
+        if (!isNull) {
+            if (ipEnd.contains(" ")) {
+                ipEnd = ipEnd.replace(" ", "");
+            }
+            this.verifyIp(ipEnd, null, null); //ip �쑀�슚�꽦 寃��궗
+
+            companyFieldForm.setIpEnd(ipEnd);
+        }
+    }
+
+    private void setCompanyFormIpStart(String ipStart, CompanyFieldForm companyFieldForm, boolean isNull) {
+        if (!isNull) {
+            if (ipStart.contains(" ")) {
+                ipStart = ipStart.replace(" ", "");
+            }
+            this.verifyIp(ipStart, null, null); //ip �쑀�슚�꽦 寃��궗
+
+            companyFieldForm.setIpStart(ipStart);
+        }
+    }
+
+    private void setCompanyFormMemo(String cellStr, CompanyFieldForm companyFieldForm, boolean isNull) {
+        if (!isNull) {
+            companyFieldForm.setMemo(cellStr);
+        }
+    }
+
+    private void setCompanyFormStatus(String cellStr, Map<String, Map<String, Object>> statusMaps, CompanyFieldForm companyFieldForm, boolean isNull) {
+        if (!isNull) {
+            Map<String, Object> statusMap = statusMaps.get(cellStr);
+            if (MapUtil.getLong(statusMap, "id") != null) {
+                companyFieldForm.setStatusId(MapUtil.getLong(statusMap, "id"));
+            } else {
+                companyFieldForm.setStatusId(120L);
+            }
+            companyFieldForm.setStatusName(cellStr);
+        }
+    }
+
+    private void setCompanyFormRegion(String cellStr, Map<String, Map<String, Object>> regionMaps, CompanyFieldForm companyFieldForm, int rowIndex, boolean isNull) {
+        if (!isNull) {
+            Map<String, Object> regionMap = regionMaps.get(cellStr);
+            if (regionMap == null) {
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_REGION_NOT_EXIST, rowIndex));
+            }
+            companyFieldForm.setRegionId(MapUtil.getLong(regionMap, "id"));
+        }
+    }
+
+    private void setCompanyFormChildSector(String cellStr, Map<String, Map<String, Object>> childSectorMaps, CompanyFieldForm companyFieldForm, int rowIndex, boolean isNull) {
+        if (!isNull) {
+            Map<String, Object> childSectorMap = childSectorMaps.get(cellStr);
+
+            //  ��遺꾨쪟 �뾾�씠 以묐텇瑜섎쭔 �엯�젰�뻽�쓣寃쎌슦
+            if (companyFieldForm.getParentSectorId() == null) {
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_PARENT_SECTOR_IS_NULL, rowIndex));
+            }
+
+            //  以묐텇瑜섍� ��遺꾨쪟�뿉 �냽�빐�엳吏� �븡�뒗 寃쎌슦
+            if (!companyFieldForm.getParentSectorId().equals(MapUtil.getLong(childSectorMap, "parentId"))) {
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_PARENT_SECTOR_NOT_EQUAL, rowIndex));
+            }
+
+            companyFieldForm.setChildSectorId(MapUtil.getLong(childSectorMap, "id"));
+        }
+    }
+
+    private void setCompanyFormParentSector(String cellStr, Map<String, Map<String, Object>> parentSectorMaps, CompanyFieldForm companyFieldForm, int rowIndex, boolean isNull) {
+        if (!isNull) {
+            Map<String, Object> parentSectorMap = parentSectorMaps.get(cellStr);
+            if (parentSectorMap == null) {
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_PARENT_SECTOR_NOT_EXIST, rowIndex));
+            }
+            companyFieldForm.setParentSectorId(MapUtil.getLong(parentSectorMap, "id"));
+        }
+    }
+
+    private void setCompanyFormCompanyType(String cellStr, Map<String, Map<String, Object>> companyTypeMaps, CompanyFieldForm companyFieldForm, int rowIndex, boolean isNull) {
+        if (!isNull) {
+            Map<String, Object> companyTypeMap = companyTypeMaps.get(cellStr);
+            if (companyTypeMap == null) {
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_COMPANY_TYPE_NOT_EXIST, rowIndex));
+            }
+            companyFieldForm.setCompanyTypeId(MapUtil.getLong(companyTypeMap, "id"));
+        }
+    }
+
+    private void setCompanyFormManager(String manager, CompanyFieldForm companyFieldForm, boolean isNull) {
+        if (!isNull) {
+            companyFieldForm.setManager(manager);
+        }
+    }
+
+    private void setCompanyFormEmail(String email, CompanyFieldForm companyFieldForm, boolean isNull) {
+        if (!isNull) {
+            //  �씠硫붿씪 �쑀�슚�꽦 寃��궗
+            email = this.verifyEmail(email);
+            companyFieldForm.setEmail(email);
+        }
+    }
+
+    /**
+     * �씠硫붿씪 �쑀�슚�꽦 寃��궗
+     * @param email String
+     * @return String
+     */
+    private String verifyEmail(String email) {
+        if (!Pattern.matches("^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$", email)) {
+            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.EMAIL_NOT_INVALID));
+        }
+
+        if (email.contains(" ")) {
+            email = email.replace(" ", "");
+        }
+
+        return email;
+    }
+
+    private void setCompanyFormTel(String tel, CompanyFieldForm companyFieldForm, boolean isNull) {
+        if (!isNull) {
+            //  �뿰�씫泥� �쑀�슚�꽦 寃��궗
+            tel = this.verifyTel(tel);
+            companyFieldForm.setTel(tel);
+        }
+    }
+
+    /**
+     * �뿰�씫泥� �쑀�슚�꽦 寃��궗
+     * @param tel String
+     * @return String
+     */
+    private String verifyTel(String tel) {
+        if (!Pattern.matches("^[0-9-]{2,20}$", tel)) {
+            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.TEL_NOT_INVALID));
+        }
+
+        if (tel.contains("-")) {
+            tel = tel.replace("-", "");
+        }
+        if (tel.contains(" ")) {
+            tel = tel.replace(" ", "");
+        }
+
+        return tel;
+    }
+
+    private void setCompanyFormHostingName(String cellStr, Map<String, HostingField> hostingFieldMaps, CompanyFieldForm companyFieldForm, int rowIndex, boolean isNull) {
+        if (!isNull) {
+            HostingField hostingField = hostingFieldMaps.get(cellStr);
+            if (hostingField == null) {
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_HOSTING_NOT_EXIST, rowIndex));
+            }
+            companyFieldForm.setHostingId(hostingField.getId());
+        }
+    }
+
+    private void setCompanyFormIspName(String cellStr, Map<String, IspField> ispFieldMaps, CompanyFieldForm companyFieldForm, int rowIndex, boolean isNull) {
+        if (!isNull) {
+            IspField ispField = ispFieldMaps.get(cellStr);
+            if (ispField == null) {
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_ISP_NOT_EXIST, rowIndex));
+            }
+            companyFieldForm.setIspId(ispField.getId());
+        }
+    }
+
+    private void setCompanyFormName(String title, CompanyFieldForm companyFieldForm) {
+        //  �뾽泥대챸 �쑀�슚�꽦 泥댄겕
+        this.verifyTitle(title, null);
+        companyFieldForm.setName(title);
+    }
+
+    private void setCompanyFormUrl(String url, CompanyFieldForm companyFieldForm, boolean isNull) {
+        if (!isNull) {
+            if (url.contains(" ")) {
+                url = url.replace(" ", "");
+            }
+            this.verifyUrl(url, null); //url �쑀�슚�꽦 寃��궗
+
+            companyFieldForm.setUrl(url);
+        }
+    }
+
+    //  �뾽泥대챸 �쑀�슚�꽦 泥댄겕
+    private void verifyTitle(String title, Long id) {
+        List<CompanyField> companyFields = new ArrayList<>();
+
+        //  �뾽泥대챸 以묐났 泥댄겕
+
+        if (id != null) { //�닔�젙 �씪 寃쎌슦
+            companyFields = this.companyFieldRepository.findByNameAndIdNot(title, id);
+        } else { // 異붽� �씪 寃쎌슦
+            companyFields = this.companyFieldRepository.findByName(title);
+        }
+        if (companyFields != null && companyFields.size() > 0) {
+            throw new OwlRuntimeException(
+                    this.messageAccessor.getMessage(MsgConstants.COMPANY_NAME_ALREADY_IN_USE));
+        }
+
+        //  �뾽泥대챸 鍮덇컪 泥댄겕
+        if (StringUtils.isEmpty(title)) {
+            throw new OwlRuntimeException(
+                    this.messageAccessor.getMessage(MsgConstants.COMPANY_NO_TITLE));
+        }
+
+        //  �뾽泥대챸 湲몄씠 泥댄겕
+        if (title.length() > 300) {
+            throw new OwlRuntimeException(
+                    this.messageAccessor.getMessage(MsgConstants.COMPANY_NAME_MAX_LENGTH_OUT));
         }
     }
 
@@ -149,6 +908,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紐� �꽕�젙
@@ -159,6 +931,12 @@
         excelInfo.addAttrInfos(new ExportExcelAttrVo("tel", this.messageAccessor.message("companyField.companyTel"), 10, ExportExcelAttrVo.ALIGN_CENTER));
         excelInfo.addAttrInfos(new ExportExcelAttrVo("email", this.messageAccessor.message("companyField.companyEmail"), 10, ExportExcelAttrVo.ALIGN_CENTER));
         excelInfo.addAttrInfos(new ExportExcelAttrVo("url", this.messageAccessor.message("companyField.companyUrl"), 10, ExportExcelAttrVo.ALIGN_CENTER));
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("ipRange", this.messageAccessor.message("companyField.companyIp"), 10, ExportExcelAttrVo.ALIGN_CENTER));
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("companyTypeName", this.messageAccessor.message("companyField.companyTypeName"), 10, ExportExcelAttrVo.ALIGN_CENTER));
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("parentSectorName", this.messageAccessor.message("companyField.parentSectorName"), 10, ExportExcelAttrVo.ALIGN_CENTER));
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("childSectorName", this.messageAccessor.message("companyField.childSectorName"), 10, ExportExcelAttrVo.ALIGN_CENTER));
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("regionName", this.messageAccessor.message("companyField.regionName"), 10, ExportExcelAttrVo.ALIGN_CENTER));
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("statusName", this.messageAccessor.message("companyField.statusName"), 10, ExportExcelAttrVo.ALIGN_CENTER));
         excelInfo.addAttrInfos(new ExportExcelAttrVo("memo", this.messageAccessor.message("companyField.companyMemo"), 10, ExportExcelAttrVo.ALIGN_CENTER));
 
         excelInfo.setDatas(companyFieldVos);
@@ -173,6 +951,46 @@
 
         for (Map<String, Object> result : results) {
             CompanyFieldVo companyFieldVo = ConvertUtil.convertMapToClass(result, CompanyFieldVo.class);
+
+            if (companyFieldVo.getCompanyTypeId() != null && companyFieldVo.getCompanyTypeId() != -1) {
+                CompanyFieldCategory companyType = this.companyFieldCategoryService.find(companyFieldVo.getCompanyTypeId());
+                if (companyType != null) {
+                    companyFieldVo.setCompanyTypeName(companyType.getUseValue());
+                }
+            }
+            if (companyFieldVo.getParentSectorId() != null && companyFieldVo.getParentSectorId() != -1) {
+                CompanyFieldCategory parentSector = this.companyFieldCategoryService.find(companyFieldVo.getParentSectorId());
+                if (parentSector != null) {
+                    companyFieldVo.setParentSectorName(parentSector.getUseValue());
+                }
+            }
+            if (companyFieldVo.getChildSectorId() != null && companyFieldVo.getChildSectorId() != -1) {
+                CompanyFieldCategory childSector = this.companyFieldCategoryService.find(companyFieldVo.getChildSectorId());
+                if (childSector != null) {
+                    companyFieldVo.setChildSectorName(childSector.getUseValue());
+                }
+            }
+            if (companyFieldVo.getRegionId() != null && companyFieldVo.getRegionId() != -1) {
+                CompanyFieldCategory region = this.companyFieldCategoryService.find(companyFieldVo.getRegionId());
+                if (region != null) {
+                    companyFieldVo.setRegionName(region.getUseValue());
+                }
+            }
+
+            if(companyFieldVo.getIspId() != null && companyFieldVo.getIspId() != -1){
+                IspField ispField = this.ispFieldService.getIsp(companyFieldVo.getIspId());
+                if(ispField != null){
+                    IspFieldVo ispFieldVo = ConvertUtil.copyProperties(ispField, IspFieldVo.class);
+                    companyFieldVo.setIspFieldVo(ispFieldVo);
+                }
+            }
+            if(companyFieldVo.getHostingId() != null && companyFieldVo.getHostingId() != -1){
+                HostingField hostingField = this.hostingFieldService.getHosting(companyFieldVo.getHostingId());
+                if(hostingField != null){
+                    HostingFieldVo hostingFieldVo = ConvertUtil.copyProperties(hostingField, HostingFieldVo.class);
+                    companyFieldVo.setHostingFieldVo(hostingFieldVo);
+                }
+            }
             companyFieldVos.add(companyFieldVo);
         }
 
@@ -185,18 +1003,30 @@
         return companyFieldVos;
     }
 
+    // ISP ID 濡� 議고쉶�븳�떎
+    @Override
+    public List<CompanyField> findByIsp(Long id) {
+        return this.companyFieldRepository.findByIspId(id);
+    }
+
+    // HOSTING ID 濡� 議고쉶�븳�떎
+    @Override
+    public List<CompanyField> findByHosting(Long id) {
+        return this.companyFieldRepository.findByHostingId(id);
+    }
+
     // �뾽泥� ID 濡� 議고쉶�븳�떎
     @Override
     public CompanyField getCompany(Long id) {
         if (id == null) {
             throw new OwlRuntimeException(
-                    this.messageAccessor.getMessage(MsgConstants.COMPANYFIELD_NOT_EXIST));
+                    this.messageAccessor.getMessage(MsgConstants.COMPANY_NOT_EXIST));
         }
         CompanyField companyField = this.findOne(id);
 
         if (companyField == null) {
             throw new OwlRuntimeException(
-                    this.messageAccessor.getMessage(MsgConstants.COMPANYFIELD_NOT_EXIST));
+                    this.messageAccessor.getMessage(MsgConstants.COMPANY_NOT_EXIST));
         }
         return companyField;
     }

--
Gitblit v1.8.0