법인 생성시 사업자번호 기준으로 중복 생성 차단
This commit is contained in:
@@ -181,6 +181,11 @@ public class OrgRegisterFacadeImpl implements OrgRegisterFacade {
|
||||
PortalOrgRegistrationDTO orgDTO,
|
||||
FileInfo uploadedFile) {
|
||||
|
||||
// 사업자등록번호 중복 체크 (이중 방어)
|
||||
if (portalOrgService.existsByCompRegNo(orgDTO.getCompRegNo())) {
|
||||
return new ValidationResponse(false, "이미 등록된 사업자등록번호입니다.");
|
||||
}
|
||||
|
||||
// PortalOrgService를 통한 기관 등록
|
||||
PortalOrg newOrg = portalOrgService.registerOrgFromDTOWithFile(orgDTO, uploadedFile);
|
||||
|
||||
@@ -218,6 +223,11 @@ public class OrgRegisterFacadeImpl implements OrgRegisterFacade {
|
||||
PortalOrgRegistrationDTO orgDTO,
|
||||
FileInfo uploadedFile) {
|
||||
|
||||
// 사업자등록번호 중복 체크 (이중 방어)
|
||||
if (portalOrgService.existsByCompRegNo(orgDTO.getCompRegNo())) {
|
||||
return new ValidationResponse(false, "이미 등록된 사업자등록번호입니다.");
|
||||
}
|
||||
|
||||
// PortalOrgService를 통한 기관 등록
|
||||
PortalOrg newOrg = portalOrgService.registerOrgFromDTOWithFile(orgDTO, uploadedFile);
|
||||
|
||||
@@ -243,6 +253,11 @@ public class OrgRegisterFacadeImpl implements OrgRegisterFacade {
|
||||
String newEmail,
|
||||
FileInfo uploadedFile) {
|
||||
|
||||
// 사업자등록번호 중복 체크 (이중 방어)
|
||||
if (portalOrgService.existsByCompRegNo(orgDTO.getCompRegNo())) {
|
||||
return new ValidationResponse(false, "이미 등록된 사업자등록번호입니다.");
|
||||
}
|
||||
|
||||
// PortalOrgService를 통한 기관 등록
|
||||
PortalOrg newOrg = portalOrgService.registerOrgFromDTOWithFile(orgDTO, uploadedFile);
|
||||
|
||||
@@ -285,9 +300,19 @@ public class OrgRegisterFacadeImpl implements OrgRegisterFacade {
|
||||
|
||||
@Override
|
||||
public ResponseEntity<ValidationResponse> checkBusinessNumber(String compRegNo) {
|
||||
boolean isValid = validationService.isValidBusinessNumber(compRegNo);
|
||||
String message = isValid ? "사용 가능한 사업자 등록번호입니다." : "유효하지 않은 사업자 등록번호입니다.";
|
||||
return ResponseEntity.ok(new ValidationResponse(isValid, message));
|
||||
// 1. 형식 검증
|
||||
boolean isValidFormat = validationService.isValidBusinessNumber(compRegNo);
|
||||
if (!isValidFormat) {
|
||||
return ResponseEntity.ok(new ValidationResponse(false, "유효하지 않은 사업자 등록번호입니다."));
|
||||
}
|
||||
|
||||
// 2. 중복 검증
|
||||
boolean isDuplicate = portalOrgService.existsByCompRegNo(compRegNo);
|
||||
if (isDuplicate) {
|
||||
return ResponseEntity.ok(new ValidationResponse(false, "이미 등록된 사업자등록번호입니다."));
|
||||
}
|
||||
|
||||
return ResponseEntity.ok(new ValidationResponse(true, "사용 가능한 사업자 등록번호입니다."));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -58,4 +58,9 @@ public class PortalOrgService {
|
||||
org.setOrgStatus(OrgStatus.READY);
|
||||
org.setApprovalStatus(ApprovalStatus.PENDING);
|
||||
}
|
||||
|
||||
// 사업자등록번호 중복 체크
|
||||
public boolean existsByCompRegNo(String compRegNo) {
|
||||
return portalOrgRepository.findByCompRegNo(compRegNo).isPresent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user