From 70e3ad43e441d07d16c7e4e1af0e093befd62c01 Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 월, 27 12월 2021 19:36:11 +0900
Subject: [PATCH] Merge branch 'master' of http://192.168.0.25:9001/r/owl-kisa

---
 src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java  |  307 +++++++++++++++++---------------------------------
 src/main/java/kr/wisestone/owl/domain/Issue.java                   |    4 
 src/main/java/kr/wisestone/owl/service/IssueService.java           |    2 
 src/main/webapp/i18n/ko/global.json                                |    1 
 src/main/java/kr/wisestone/owl/web/controller/IssueController.java |    2 
 src/main/webapp/views/issue/issueExcelImport.html                  |   17 ++
 src/main/webapp/scripts/app/issue/issueImportExcel.controller.js   |   22 +++
 7 files changed, 149 insertions(+), 206 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/domain/Issue.java b/src/main/java/kr/wisestone/owl/domain/Issue.java
index 6b35bc3..49fc8b5 100644
--- a/src/main/java/kr/wisestone/owl/domain/Issue.java
+++ b/src/main/java/kr/wisestone/owl/domain/Issue.java
@@ -217,6 +217,10 @@
         this.issueDepartments = issueDepartments;
     }
 
+    public void addIssueDepartment(IssueDepartment issueDepartment) {
+        this.issueDepartments.add(issueDepartment);
+    }
+
     public Set<AttachedFile> getAttachedFiles() {
         return attachedFiles;
     }
diff --git a/src/main/java/kr/wisestone/owl/service/IssueService.java b/src/main/java/kr/wisestone/owl/service/IssueService.java
index b1f692a..bb41933 100644
--- a/src/main/java/kr/wisestone/owl/service/IssueService.java
+++ b/src/main/java/kr/wisestone/owl/service/IssueService.java
@@ -87,7 +87,7 @@
 
     ModelAndView downloadExcelTemplate(HttpServletRequest request, Model model);
 
-    void importExcel(MultipartFile multipartFile) throws Exception;
+    void importExcel(IssueForm issueForm, MultipartFile multipartFile) throws Exception;
 
     List<Long> findByProjectId(Long projectId);
 
diff --git a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
index 8151068..d909d9e 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/IssueServiceImpl.java
@@ -187,9 +187,6 @@
     private UserDepartmentService userDepartmentService;
 
     @Autowired
-    private WorkflowTransitionService workflowTransitionService;
-
-    @Autowired
     private UserDepartmentRepository userDepartmentRepository;
 
     @Autowired
@@ -197,9 +194,6 @@
 
     @Autowired
     private WorkflowDepartmentRepository workflowDepartmentRepository;
-
-    @Autowired
-    WorkflowService workflowService;
 
     @Override
     protected JpaRepository<Issue, Long> getRepository() {
@@ -240,6 +234,7 @@
         }
 
         Workflow workflow = issueType.getWorkflow();
+
         if (issueApiForm.getApiType().equals(IssueApiForm.ApiType.add)) {
             // �씠�뒋 �긽�깭媛� 吏��젙�릺�뼱 �엳吏� �븡�쓣 寃쎌슦 �썙�겕�뵆濡쒖슦 ��湲� �긽�깭 媛믪쑝濡� 吏��젙
             List<Long> departmentIds = this.workflowDepartmentService.findFirstDepartmentIds(workflow);
@@ -248,15 +243,8 @@
                     issueForm.addDepartmentId(departmentId);
                 }
             }
-        } else {
-            if (issueApiForm.getIssueStatusId() == null){
-                throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_IS_NULL));
-            }
-            // �썙�겕�뵆濡쒖슦�뿉�꽌 �궗�슜 以묒씤 �씠�뒋 �긽�깭�씤吏� 泥댄겕
-            else if (!this.workflowTransitionService.contains(issueApiForm.getIssueStatusId(), workflow.getId())) {
-                throw new OwlRuntimeException(
-                        this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_IN_WORKFLOW));
-            }
+        } else if (issueApiForm.getIssueStatusId() == null){
+            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_ISSUE_STATUS_NOT_EXIST));
         }
 
         // �봽濡쒖젥�듃 �엯�젰
