이미지 단일조회 추가
This commit is contained in:
@@ -772,8 +772,17 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
public TrainingDataLabelDto.CogImageResponse getCogImageUrl(
|
public TrainingDataLabelDto.CogImageResponse getCogImageUrl(
|
||||||
String mapSheetNum, Integer beforeYear, Integer afterYear) {
|
String mapSheetNum, Integer beforeYear, Integer afterYear) {
|
||||||
try {
|
try {
|
||||||
// beforeYear COG URL 조회
|
// 최소 하나의 년도는 제공되어야 함
|
||||||
String beforeCogUrl =
|
if (beforeYear == null && afterYear == null) {
|
||||||
|
throw new IllegalArgumentException("At least one year parameter (beforeYear or afterYear) must be provided");
|
||||||
|
}
|
||||||
|
|
||||||
|
String beforeCogUrl = null;
|
||||||
|
String afterCogUrl = null;
|
||||||
|
|
||||||
|
// beforeYear가 제공된 경우 COG URL 조회
|
||||||
|
if (beforeYear != null) {
|
||||||
|
beforeCogUrl =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
@@ -781,9 +790,11 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.from(imageryEntity)
|
.from(imageryEntity)
|
||||||
.where(imageryEntity.scene5k.eq(mapSheetNum), imageryEntity.year.eq(beforeYear))
|
.where(imageryEntity.scene5k.eq(mapSheetNum), imageryEntity.year.eq(beforeYear))
|
||||||
.fetchFirst();
|
.fetchFirst();
|
||||||
|
}
|
||||||
|
|
||||||
// afterYear COG URL 조회
|
// afterYear가 제공된 경우 COG URL 조회
|
||||||
String afterCogUrl =
|
if (afterYear != null) {
|
||||||
|
afterCogUrl =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
@@ -791,15 +802,17 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.from(imageryEntity)
|
.from(imageryEntity)
|
||||||
.where(imageryEntity.scene5k.eq(mapSheetNum), imageryEntity.year.eq(afterYear))
|
.where(imageryEntity.scene5k.eq(mapSheetNum), imageryEntity.year.eq(afterYear))
|
||||||
.fetchFirst();
|
.fetchFirst();
|
||||||
|
}
|
||||||
|
|
||||||
if (beforeCogUrl == null && afterCogUrl == null) {
|
// 제공된 년도에 대해 하나도 찾지 못한 경우에만 예외 발생
|
||||||
|
if ((beforeYear != null && beforeCogUrl == null) && (afterYear != null && afterCogUrl == null)) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"COG images not found for mapSheetNum: "
|
"COG images not found for mapSheetNum: "
|
||||||
+ mapSheetNum
|
+ mapSheetNum
|
||||||
+ ", years: "
|
+ ", years: "
|
||||||
+ beforeYear
|
+ (beforeYear != null ? beforeYear : "")
|
||||||
+ ", "
|
+ (beforeYear != null && afterYear != null ? ", " : "")
|
||||||
+ afterYear);
|
+ (afterYear != null ? afterYear : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TrainingDataLabelDto.CogImageResponse.builder()
|
return TrainingDataLabelDto.CogImageResponse.builder()
|
||||||
@@ -817,9 +830,9 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
"Failed to get COG image URLs for mapSheetNum: "
|
"Failed to get COG image URLs for mapSheetNum: "
|
||||||
+ mapSheetNum
|
+ mapSheetNum
|
||||||
+ ", years: "
|
+ ", years: "
|
||||||
+ beforeYear
|
+ (beforeYear != null ? beforeYear : "")
|
||||||
+ ", "
|
+ (beforeYear != null && afterYear != null ? ", " : "")
|
||||||
+ afterYear,
|
+ (afterYear != null ? afterYear : ""),
|
||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -776,8 +776,17 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
public TrainingDataReviewDto.CogImageResponse getCogImageUrl(
|
public TrainingDataReviewDto.CogImageResponse getCogImageUrl(
|
||||||
String mapSheetNum, Integer beforeYear, Integer afterYear) {
|
String mapSheetNum, Integer beforeYear, Integer afterYear) {
|
||||||
try {
|
try {
|
||||||
// beforeYear COG URL 조회
|
// 최소 하나의 년도는 제공되어야 함
|
||||||
String beforeCogUrl =
|
if (beforeYear == null && afterYear == null) {
|
||||||
|
throw new IllegalArgumentException("At least one year parameter (beforeYear or afterYear) must be provided");
|
||||||
|
}
|
||||||
|
|
||||||
|
String beforeCogUrl = null;
|
||||||
|
String afterCogUrl = null;
|
||||||
|
|
||||||
|
// beforeYear가 제공된 경우 COG URL 조회
|
||||||
|
if (beforeYear != null) {
|
||||||
|
beforeCogUrl =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
@@ -785,9 +794,11 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.from(imageryEntity)
|
.from(imageryEntity)
|
||||||
.where(imageryEntity.scene5k.eq(mapSheetNum), imageryEntity.year.eq(beforeYear))
|
.where(imageryEntity.scene5k.eq(mapSheetNum), imageryEntity.year.eq(beforeYear))
|
||||||
.fetchFirst();
|
.fetchFirst();
|
||||||
|
}
|
||||||
|
|
||||||
// afterYear COG URL 조회
|
// afterYear가 제공된 경우 COG URL 조회
|
||||||
String afterCogUrl =
|
if (afterYear != null) {
|
||||||
|
afterCogUrl =
|
||||||
queryFactory
|
queryFactory
|
||||||
.select(
|
.select(
|
||||||
Expressions.stringTemplate(
|
Expressions.stringTemplate(
|
||||||
@@ -795,15 +806,17 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
.from(imageryEntity)
|
.from(imageryEntity)
|
||||||
.where(imageryEntity.scene5k.eq(mapSheetNum), imageryEntity.year.eq(afterYear))
|
.where(imageryEntity.scene5k.eq(mapSheetNum), imageryEntity.year.eq(afterYear))
|
||||||
.fetchFirst();
|
.fetchFirst();
|
||||||
|
}
|
||||||
|
|
||||||
if (beforeCogUrl == null && afterCogUrl == null) {
|
// 제공된 년도에 대해 하나도 찾지 못한 경우에만 예외 발생
|
||||||
|
if ((beforeYear != null && beforeCogUrl == null) && (afterYear != null && afterCogUrl == null)) {
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"COG images not found for mapSheetNum: "
|
"COG images not found for mapSheetNum: "
|
||||||
+ mapSheetNum
|
+ mapSheetNum
|
||||||
+ ", years: "
|
+ ", years: "
|
||||||
+ beforeYear
|
+ (beforeYear != null ? beforeYear : "")
|
||||||
+ ", "
|
+ (beforeYear != null && afterYear != null ? ", " : "")
|
||||||
+ afterYear);
|
+ (afterYear != null ? afterYear : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TrainingDataReviewDto.CogImageResponse.builder()
|
return TrainingDataReviewDto.CogImageResponse.builder()
|
||||||
@@ -821,9 +834,9 @@ public class TrainingDataReviewRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
"Failed to get COG image URLs for mapSheetNum: "
|
"Failed to get COG image URLs for mapSheetNum: "
|
||||||
+ mapSheetNum
|
+ mapSheetNum
|
||||||
+ ", years: "
|
+ ", years: "
|
||||||
+ beforeYear
|
+ (beforeYear != null ? beforeYear : "")
|
||||||
+ ", "
|
+ (beforeYear != null && afterYear != null ? ", " : "")
|
||||||
+ afterYear,
|
+ (afterYear != null ? afterYear : ""),
|
||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ public class TrainingDataLabelApiController {
|
|||||||
return ApiResponseDto.okObject(trainingDataLabelService.saveNewPolygon(request));
|
return ApiResponseDto.okObject(trainingDataLabelService.saveNewPolygon(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "COG 이미지 URL 조회", description = "변화 전/후 COG 이미지 URL을 함께 조회합니다")
|
@Operation(summary = "COG 이미지 URL 조회", description = "변화 전/후 COG 이미지 URL을 조회합니다. beforeYear와 afterYear 중 최소 하나는 필수입니다.")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@ApiResponse(
|
@ApiResponse(
|
||||||
@@ -476,6 +476,7 @@ public class TrainingDataLabelApiController {
|
|||||||
mediaType = "application/json",
|
mediaType = "application/json",
|
||||||
schema =
|
schema =
|
||||||
@Schema(implementation = TrainingDataLabelDto.CogImageResponse.class))),
|
@Schema(implementation = TrainingDataLabelDto.CogImageResponse.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "년도 파라미터가 하나도 제공되지 않음", content = @Content),
|
||||||
@ApiResponse(responseCode = "404", description = "이미지를 찾을 수 없음", content = @Content),
|
@ApiResponse(responseCode = "404", description = "이미지를 찾을 수 없음", content = @Content),
|
||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@@ -483,9 +484,9 @@ public class TrainingDataLabelApiController {
|
|||||||
public ApiResponseDto<TrainingDataLabelDto.CogImageResponse> getCogImageUrl(
|
public ApiResponseDto<TrainingDataLabelDto.CogImageResponse> getCogImageUrl(
|
||||||
@Parameter(description = "도엽번호", required = true, example = "35905086") @RequestParam
|
@Parameter(description = "도엽번호", required = true, example = "35905086") @RequestParam
|
||||||
String mapSheetNum,
|
String mapSheetNum,
|
||||||
@Parameter(description = "변화 전 년도", required = true, example = "2023") @RequestParam
|
@Parameter(description = "변화 전 년도", required = false, example = "2023") @RequestParam(required = false)
|
||||||
Integer beforeYear,
|
Integer beforeYear,
|
||||||
@Parameter(description = "변화 후 년도", required = true, example = "2024") @RequestParam
|
@Parameter(description = "변화 후 년도", required = false, example = "2024") @RequestParam(required = false)
|
||||||
Integer afterYear) {
|
Integer afterYear) {
|
||||||
return ApiResponseDto.ok(
|
return ApiResponseDto.ok(
|
||||||
trainingDataLabelService.getCogImageUrl(mapSheetNum, beforeYear, afterYear));
|
trainingDataLabelService.getCogImageUrl(mapSheetNum, beforeYear, afterYear));
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ public class TrainingDataReviewApiController {
|
|||||||
return ApiResponseDto.okObject(trainingDataReviewService.saveNewPolygon(request));
|
return ApiResponseDto.okObject(trainingDataReviewService.saveNewPolygon(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "COG 이미지 URL 조회", description = "변화 전/후 COG 이미지 URL을 함께 조회합니다")
|
@Operation(summary = "COG 이미지 URL 조회", description = "변화 전/후 COG 이미지 URL을 조회합니다. beforeYear와 afterYear 중 최소 하나는 필수입니다.")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@ApiResponse(
|
@ApiResponse(
|
||||||
@@ -476,6 +476,7 @@ public class TrainingDataReviewApiController {
|
|||||||
mediaType = "application/json",
|
mediaType = "application/json",
|
||||||
schema =
|
schema =
|
||||||
@Schema(implementation = TrainingDataReviewDto.CogImageResponse.class))),
|
@Schema(implementation = TrainingDataReviewDto.CogImageResponse.class))),
|
||||||
|
@ApiResponse(responseCode = "400", description = "년도 파라미터가 하나도 제공되지 않음", content = @Content),
|
||||||
@ApiResponse(responseCode = "404", description = "이미지를 찾을 수 없음", content = @Content),
|
@ApiResponse(responseCode = "404", description = "이미지를 찾을 수 없음", content = @Content),
|
||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@@ -483,9 +484,9 @@ public class TrainingDataReviewApiController {
|
|||||||
public ApiResponseDto<TrainingDataReviewDto.CogImageResponse> getCogImageUrl(
|
public ApiResponseDto<TrainingDataReviewDto.CogImageResponse> getCogImageUrl(
|
||||||
@Parameter(description = "도엽번호", required = true, example = "35905086") @RequestParam
|
@Parameter(description = "도엽번호", required = true, example = "35905086") @RequestParam
|
||||||
String mapSheetNum,
|
String mapSheetNum,
|
||||||
@Parameter(description = "변화 전 년도", required = true, example = "2023") @RequestParam
|
@Parameter(description = "변화 전 년도", required = false, example = "2023") @RequestParam(required = false)
|
||||||
Integer beforeYear,
|
Integer beforeYear,
|
||||||
@Parameter(description = "변화 후 년도", required = true, example = "2024") @RequestParam
|
@Parameter(description = "변화 후 년도", required = false, example = "2024") @RequestParam(required = false)
|
||||||
Integer afterYear) {
|
Integer afterYear) {
|
||||||
return ApiResponseDto.ok(
|
return ApiResponseDto.ok(
|
||||||
trainingDataReviewService.getCogImageUrl(mapSheetNum, beforeYear, afterYear));
|
trainingDataReviewService.getCogImageUrl(mapSheetNum, beforeYear, afterYear));
|
||||||
|
|||||||
@@ -106,9 +106,9 @@ public class TrainingDataLabelService {
|
|||||||
* COG 이미지 URL 조회 (변화 전/후)
|
* COG 이미지 URL 조회 (변화 전/후)
|
||||||
*
|
*
|
||||||
* @param mapSheetNum 도엽번호
|
* @param mapSheetNum 도엽번호
|
||||||
* @param beforeYear 변화 전 년도
|
* @param beforeYear 변화 전 년도 (선택적)
|
||||||
* @param afterYear 변화 후 년도
|
* @param afterYear 변화 후 년도 (선택적)
|
||||||
* @return 변화 전/후 COG 이미지 URL
|
* @return 변화 전/후 COG 이미지 URL (최소 하나의 년도는 제공되어야 함)
|
||||||
*/
|
*/
|
||||||
public TrainingDataLabelDto.CogImageResponse getCogImageUrl(
|
public TrainingDataLabelDto.CogImageResponse getCogImageUrl(
|
||||||
String mapSheetNum, Integer beforeYear, Integer afterYear) {
|
String mapSheetNum, Integer beforeYear, Integer afterYear) {
|
||||||
|
|||||||
@@ -108,9 +108,9 @@ public class TrainingDataReviewService {
|
|||||||
* COG 이미지 URL 조회 (변화 전/후)
|
* COG 이미지 URL 조회 (변화 전/후)
|
||||||
*
|
*
|
||||||
* @param mapSheetNum 도엽번호
|
* @param mapSheetNum 도엽번호
|
||||||
* @param beforeYear 변화 전 년도
|
* @param beforeYear 변화 전 년도 (선택적)
|
||||||
* @param afterYear 변화 후 년도
|
* @param afterYear 변화 후 년도 (선택적)
|
||||||
* @return 변화 전/후 COG 이미지 URL
|
* @return 변화 전/후 COG 이미지 URL (최소 하나의 년도는 제공되어야 함)
|
||||||
*/
|
*/
|
||||||
public TrainingDataReviewDto.CogImageResponse getCogImageUrl(
|
public TrainingDataReviewDto.CogImageResponse getCogImageUrl(
|
||||||
String mapSheetNum, Integer beforeYear, Integer afterYear) {
|
String mapSheetNum, Integer beforeYear, Integer afterYear) {
|
||||||
|
|||||||
Reference in New Issue
Block a user