test api 추가, 개발서버 토큰 만료시간 조정
This commit is contained in:
@@ -6,7 +6,6 @@ import org.springframework.http.HttpStatus;
|
||||
|
||||
@Getter
|
||||
public enum AuthErrorCode implements ErrorCode {
|
||||
|
||||
LOGIN_ID_NOT_FOUND("LOGIN_ID_NOT_FOUND", HttpStatus.UNAUTHORIZED),
|
||||
|
||||
LOGIN_PASSWORD_MISMATCH("LOGIN_PASSWORD_MISMATCH", HttpStatus.UNAUTHORIZED),
|
||||
|
||||
@@ -54,59 +54,59 @@ public class AuthController {
|
||||
@Operation(summary = "로그인", description = "사번으로 로그인하여 액세스/리프레시 토큰을 발급.")
|
||||
@ApiResponses({
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "로그인 성공",
|
||||
content = @Content(schema = @Schema(implementation = TokenResponse.class))),
|
||||
responseCode = "200",
|
||||
description = "로그인 성공",
|
||||
content = @Content(schema = @Schema(implementation = TokenResponse.class))),
|
||||
@ApiResponse(
|
||||
responseCode = "401",
|
||||
description = "로그인 실패 (아이디/비밀번호 오류, 계정잠금 등)",
|
||||
content =
|
||||
@Content(
|
||||
schema = @Schema(implementation = ErrorResponse.class),
|
||||
examples = {
|
||||
@ExampleObject(
|
||||
name = "아이디 입력 오류",
|
||||
description = "존재하지 않는 아이디",
|
||||
value =
|
||||
"""
|
||||
responseCode = "401",
|
||||
description = "로그인 실패 (아이디/비밀번호 오류, 계정잠금 등)",
|
||||
content =
|
||||
@Content(
|
||||
schema = @Schema(implementation = ErrorResponse.class),
|
||||
examples = {
|
||||
@ExampleObject(
|
||||
name = "아이디 입력 오류",
|
||||
description = "존재하지 않는 아이디",
|
||||
value =
|
||||
"""
|
||||
{
|
||||
"code": "LOGIN_ID_NOT_FOUND",
|
||||
"message": "아이디를 잘못 입력하셨습니다."
|
||||
}
|
||||
"""),
|
||||
@ExampleObject(
|
||||
name = "비밀번호 입력 오류 (4회 이하)",
|
||||
description = "아이디는 정상, 비밀번호를 여러 번 틀린 경우",
|
||||
value =
|
||||
"""
|
||||
@ExampleObject(
|
||||
name = "비밀번호 입력 오류 (4회 이하)",
|
||||
description = "아이디는 정상, 비밀번호를 여러 번 틀린 경우",
|
||||
value =
|
||||
"""
|
||||
{
|
||||
"code": "LOGIN_PASSWORD_MISMATCH",
|
||||
"message": "비밀번호를 잘못 입력하셨습니다."
|
||||
}
|
||||
"""),
|
||||
@ExampleObject(
|
||||
name = "비밀번호 오류 횟수 초과",
|
||||
description = "비밀번호 5회 이상 오류로 계정 잠김",
|
||||
value =
|
||||
"""
|
||||
@ExampleObject(
|
||||
name = "비밀번호 오류 횟수 초과",
|
||||
description = "비밀번호 5회 이상 오류로 계정 잠김",
|
||||
value =
|
||||
"""
|
||||
{
|
||||
"code": "LOGIN_PASSWORD_EXCEEDED",
|
||||
"message": "비밀번호 오류 횟수를 초과하여 이용하실 수 없습니다. 로그인 오류에 대해 관리자에게 문의하시기 바랍니다."
|
||||
}
|
||||
""")
|
||||
}))
|
||||
}))
|
||||
})
|
||||
public ApiResponseDto<TokenResponse> signin(
|
||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||
description = "로그인 요청 정보",
|
||||
required = true)
|
||||
@RequestBody
|
||||
SignInRequest request,
|
||||
HttpServletResponse response) {
|
||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||
description = "로그인 요청 정보",
|
||||
required = true)
|
||||
@RequestBody
|
||||
SignInRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
Authentication authentication =
|
||||
authenticationManager.authenticate(
|
||||
new UsernamePasswordAuthenticationToken(request.getUsername(), request.getPassword()));
|
||||
authenticationManager.authenticate(
|
||||
new UsernamePasswordAuthenticationToken(request.getUsername(), request.getPassword()));
|
||||
|
||||
String status = authService.getUserStatus(request);
|
||||
|
||||
@@ -124,17 +124,17 @@ public class AuthController {
|
||||
|
||||
// Redis에 RefreshToken 저장 (TTL = 7일)
|
||||
refreshTokenService.save(
|
||||
username, refreshToken, jwtTokenProvider.getRefreshTokenValidityInMs());
|
||||
username, refreshToken, jwtTokenProvider.getRefreshTokenValidityInMs());
|
||||
|
||||
// HttpOnly + Secure 쿠키에 RefreshToken 저장
|
||||
ResponseCookie cookie =
|
||||
ResponseCookie.from(refreshCookieName, refreshToken)
|
||||
.httpOnly(true)
|
||||
.secure(refreshCookieSecure)
|
||||
.path("/")
|
||||
.maxAge(Duration.ofMillis(jwtTokenProvider.getRefreshTokenValidityInMs()))
|
||||
.sameSite("Strict")
|
||||
.build();
|
||||
ResponseCookie.from(refreshCookieName, refreshToken)
|
||||
.httpOnly(true)
|
||||
.secure(refreshCookieSecure)
|
||||
.path("/")
|
||||
.maxAge(Duration.ofMillis(jwtTokenProvider.getRefreshTokenValidityInMs()))
|
||||
.sameSite("Strict")
|
||||
.build();
|
||||
|
||||
response.addHeader(HttpHeaders.SET_COOKIE, cookie.toString());
|
||||
|
||||
@@ -153,16 +153,16 @@ public class AuthController {
|
||||
@Operation(summary = "토큰 재발급", description = "리프레시 토큰으로 새로운 액세스/리프레시 토큰을 재발급합니다.")
|
||||
@ApiResponses({
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "재발급 성공",
|
||||
content = @Content(schema = @Schema(implementation = TokenResponse.class))),
|
||||
responseCode = "200",
|
||||
description = "재발급 성공",
|
||||
content = @Content(schema = @Schema(implementation = TokenResponse.class))),
|
||||
@ApiResponse(
|
||||
responseCode = "403",
|
||||
description = "만료되었거나 유효하지 않은 리프레시 토큰",
|
||||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
|
||||
responseCode = "403",
|
||||
description = "만료되었거나 유효하지 않은 리프레시 토큰",
|
||||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
|
||||
})
|
||||
public ResponseEntity<TokenResponse> refresh(String refreshToken, HttpServletResponse response)
|
||||
throws AccessDeniedException {
|
||||
throws AccessDeniedException {
|
||||
if (refreshToken == null || !jwtTokenProvider.isValidToken(refreshToken)) {
|
||||
throw new AccessDeniedException("만료되었거나 유효하지 않은 리프레시 토큰 입니다.");
|
||||
}
|
||||
@@ -179,17 +179,17 @@ public class AuthController {
|
||||
|
||||
// Redis 갱신
|
||||
refreshTokenService.save(
|
||||
username, newRefreshToken, jwtTokenProvider.getRefreshTokenValidityInMs());
|
||||
username, newRefreshToken, jwtTokenProvider.getRefreshTokenValidityInMs());
|
||||
|
||||
// 쿠키 갱신
|
||||
ResponseCookie cookie =
|
||||
ResponseCookie.from(refreshCookieName, newRefreshToken)
|
||||
.httpOnly(true)
|
||||
.secure(refreshCookieSecure)
|
||||
.path("/")
|
||||
.maxAge(Duration.ofMillis(jwtTokenProvider.getRefreshTokenValidityInMs()))
|
||||
.sameSite("Strict")
|
||||
.build();
|
||||
ResponseCookie.from(refreshCookieName, newRefreshToken)
|
||||
.httpOnly(true)
|
||||
.secure(refreshCookieSecure)
|
||||
.path("/")
|
||||
.maxAge(Duration.ofMillis(jwtTokenProvider.getRefreshTokenValidityInMs()))
|
||||
.sameSite("Strict")
|
||||
.build();
|
||||
response.addHeader(HttpHeaders.SET_COOKIE, cookie.toString());
|
||||
|
||||
MembersDto.Member member = new MembersDto.Member();
|
||||
@@ -200,12 +200,12 @@ public class AuthController {
|
||||
@Operation(summary = "로그아웃", description = "현재 사용자의 토큰을 무효화(리프레시 토큰 삭제)합니다.")
|
||||
@ApiResponses({
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "로그아웃 성공",
|
||||
content = @Content(schema = @Schema(implementation = Void.class)))
|
||||
responseCode = "200",
|
||||
description = "로그아웃 성공",
|
||||
content = @Content(schema = @Schema(implementation = Void.class)))
|
||||
})
|
||||
public ApiResponseDto<ResponseEntity<Object>> logout(
|
||||
Authentication authentication, HttpServletResponse response) {
|
||||
Authentication authentication, HttpServletResponse response) {
|
||||
if (authentication != null) {
|
||||
String username = authentication.getName();
|
||||
// Redis에서 RefreshToken 삭제
|
||||
@@ -214,13 +214,13 @@ public class AuthController {
|
||||
|
||||
// 쿠키 삭제 (Max-Age=0)
|
||||
ResponseCookie cookie =
|
||||
ResponseCookie.from(refreshCookieName, "")
|
||||
.httpOnly(true)
|
||||
.secure(refreshCookieSecure)
|
||||
.path("/")
|
||||
.maxAge(0)
|
||||
.sameSite("Strict")
|
||||
.build();
|
||||
ResponseCookie.from(refreshCookieName, "")
|
||||
.httpOnly(true)
|
||||
.secure(refreshCookieSecure)
|
||||
.path("/")
|
||||
.maxAge(0)
|
||||
.sameSite("Strict")
|
||||
.build();
|
||||
response.addHeader(HttpHeaders.SET_COOKIE, cookie.toString());
|
||||
|
||||
return ApiResponseDto.createOK(ResponseEntity.noContent().build());
|
||||
|
||||
@@ -40,11 +40,11 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
private final QModelVerEntity tmv = QModelVerEntity.modelVerEntity;
|
||||
private final QMapSheetAnalEntity mapSheetAnalEntity = QMapSheetAnalEntity.mapSheetAnalEntity;
|
||||
private final QMapSheetAnalDataEntity mapSheetAnalDataEntity =
|
||||
QMapSheetAnalDataEntity.mapSheetAnalDataEntity;
|
||||
QMapSheetAnalDataEntity.mapSheetAnalDataEntity;
|
||||
private final QMapSheetAnalDataGeomEntity mapSheetAnalDataGeomEntity =
|
||||
QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
private final QMapSheetAnalSttcEntity mapSheetAnalSttcEntity =
|
||||
QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
|
||||
QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
|
||||
|
||||
/**
|
||||
* 분석결과 목록 조회
|
||||
@@ -54,7 +54,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
*/
|
||||
@Override
|
||||
public Page<InferenceResultDto.AnalResList> getInferenceResultList(
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
InferenceResultDto.SearchReq searchReq) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
// "0000" 전체조회
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
@@ -68,35 +68,35 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
}
|
||||
|
||||
List<InferenceResultDto.AnalResList> content =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResList.class,
|
||||
mapSheetAnalEntity.id,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
mapSheetAnalEntity.analMapSheet,
|
||||
mapSheetAnalEntity.detectingCnt,
|
||||
mapSheetAnalEntity.analStrtDttm,
|
||||
mapSheetAnalEntity.analEndDttm,
|
||||
mapSheetAnalEntity.analSec,
|
||||
mapSheetAnalEntity.analPredSec,
|
||||
mapSheetAnalEntity.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState),
|
||||
mapSheetAnalEntity.gukyuinUsed))
|
||||
.from(mapSheetAnalEntity)
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetAnalEntity.id.desc())
|
||||
.fetch();
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResList.class,
|
||||
mapSheetAnalEntity.id,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
mapSheetAnalEntity.analMapSheet,
|
||||
mapSheetAnalEntity.detectingCnt,
|
||||
mapSheetAnalEntity.analStrtDttm,
|
||||
mapSheetAnalEntity.analEndDttm,
|
||||
mapSheetAnalEntity.analSec,
|
||||
mapSheetAnalEntity.analPredSec,
|
||||
mapSheetAnalEntity.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState),
|
||||
mapSheetAnalEntity.gukyuinUsed))
|
||||
.from(mapSheetAnalEntity)
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetAnalEntity.id.desc())
|
||||
.fetch();
|
||||
|
||||
long total =
|
||||
queryFactory
|
||||
.select(mapSheetAnalEntity.id)
|
||||
.from(mapSheetAnalEntity)
|
||||
.where(builder)
|
||||
.fetchCount();
|
||||
queryFactory
|
||||
.select(mapSheetAnalEntity.id)
|
||||
.from(mapSheetAnalEntity)
|
||||
.where(builder)
|
||||
.fetchCount();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
@@ -112,41 +112,40 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
|
||||
// 1. 최신 버전 UID를 가져오는 서브쿼리
|
||||
JPQLQuery<Long> latestVerUidSub =
|
||||
JPAExpressions.select(tmv.id.max()).from(tmv).where(tmv.modelUid.eq(tmm.id));
|
||||
JPAExpressions.select(tmv.id.max()).from(tmv).where(tmv.modelUid.eq(tmm.id));
|
||||
|
||||
Optional<InferenceResultDto.AnalResSummary> content =
|
||||
Optional.ofNullable(
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResSummary.class,
|
||||
mapSheetAnalEntity.id,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
tmm.modelNm.concat(" ").concat(tmv.modelVer).as("modelInfo"),
|
||||
mapSheetAnalEntity.targetYyyy,
|
||||
mapSheetAnalEntity.compareYyyy,
|
||||
mapSheetAnalEntity.analMapSheet,
|
||||
mapSheetAnalEntity.analStrtDttm,
|
||||
mapSheetAnalEntity.analEndDttm,
|
||||
mapSheetAnalEntity.analSec,
|
||||
mapSheetAnalEntity.analPredSec,
|
||||
mapSheetAnalEntity.resultUrl,
|
||||
mapSheetAnalEntity.detectingCnt,
|
||||
mapSheetAnalEntity.accuracy,
|
||||
mapSheetAnalEntity.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState)))
|
||||
.from(mapSheetAnalEntity)
|
||||
.leftJoin(tmm)
|
||||
.on(mapSheetAnalEntity.modelUid.eq(tmm.id))
|
||||
.leftJoin(tmv)
|
||||
.on(tmv.modelUid.eq(tmm.id).and(tmv.id.eq(latestVerUidSub)))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.fetchOne());
|
||||
Optional.ofNullable(
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.AnalResSummary.class,
|
||||
mapSheetAnalEntity.id,
|
||||
mapSheetAnalEntity.analTitle,
|
||||
tmm.modelNm.concat(" ").concat(tmv.modelVer).as("modelInfo"),
|
||||
mapSheetAnalEntity.targetYyyy,
|
||||
mapSheetAnalEntity.compareYyyy,
|
||||
mapSheetAnalEntity.analMapSheet,
|
||||
mapSheetAnalEntity.analStrtDttm,
|
||||
mapSheetAnalEntity.analEndDttm,
|
||||
mapSheetAnalEntity.analSec,
|
||||
mapSheetAnalEntity.analPredSec,
|
||||
mapSheetAnalEntity.resultUrl,
|
||||
mapSheetAnalEntity.detectingCnt,
|
||||
mapSheetAnalEntity.accuracy,
|
||||
mapSheetAnalEntity.analState,
|
||||
Expressions.stringTemplate(
|
||||
"fn_code_name({0}, {1})", "0002", mapSheetAnalEntity.analState)))
|
||||
.from(mapSheetAnalEntity)
|
||||
.leftJoin(tmm)
|
||||
.on(mapSheetAnalEntity.modelUid.eq(tmm.id))
|
||||
.leftJoin(tmv)
|
||||
.on(tmv.modelUid.eq(tmm.id).and(tmv.id.eq(latestVerUidSub)))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.fetchOne());
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 분석결과 상세 class name별 탐지 개수
|
||||
*
|
||||
@@ -156,16 +155,16 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
@Override
|
||||
public List<Dashboard> getDashboard(Long id) {
|
||||
return queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
Dashboard.class,
|
||||
mapSheetAnalSttcEntity.id.classAfterCd,
|
||||
mapSheetAnalSttcEntity.classAfterCnt.sum()))
|
||||
.from(mapSheetAnalSttcEntity)
|
||||
.where(mapSheetAnalSttcEntity.id.analUid.eq(id))
|
||||
.groupBy(mapSheetAnalSttcEntity.id.classAfterCd)
|
||||
.orderBy(mapSheetAnalSttcEntity.id.classAfterCd.asc())
|
||||
.fetch();
|
||||
.select(
|
||||
Projections.constructor(
|
||||
Dashboard.class,
|
||||
mapSheetAnalSttcEntity.id.classAfterCd,
|
||||
mapSheetAnalSttcEntity.classAfterCnt.sum()))
|
||||
.from(mapSheetAnalSttcEntity)
|
||||
.where(mapSheetAnalSttcEntity.id.analUid.eq(id))
|
||||
.groupBy(mapSheetAnalSttcEntity.id.classAfterCd)
|
||||
.orderBy(mapSheetAnalSttcEntity.id.classAfterCd.asc())
|
||||
.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -182,22 +181,22 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
*/
|
||||
@Override
|
||||
public Page<MapSheetAnalDataGeomEntity> listInferenceResultWithGeom(
|
||||
List<Long> ids, SearchGeoReq searchReq) {
|
||||
List<Long> ids, SearchGeoReq searchReq) {
|
||||
|
||||
// 분석 차수
|
||||
QMapSheetAnalDataGeomEntity detectedEntity =
|
||||
QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
QMapSheetAnalDataGeomEntity.mapSheetAnalDataGeomEntity;
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
|
||||
// 검색조건
|
||||
JPAQuery<MapSheetAnalDataGeomEntity> query =
|
||||
queryFactory
|
||||
.selectFrom(detectedEntity)
|
||||
.where(
|
||||
detectedEntity.dataUid.in(ids),
|
||||
eqTargetClass(detectedEntity, searchReq.getTargetClass()),
|
||||
eqCompareClass(detectedEntity, searchReq.getCompareClass()),
|
||||
containsMapSheetNum(detectedEntity, searchReq.getMapSheetNum()));
|
||||
queryFactory
|
||||
.selectFrom(detectedEntity)
|
||||
.where(
|
||||
detectedEntity.dataUid.in(ids),
|
||||
eqTargetClass(detectedEntity, searchReq.getTargetClass()),
|
||||
eqCompareClass(detectedEntity, searchReq.getCompareClass()),
|
||||
containsMapSheetNum(detectedEntity, searchReq.getMapSheetNum()));
|
||||
|
||||
// count
|
||||
long total = query.fetchCount();
|
||||
@@ -209,11 +208,11 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
}
|
||||
|
||||
List<MapSheetAnalDataGeomEntity> content =
|
||||
query
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(orders.toArray(new OrderSpecifier[0]))
|
||||
.fetch();
|
||||
query
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(orders.toArray(new OrderSpecifier[0]))
|
||||
.fetch();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
@@ -235,19 +234,19 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
// 기준년도 분류
|
||||
if (searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().equals("")) {
|
||||
builder.and(
|
||||
mapSheetAnalDataGeomEntity
|
||||
.classAfterCd
|
||||
.toLowerCase()
|
||||
.eq(searchGeoReq.getTargetClass().toLowerCase()));
|
||||
mapSheetAnalDataGeomEntity
|
||||
.classAfterCd
|
||||
.toLowerCase()
|
||||
.eq(searchGeoReq.getTargetClass().toLowerCase()));
|
||||
}
|
||||
|
||||
// 비교년도 분류
|
||||
if (searchGeoReq.getCompareClass() != null && !searchGeoReq.getCompareClass().equals("")) {
|
||||
builder.and(
|
||||
mapSheetAnalDataGeomEntity
|
||||
.classBeforeCd
|
||||
.toLowerCase()
|
||||
.eq(searchGeoReq.getCompareClass().toLowerCase()));
|
||||
mapSheetAnalDataGeomEntity
|
||||
.classBeforeCd
|
||||
.toLowerCase()
|
||||
.eq(searchGeoReq.getCompareClass().toLowerCase()));
|
||||
}
|
||||
|
||||
// 분석도엽
|
||||
@@ -257,39 +256,39 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
}
|
||||
|
||||
List<InferenceResultDto.Geom> content =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.Geom.class,
|
||||
mapSheetAnalDataGeomEntity.compareYyyy,
|
||||
mapSheetAnalDataGeomEntity.targetYyyy,
|
||||
mapSheetAnalDataGeomEntity.classBeforeCd,
|
||||
mapSheetAnalDataGeomEntity.classBeforeProb,
|
||||
mapSheetAnalDataGeomEntity.classAfterCd,
|
||||
mapSheetAnalDataGeomEntity.classAfterProb,
|
||||
mapSheetAnalDataGeomEntity.mapSheetNum,
|
||||
mapSheetAnalDataGeomEntity.geom,
|
||||
mapSheetAnalDataGeomEntity.geomCenter))
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.join(mapSheetAnalDataGeomEntity)
|
||||
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceResultDto.Geom.class,
|
||||
mapSheetAnalDataGeomEntity.compareYyyy,
|
||||
mapSheetAnalDataGeomEntity.targetYyyy,
|
||||
mapSheetAnalDataGeomEntity.classBeforeCd,
|
||||
mapSheetAnalDataGeomEntity.classBeforeProb,
|
||||
mapSheetAnalDataGeomEntity.classAfterCd,
|
||||
mapSheetAnalDataGeomEntity.classAfterProb,
|
||||
mapSheetAnalDataGeomEntity.mapSheetNum,
|
||||
mapSheetAnalDataGeomEntity.geom,
|
||||
mapSheetAnalDataGeomEntity.geomCenter))
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.join(mapSheetAnalDataGeomEntity)
|
||||
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(builder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
long total =
|
||||
queryFactory
|
||||
.select(mapSheetAnalDataGeomEntity.id)
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.join(mapSheetAnalDataGeomEntity)
|
||||
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(builder)
|
||||
.fetchCount();
|
||||
queryFactory
|
||||
.select(mapSheetAnalDataGeomEntity.id)
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.join(mapSheetAnalDataGeomEntity)
|
||||
.on(mapSheetAnalDataGeomEntity.dataUid.eq(mapSheetAnalDataEntity.id))
|
||||
.where(builder)
|
||||
.fetchCount();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
@@ -303,18 +302,16 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
@Override
|
||||
public List<Long> getSheets(Long id) {
|
||||
return queryFactory
|
||||
.select(mapSheetAnalDataEntity.mapSheetNum)
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.groupBy(mapSheetAnalDataEntity.mapSheetNum)
|
||||
.fetch();
|
||||
.select(mapSheetAnalDataEntity.mapSheetNum)
|
||||
.from(mapSheetAnalEntity)
|
||||
.join(mapSheetAnalDataEntity)
|
||||
.on(mapSheetAnalDataEntity.analUid.eq(mapSheetAnalEntity.id))
|
||||
.where(mapSheetAnalEntity.id.eq(id))
|
||||
.groupBy(mapSheetAnalDataEntity.mapSheetNum)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Pageable의 Sort를 QueryDSL OrderSpecifier로 변환
|
||||
*/
|
||||
/** Pageable의 Sort를 QueryDSL OrderSpecifier로 변환 */
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private List<OrderSpecifier<?>> getOrderSpecifiers(Sort sort) {
|
||||
List<OrderSpecifier<?>> orders = new ArrayList<>();
|
||||
@@ -329,7 +326,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
// 유효한 필드만 처리
|
||||
switch (property) {
|
||||
case "classBeforeCd" -> orders.add(new OrderSpecifier(direction, entity.classBeforeCd));
|
||||
case "classBeforeProb" -> orders.add(new OrderSpecifier(direction, entity.classBeforeProb));
|
||||
case "classBeforeProb" ->
|
||||
orders.add(new OrderSpecifier(direction, entity.classBeforeProb));
|
||||
case "classAfterCd" -> orders.add(new OrderSpecifier(direction, entity.classAfterCd));
|
||||
case "classAfterProb" -> orders.add(new OrderSpecifier(direction, entity.classAfterProb));
|
||||
case "mapSheetNum" -> orders.add(new OrderSpecifier(direction, entity.mapSheetNum));
|
||||
@@ -338,9 +336,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
case "area" -> orders.add(new OrderSpecifier(direction, entity.area));
|
||||
case "createdDttm" -> orders.add(new OrderSpecifier(direction, entity.createdDttm));
|
||||
case "updatedDttm" -> orders.add(new OrderSpecifier(direction, entity.updatedDttm));
|
||||
// 유효하지 않은 필드는 무시
|
||||
default -> {
|
||||
}
|
||||
// 유효하지 않은 필드는 무시
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,21 +346,21 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
}
|
||||
|
||||
private BooleanExpression eqTargetClass(
|
||||
QMapSheetAnalDataGeomEntity detectedEntity, String targetClass) {
|
||||
QMapSheetAnalDataGeomEntity detectedEntity, String targetClass) {
|
||||
return targetClass != null && !targetClass.isEmpty()
|
||||
? detectedEntity.classAfterCd.toLowerCase().eq(targetClass.toLowerCase())
|
||||
: null;
|
||||
? detectedEntity.classAfterCd.toLowerCase().eq(targetClass.toLowerCase())
|
||||
: null;
|
||||
}
|
||||
|
||||
private BooleanExpression eqCompareClass(
|
||||
QMapSheetAnalDataGeomEntity detectedEntity, String compareClass) {
|
||||
QMapSheetAnalDataGeomEntity detectedEntity, String compareClass) {
|
||||
return compareClass != null && !compareClass.isEmpty()
|
||||
? detectedEntity.classBeforeCd.toLowerCase().eq(compareClass.toLowerCase())
|
||||
: null;
|
||||
? detectedEntity.classBeforeCd.toLowerCase().eq(compareClass.toLowerCase())
|
||||
: null;
|
||||
}
|
||||
|
||||
private BooleanExpression containsMapSheetNum(
|
||||
QMapSheetAnalDataGeomEntity detectedEntity, List<Long> mapSheet) {
|
||||
QMapSheetAnalDataGeomEntity detectedEntity, List<Long> mapSheet) {
|
||||
if (mapSheet == null || mapSheet.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@ public class TestApiController {
|
||||
@Operation(summary = "admin test", description = "admin test api")
|
||||
@ApiResponses({
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "조회",
|
||||
content = @Content(schema = @Schema(implementation = String.class))),
|
||||
responseCode = "200",
|
||||
description = "조회",
|
||||
content = @Content(schema = @Schema(implementation = String.class))),
|
||||
@ApiResponse(
|
||||
responseCode = "403",
|
||||
description = "권한 없음",
|
||||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
|
||||
responseCode = "403",
|
||||
description = "권한 없음",
|
||||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
|
||||
})
|
||||
@GetMapping("/admin")
|
||||
public String admin() {
|
||||
@@ -37,13 +37,13 @@ public class TestApiController {
|
||||
@Operation(summary = "label test", description = "label test api")
|
||||
@ApiResponses({
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "조회",
|
||||
content = @Content(schema = @Schema(implementation = String.class))),
|
||||
responseCode = "200",
|
||||
description = "조회",
|
||||
content = @Content(schema = @Schema(implementation = String.class))),
|
||||
@ApiResponse(
|
||||
responseCode = "403",
|
||||
description = "권한 없음",
|
||||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
|
||||
responseCode = "403",
|
||||
description = "권한 없음",
|
||||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
|
||||
})
|
||||
@GetMapping("/label")
|
||||
public String label() {
|
||||
@@ -53,13 +53,13 @@ public class TestApiController {
|
||||
@Operation(summary = "review test", description = "review test api")
|
||||
@ApiResponses({
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "조회",
|
||||
content = @Content(schema = @Schema(implementation = String.class))),
|
||||
responseCode = "200",
|
||||
description = "조회",
|
||||
content = @Content(schema = @Schema(implementation = String.class))),
|
||||
@ApiResponse(
|
||||
responseCode = "403",
|
||||
description = "권한 없음",
|
||||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
|
||||
responseCode = "403",
|
||||
description = "권한 없음",
|
||||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
|
||||
})
|
||||
@GetMapping("/review")
|
||||
public String review() {
|
||||
|
||||
Reference in New Issue
Block a user