From 942b2e7ecb24112e1d26c4f8badcfce583548a89 Mon Sep 17 00:00:00 2001 From: Kang Jung Kyo Date: Tue, 8 Oct 2024 11:28:16 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=B6=94=EA=B0=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qcast/biz/login/LoginService.java | 105 +++++++++--------- .../qcast/biz/login/dto/JoinUser.java | 1 + .../qcast/biz/login/dto/LoginUser.java | 2 - .../qcast/biz/login/dto/UserResponse.java | 1 + 4 files changed, 53 insertions(+), 56 deletions(-) diff --git a/src/main/java/com/interplug/qcast/biz/login/LoginService.java b/src/main/java/com/interplug/qcast/biz/login/LoginService.java index 1ece5434..7a564960 100644 --- a/src/main/java/com/interplug/qcast/biz/login/LoginService.java +++ b/src/main/java/com/interplug/qcast/biz/login/LoginService.java @@ -1,5 +1,6 @@ package com.interplug.qcast.biz.login; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpMethod; import org.springframework.stereotype.Service; @@ -10,6 +11,9 @@ import com.interplug.qcast.biz.login.dto.LoginUser; import com.interplug.qcast.biz.login.dto.UserLoginResponse; import com.interplug.qcast.biz.login.dto.UserPassword; import com.interplug.qcast.biz.login.dto.UserResponse; +import com.interplug.qcast.config.Exception.ErrorCode; +import com.interplug.qcast.config.Exception.QcastException; +import com.interplug.qcast.config.message.Messages; import com.interplug.qcast.util.DefaultResponse; import com.interplug.qcast.util.InterfaceQsp; import lombok.RequiredArgsConstructor; @@ -26,22 +30,18 @@ public class LoginService { @Value("${qsp.url}") private String qspUrl; + @Autowired + Messages message; + // 로그인 처리 public UserLoginResponse getLogin(LoginUser loginUser) throws Exception { - if (loginUser == null) - throw new IllegalArgumentException("DTO 설정이 필요합니다."); - - if (loginUser.getLangCd() == null || "".equals(loginUser.getLangCd())) - throw new IllegalArgumentException("Language Code" + "은(는) 필수값입니다."); - - if (loginUser.getLastEditUser() == null || "".equals(loginUser.getLastEditUser())) - throw new IllegalArgumentException("Last Edit User Id" + "은(는) 필수값입니다."); - if (loginUser.getLoginId() == null || "".equals(loginUser.getLoginId())) - throw new IllegalArgumentException("Login Id" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Login Id")); if (loginUser.getPwd() == null || "".equals(loginUser.getPwd())) - throw new IllegalArgumentException("Password" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Password")); UserLoginResponse userLoginResponse = null; @@ -61,60 +61,67 @@ public class LoginService { } public UserResponse getUser(LoginUser loginUser) { - log.info("Build Test"); return loginMapper.getUser(loginUser); } // 가입 신청 등록 public DefaultResponse joinUser(JoinUser joinUser) throws Exception { - if (joinUser == null) - throw new IllegalArgumentException("DTO 설정이 필요합니다."); - if (joinUser.getLangCd() == null || "".equals(joinUser.getLangCd())) - throw new IllegalArgumentException("Language Code" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Language Code")); if (joinUser.getLastEditUser() == null || "".equals(joinUser.getLastEditUser())) - throw new IllegalArgumentException("Last Edit User Id" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Last Edit User Id")); if (joinUser.getStoreQcastNm() == null || "".equals(joinUser.getStoreQcastNm())) - throw new IllegalArgumentException("Store QCast Name" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Store QCast Name")); if (joinUser.getStoreQcastNmKana() == null || "".equals(joinUser.getStoreQcastNmKana())) - throw new IllegalArgumentException("Store QCast Name Kana" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Store QCast Name Kana")); if (joinUser.getPostCd() == null || "".equals(joinUser.getPostCd())) - throw new IllegalArgumentException("Postal Code" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Postal Code")); if (joinUser.getAddr() == null || "".equals(joinUser.getAddr())) - throw new IllegalArgumentException("Address" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Address")); if (joinUser.getTelNo() == null || "".equals(joinUser.getTelNo())) - throw new IllegalArgumentException("Telephone" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Telephone")); if (joinUser.getFax() == null || "".equals(joinUser.getFax())) - throw new IllegalArgumentException("Fax" + "은(는) 필수값입니다."); - - if (joinUser.getUserInfo() == null) - throw new IllegalArgumentException("사용자 정보 DTO 설정이 필요합니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Fax")); if (joinUser.getUserInfo().getUserId() == null || "".equals(joinUser.getUserInfo().getUserId())) - throw new IllegalArgumentException("User Id" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "User Id")); if (joinUser.getUserInfo().getUserNm() == null || "".equals(joinUser.getUserInfo().getUserNm())) - throw new IllegalArgumentException("Name" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Name")); - if (joinUser.getUserInfo().getUserNmKana() == null - || "".equals(joinUser.getUserInfo().getUserNmKana())) - throw new IllegalArgumentException("Name_Kana" + "은(는) 필수값입니다."); + // if (joinUser.getUserInfo().getUserNmKana() == null + // || "".equals(joinUser.getUserInfo().getUserNmKana())) + // throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + // message.getMessage("common.message.required.data", "Name Kana")); if (joinUser.getUserInfo().getTelNo() == null || "".equals(joinUser.getUserInfo().getTelNo())) - throw new IllegalArgumentException("Telephone" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Telephone")); if (joinUser.getUserInfo().getFax() == null || "".equals(joinUser.getUserInfo().getFax())) - throw new IllegalArgumentException("Fax" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Fax")); if (joinUser.getUserInfo().getEmail() == null || "".equals(joinUser.getUserInfo().getEmail())) - throw new IllegalArgumentException("E-Mail" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "E-Mail")); // QSP API Call.. // Q.CAST 신규 사용자 요청 @@ -134,20 +141,13 @@ public class LoginService { // 비밀번호 초기화 public DefaultResponse initPassword(UserPassword userPassword) throws Exception { - if (userPassword == null) - throw new IllegalArgumentException("DTO 설정이 필요합니다."); - - if (userPassword.getLangCd() == null || "".equals(userPassword.getLangCd())) - throw new IllegalArgumentException("Language Code" + "은(는) 필수값입니다."); - - if (userPassword.getLastEditUser() == null || "".equals(userPassword.getLastEditUser())) - throw new IllegalArgumentException("Last Edit User Id" + "은(는) 필수값입니다."); - if (userPassword.getLoginId() == null || "".equals(userPassword.getLoginId())) - throw new IllegalArgumentException("Login Id" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Login Id")); if (userPassword.getEmail() == null || "".equals(userPassword.getEmail())) - throw new IllegalArgumentException("E-Mail" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "E-Mail")); // QSP API Call.. // Q.CAST 비밀번호 초기화 @@ -167,20 +167,17 @@ public class LoginService { // 비밀번호 변경 public DefaultResponse changePassword(UserPassword userPassword) throws Exception { - if (userPassword == null) - throw new IllegalArgumentException("DTO 설정이 필요합니다."); - - if (userPassword.getLangCd() == null || "".equals(userPassword.getLangCd())) - throw new IllegalArgumentException("Language Code" + "은(는) 필수값입니다."); - if (userPassword.getLastEditUser() == null || "".equals(userPassword.getLastEditUser())) - throw new IllegalArgumentException("Last Edit User Id" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Last Edit User Id")); if (userPassword.getPwd() == null || "".equals(userPassword.getPwd())) - throw new IllegalArgumentException("Now Password" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Now Password")); if (userPassword.getChgPwd() == null || "".equals(userPassword.getChgPwd())) - throw new IllegalArgumentException("Change Password" + "은(는) 필수값입니다."); + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Change Password")); // QSP API Call.. // Q.CAST 비밀번호 변경 diff --git a/src/main/java/com/interplug/qcast/biz/login/dto/JoinUser.java b/src/main/java/com/interplug/qcast/biz/login/dto/JoinUser.java index ee4bb49a..c076d268 100644 --- a/src/main/java/com/interplug/qcast/biz/login/dto/JoinUser.java +++ b/src/main/java/com/interplug/qcast/biz/login/dto/JoinUser.java @@ -14,6 +14,7 @@ public class JoinUser { private String addr; // Address private String telNo; // Telephone private String fax; // Fax + private String bizNo; // Business Registration No private String payTermsCd; // Pay Terms Code private String kamId; // Kam Id private String qtCompNm; // Quotation Company name diff --git a/src/main/java/com/interplug/qcast/biz/login/dto/LoginUser.java b/src/main/java/com/interplug/qcast/biz/login/dto/LoginUser.java index d78ec590..89f1c6de 100644 --- a/src/main/java/com/interplug/qcast/biz/login/dto/LoginUser.java +++ b/src/main/java/com/interplug/qcast/biz/login/dto/LoginUser.java @@ -4,8 +4,6 @@ import lombok.Data; @Data public class LoginUser { - private String langCd; // Language Code - private String lastEditUser; // Last Edit User Id private String loginId; // Login Id private String pwd; // Password } diff --git a/src/main/java/com/interplug/qcast/biz/login/dto/UserResponse.java b/src/main/java/com/interplug/qcast/biz/login/dto/UserResponse.java index e17ae25f..4de758be 100644 --- a/src/main/java/com/interplug/qcast/biz/login/dto/UserResponse.java +++ b/src/main/java/com/interplug/qcast/biz/login/dto/UserResponse.java @@ -22,5 +22,6 @@ public class UserResponse { private String fax; // Fax private String email; // E-Mail private String pwdInitYn; // Password Init Yn + private String storeLvl; // Store Level }