From ad486a401ad59d44bd4187f6406fe8c11b046a1f Mon Sep 17 00:00:00 2001
From: minhee <alsdldlfrl@gmail.com>
Date: 월, 21 2월 2022 16:05:09 +0900
Subject: [PATCH] - 파트너 정보 엑셀 임포트 시 연락처, 코드, 이메일 유효성 검사 - 특정 프로젝트로 설정된 상태에서 타 프로젝트의 이슈 클릭 시 대시보드로 이동되는 문제 해결

---
 src/main/java/kr/wisestone/owl/service/impl/IspFieldServiceImpl.java |  479 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 444 insertions(+), 35 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/service/impl/IspFieldServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/IspFieldServiceImpl.java
index 110f026..23212c1 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/IspFieldServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/IspFieldServiceImpl.java
@@ -6,31 +6,34 @@
 import kr.wisestone.owl.constant.MsgConstants;
 import kr.wisestone.owl.domain.CompanyField;
 import kr.wisestone.owl.domain.IspField;
+import kr.wisestone.owl.domain.Priority;
 import kr.wisestone.owl.exception.OwlRuntimeException;
 import kr.wisestone.owl.mapper.IspFieldMapper;
 import kr.wisestone.owl.repository.IspFieldRepository;
+import kr.wisestone.owl.service.CompanyFieldService;
 import kr.wisestone.owl.service.IspFieldService;
 import kr.wisestone.owl.service.WorkspaceService;
+import kr.wisestone.owl.util.CommonUtil;
 import kr.wisestone.owl.util.ConvertUtil;
-import kr.wisestone.owl.vo.IspFieldVo;
-import kr.wisestone.owl.vo.ExportExcelAttrVo;
-import kr.wisestone.owl.vo.ExportExcelVo;
-import kr.wisestone.owl.vo.ResPage;
+import kr.wisestone.owl.vo.*;
 import kr.wisestone.owl.web.condition.IspFieldCondition;
+import kr.wisestone.owl.web.form.CompanyFieldForm;
 import kr.wisestone.owl.web.form.IspFieldForm;
 import kr.wisestone.owl.web.view.ExcelView;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.ui.Model;
+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 IspFieldServiceImpl extends AbstractServiceImpl<IspField, Long, JpaRepository<IspField, Long>> implements IspFieldService {
@@ -45,6 +48,9 @@
     private WorkspaceService workspaceService;
 
     @Autowired
+    private CompanyFieldService companyFieldService;
+
+    @Autowired
     private ExcelView excelView;
 
     @Autowired
@@ -55,15 +61,42 @@
         return this.ispFieldRepository;
     }
 
+    private static final int EXCEL_IMPORT_MAX_ROWS = 10000; //  excel import �젣�븳
+
     // Isp 異붽�
     @Override
     public IspField add(IspFieldForm IspFieldForm) {
-        //  url �쑀�슚�꽦 泥댄겕
-        this.verifyUrl(IspFieldForm.getUrl(), null);
+        //  ISP紐� 以묐났 泥댄겕
+        //this.verifyTitle(IspFieldForm.getName(), null);
+        
+        if (IspFieldForm.getTelList() != null && IspFieldForm.getTelList().size() > 0) {
+            String tels = IspFieldForm.getTelList().toString();
+            if (tels.contains("[")) {
+                tels = tels.substring(1, tels.indexOf("]"));
+            }
+            IspFieldForm.setTel(tels.trim());
+        }
+        if (IspFieldForm.getEmailList() != null && IspFieldForm.getEmailList().size() > 0) {
+            String emails = IspFieldForm.getEmailList().toString();
+            if (emails.contains("[")) {
+                emails = emails.substring(1, emails.indexOf("]"));
+            }
+            IspFieldForm.setEmail(emails.trim());
+        }
 
-        IspField IspField = ConvertUtil.copyProperties(IspFieldForm, IspField.class);
-        ispFieldRepository.saveAndFlush(IspField);
-        return IspField;
+        IspField ispField = ConvertUtil.copyProperties(IspFieldForm, IspField.class);
+
+        if (ispField.getCode() != null && !ispField.getCode().equals("")) {
+            try {
+                ispFieldRepository.saveAndFlush(ispField);
+            } catch (Exception e) {
+                throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.ISP_CODE_USED_EXIST_VALUE));
+            }
+        } else {
+            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.ISP_CODE_NOT_ENTER));
+        }
+
+        return ispField;
     }
 
     // Isp 紐⑸줉�쓣 媛��졇�삩�떎.
