From 916a3cbabe4e50062fce61ff6f2f5d46c05dfbd1 Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 목, 17 3월 2022 17:47:45 +0900
Subject: [PATCH] - api로 이슈 추가 시 url/ip로 업체 찾는 코드 수정

---
 src/main/java/kr/wisestone/owl/service/impl/IssueStatusServiceImpl.java |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/service/impl/IssueStatusServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/IssueStatusServiceImpl.java
index 0b36fc8..3cc0736 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/IssueStatusServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/IssueStatusServiceImpl.java
@@ -17,6 +17,7 @@
 import kr.wisestone.owl.web.form.IssueStatusForm;
 import kr.wisestone.owl.web.view.ExcelView;
 import org.apache.commons.lang3.StringUtils;
+import org.hibernate.jdbc.Work;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,10 +40,16 @@
     private IssueStatusRepository issueStatusRepository;
 
     @Autowired
+    private WorkflowService workflowService;
+
+    @Autowired
     private WorkspaceService workspaceService;
 
     @Autowired
     private WorkflowTransitionService workflowTransitionService;
+
+    @Autowired
+    private WorkflowDepartmentService workflowDepartmentService;
 
     @Autowired
     private IssueTypeService issueTypeService;
@@ -89,6 +96,15 @@
     public List<IssueStatus> findByWorkspaceId(Long workspaceId) {
         return this.issueStatusRepository.findByWorkspaceId(workspaceId);
     }
+
+
+    @Override
+    @Transactional(readOnly = true)
+    public List<IssueStatusVo> findByIssueTypeId(Long issueTypeId) {
+        IssueType issueType = this.issueTypeService.getIssueType(issueTypeId);
+        Workflow workflow = issueType.getWorkflow();
+        return findByWorkflowId(workflow.getId());
+     }
 
     //  �씠�뒋 �긽�깭瑜� �깮�꽦�븳�떎.
     @Override
@@ -320,11 +336,11 @@
         //  �궘�젣�븷 �씠�뒋 �긽�깭媛� �썙�겕�뵆濡쒖슦 �뿉�꽌 �궗�슜�릺怨� �엳�뒗吏� �솗�씤�븳�떎.
         this.checkUseWorkflow(issueStatus);
 
-        //  湲곕낯�쑝濡� �젣怨듬릺�뒗 �씠�뒋 �긽�깭�뒗 �궘�젣 湲덉�
-        if (issueStatus.getDefaultYn()) {
+        //  湲곕낯�쑝濡� �젣怨듬릺�뒗 �씠�뒋 �긽�깭�뒗 �궘�젣 湲덉� -> 湲곕낯�젣怨듭씠�뿬�룄 �궗�슜�븯吏� �븡�쑝硫� �궘�젣 媛��뒫�븯�룄濡� �닔�젙
+        /*if (issueStatus.getDefaultYn()) {
             throw new OwlRuntimeException(
                     this.messageAccessor.getMessage(MsgConstants.DEFAULT_ISSUE_STATUS_NOT_REMOVE));
-        }
+        }*/
 
         this.issueStatusRepository.delete(issueStatus);
     }
@@ -545,12 +561,18 @@
                 if (count < 1) {
                     IssueStatusVo issueStatusVo = new IssueStatusVo(workflowTransitionVo.getTargetStatusId(), workflowTransitionVo.getTargetStatusName());
                     issueStatusVos.add(issueStatusVo);
+
+                    List<WorkflowDepartmentVo> workflowDepartments = this.workflowDepartmentService.find(workflow.getId(), issueStatusVo.getId());
+                    issueStatusVo.setWorkflowDepartmentVos(workflowDepartments);
                 }
                 else {
                     //  �몢踰덉㎏ �씠�뒋遺��꽣 泥ル쾲吏� �씠�뒋�뿉�꽌 �씠�룞 媛��뒫�뻽�뜕 �긽�깭 以� �뾾�뒗 ���긽�쓣 李얜뒗�떎.
                     for (IssueStatusVo issueStatusVo : issueStatusVos) {
                         if (issueStatusVo.getId().equals(workflowTransitionVo.getTargetStatusId())) {
                             tempIssueStatusVos.add(issueStatusVo);
+
+                            List<WorkflowDepartmentVo> workflowDepartments = this.workflowDepartmentService.find(workflow.getId(), issueStatusVo.getId());
+                            issueStatusVo.setWorkflowDepartmentVos(workflowDepartments);
                         }
                     }
                 }
@@ -566,5 +588,4 @@
 
         resJsonData.put(Constants.RES_KEY_CONTENTS, issueStatusVos);
     }
-
 }

--
Gitblit v1.8.0