260716_01_ENH: 본 서버에서 기동 후 중간 테스트를 위한 커밋

This commit is contained in:
2026-07-16 09:12:19 +09:00
parent 50ecd6bf6b
commit 5e96dded62
42 changed files with 572 additions and 75 deletions

View File

@@ -21,6 +21,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
@@ -37,6 +38,8 @@ public class UserService {
private final RoleService roleService;
private final UserRepository userRepository;
private static final int OUTSOURCE_USER_ROLE_END = ContactConstant.OUTSOURCE_USER_ROLE + 1000;
@Transactional
public void createUser(UserInfoDto userInfo, String regUser, LocalDateTime regDt) {
List<RoleInfoDto> roleList = roleService.getRoleList();
@@ -220,7 +223,9 @@ public class UserService {
.with("userId", dto.getUserId())
);
if(entity.getUserRole() != dto.getUserRole()) {
validateUserRoleChange(entity.getUserRole(), dto.getUserRole());
if(!Objects.equals(entity.getUserRole(), dto.getUserRole())) {
assignService.deleteListAssignWithUser(dto.getUserId());
}
@@ -239,6 +244,29 @@ public class UserService {
}
/*******************************private*******************************/
private void validateUserRoleChange(Integer currentRole, Integer newRole) {
if (Objects.equals(currentRole, newRole)) {
return;
}
if ((isOutsourceRole(currentRole) && isFieldworkRole(newRole))
|| (isFieldworkRole(currentRole) && isOutsourceRole(newRole))) {
throw BusinessException.badRequest(
"USER_ROLE_CHANGE_NOT_ALLOWED",
"외주사와 콜센터/컨택원/면접원 간 권한 변경은 할 수 없습니다."
);
}
}
private boolean isOutsourceRole(Integer role) {
return role != null
&& role >= ContactConstant.OUTSOURCE_USER_ROLE
&& role < OUTSOURCE_USER_ROLE_END;
}
private boolean isFieldworkRole(Integer role) {
return role != null && role >= ContactConstant.FIELDWORK_USER_ROLE;
}
private DataVerificationDto verifyUserId(String userId, List<String> intranetUserList) {
if (userId == null || userId.isBlank()) {
return new DataVerificationDto(false, "사용자 ID", "사용자 ID가 비었습니다.");