법인회원 전환 요청 로직 개선 및 레이아웃 템플릿 변경
This commit is contained in:
@@ -16,7 +16,9 @@ import com.eactive.apim.portal.invitation.repository.UserInvitationRepository;
|
||||
import com.eactive.apim.portal.portaluser.entity.PortalUserEnums;
|
||||
import com.eactive.apim.portal.portaluser.entity.PortalUserEnums.RoleCode;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -36,6 +38,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
@@ -271,18 +274,20 @@ public class AccountController {
|
||||
|
||||
|
||||
@PostMapping("/mypage/org-transfer")
|
||||
public String processOrgTransfer(
|
||||
@ResponseBody
|
||||
public Map<String, Object> processOrgTransfer(
|
||||
@ModelAttribute PortalOrgRegistrationDTO orgDTO,
|
||||
@ModelAttribute UserAgreementDTO agreementDTO,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes) {
|
||||
HttpServletResponse response) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
var currentUser = SecurityUtil.getPortalAuthenticatedUser();
|
||||
|
||||
if (currentUser.getRoleCode() != PortalUserEnums.RoleCode.ROLE_USER) {
|
||||
redirectAttributes.addFlashAttribute("error", "잘못된 접근입니다.");
|
||||
return "redirect:/mypage";
|
||||
result.put("status", "ERROR");
|
||||
result.put("message", "잘못된 접근입니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
ValidationResponse validationResponse = orgRegisterFacade.convertToOrgUser(
|
||||
@@ -310,16 +315,20 @@ public class AccountController {
|
||||
}
|
||||
}
|
||||
|
||||
redirectAttributes.addFlashAttribute("success", validationResponse.getMessage());
|
||||
return "apps/mypage/UserConversionCompleted";
|
||||
result.put("status", "SUCCESS");
|
||||
result.put("message", validationResponse.getMessage());
|
||||
result.put("redirectUrl", "/");
|
||||
return result;
|
||||
} else {
|
||||
redirectAttributes.addFlashAttribute("error", validationResponse.getMessage());
|
||||
return "redirect:/mypage/org-transfer";
|
||||
result.put("status", "ERROR");
|
||||
result.put("message", validationResponse.getMessage());
|
||||
return result;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
redirectAttributes.addFlashAttribute("error", "법인회원 전환 중 오류가 발생했습니다: " + e.getMessage());
|
||||
return "redirect:/mypage/org-transfer";
|
||||
result.put("status", "ERROR");
|
||||
result.put("message", "법인회원 전환 중 오류가 발생했습니다: " + e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout/kbank_nohead_layout}">
|
||||
layout:decorate="~{layout/kjbank_nohead_layout}">
|
||||
<body>
|
||||
<section layout:fragment="contentFragment" class="content pop">
|
||||
<div class="sub_title2">
|
||||
|
||||
@@ -90,11 +90,6 @@
|
||||
compRegNo: $('#compRegNo').val().trim() !== '',
|
||||
corpRegNo: $('#corpRegNo').val().trim() !== '',
|
||||
orgName: $('#orgName').val().trim() !== '',
|
||||
ceoName: $('#ceoName').val().trim() !== '',
|
||||
orgAddr: $('#orgAddr').val().trim() !== '',
|
||||
orgPhoneNumber: $('#orgPhoneNumber').val().trim() !== '',
|
||||
scPhoneNumber: $('#scPhoneNumber').val().trim() !== '',
|
||||
serviceName: $('#serviceName').val().trim() !== '',
|
||||
compRegFile: $('#compRegFile').val().trim() !== ''
|
||||
};
|
||||
|
||||
@@ -104,11 +99,6 @@
|
||||
compRegNo: '사업자등록번호를 입력해주세요.',
|
||||
corpRegNo: '법인등록번호를 입력해주세요.',
|
||||
orgName: '법인명을 입력해주세요.',
|
||||
ceoName: '대표자 성명을 입력해주세요.',
|
||||
orgAddr: '사업장 소재지를 입력해주세요.',
|
||||
orgPhoneNumber: '회사 전화번호를 입력해주세요.',
|
||||
scPhoneNumber: '고객센터 전화번호를 입력해주세요.',
|
||||
serviceName: '서비스명을 입력해주세요.',
|
||||
compRegFile: '사업자등록증을 업로드해주세요.'
|
||||
};
|
||||
|
||||
@@ -150,18 +140,12 @@
|
||||
success: function(response) {
|
||||
console.log('폼 제출 성공:', response);
|
||||
|
||||
// 응답이 JSON인 경우
|
||||
if (typeof response === 'object') {
|
||||
if (response.status === 'SUCCESS') {
|
||||
customPopups.showSuccess(response.message || '법인회원 전환 신청이 완료되었습니다.', function() {
|
||||
window.location.href = /*[[@{/mypage}]]*/ '/mypage';
|
||||
});
|
||||
} else {
|
||||
customPopups.showAlert(response.message || '처리 중 오류가 발생했습니다.');
|
||||
}
|
||||
if (response.status === 'SUCCESS') {
|
||||
customPopups.showAlert(response.message || '법인회원 전환 신청이 완료되었습니다.', function() {
|
||||
window.location.href = response.redirectUrl || /*[[@{/apps/mypage/UserConversionCompleted}]]*/ '/apps/mypage/UserConversionCompleted';
|
||||
});
|
||||
} else {
|
||||
// 응답이 HTML인 경우 (페이지 리다이렉트)
|
||||
window.location.href = /*[[@{/mypage}]]*/ '/mypage';
|
||||
customPopups.showAlert(response.message || '처리 중 오류가 발생했습니다.');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout/kbank_nohead_layout}">
|
||||
layout:decorate="~{layout/kjbank_nohead_layout}">
|
||||
<body>
|
||||
<section layout:fragment="contentFragment" class="content pop">
|
||||
<div class="sub_title2">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout/kbank_nohead_layout}">
|
||||
layout:decorate="~{layout/kjbank_nohead_layout}">
|
||||
<body>
|
||||
<section layout:fragment="contentFragment" class="content pop">
|
||||
<div class="sub_title2">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout/kbank_nohead_layout}">
|
||||
layout:decorate="~{layout/kjbank_nohead_layout}">
|
||||
<body>
|
||||
<section layout:fragment="contentFragment" class="content pop">
|
||||
<div class="sub_title2">
|
||||
|
||||
Reference in New Issue
Block a user