@@ -292,20 +280,6 @@
             if (customFieldApiOverlaps != null && customFieldApiOverlaps.size() > 0) {
                 for (int i = 0; i < customFieldApiOverlaps.size(); i++) {
                     CustomFieldApiOverlap customFieldApiOverlap = customFieldApiOverlaps.get(i);
-                    CustomField customField = customFieldApiOverlap.getCustomField();
-                    if (customField.getCustomFieldType() == CustomFieldType.SITE) {
-                        for (Map<String, Object> map : issueApiForm.getCustomFieldValues()) {
-                            if (customField.getId().equals(MapUtil.getLong(map, "customFieldId"))) {
-                                String fullUrl = MapUtil.getString(map, "useValue");
-                                String url = CommonUtil.getUrl(fullUrl);
-                                if (!url.equals("")) {
-                                    issueApiForm.setUrl(fullUrl);
-                                    break;
-                                }
-                            }
-                        }
-
-                    }
                     issueApiForm.addUseIssueCustomFieldId(customFieldApiOverlap.getCustomField().getId());
                 }
 
@@ -327,7 +301,7 @@
             // �궗�슜�옄 �젙�쓽 �븘�뱶 �꽕�젙
             issueForm.setIssueCustomFields(issueApiForm.getCustomFieldValues());
             //  媛숈� �룄硫붿씤 �뾽泥� 李얘린
-            this.findCompanyField(issueForm, issueApiForm.getUrl());
+            this.findCompanyField(issueForm);
 
             // api �엯�젰媛� �쟻�슜
             ConvertUtil.copyProperties(issueApiForm, issueForm);
@@ -339,36 +313,45 @@
         }
     }
 
