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/DepartmentServiceImpl.java |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/service/impl/DepartmentServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/DepartmentServiceImpl.java
index c7e7000..67d7586 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/DepartmentServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/DepartmentServiceImpl.java
@@ -56,6 +56,9 @@
     private ProjectRoleDepartmentService projectRoleDepartmentService;
 
     @Autowired
+    private IssueDepartmentService issueDepartmentService;
+
+    @Autowired
     private ProjectRoleService projectRoleService;
 
     @Autowired
@@ -125,11 +128,28 @@
         }
 
         for (Long id : departmentForm.getRemoveIds()) {
-            if (!this.departmentService.countInDepartment(id)) {
-                this.departmentRepository.deleteById(id);
-            } else {
+            if (this.departmentService.countInDepartment(id)) {
+                //  �궗�슜�옄媛� 遺��꽌�뿉 �냽�빐 �엳�뒗吏� 泥댄겕
                 throw new OwlRuntimeException(
                         this.messageAccessor.getMessage(MsgConstants.DEPARTMENT_ALREADY_IN_USE));
+
+            } else if (this.workflowDepartmentService.usingDepartment(id)) {
+                //  �썙�겕�뵆濡쒖슦�뿉�꽌 �빐�떦 遺��꽌瑜� �궗�슜�븯怨� �엳�뒗吏� 泥댄겕
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.DEPARTMENT_ALREADY_IN_USE_IN_WORKFLOW));
+
+            } else if (this.projectRoleDepartmentService.usingDepartment(id)) {
+                //  �봽濡쒖젥�듃�쓽 �떞�떦遺��꽌�씤吏� 泥댄겕
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.DEPARTMENT_ALREADY_IN_USE_IN_PROJECT));
+
+            } else if (this.issueDepartmentService.usingDepartment(id)) {
+                //  �씠�뒋�쓽 �떞�떦遺��꽌濡� �릺�뼱�엳�뒗吏� 泥댄겕
+                throw new OwlRuntimeException(
+                        this.messageAccessor.getMessage(MsgConstants.DEPARTMENT_ALREADY_IN_USE_IN_ISSUE));
+
+            } else {
+                this.departmentRepository.deleteById(id);
             }
         }
         this.departmentRepository.flush();

--
Gitblit v1.8.0