error-list api upgarde and sync api change to stable

This commit is contained in:
DanielLee
2025-12-16 15:36:16 +09:00
parent 77931aa97a
commit b5b7fc79a8
6 changed files with 119 additions and 18 deletions

View File

@@ -71,9 +71,40 @@ public class MapSheetMngApiController {
/**
* 오류데이터 목록 조회
*
* @param searchReq
* @return
* <p>도엽파일 동기화 시 발생한 오류 데이터를 조회합니다.
*
* <p>오류 타입:
*
* <ul>
* <li>NOFILE - 파일없음
* <li>NOTPAIR - 페어없음 (tif/tfw 중 하나만 존재)
* <li>DUPLICATE - 중복 (동일한 파일이 여러개 존재)
* <li>SIZEERROR - size 0 (파일 크기가 0)
* <li>TYPEERROR - 형식오류 (tfw 검증 실패 또는 GeoTIFF 검증 실패)
* </ul>
*
* <p>sync_check_strt_dttm과 sync_check_end_dttm은 동일한 값으로 설정됩니다.
*
* @param searchReq 검색 조건 (년도, 검색어, syncStateFilter 등)
* @return 오류 데이터 목록
*/
@Operation(
summary = "오류데이터 목록 조회",
description =
"도엽파일 동기화 시 발생한 오류 데이터를 조회합니다. "
+ "오류 타입: NOFILE(파일없음), NOTPAIR(페어없음), DUPLICATE(중복), SIZEERROR(size 0), TYPEERROR(형식오류)")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "조회 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = MapSheetMngDto.ErrorDataDto.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PostMapping("/error-list")
public ApiResponseDto<Page<MapSheetMngDto.ErrorDataDto>> findMapSheetErrorList(
@RequestBody @Valid MapSheetMngDto.ErrorSearchReq searchReq) {

View File

@@ -128,6 +128,11 @@ public class MapSheetMngDto {
@Schema(description = "년도", example = "2025")
private Integer mngYyyy;
@Schema(
description = "동기화 상태 필터 (NOFILE, NOTPAIR, DUPLICATE, SIZEERROR, TYPEERROR)",
example = "NOFILE")
private String syncStateFilter;
public Pageable toPageable() {
if (sort != null && !sort.isEmpty()) {
String[] sortParams = sort.split(",");
@@ -153,6 +158,18 @@ public class MapSheetMngDto {
private Integer mapCodeSrc;
private String createdDttm;
private DataState dataState;
@Schema(description = "동기화 상태 (NOFILE, NOTPAIR, DUPLICATE, SIZEERROR, TYPEERROR)")
private String syncState;
@Schema(description = "동기화 체크 상태")
private String syncCheckState;
@Schema(description = "동기화 체크 시작 시간")
private java.time.LocalDateTime syncCheckStrtDttm;
@Schema(description = "동기화 체크 종료 시간")
private java.time.LocalDateTime syncCheckEndDttm;
}
@Schema(name = "DmlReturn", description = "영상관리 DML 수행 후 리턴")
@@ -224,4 +241,27 @@ public class MapSheetMngDto {
return desc;
}
}
@Getter
@AllArgsConstructor
public enum SyncErrorState implements EnumType {
NOFILE("파일없음"),
NOTPAIR("페어없음"),
DUPLICATE("중복"),
SIZEERROR("size 0"),
TYPEERROR("형식오류"),
DONE("정상");
private final String desc;
@Override
public String getId() {
return name();
}
@Override
public String getText() {
return desc;
}
}
}

View File

@@ -172,6 +172,30 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
MapSheetMngDto.@Valid ErrorSearchReq searchReq) {
Pageable pageable = PageRequest.of(searchReq.getPage(), searchReq.getSize());
BooleanBuilder whereBuilder = new BooleanBuilder();
whereBuilder.and(mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()));
// syncStateFilter 조건 추가
if (searchReq.getSyncStateFilter() != null && !searchReq.getSyncStateFilter().isEmpty()) {
whereBuilder.and(mapSheetMngHstEntity.syncState.eq(searchReq.getSyncStateFilter()));
} else {
// 기본: 오류 상태만 조회 (NOFILE, NOTPAIR, DUPLICATE, SIZEERROR, TYPEERROR)
whereBuilder.and(
mapSheetMngHstEntity
.syncState
.eq("NOFILE")
.or(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))
.or(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))
.or(mapSheetMngHstEntity.syncState.eq("SIZEERROR"))
.or(mapSheetMngHstEntity.syncState.eq("TYPEERROR")));
}
// 검색어 조건 추가
if (searchReq.getSearchValue() != null && !searchReq.getSearchValue().isEmpty()) {
whereBuilder.and(mapSheetErrorSearchValue(searchReq));
}
List<MapSheetMngDto.ErrorDataDto> foundContent =
queryFactory
.select(
@@ -188,16 +212,17 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
mapSheetMngHstEntity.mapSheetCodeSrc,
Expressions.stringTemplate(
"to_char({0}, 'YYYY-MM-DD')", mapSheetMngHstEntity.createdDate),
mapSheetMngHstEntity.dataState))
mapSheetMngHstEntity.dataState,
mapSheetMngHstEntity.syncState,
mapSheetMngHstEntity.syncCheckState,
mapSheetMngHstEntity.syncCheckStrtDttm,
mapSheetMngHstEntity.syncCheckEndDttm))
.from(mapSheetMngHstEntity)
.innerJoin(mapInkx5kEntity)
.on(mapSheetMngHstEntity.mapSheetCode.eq(mapInkx5kEntity.fid))
.leftJoin(mapInkx50kEntity)
.on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid.longValue()))
.where(
mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()),
// mapSheetMngHstEntity.dataState.eq(MapSheetMngDto.DataState.FAIL), // 오류만 검색
mapSheetErrorSearchValue(searchReq))
.where(whereBuilder)
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.orderBy(mapSheetMngHstEntity.createdDate.desc())
@@ -211,10 +236,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
.on(mapSheetMngHstEntity.mapSheetCode.eq(mapInkx5kEntity.fid))
.leftJoin(mapInkx50kEntity)
.on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid.longValue()))
.where(
mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()),
// mapSheetMngHstEntity.dataState.eq(MapSheetMngDto.DataState.FAIL), // 오류만 검색
mapSheetErrorSearchValue(searchReq))
.where(whereBuilder)
.fetchOne();
return new PageImpl<>(foundContent, pageable, countQuery);

