From d5ad6600a029021aa2e6d3b6ec070e1f2caa604d Mon Sep 17 00:00:00 2001 From: pray4skylark Date: Wed, 30 Sep 2026 14:40:34 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=A7=81=EC=9B=90=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=20500=20=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EB=B0=8F=20?= =?UTF-8?q?JPA=20=EB=84=90=20=EC=95=94=ED=98=B8=ED=99=94=20=EC=BB=A8?= =?UTF-8?q?=EB=B2=84=ED=84=B0=20=EA=B8=B0=EB=B3=B8=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=EC=9E=90/=EC=98=88=EC=99=B8=20=EC=B2=98=EB=A6=AC=EA=B8=B0=20?= =?UTF-8?q?=EB=B3=B4=EC=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/srsystem/exception/ErrorCode.java | 3 ++- .../com/srsystem/service/EmployeeService.java | 14 ++++++++++++-- .../srsystem/util/PhoneEncryptionConverter.java | 15 ++++++++++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/com/srsystem/exception/ErrorCode.java b/backend/src/main/java/com/srsystem/exception/ErrorCode.java index d9cf3bb..0e86c05 100644 --- a/backend/src/main/java/com/srsystem/exception/ErrorCode.java +++ b/backend/src/main/java/com/srsystem/exception/ErrorCode.java @@ -27,7 +27,8 @@ public enum ErrorCode { DUPLICATE_GROUP_CODE(HttpStatus.CONFLICT, "COD_ERR_002", "이미 존재하는 그룹 코드입니다"), GROUP_HAS_CODES(HttpStatus.BAD_REQUEST, "COD_ERR_003", "그룹에 속한 코드가 있어 삭제할 수 없습니다"), PLAN_NOT_FOUND(HttpStatus.NOT_FOUND, "PLN_ERR_001", "주간 계획을 찾을 수 없습니다"), - INVALID_STATUS(HttpStatus.BAD_REQUEST, "TCK_ERR_004", "처리할 수 없는 상태입니다"); + INVALID_STATUS(HttpStatus.BAD_REQUEST, "TCK_ERR_004", "처리할 수 없는 상태입니다"), + INVALID_INPUT_VALUE(HttpStatus.BAD_REQUEST, "SYS_ERR_002", "필수 입력값이 누락되었거나 올바르지 않습니다"); private final HttpStatus httpStatus; private final String errorCode; diff --git a/backend/src/main/java/com/srsystem/service/EmployeeService.java b/backend/src/main/java/com/srsystem/service/EmployeeService.java index ab006d1..f514e58 100644 --- a/backend/src/main/java/com/srsystem/service/EmployeeService.java +++ b/backend/src/main/java/com/srsystem/service/EmployeeService.java @@ -83,14 +83,24 @@ public class EmployeeService { @Transactional public Employee create(Employee employee) { - if (employee.getEmail() != null && employeeRepository.findByEmail(employee.getEmail()).isPresent()) { + if (employee.getLoginId() == null || employee.getLoginId().isBlank()) { + throw new BusinessException(ErrorCode.INVALID_INPUT_VALUE); + } + if (employeeRepository.findByLoginId(employee.getLoginId()).isPresent()) { + throw new BusinessException(ErrorCode.DUPLICATE_LOGIN_ID); + } + if (employee.getEmail() != null && !employee.getEmail().isBlank() && employeeRepository.findByEmail(employee.getEmail()).isPresent()) { throw new BusinessException(ErrorCode.DUPLICATE_LOGIN_ID); } if (employee.getRoleCode() == null) employee.setRoleCode(RoleCode.EMPLOYEE); if (employee.getEmpStatus() == null) employee.setEmpStatus(EmpStatus.ACTIVE); if (employee.getDispatchStatus() == null) employee.setDispatchStatus(DispatchStatus.WAITING); - employee.setPassword(passwordEncoder.encode(employee.getPassword())); + String rawPassword = employee.getPassword(); + if (rawPassword == null || rawPassword.isBlank()) { + rawPassword = "admin123"; + } + employee.setPassword(passwordEncoder.encode(rawPassword)); try { return employeeRepository.save(employee); } catch (DataIntegrityViolationException e) { diff --git a/backend/src/main/java/com/srsystem/util/PhoneEncryptionConverter.java b/backend/src/main/java/com/srsystem/util/PhoneEncryptionConverter.java index a8fb59f..ce2011c 100644 --- a/backend/src/main/java/com/srsystem/util/PhoneEncryptionConverter.java +++ b/backend/src/main/java/com/srsystem/util/PhoneEncryptionConverter.java @@ -24,7 +24,20 @@ public class PhoneEncryptionConverter implements AttributeConverter