@@ -79,26 +112,9 @@
         return this.convertIspVoToMap(results, totalIspCount, pageable, resJsonData);
     }
 
-    //  url �쑀�슚�꽦 泥댄겕
-    private void verifyUrl(String url, Long id) {
-        if (StringUtils.isEmpty(url)) {
-            throw new OwlRuntimeException(
-                    this.messageAccessor.getMessage(MsgConstants.COMPANYFIELD_NOT_URL));
-        }
-        IspField ispField;
-
-        if(id == null){
-            ispField = this.ispFieldRepository.findByUrl(url);
-        } else {
-            ispField = this.ispFieldRepository.findByUrlAndIdNot(url,id);
-        }
-
-        if (ispField != null) {
-            throw new OwlRuntimeException(
-                    this.messageAccessor.getMessage(MsgConstants.COMPANYFIELD_USED_URL));
-        }
+    public Map<String, Object> find(Long id) {
+        return this.ispFieldMapper.findById(id);
     }
-
 
     // Isp �긽�꽭 議고쉶�븳�떎.
     @Override
@@ -116,11 +132,36 @@
     // Isp �젙濡쒕�� �닔�젙�븳�떎.
     @Override
     public void modify(IspFieldForm IspFieldForm) {
-        //  url �쑀�슚�꽦 泥댄겕
-        this.verifyUrl(IspFieldForm.getUrl(), IspFieldForm.getId());
+        //  ISP紐� �쑀�슚�꽦 泥댄겕
+        //this.verifyTitle(IspFieldForm.getName(), IspFieldForm.getId());
 
-        IspField IspField = ConvertUtil.copyProperties(IspFieldForm, IspField.class);
-        ispFieldRepository.saveAndFlush(IspField);
+        if (IspFieldForm.getTelList() != null && IspFieldForm.getTelList().size() > 0) {
+            String tels = IspFieldForm.getTelList().toString();
+            if (tels.contains("[")) {
+                tels = tels.substring(1, tels.indexOf("]"));
+            }
+            IspFieldForm.setTel(tels.trim());
+        }
+        if (IspFieldForm.getEmailList() != null && IspFieldForm.getEmailList().size() > 0) {
+            String emails = IspFieldForm.getEmailList().toString();
+            if (emails.contains("[")) {
+                emails = emails.substring(1, emails.indexOf("]"));
+            }
+            IspFieldForm.setEmail(emails.trim());
+        }
+
+        IspField ispField = ConvertUtil.copyProperties(IspFieldForm, IspField.class);
+
+        if (ispField.getCode() != null && !ispField.getCode().equals("")) {
+            try {
+                ispFieldRepository.saveAndFlush(ispField);
+            } catch (Exception e) {
+                throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.ISP_CODE_USED_EXIST_VALUE));
+            }
+        } else {
+            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.ISP_CODE_NOT_ENTER));
+        }
+
     }
 
 
@@ -132,9 +173,21 @@
                     this.messageAccessor.getMessage(MsgConstants.ISP_REMOVE_NOT_SELECT));
         }
         for (Long id : IspFieldForm.getRemoveIds()) {
+            List<CompanyField> companyField = this.companyFieldService.findByIsp(id);
+            if (companyField != null && companyField.size() > 0) {
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.ISP_EXIST_COMPANY));
+            } else {
                 this.ispFieldRepository.deleteById(id);
+            }
         }
         this.ispFieldRepository.flush();
+    }
+
+    @Override
+    @Transactional(readOnly = true)
+    public List<IspField> findAll() {
+        return this.ispFieldRepository.findAll();
     }
 
     // Isp 紐⑸줉�쓣 �뿊��濡� �떎�슫濡쒕뱶 �븳�떎.
@@ -174,6 +227,360 @@
         return new ModelAndView(this.excelView);
     }
 
