spotlessApply 적용

This commit is contained in:
2025-12-11 13:47:57 +09:00
parent ec19cf533a
commit d798dc16f9
14 changed files with 261 additions and 279 deletions

View File

@@ -8,17 +8,11 @@ import org.springframework.http.HttpStatus;
public enum AuthErrorCode implements ErrorCode { public enum AuthErrorCode implements ErrorCode {
// 🔐 로그인 관련 // 🔐 로그인 관련
LOGIN_ID_NOT_FOUND( LOGIN_ID_NOT_FOUND("LOGIN_ID_NOT_FOUND", HttpStatus.UNAUTHORIZED),
"LOGIN_ID_NOT_FOUND",
HttpStatus.UNAUTHORIZED),
LOGIN_PASSWORD_MISMATCH( LOGIN_PASSWORD_MISMATCH("LOGIN_PASSWORD_MISMATCH", HttpStatus.UNAUTHORIZED),
"LOGIN_PASSWORD_MISMATCH",
HttpStatus.UNAUTHORIZED),
LOGIN_PASSWORD_EXCEEDED( LOGIN_PASSWORD_EXCEEDED("LOGIN_PASSWORD_EXCEEDED", HttpStatus.UNAUTHORIZED);
"LOGIN_PASSWORD_EXCEEDED",
HttpStatus.UNAUTHORIZED);
private final String code; private final String code;
private final HttpStatus status; private final HttpStatus status;

View File

@@ -20,11 +20,9 @@ public class ApiResponseDto<T> {
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
private T errorData; private T errorData;
@JsonIgnore @JsonIgnore private HttpStatus httpStatus;
private HttpStatus httpStatus;
@JsonIgnore @JsonIgnore private Long errorLogUid;
private Long errorLogUid;
public ApiResponseDto(T data) { public ApiResponseDto(T data) {
this.data = data; this.data = data;
@@ -116,9 +114,7 @@ public class ApiResponseDto<T> {
} }
} }
/** /** Error가 아닌 Business상 성공이거나 실패인 경우, 메세지 함께 전달하기 위한 object */
* Error가 아닌 Business상 성공이거나 실패인 경우, 메세지 함께 전달하기 위한 object
*/
@Getter @Getter
public static class ResponseObj { public static class ResponseObj {

View File

@@ -63,7 +63,8 @@ public class AuthController {
@ExampleObject( @ExampleObject(
name = "아이디 입력 오류", name = "아이디 입력 오류",
description = "존재하지 않는 아이디", description = "존재하지 않는 아이디",
value = """ value =
"""
{ {
"code": "LOGIN_ID_NOT_FOUND", "code": "LOGIN_ID_NOT_FOUND",
"message": "아이디를 잘못 입력하셨습니다." "message": "아이디를 잘못 입력하셨습니다."
@@ -72,7 +73,8 @@ public class AuthController {
@ExampleObject( @ExampleObject(
name = "비밀번호 입력 오류 (4회 이하)", name = "비밀번호 입력 오류 (4회 이하)",
description = "아이디는 정상, 비밀번호를 여러 번 틀린 경우", description = "아이디는 정상, 비밀번호를 여러 번 틀린 경우",
value = """ value =
"""
{ {
"code": "LOGIN_PASSWORD_MISMATCH", "code": "LOGIN_PASSWORD_MISMATCH",
"message": "비밀번호를 잘못 입력하셨습니다." "message": "비밀번호를 잘못 입력하셨습니다."
@@ -81,14 +83,14 @@ public class AuthController {
@ExampleObject( @ExampleObject(
name = "비밀번호 오류 횟수 초과", name = "비밀번호 오류 횟수 초과",
description = "비밀번호 5회 이상 오류로 계정 잠김", description = "비밀번호 5회 이상 오류로 계정 잠김",
value = """ value =
"""
{ {
"code": "LOGIN_PASSWORD_EXCEEDED", "code": "LOGIN_PASSWORD_EXCEEDED",
"message": "비밀번호 오류 횟수를 초과하여 이용하실 수 없습니다. 로그인 오류에 대해 관리자에게 문의하시기 바랍니다." "message": "비밀번호 오류 횟수를 초과하여 이용하실 수 없습니다. 로그인 오류에 대해 관리자에게 문의하시기 바랍니다."
} }
""") """)
} }))
))
}) })
public ApiResponseDto<TokenResponse> signin( public ApiResponseDto<TokenResponse> signin(
@io.swagger.v3.oas.annotations.parameters.RequestBody( @io.swagger.v3.oas.annotations.parameters.RequestBody(
@@ -210,7 +212,5 @@ public class AuthController {
return ApiResponseDto.createOK(ResponseEntity.noContent().build()); return ApiResponseDto.createOK(ResponseEntity.noContent().build());
} }
public record TokenResponse(String status, String accessToken, String refreshToken) { public record TokenResponse(String status, String accessToken, String refreshToken) {}
}
} }

View File

@@ -51,7 +51,6 @@ public class MembersApiController {
return ApiResponseDto.ok(membersService.findByMembers(searchReq)); return ApiResponseDto.ok(membersService.findByMembers(searchReq));
} }
@Operation(summary = "사용자 비밀번호 변경", description = "사용자 비밀번호 변경") @Operation(summary = "사용자 비밀번호 변경", description = "사용자 비밀번호 변경")
@ApiResponses( @ApiResponses(
value = { value = {
@@ -67,7 +66,8 @@ public class MembersApiController {
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
}) })
@PatchMapping("/{memberId}/password") @PatchMapping("/{memberId}/password")
public ApiResponseDto<String> resetPassword(@PathVariable String memberId, @RequestBody @Valid MembersDto.InitReq initReq) { public ApiResponseDto<String> resetPassword(
@PathVariable String memberId, @RequestBody @Valid MembersDto.InitReq initReq) {
authenticationManager.authenticate( authenticationManager.authenticate(
new UsernamePasswordAuthenticationToken(memberId, initReq.getTempPassword())); new UsernamePasswordAuthenticationToken(memberId, initReq.getTempPassword()));

View File

@@ -32,14 +32,10 @@ public class MembersDto {
private String tempPassword; private String tempPassword;
private String status; private String status;
private String statusName; private String statusName;
@JsonFormatDttm @JsonFormatDttm private ZonedDateTime createdDttm;
private ZonedDateTime createdDttm; @JsonFormatDttm private ZonedDateTime updatedDttm;
@JsonFormatDttm @JsonFormatDttm private ZonedDateTime firstLoginDttm;
private ZonedDateTime updatedDttm; @JsonFormatDttm private ZonedDateTime lastLoginDttm;
@JsonFormatDttm
private ZonedDateTime firstLoginDttm;
@JsonFormatDttm
private ZonedDateTime lastLoginDttm;
public Basic( public Basic(
Long id, Long id,
@@ -55,8 +51,7 @@ public class MembersDto {
ZonedDateTime createdDttm, ZonedDateTime createdDttm,
ZonedDateTime updatedDttm, ZonedDateTime updatedDttm,
ZonedDateTime firstLoginDttm, ZonedDateTime firstLoginDttm,
ZonedDateTime lastLoginDttm ZonedDateTime lastLoginDttm) {
) {
this.id = id; this.id = id;
this.uuid = uuid; this.uuid = uuid;
this.userRole = userRole; this.userRole = userRole;
@@ -82,7 +77,6 @@ public class MembersDto {
StatusType type = EnumType.fromId(StatusType.class, status); StatusType type = EnumType.fromId(StatusType.class, status);
return type.getText(); return type.getText();
} }
} }
@Getter @Getter
@@ -91,7 +85,9 @@ public class MembersDto {
@AllArgsConstructor @AllArgsConstructor
public static class SearchReq { public static class SearchReq {
@Schema(description = "전체, 관리자(ROLE_ADMIN), 라벨러(ROLE_LABELER), 검수자(ROLE_REVIEWER)", example = "") @Schema(
description = "전체, 관리자(ROLE_ADMIN), 라벨러(ROLE_LABELER), 검수자(ROLE_REVIEWER)",
example = "")
private String userRole; private String userRole;
@Schema(description = "키워드", example = "홍길동") @Schema(description = "키워드", example = "홍길동")

View File

@@ -36,7 +36,6 @@ public class AdminService {
membersCoreService.updateMembers(uuid, updateReq); membersCoreService.updateMembers(uuid, updateReq);
} }
/** /**
* 관리자 계정 미사용 처리 * 관리자 계정 미사용 처리
* *

View File

@@ -77,7 +77,6 @@ public class MembersCoreService {
membersRepository.save(memberEntity); membersRepository.save(memberEntity);
} }
/** /**
* 관리자 계정 미사용 처리 * 관리자 계정 미사용 처리
* *
@@ -92,7 +91,6 @@ public class MembersCoreService {
membersRepository.save(memberEntity); membersRepository.save(memberEntity);
} }
/** /**
* 패스워드 변경 * 패스워드 변경
* *
@@ -112,6 +110,7 @@ public class MembersCoreService {
memberEntity.setUpdatedDttm(ZonedDateTime.now()); memberEntity.setUpdatedDttm(ZonedDateTime.now());
membersRepository.save(memberEntity); membersRepository.save(memberEntity);
} }
// //
/** /**
@@ -131,7 +130,10 @@ public class MembersCoreService {
* @return * @return
*/ */
public String getUserStatus(SignInRequest request) { public String getUserStatus(SignInRequest request) {
MemberEntity memberEntity = membersRepository.findByUserId(request.getUsername()).orElseThrow(MemberNotFoundException::new); MemberEntity memberEntity =
membersRepository
.findByUserId(request.getUsername())
.orElseThrow(MemberNotFoundException::new);
return memberEntity.getStatus(); return memberEntity.getStatus();
} }
} }

View File

@@ -61,8 +61,7 @@ public class CommonCodeRepositoryImpl implements CommonCodeRepositoryCustom {
.on(child.deleted.isFalse().or(child.deleted.isNull())) .on(child.deleted.isFalse().or(child.deleted.isNull()))
.where( .where(
commonCodeEntity.parent.isNull(), commonCodeEntity.parent.isNull(),
commonCodeEntity.deleted.isFalse().or(commonCodeEntity.deleted.isNull()) commonCodeEntity.deleted.isFalse().or(commonCodeEntity.deleted.isNull()))
)
.orderBy(commonCodeEntity.order.asc(), child.order.asc()) .orderBy(commonCodeEntity.order.asc(), child.order.asc())
.fetch(); .fetch();
} }

View File

@@ -68,10 +68,11 @@ public class MembersRepositoryImpl implements MembersRepositoryCustom {
String contains = "%" + searchReq.getKeyword() + "%"; String contains = "%" + searchReq.getKeyword() + "%";
builder.and( builder.and(
memberEntity.name.likeIgnoreCase(contains) memberEntity
.name
.likeIgnoreCase(contains)
.or(memberEntity.userId.likeIgnoreCase(contains)) .or(memberEntity.userId.likeIgnoreCase(contains))
.or(memberEntity.employeeNo.likeIgnoreCase(contains)) .or(memberEntity.employeeNo.likeIgnoreCase(contains)));
);
} }
// 권한 // 권한
@@ -95,8 +96,7 @@ public class MembersRepositoryImpl implements MembersRepositoryCustom {
memberEntity.createdDttm, memberEntity.createdDttm,
memberEntity.updatedDttm, memberEntity.updatedDttm,
memberEntity.firstLoginDttm, memberEntity.firstLoginDttm,
memberEntity.lastLoginDttm memberEntity.lastLoginDttm))
))
.from(memberEntity) .from(memberEntity)
.where(builder) .where(builder)
.offset(pageable.getOffset()) .offset(pageable.getOffset())
@@ -104,11 +104,7 @@ public class MembersRepositoryImpl implements MembersRepositoryCustom {
.orderBy(memberEntity.createdDttm.desc()) .orderBy(memberEntity.createdDttm.desc())
.fetch(); .fetch();
long total = long total = queryFactory.select(memberEntity).from(memberEntity).fetchCount();
queryFactory
.select(memberEntity)
.from(memberEntity)
.fetchCount();
return new PageImpl<>(content, pageable, total); return new PageImpl<>(content, pageable, total);
} }