From d438f9c81cffd2e2cbec48150b43a5a89c9ab749 Mon Sep 17 00:00:00 2001
From: 이민희 <mhlee@maprex.co.kr>
Date: 수, 16 2월 2022 15:56:56 +0900
Subject: [PATCH] - 하위이슈 직접 생성 시 프로젝트 변경 못하도록 수정 - 연관이슈 직접 생성 시 프로젝트 변경 할 경우 이슈타입도 변경 되도록 수정

---
 src/main/java/kr/wisestone/owl/service/impl/HostingFieldServiceImpl.java |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/main/java/kr/wisestone/owl/service/impl/HostingFieldServiceImpl.java b/src/main/java/kr/wisestone/owl/service/impl/HostingFieldServiceImpl.java
index 38ad53c..9235686 100644
--- a/src/main/java/kr/wisestone/owl/service/impl/HostingFieldServiceImpl.java
+++ b/src/main/java/kr/wisestone/owl/service/impl/HostingFieldServiceImpl.java
@@ -81,11 +81,17 @@
         }
 
         HostingField hostingField = ConvertUtil.copyProperties(HostingFieldForm, HostingField.class);
+
         if (hostingField.getCode() != null && !hostingField.getCode().equals("")) {
-            hostingFieldRepository.saveAndFlush(hostingField);
+            try {
+                hostingFieldRepository.saveAndFlush(hostingField);
+            } catch (Exception e) {
+                throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.HOSTING_CODE_USED_EXIST_VALUE));
+            }
         } else {
             throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.HOSTING_CODE_NOT_ENTER));
         }
+
         return hostingField;
     }
 
@@ -139,7 +145,17 @@
             HostingFieldForm.setEmail(emails.trim());
         }
         HostingField HostingField = ConvertUtil.copyProperties(HostingFieldForm, HostingField.class);
-        hostingFieldRepository.saveAndFlush(HostingField);
+
+        if (HostingField.getCode() != null && !HostingField.getCode().equals("")) {
+            try {
+                hostingFieldRepository.saveAndFlush(HostingField);
+            } catch (Exception e) {
+                throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.HOSTING_CODE_USED_EXIST_VALUE));
+            }
+        } else {
+            throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.HOSTING_CODE_NOT_ENTER));
+        }
+
     }
 
     // Hosting瑜� �궘�젣�븳�떎.
@@ -304,7 +320,15 @@
                 HostingField hostingField = new HostingField();
                 ConvertUtil.copyProperties(saveHostingFieldForm, hostingField);
 
-                hostingField = this.hostingFieldRepository.saveAndFlush(hostingField);
+                if (hostingField.getCode() != null && !hostingField.getCode().equals("")) {
+                    try {
+                        hostingField = hostingFieldRepository.saveAndFlush(hostingField);
+                    } catch (Exception e) {
+                        throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.HOSTING_CODE_USED_EXIST_VALUE));
+                    }
+                } else {
+                    throw new OwlRuntimeException(this.messageAccessor.getMessage(MsgConstants.HOSTING_CODE_NOT_ENTER));
+                }
 
                 saveHostingFieldForm.setId(hostingField.getId());
             }

--
Gitblit v1.8.0