-    private void findCompanyField(IssueForm issueForm, String url) {
+    private void findCompanyField(IssueForm issueForm) {
         if(issueForm.getIssueCustomFields() != null && issueForm.getIssueCustomFields().size() > 0) {
             CompanyFieldCondition condition = new CompanyFieldCondition();
-            condition.setUrl(url);
             List<Map<String, Object>> companyFields = this.companyFieldService.find(condition);
             List<Map<String, Object>> issueCompanyFields = Lists.newArrayList();
             List<Map<String, Object>> issueIspFields = Lists.newArrayList();
             List<Map<String, Object>> issueHostingFields = Lists.newArrayList();
 
-            if (companyFields != null && companyFields.size() > 0) {
-                Map<String, Object> companyFieldMap = companyFields.get(0);
-                companyFieldMap.put("companyId", companyFieldMap.get("id"));
-
-                issueCompanyFields.add(companyFieldMap);
+            for (Map<String, Object> issueCustomField : issueForm.getIssueCustomFields()) {
+                int customFieldId = (Integer) issueCustomField.get("customFieldId");
+                Long customId = (long) customFieldId;
+                CustomField customField = this.customFieldService.getCustomField(customId);
+                if(customField != null && customField.getCustomFieldType().toString().equals("SITE") && customField.getName().equals("�룄硫붿씤")) {
+                    String useValue = issueCustomField.get("useValue").toString();
+                    if(companyFields != null && companyFields.size() > 0) {
+                        for (Map<String, Object> companyField : companyFields) {
+                            CompanyFieldVo companyFieldVo = ConvertUtil.convertMapToClass(companyField, CompanyFieldVo.class);
+                            if(useValue.equals(companyFieldVo.getUrl())) {
+                                companyField.put("companyId", companyField.get("id"));
+                                issueCompanyFields.add(companyField);
+                                if(companyFieldVo.getIspId() != null) {
+                                    Map<String, Object> ispField = this.ispFieldService.find(companyFieldVo.getIspId());
+                                    if (ispField != null) {
+                                        ispField.put("ispId", ispField.get("id"));
+                                        issueIspFields.add(ispField);
+                                    }
+                                }
+                                if(companyFieldVo.getHostingId() != null) {
+                                    Map<String, Object> hostingField = this.hostingFieldService.find(companyFieldVo.getHostingId());
+                                    if (hostingField != null) {
+                                        hostingField.put("hostingId", hostingField.get("id"));
+                                        issueHostingFields.add(hostingField);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
                 issueForm.setIssueCompanyFields(issueCompanyFields);
-
-                IspField ispField = this.ispFieldService.getIsp(MapUtil.getLong(companyFieldMap, "ispId"));
-                if (ispField != null) {
-                    Map<String, Object> ispFieldMap = ConvertUtil.convertObjectToMap(ispField);
-                    ispFieldMap.put("ispId", ispField.getId());
-                    issueIspFields.add(ispFieldMap);
-                }
-
-                HostingField hostingField = this.hostingFieldService.getHosting(MapUtil.getLong(companyFieldMap, "hostingId"));
-                if (hostingField != null) {
-                    Map<String, Object> hostingFieldMap = ConvertUtil.convertObjectToMap(hostingField);
-                    hostingFieldMap.put("hostingId", hostingField.getId());
-                    issueHostingFields.add(hostingFieldMap);
-                }
-
                 issueForm.setIssueIspFields(issueIspFields);
                 issueForm.setIssueHostingFields(issueHostingFields);
             }
@@ -945,7 +928,7 @@
 //        if (!this.userWorkspaceService.checkWorkspaceManager(user)
 //                && !MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) { //理쒓퀬愿�由ъ옄 & �봽濡쒖젥�듃,�씠�뒋 愿�由ъ옄 �씪 寃쎌슦 紐⑤뱺 �씠�뒋 蹂닿린
 //            this.SetMyDepartmentId(issueCondition);
-        //this.SetAllDepartmentId(issueCondition);
+            //this.SetAllDepartmentId(issueCondition);
 //        } /*else{
 //            results = this.issueMapper.findByDepartment(issueCondition);
 //            totalCount = this.issueMapper.countByDepartment(issueCondition);
@@ -1829,14 +1812,15 @@
                 Issue parentIssue = modifyIssue.getParentIssue();
                 IssueType issueType = modifyIssue.getIssueType();
 
+                Set<IssueTypeApiEndStatus> issueTypeApiEndStatuses = issueType.getIssueTypeApiEndStatuses();
+                IssueTypeApiEndStatus issueStatus = null;
+                if (issueTypeApiEndStatuses != null && issueTypeApiEndStatuses.size() > 0) {
+                    issueStatus = issueTypeApiEndStatuses.iterator().next();
+                } else {
+                    throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_COMPLETE_ISSUE_STATUS_NOT_EXIST));
+                }
+
                 if (parentIssue != null) {
-                    Set<IssueTypeApiEndStatus> issueTypeApiEndStatuses = issueType.getIssueTypeApiEndStatuses();
-                    IssueTypeApiEndStatus issueStatus = null;
-                    if (issueTypeApiEndStatuses != null && issueTypeApiEndStatuses.size() > 0) {
-                        issueStatus = issueTypeApiEndStatuses.iterator().next();
-                    } else {
-                        throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.API_COMPLETE_ISSUE_STATUS_NOT_EXIST));
-                    }
 
                     IssueCondition issueCondition = new IssueCondition(issueVo.getId(), parentIssue.getId());
                     List<Map<String, Object>> results = this.issueMapper.findNotCompleteByParentIssueId(issueCondition);
@@ -2887,11 +2871,8 @@
         excelInfo.setFileName(this.messageAccessor.message("common.registerExcelIssue")); // �뿊��濡� �씠�뒋 �벑濡앺븯湲�
         excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.title"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // �젣紐�
         excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.content"), 40, ExportExcelAttrVo.ALIGN_CENTER)); // �궡�슜
-        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.projectKey"), 10, ExportExcelAttrVo.ALIGN_LEFT)); // �봽濡쒖젥�듃 �궎
-        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.issueType"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �씠�뒋 ���엯
         excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.priority"), 5, ExportExcelAttrVo.ALIGN_CENTER)); // �슦�꽑�닚�쐞
         excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.importance"), 5, ExportExcelAttrVo.ALIGN_CENTER)); // 以묒슂�룄
-        excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.department"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �떞�떦遺��꽌
         excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.startDate"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // �떆�옉�씪
         excelInfo.addAttrInfos(new ExportExcelAttrVo("id", this.messageAccessor.message("common.endDate"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // 醫낅즺�씪
         //  �봽濡쒖젥�듃�뿉 �뿰寃곕맂 �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� 異붿텧�븯�뿬 �뿊�� download �뀥�뵆由우쓣 留뚮뱺�떎.
@@ -2915,7 +2896,7 @@
     //  �뿊�� import 濡� �씠�뒋瑜� �벑濡앺븳�떎.
     @Override
     @Transactional
-    public void importExcel(MultipartFile multipartFile) throws Exception {
+    public void importExcel(IssueForm issueForm, MultipartFile multipartFile) throws Exception {
         /*StopWatch serviceStart = new StopWatch();
         serviceStart.start();*/
 
@@ -2926,19 +2907,16 @@
             //  �뾽濡쒕뱶 �뙆�씪 �솗�옣�옄 泥댄겕
             this.verifyMultipartFileExtension(multipartFile);
 
-            Map<String, Project> projectMaps = new HashMap<>(); //  �봽濡쒖젥�듃 紐⑥쓬
-            Map<String, IssueType> issueTypeMaps = new HashMap<>(); //  �씠�뒋 ���엯 紐⑥쓬
             Map<String, Priority> priorityMaps = new HashMap<>();   //  �슦�꽑 �닚�쐞 紐⑥쓬
             Map<String, Severity> severityMaps = new HashMap<>();   //  以묒슂�룄 紐⑥쓬
-            Map<String, Object> userMaps = new HashMap<>(); //  �궗�슜�옄 紐⑥쓬
             Map<String, DepartmentVo> departmentMaps = new HashMap<>(); //  遺��꽌 紐⑥쓬
             Map<String, CustomField> customFieldMaps = new HashMap<>();
-            Map<String, IssueStatus> issueStatusReadyMaps = new HashMap<>();   //  �긽�깭 �냽�꽦 '��湲�'�씤 �씠�뒋 �긽�깭
             Map<Long, Long> issueNumberMaps = new HashMap<>();  //  �씠�뒋 踰덊샇 紐⑥쓬
             Map<String, Long> issueTypeCustomFieldMaps = new HashMap<>(); //  �씠�뒋 ���엯 + �궗�슜�옄 �젙�쓽 �븘�뱶 �뿰寃� �젙蹂�
+
             Workspace workspace = this.workspaceService.getWorkspace(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId());  //  �씠�뒋瑜� �꽔�쑝�젮�뒗 �뾽臾� 怨듦컙
             //  �씠�뒋�쓽 二쇱슂 �냽�꽦�쓣 map �뿉 ���옣�븯�뿬 �뿊�� import �뿉�꽌 吏��젙�븳 ���긽(�씠�뒋 �냽�꽦)�쓣 鍮좊Ⅴ寃� 李얠쓣 �닔 �엳寃� �븳�떎.
-            this.IssueAttributeMapToList(projectMaps, issueTypeMaps, priorityMaps, severityMaps, userMaps, departmentMaps, customFieldMaps, issueNumberMaps, issueTypeCustomFieldMaps, issueStatusReadyMaps);
+            this.IssueAttributeMapToList(priorityMaps, severityMaps, departmentMaps, customFieldMaps, issueTypeCustomFieldMaps);
             //  0.237 - 0.230
 
             List<IssueForm> issueForms = Lists.newArrayList();
@@ -2981,7 +2959,14 @@
                 //  1踰� �뿤�뜑遺��꽣 �뜲�씠�꽣 �쁺�뿭
                 if (rowIndex > 1) {
                     //  �씠�뒋濡� �벑濡앺븯湲� �쐞�빐 IssueForm �뿉 �뜲�씠�꽣瑜� �뀑�똿�븳�떎.
-                    issueForms.add(this.setIssueFormToExcelField(row, (rowIndex + 1), issueStatusReadyMaps, projectMaps, issueTypeMaps, priorityMaps, severityMaps, userMaps, departmentMaps, customFieldMaps, issueNumberMaps, headers));
+                    IssueForm newIssueForm = this.setIssueFormToExcelField(row, (rowIndex + 1), priorityMaps, severityMaps, departmentMaps, customFieldMaps, headers);
+                    ConvertUtil.copyProperties(issueForm, newIssueForm);
+
+
+
+                    issueForms.add(newIssueForm);
+
+
                 }
             }
 
@@ -2992,7 +2977,46 @@
 
 
             //  �씠�뒋 �벑濡�
-            this.issueMapper.insertBatch(issueForms);
+//            this.issueMapper.insertBatch(issueForms);
+
+            for (IssueForm saveIssueForm : issueForms) {
+                Issue issue = new Issue();
+                ConvertUtil.copyProperties(saveIssueForm, issue);
+
+                IssueType issueType = this.issueTypeService.getIssueType(saveIssueForm.getIssueTypeId());
+                Workflow workflow = issueType.getWorkflow();
+
+                Project project = this.projectService.getProject(saveIssueForm.getProjectId());
+                Long issueNumber = this.issueNumberGeneratorService.generateIssueNumber(project);
+
+                IssueStatus issueStatus = this.issueStatusService.findByIssueStatusTypeIsReady(workflow);
+
+                issue.setPriority(this.priorityService.getPriority(saveIssueForm.getPriorityId()));
+                issue.setSeverity(this.severityService.getSeverity(saveIssueForm.getSeverityId()));
+                issue.setIssueStatus(issueStatus);
+                issue.setIssueType(issueType);
+                issue.setProject(project);
+                issue.setIssueNumber(issueNumber);
+                issue.setParentIssue(this.getIssue(saveIssueForm.getParentIssueId()));
+
+                issue = this.issueRepository.saveAndFlush(issue);
+
+                saveIssueForm.setId(issue.getId());
+
+                IssueDepartment issueDepartment = new IssueDepartment();
+                issueDepartment.setIssue(issue);
+                issueDepartment.setWorkspace(workspace);
+
+                List<Long> departmentsIds = this.workflowDepartmentService.findFirstDepartmentIds(workflow);
+                for (Long departmentId : departmentsIds) {
+                    issueDepartment.setDepartment(this.departmentService.getDepartment(departmentId));
+                }
+                issue.addIssueDepartment(issueDepartment);
+
+                saveIssueForm.setIssueStatusId(issueStatus.getId());
+            }
+
+
             //  0.416 - 0.439
 
             //  1.373 ~ 1.394
@@ -3022,7 +3046,8 @@
             //  reverse index �뾽�뜲�씠�듃
             this.issueMapper.updateBatch(issueForms);
             //  利앷��맂 �씠�뒋 踰덊샇瑜� �뾽�뜲�씠�듃 �븳�떎.
-            this.issueNumberGeneratorService.updateIssueNumber(issueNumberMaps);
+//            issueNumberMaps.put(issueForm.getProjectId(), issueForm.getProjectId());
+//            this.issueNumberGeneratorService.updateIssueNumber(issueNumberMaps);
         }
     }
 
@@ -3131,49 +3156,8 @@
     }
 
     //  �씠�뒋�쓽 二쇱슂 �냽�꽦�쓣 map �뿉 ���옣�븯�뿬 �뿊�� import �뿉�꽌 吏��젙�븳 ���긽(�씠�뒋 �냽�꽦)�쓣 鍮좊Ⅴ寃� 李얠쓣 �닔 �엳寃� �븳�떎.
-    private void IssueAttributeMapToList(Map<String, Project> projectMaps, Map<String, IssueType> issueTypeMaps, Map<String, Priority> priorityMaps, Map<String, Severity> severityMaps,
-                                         Map<String, Object> userMaps, Map<String, DepartmentVo> departmentMaps, Map<String, CustomField> customFieldMaps, Map<Long, Long> issueNumberMaps, Map<String, Long> issueTypeCustomFieldMaps, Map<String, IssueStatus> issueStatusReadyMaps) {
-        //  �봽濡쒖젥�듃 �궎濡� 諛붾줈 李얠쓣 �닔 �엳寃� 以�鍮�
-        List<Project> projects = this.projectService.findByWorkspaceId();
-        List<Long> projectIds = Lists.newArrayList();
-
-        for (Project project : projects) {
-            projectIds.add(project.getId());
-            //  �빐�떦 �봽濡쒖젥�듃�뿉�꽌 �깮�꽦�릺�뒗 �떎�쓬 �씠�뒋 踰덊샇瑜� �깮�꽦�빐�삩�떎.
-            issueNumberMaps.put(project.getId(), this.issueNumberGeneratorService.generateIssueNumber(project));
-            projectMaps.put(project.getProjectKey(), project);
-
-            for (IssueTypeCustomField issueTypeCustomField : project.getIssueTypeCustomFields()) {
-                //  鍮좊Ⅴ寃� 李얘린 �쐞�빐 �씠�뒋 ���엯 �븘�씠�뵒 + �궗�슜�옄 �젙�쓽 �븘�뱶 �븘�씠�뵒瑜� �궎濡� �븳�떎.
-                String makeKey = issueTypeCustomField.getIssueType().getId().toString() + issueTypeCustomField.getCustomField().getId().toString();
-                issueTypeCustomFieldMaps.put(makeKey, issueTypeCustomField.getId());
-            }
-
-            //  �봽濡쒖젥�듃�뿉 李몄뿬�븯�뒗 �궗�슜�옄 �젙蹂�
-            List<Map<String, Object>> users = this.userService.findProjectMember(project);
-            Map<String, Object> userMap = new HashMap<>();
-            //  �궗�슜�옄 �젙蹂대�� Map �뿉 ���옣
-            for (Map<String, Object> user : users) {
-                userMap.put(CommonUtil.decryptAES128(MapUtil.getString(user, "account")), MapUtil.getLong(user, "userId"));
-            }
-            userMaps.put(project.getProjectKey(), userMap);
-        }
-
-        //  �씠�뒋 �쑀�삎�쓣 諛붾줈 李얠쓣 �닔 �엳寃� 以�鍮�
-        List<IssueType> issueTypes = this.issueTypeService.findByWorkspaceId();
-        for (IssueType issueType : issueTypes) {
-            issueTypeMaps.put(issueType.getName(), issueType);
-
-            IssueStatus issueStatus = this.issueStatusService.findByIssueStatusTypeIsReady(issueType.getWorkflow());
-            issueStatusReadyMaps.put(issueType.getId().toString(), issueStatus);
-
-            //  �썙�겕�뵆濡쒖슦�뿉 �냽�빐�엳�뒗 遺��꽌 �젙蹂�
-            List<DepartmentVo> departments = this.departmentService.findWorkflowDepartment(issueType.getId());
-            //  遺��꽌 �젙蹂대�� ���옣
-            for (DepartmentVo department : departments) {
-                departmentMaps.put(department.getDepartmentName(), department);
-            }
-        }
+    private void IssueAttributeMapToList(Map<String, Priority> priorityMaps, Map<String, Severity> severityMaps,
+                                         Map<String, DepartmentVo> departmentMaps, Map<String, CustomField> customFieldMaps,Map<String, Long> issueTypeCustomFieldMaps) {
 
         //  �슦�꽑�닚�쐞瑜� 諛붾줈 李얠쓣 �닔 �엳寃� 以�鍮�
         List<Priority> priorities = this.priorityService.findByWorkspaceId();
@@ -3195,8 +3179,9 @@
     }
 
     //  �뿊�� �븘�뱶�뿉 �엳�뒗 �젙蹂대�� �씠�뒋 form �쑝濡� �삷湲대떎.
-    private IssueForm setIssueFormToExcelField(Row row, int rowIndex, Map<String, IssueStatus> issueStatusReadyMaps, Map<String, Project> projectMaps, Map<String, IssueType> issueTypeMaps, Map<String,
-            Priority> priorityMaps, Map<String, Severity> severityMaps, Map<String, Object> userMaps, Map<String, DepartmentVo> departmentMaps, Map<String, CustomField> customFieldMaps, Map<Long, Long> issueNumberMaps, List<String> headers) {
+    private IssueForm setIssueFormToExcelField(Row row, int rowIndex, Map<String, Priority> priorityMaps,
+                                               Map<String, Severity> severityMaps, Map<String, DepartmentVo> departmentMaps,
+                                               Map<String, CustomField> customFieldMaps, List<String> headers) {
         IssueForm issueForm = new IssueForm();
         issueForm.setRegisterId(this.webAppUtil.getLoginId());
         Project project = null;
@@ -3220,23 +3205,12 @@
 
                     break;
 
-                case 2:    //  �봽濡쒖젥�듃 �궎�� �씠�뒋 踰덊샇
-                    project = this.setIssueFormProjectKeyAndIssueNumber(cell, issueForm, projectMaps, issueNumberMaps, rowIndex);
-                    break;
-
-                case 3:
-                    //  �씠�뒋 ���엯�쓣 IssueForm �뿉 ���옣�븳�떎.
-                    this.setIssueFormIssueType(cell, issueTypeMaps, issueForm, rowIndex);
-                    //  �씠�뒋 ���엯�뿉 �뿰寃곕맂 �썙�겕�뵆濡쒖슦�쓽 �긽�깭 �냽�꽦 '��湲�' �씤 �긽�깭瑜� issueForm �뿉 ���옣�븳�떎.
-                    this.setIssueFormIssueStatus(issueStatusReadyMaps, issueForm, rowIndex);
-                    break;
-
-                case 4:
+                case 2:
                     //  �슦�꽑�닚�쐞瑜� IssueForm �뿉 ���옣�븳�떎.
                     this.setIssueFormPriority(cell, priorityMaps, issueForm, rowIndex);
                     break;
 
-                case 5:
+                case 3:
                     //  以묒슂�룄瑜� IssueForm �뿉 ���옣�븳�떎.
                     this.setIssueFormSeverity(cell, severityMaps, issueForm, rowIndex);
                     break;
@@ -3244,19 +3218,13 @@
                     //  �떞�떦�옄瑜� IssueForm �뿉 ���옣�븳�떎.
                     this.setIssueFormAssignee(cell, userMaps, issueForm, project);
                     break;*/
-                case 6:
-                    //  �떞�떦遺��꽌瑜� IssueForm �뿉 ���옣�븳�떎.
-                    if (cell != null) {
-                        this.setIssueFormDepartment(cell, departmentMaps, issueForm, project);
-                    }
-                    break;
-                case 7:
+                case 4:
                     //  �떆�옉�씪�쓣 IssueForm �뿉 ���옣�븳�떎.
                     if (cell != null) {
                         this.setIssueFormPeriod(cell, issueForm, true, rowIndex);
                     }
                     break;
-                case 8:
+                case 5:
                     //  醫낅즺�씪�쓣 IssueForm �뿉 ���옣�븳�떎.
                     if (cell != null) {
                         this.setIssueFormPeriod(cell, issueForm, false, rowIndex);
@@ -3283,17 +3251,6 @@
         //  �젣紐� �쑀�슚�꽦 泥댄겕
         this.verifyTitle(title);
         issueForm.setTitle(title);
-    }
-
-    //  �봽濡쒖젥�듃 �궎, �씠�뒋 怨좎쑀 踰덊샇, �떞�떦�옄瑜� IssueForm �뿉 ���옣�븳�떎.
-    private Project setIssueFormProjectKeyAndIssueNumber(Cell cell, IssueForm issueForm, Map<String, Project> projectMaps, Map<Long, Long> issueNumberMaps, int rowIndex) {
-        //  �봽濡쒖젥�듃 �븘�씠�뵒瑜� IssueForm �뿉 ���옣�븳�떎.
-        Project project = this.setIssueFormProject(cell, projectMaps, issueForm, rowIndex);
-
-        //  �씠�뒋 怨좎쑀 踰덊샇瑜� IssueForm �뿉 ���옣�븳�떎.
-        this.setIssueFormIssueNumber(issueForm, issueNumberMaps, project, rowIndex);
-
-        return project;
     }
 
     //  �봽濡쒖젥�듃 �븘�씠�뵒瑜� IssueForm �뿉 ���옣�븳�떎.
@@ -3329,34 +3286,6 @@
         issueNumberMaps.put(project.getId(), ++issueNumber);  //  �씠�뒋 踰덊샇瑜� 1�뵫 利앷� �떆�궓�떎.
     }
 
-    //  �씠�뒋 ���엯�쓣 IssueForm �뿉 ���옣�븳�떎.
-    private void setIssueFormIssueType(Cell cell, Map<String, IssueType> issueTypeMaps, IssueForm issueForm, int rowIndex) {
-        if (cell == null) {
-            throw new OwlRuntimeException(
-                    this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_ISSUE_TYPE_IS_NULL, rowIndex));
-        }
-
-        IssueType issueType = issueTypeMaps.get(CommonUtil.convertExcelStringToCell(cell));
-
-        if (issueType == null) {
-            throw new OwlRuntimeException(
-                    this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_ISSUE_TYPE_NOT_EXIST, rowIndex));
-        }
-
-        issueForm.setIssueTypeId(issueType.getId());
-    }
-
-    //  �씠�뒋 ���엯�뿉 �뿰寃곕맂 �썙�겕�뵆濡쒖슦�쓽 �긽�깭 �냽�꽦 '��湲�' �씤 �긽�깭瑜� issueForm �뿉 ���옣�븳�떎.
-    private void setIssueFormIssueStatus(Map<String, IssueStatus> issueStatusReadyMaps, IssueForm issueForm, int rowIndex) {
-        IssueStatus issueStatus = issueStatusReadyMaps.get(issueForm.getIssueTypeId().toString());
-
-        if (issueStatus == null) {
-            throw new OwlRuntimeException(
-                    this.messageAccessor.getMessage(MsgConstants.EXCEL_IMPORT_ISSUE_STATUS_READY_NOT_EXIST, rowIndex));
-        }
-
-        issueForm.setIssueStatusId(issueStatus.getId());
-    }
 
     //  �슦�꽑�닚�쐞瑜� IssueForm �뿉 ���옣�븳�떎.
     private void setIssueFormPriority(Cell cell, Map<String, Priority> priorityMaps, IssueForm issueForm, int rowIndex) {
@@ -3407,28 +3336,6 @@
             issueForm.setUserIds(userIds);
         }
     }
-
-    //  �떞�떦遺��꽌瑜� IssueForm �뿉 ���옣�븳�떎.
-    private void setIssueFormDepartment(Cell cell, Map<String, DepartmentVo> departmentMaps, IssueForm issueForm, Project project) {
-        if (cell != null) {
-            String[] splitDepartment = CommonUtil.convertExcelStringToCell(cell).split("#");
-
-            //  媛믪씠 怨듬갚�씠硫� 以묒�
-            String cellValue = CommonUtil.convertExcelStringToCell(cell);
-            if (StringUtils.isEmpty(cellValue)) {
-                return;
-            }
-
-            List<Long> departmentIds = Lists.newArrayList();
-
-            for (String department : splitDepartment) {
-                DepartmentVo departmentVo = departmentMaps.get(department);
-                departmentIds.add(departmentVo.getId());
-            }
-            issueForm.setDepartmentIds(departmentIds);
-        }
-    }
-
     //  �떆�옉�씪, 醫낅즺�씪�쓣 IssueForm �뿉 ���옣�븳�떎.
     private void setIssueFormPeriod(Cell cell, IssueForm issueForm, Boolean checkStartDate, int rowIndex) {
         if (cell != null && !cell.toString().equals("")) {
@@ -3464,7 +3371,7 @@
         }
     }
 
-    //  �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� IssueForm �뿉 ���옣�븳�떎.
+    //  �궗�슜�옄 �젙�쓽 �븘�뱶 �젙蹂대�� IssueForm �뿉 ���옣�븳�떎.-
     private void setIssueFormCustomFieldValue(Cell cell, Map<String, CustomField> customFieldMaps, IssueForm issueForm, String customFieldName, int rowIndex) {
         if (cell != null) {
             String cellValue = CommonUtil.convertExcelStringToCell(cell);
diff --git a/src/main/java/kr/wisestone/owl/web/controller/IssueController.java b/src/main/java/kr/wisestone/owl/web/controller/IssueController.java
index 904cdc6..28c74b5 100644
--- a/src/main/java/kr/wisestone/owl/web/controller/IssueController.java
+++ b/src/main/java/kr/wisestone/owl/web/controller/IssueController.java
@@ -218,7 +218,7 @@
     public @ResponseBody Map<String, Object> importExcel(MultipartHttpServletRequest request) throws Exception {
         Map<String, Object> resJsonData = new HashMap<>();
 
-        this.issueService.importExcel(request.getFile("file"));
+        this.issueService.importExcel(IssueForm.make(ConvertUtil.convertJsonToMap(request.getParameter(Constants.REQ_KEY_CONTENT))), request.getFile("file"));
 
         return this.setSuccessMessage(resJsonData);
     }
diff --git a/src/main/webapp/i18n/ko/global.json b/src/main/webapp/i18n/ko/global.json
index 8a7931a..8bb5130 100644
--- a/src/main/webapp/i18n/ko/global.json
+++ b/src/main/webapp/i18n/ko/global.json
@@ -161,6 +161,7 @@
         "issueContent": "�씠�뒋 �궡�슜",
         "issueTitle": "�씠�뒋 �젣紐�",
         "issueInfo": "�씠�뒋 �젙蹂�",
+        "parentIssue": "�긽�쐞 �씠�뒋",
         "relationIssue": "�뿰愿� �씠�뒋",
         "addRelationIssue": "�뿰愿� �씠�뒋 異붽�",
         "relationIssueTitle": "�뿰愿� �씠�뒋 �젣紐�",
diff --git a/src/main/webapp/scripts/app/issue/issueImportExcel.controller.js b/src/main/webapp/scripts/app/issue/issueImportExcel.controller.js
index 633ebb8..b4983b4 100644
--- a/src/main/webapp/scripts/app/issue/issueImportExcel.controller.js
+++ b/src/main/webapp/scripts/app/issue/issueImportExcel.controller.js
@@ -17,7 +17,8 @@
                     formCheck : formCheck,  //  �뤌 泥댄겕
                     getIssueTypes : getIssueTypes,  //  �씠�뒋 ���엯 紐⑸줉 媛��졇�삤湲�
                     makeSearchConditions : makeSearchConditions,    //  �꽑�깮�븳 議곌굔�쓣 json �쑝濡� 留뚮뱺�떎.
-                    onFileSelect : onFileSelect //  �뙆�씪 �뾽濡쒕뱶
+                    onFileSelect : onFileSelect, //  �뙆�씪 �뾽濡쒕뱶
+                    getIssueListCallBack : getIssueListCallBack // �씠�뒋 autocomplete page �뾽�뜲�씠�듃
                 };
 
                 $scope.vm = {
@@ -39,6 +40,11 @@
                 };
 
                 angular.extend(this, $controller('autoCompleteController', {$scope : $scope, $injector : $injector}));
+
+                //  �씠�뒋 autocomplete page �뾽�뜲�씠�듃
+                function getIssueListCallBack(result) {
+                    $scope.vm.autoCompletePage.issue.totalPage = result.data.page.totalPage;
+                }
 
                 //  �씠�뒋 �쑀�삎 紐⑸줉
                 function getIssueTypes() {
@@ -84,6 +90,14 @@
 
                 //  �뤌 泥댄겕
                 function formCheck() {
+                    if ($scope.vm.form.projects == null || $scope.vm.form.projects.length === 0) {
+                        return false;
+                    }
+
+                    if ($scope.vm.form.issues == null || $scope.vm.form.issues.length === 0) {
+                        return false;
+                    }
+
                     if ($scope.vm.form.file.length < 1) {
                         return true;
                     }
@@ -100,7 +114,11 @@
                         file : $scope.vm.form.file,
                         //      data �냽�꽦�쑝濡� 蹂꾨룄�쓽 �뜲�씠�꽣 �쟾�넚
                         fields : {
-                            content : {}
+                            content : {
+                                projectId : $scope.vm.form.projects[0].id,
+                                issueTypeId : $scope.vm.form.issueTypeId,
+                                parentIssueId : $scope.vm.form.issues[0].id
+                            }
                         },
                         fileFormDataName : "file"
                     })
diff --git a/src/main/webapp/views/issue/issueExcelImport.html b/src/main/webapp/views/issue/issueExcelImport.html
index 4d66c0d..6b27056 100644
--- a/src/main/webapp/views/issue/issueExcelImport.html
+++ b/src/main/webapp/views/issue/issueExcelImport.html
@@ -13,7 +13,7 @@
             <div class="row">
                 <div class="col-lg-5">
                     <div class="form-group">
-                        <label for=""> <span translate="common.project">�봽濡쒖젥�듃</span> <code
+                        <label><span translate="common.project">�봽濡쒖젥�듃</span> <code
                                 class="highlighter-rouge">*</code></label>
                         <js-autocomplete-single data-input-name="project"
                                                 selected-model="vm.form.projects"
@@ -26,7 +26,20 @@
                                                 type : '', maxlength : 200, autoResize : true, stopRemoveBodyEvent : true }"></js-autocomplete-single>
                     </div>
 
-                    <div class="form-group">
+                    <label><span translate="issue.parentIssue">�긽�쐞 �씠�뒋</span> <code
+                            class="highlighter-rouge">*</code></label>
+                    <js-autocomplete-single data-input-name="issue"
+                                            selected-model="vm.form.issues"
+                                            search="vm.issueName"
+                                            source="fn.getRelIssueList(vm.issueName, vm.issueTypeId, vm.form.issues, vm.autoCompletePage.issue.page, fn.getIssueListCallBack)"
+                                            page="vm.autoCompletePage.issue.page"
+                                            total-page="vm.autoCompletePage.issue.totalPage"
+                                            input-disabled="false"
+                                            translation-texts="{ empty : 'common.emptyIssue' }"
+                                            extra-settings="{ displayProp : 'title' , idProp : 'id', imageable : false, imagePathProp : '',
+                                            type : '', maxlength : 200, autoResize : true, stopRemoveBodyEvent : true }"></js-autocomplete-single>
+
+                    <div class="form-group mt-5">
                         <label for="issueExcelImportFrom3"> <span translate="issue.issueType">�씠�뒋 ���엯</span> <code
                                 class="highlighter-rouge">*</code></label>
                         <select id="issueExcelImportFrom3"

--
Gitblit v1.8.0