+    //  ISP Import �슜 �뿊�� �뀥�뵆由� �떎�슫濡쒕뱶
+    @Override
+    @Transactional
+    public ModelAndView downloadExcelTemplate(HttpServletRequest request, Model model) {
+
+        ExportExcelVo excelInfo = new ExportExcelVo();
+        excelInfo.setHideCount(true);
+        excelInfo.setFileName(this.messageAccessor.message("common.registerExcelIspField")); // �뿊��濡� ISP �벑濡앺븯湲�
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("isp.ispName"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // ISP紐�
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("isp.ispCode"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // 肄붾뱶
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("isp.ispManager"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �떞�떦�옄
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("isp.ispTel"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �뿰�씫泥�
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("isp.ispEmail"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �씠硫붿씪
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("isp.ispUrl"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // url
+        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("isp.ispMemo"), 40, ExportExcelAttrVo.ALIGN_CENTER)); // 鍮꾧퀬
+
+        //  �뿊���뿉 �꽔�쓣 �뜲�씠�꽣 - IspFieldVo �뜲�씠�꽣瑜� �뿊���뿉�꽌 �몴�떆�븷 �닔 �엳�뒗 �뜲�씠�꽣濡� 蹂�寃쏀븳�떎.
+        excelInfo.setDatas(Lists.newArrayList(new IspFieldVo()));
+
+        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));
+        }
+    }
+
+    //  �뿊�� import 濡� ISP瑜� �벑濡앺븳�떎.
+    @Override
+    @Transactional
+    public void importExcel(MultipartFile multipartFile) throws Exception {
+        //  �궗�슜�븯怨� �엳�뒗 �뾽臾� 怨듦컙�씠 �솢�꽦 �긽�깭�씤吏� �솗�씤�븳�떎. �궗�슜 怨듦컙�뿉�꽌 濡쒓렇�씤�븳 �궗�슜�옄媛� 鍮꾪솢�꽦�씤吏� �솗�씤�븳�떎.
+        this.workspaceService.checkUseWorkspace();
+
+        if (multipartFile != null) {
+            //  �뾽濡쒕뱶 �뙆�씪 �솗�옣�옄 泥댄겕
+            this.verifyMultipartFileExtension(multipartFile);
+
+            List<IspFieldForm> ispFieldForms = 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) {
+                    //  ISP濡� �벑濡앺븯湲� �쐞�빐 ispFieldForm �뿉 �뜲�씠�꽣瑜� �뀑�똿�븳�떎.
+                    IspFieldForm newIspFieldForm = this.setIspFieldFormToExcelField(row, (rowIndex + 1), headers);
+
+                    ispFieldForms.add(newIspFieldForm);
+                }
+            }
+
+            if (ispFieldForms.size() < 1) {
+                return;
+            }
+
+            for (IspFieldForm saveIspFieldForm : ispFieldForms) {
+                IspField ispField = new IspField();
+                ConvertUtil.copyProperties(saveIspFieldForm, ispField);
+
+                if (ispField.getCode() != null && !ispField.getCode().equals("")) {
+                    try {
+                        ispField = ispFieldRepository.saveAndFlush(ispField);
+                    } catch (Exception e) {
+                        throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.ISP_CODE_USED_EXIST_VALUE));
+                    }
+                } else {
+                    throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.ISP_CODE_NOT_ENTER));
+                }
+
+                saveIspFieldForm.setId(ispField.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));
+        }
+    }
+
+    //  �뿊�� �븘�뱶�뿉 �엳�뒗 �젙蹂대�� ISP form �쑝濡� �삷湲대떎.
+    private IspFieldForm setIspFieldFormToExcelField(Row row, int rowIndex, List<String> headers) {
+        IspFieldForm ispFieldForm = new IspFieldForm();
+        ispFieldForm.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:
+                    //  ISP紐�
+                    if (isNull) {
+                        throw new OwlRuntimeException(
+                                this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_ISP_NAME_IS_NULL, rowIndex));
+                    }
+                    this.setIspFormName(cellStr, ispFieldForm);
+                    break;
+
+                case 1:
+                    //  肄붾뱶
+                    if (isNull) {
+                        throw new OwlRuntimeException(
+                                this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_ISP_CODE_IS_NULL, rowIndex));
+                    }
+                    this.setIspFormCode(cellStr, ispFieldForm);
+                    break;
+
+                case 2:
+                    // �떞�떦�옄
+                    this.setIspFormManager(cellStr, ispFieldForm, isNull);
+                    break;
+
+                case 3:
+                    // �뿰�씫泥�
+                    telTypeCheck(cell, rowIndex);
+                    this.setIspFormTel(cellStr, ispFieldForm, rowIndex, isNull);
+                    break;
+
+                case 4:
+                    // �씠硫붿씪
+                    this.setIspFormEmail(cellStr, ispFieldForm, isNull);
+                    break;
+
+                case 5:
+                    // url
+                    this.setIspFormUrl(cellStr, ispFieldForm, isNull);
+                    break;
+
+                case 6:
+                    // 鍮꾧퀬
+                    this.setIspFormMemo(cellStr, ispFieldForm, isNull);
+            }
+        }
+
+        return ispFieldForm;
+    }
+
+    private void setIspFormMemo(String memo, IspFieldForm ispFieldForm, boolean isNull) {
+        if (!isNull) {
+            ispFieldForm.setMemo(memo);
+        }
+    }
+
+    private void setIspFormUrl(String url, IspFieldForm ispFieldForm, boolean isNull) {
+        if (!isNull) {
+            if (url.contains(" ")) {
+                url = url.replace(" ", "");
+            }
+            ispFieldForm.setUrl(url);
+        }
+    }
+
+    private void setIspFormEmail(String email, IspFieldForm ispFieldForm, boolean isNull) {
+        if (!isNull) {
+            //  �씠硫붿씪 �쑀�슚�꽦 寃��궗
+            email = this.verifyEmail(email);
+            ispFieldForm.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 setIspFormTel(String tel, IspFieldForm ispFieldForm, int rowIndex, boolean isNull) {
+        if (!isNull) {
+            //  �뿰�씫泥� �쑀�슚�꽦 寃��궗
+            tel = this.verifyTel(tel);
+            ispFieldForm.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 setIspFormManager(String manager, IspFieldForm ispFieldForm, boolean isNull) {
+        if (!isNull) {
+            ispFieldForm.setManager(manager);
+        }
+    }
+
+    private void setIspFormCode(String code, IspFieldForm ispFieldForm) {
+        //肄붾뱶 �쑀�슚�꽦 泥댄겕
+        this.verifyCode(code);
+        ispFieldForm.setCode(code);
+    }
+
+    /**
+     * 肄붾뱶 �쑀�슚�꽦 寃��궗
+     * @param code String
+     */
+    private void verifyCode(String code) {
+        if (!Pattern.matches("^[a-zA-Z0-9媛�-�옡�꽦-�뀕�뀖-�뀭\\u318D\\u119E\\u11A2\\u2022\\u2025a\\u00B7\\uFE55]+$", code)) {
+            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.CODE_NOT_INVALID));
+        }
+    }
+
+    private void setIspFormName(String title, IspFieldForm ispFieldForm) {
+        //  ISP紐� �쑀�슚�꽦 泥댄겕
+        //this.verifyTitle(title, null);
+        ispFieldForm.setName(title);
+    }
+
+    //  ISP紐� �쑀�슚�꽦 泥댄겕
+    private void verifyTitle(String title, Long id) {
+        List<IspField> ispFields = new ArrayList<>();
+
+        //  ISP紐� 以묐났 泥댄겕
+
+        if (id != null) { //�닔�젙 �씪 寃쎌슦
+            ispFields = this.ispFieldRepository.findByNameAndIdNot(title, id);
+        } else { // 異붽� �씪 寃쎌슦
+            ispFields = this.ispFieldRepository.findByName(title);
+        }
+        if (ispFields != null && ispFields.size() > 0) {
+            throw new OwlRuntimeException(
+                    this.messageAccessor.getMessage(MsgConstants.ISP_NAME_ALREADY_IN_USE));
+        }
+
+        //  ISP紐� 鍮덇컪 泥댄겕
+        if (StringUtils.isEmpty(title)) {
+            throw new OwlRuntimeException(
+                    this.messageAccessor.getMessage(MsgConstants.ISP_NO_TITLE));
+        }
+
+        //  ISP紐� 湲몄씠 泥댄겕
+        if (title.length() > 300) {
+            throw new OwlRuntimeException(
+                    this.messageAccessor.getMessage(MsgConstants.ISP_NAME_MAX_LENGTH_OUT));
+        }
+    }
+
     //  寃��깋 寃곌낵瑜� IspVo 濡� 蹂��솚�븳�떎.
     private List<IspFieldVo> convertIspVoToMap(List<Map<String, Object>> results, Long totalIspCount, Pageable pageable, Map<String, Object> resJsonData) {
         List<IspFieldVo> ispFieldVos = Lists.newArrayList();
@@ -208,4 +615,6 @@
         }
         return IspField;
     }
+
+
 }

--
Gitblit v1.8.0