View File

@@ -108,14 +108,19 @@ public class MapSheetMngFileJobRepositoryImpl extends QuerydslRepositorySupport
public void mngHstDataSyncStateUpdate(MapSheetMngDto.MngHstDto updateReq) {
ZonedDateTime now = ZonedDateTime.now();
if (updateReq.getDataState().equals("DONE")) {
long updateCount =
queryFactory
.update(mapSheetMngHstEntity)
.set(mapSheetMngHstEntity.dataState, updateReq.getDataState())
.set(mapSheetMngHstEntity.dataStateDttm, ZonedDateTime.now())
.set(mapSheetMngHstEntity.dataStateDttm, now)
.set(mapSheetMngHstEntity.syncState, updateReq.getSyncState())
.set(mapSheetMngHstEntity.syncEndDttm, ZonedDateTime.now())
.set(mapSheetMngHstEntity.syncEndDttm, now)
.set(mapSheetMngHstEntity.syncCheckState, "DONE")
.set(mapSheetMngHstEntity.syncCheckStrtDttm, now)
.set(mapSheetMngHstEntity.syncCheckEndDttm, now)
.where(mapSheetMngHstEntity.hstUid.eq(updateReq.getHstUid()))
.execute();
} else {
@@ -123,10 +128,13 @@ public class MapSheetMngFileJobRepositoryImpl extends QuerydslRepositorySupport
queryFactory
.update(mapSheetMngHstEntity)
.set(mapSheetMngHstEntity.dataState, updateReq.getDataState())
.set(mapSheetMngHstEntity.dataStateDttm, ZonedDateTime.now())
.set(mapSheetMngHstEntity.dataStateDttm, now)
.set(mapSheetMngHstEntity.syncState, updateReq.getSyncState())
.set(mapSheetMngHstEntity.syncStrtDttm, ZonedDateTime.now())
.set(mapSheetMngHstEntity.syncEndDttm, ZonedDateTime.now())
.set(mapSheetMngHstEntity.syncStrtDttm, now)
.set(mapSheetMngHstEntity.syncEndDttm, now)
.set(mapSheetMngHstEntity.syncCheckState, "PROCESSING")
.set(mapSheetMngHstEntity.syncCheckStrtDttm, now)
.set(mapSheetMngHstEntity.syncCheckEndDttm, now)
.where(mapSheetMngHstEntity.hstUid.eq(updateReq.getHstUid()))
.execute();
}

View File

@@ -1,7 +1,7 @@
spring:
config:
activate:
on-profile: dev
on-profile: prod
jpa:
show-sql: false

View File

@@ -5,7 +5,7 @@ spring:
application:
name: kamco-change-detection-api
profiles:
active: dev # 사용할 프로파일 지정 (ex. dev, prod, test)
active: local # 사용할 프로파일 지정 (ex. dev, prod, test)
datasource:
driver-class-name: org.postgresql.Driver