영상관리 싱크하기 수정
This commit is contained in:
@@ -8,6 +8,7 @@ import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FoldersDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFilesDepthDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFilesDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFoldersDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -100,7 +101,7 @@ public class MapSheetMngApiController {
|
||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetErrorList(searchReq));
|
||||
}
|
||||
|
||||
@Operation(summary = "영상관리목록 조회", description = "영상관리목록 조회")
|
||||
@Operation(summary = "영상데이터관리목록 조회", description = "영상데이터관리목록 조회")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
@@ -119,6 +120,27 @@ public class MapSheetMngApiController {
|
||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngList(searchReq));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "영상데이터관리 > 영상파일 동기화", description = "영상파일 동기화")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "동기화 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
||||
@ApiResponse(responseCode = "404", description = "동기화 할수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping("/sync-process")
|
||||
public ApiResponseDto<MapSheetMngDto.DmlReturn> uploadProcess(
|
||||
@RequestBody @Valid ImageryDto.searchReq searchReq) {
|
||||
return ApiResponseDto.ok(mapSheetMngService.syncProcess(searchReq));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param hstUidList
|
||||
* @return
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.kamco.cd.kamcoback.mapsheet.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
public class ImageryDto {
|
||||
|
||||
@Schema(name = "searchReq", description = "영상관리 Sync대상 검색 요청")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class searchReq {
|
||||
|
||||
// 페이징 파라미터
|
||||
@Schema(description = "페이지 번호 (0부터 시작) ", example = "0")
|
||||
@NotNull
|
||||
private int page = 0;
|
||||
|
||||
@Schema(description = "페이지 크기", example = "20000")
|
||||
@NotNull
|
||||
private int size = 20000;
|
||||
|
||||
@Schema(description = "정렬", example = "id desc")
|
||||
private String sort;
|
||||
|
||||
@Schema(description = "검색어(36809 또는 36809010)", example = "36809010")
|
||||
private String searchValue;
|
||||
|
||||
@Schema(description = "년도", example = "2025")
|
||||
@NotNull
|
||||
private Integer mngYyyy;
|
||||
|
||||
public Pageable toPageable() {return PageRequest.of(page, size);}
|
||||
}
|
||||
|
||||
@Schema(name = "ImageryDto", description = "영상관리파일 검색 리턴")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class BasicDto {
|
||||
private Long id;
|
||||
private UUID uuid;
|
||||
private Integer year;
|
||||
private String scene50k;
|
||||
private String scene5k;
|
||||
private Integer sceneId50k;
|
||||
private Integer sceneId5k;
|
||||
private ZonedDateTime createdDate;
|
||||
private String middlePath;
|
||||
private String cogMiddlePath;
|
||||
private String filename;
|
||||
private String cogFilename;
|
||||
}
|
||||
|
||||
@Schema(name = "ImagerySyncDto", description = "영상싱크파일 검색 리턴")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class SyncDto {
|
||||
private Long id;
|
||||
private Integer year;
|
||||
private String scene50k;
|
||||
private String scene5k;
|
||||
private String middlePath;
|
||||
private String cogMiddlePath;
|
||||
private String filename;
|
||||
private String cogFilename;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FoldersDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFilesDepthDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFilesDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFoldersDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -322,4 +323,9 @@ public class MapSheetMngService {
|
||||
public MapSheetMngDto.DmlReturn updateExceptUseInference(@Valid List<Long> hstUidList) {
|
||||
return mapSheetMngCoreService.updateExceptUseInference(hstUidList);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn syncProcess(ImageryDto.searchReq searchReq) {
|
||||
return mapSheetMngCoreService.syncProcess(searchReq);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngRepository;
|
||||
@@ -122,4 +123,25 @@ public class MapSheetMngCoreService {
|
||||
throw new RuntimeException("File search error", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public MapSheetMngDto.DmlReturn syncProcess(ImageryDto.searchReq searchReq) {
|
||||
int count = 0;
|
||||
|
||||
//대상파일목록 가저오기
|
||||
Page<ImageryDto.SyncDto> pageImagerySyncDto = mapSheetMngRepository.findImageryList(searchReq);
|
||||
//List<ImagerySyncDto> imagerySyncDtoList = pageImagerySyncDto.getContent();
|
||||
|
||||
for (ImageryDto.SyncDto dto : pageImagerySyncDto.getContent()) {
|
||||
// 여기에 처리 로직 작성
|
||||
System.out.println("ID: " + dto.getId());
|
||||
|
||||
// 예: 특정 작업 수행
|
||||
// someService.process(dto);
|
||||
}
|
||||
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", count + "개 업로드 성공하였습니다.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
||||
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -13,4 +14,7 @@ public interface MapSheetMngRepositoryCustom {
|
||||
Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.@Valid searchReq searchReq);
|
||||
|
||||
Optional<MapSheetMngHstEntity> findMapSheetMngHstInfo(Long hstUid);
|
||||
|
||||
Page<ImageryDto.SyncDto> findImageryList(ImageryDto.@Valid searchReq searchReq);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
||||
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QImageryEntity.imageryEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx50kEntity.mapInkx50kEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapInkx5kEntity.mapInkx5kEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngEntity.mapSheetMngEntity;
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngHstEntity.mapSheetMngHstEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.ImageryDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
@@ -139,6 +141,49 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ImageryDto.SyncDto> findImageryList(ImageryDto.@Valid searchReq searchReq) {
|
||||
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
|
||||
if (searchReq.getMngYyyy() != null) {
|
||||
whereBuilder.and(imageryEntity.year.eq(searchReq.getMngYyyy()));
|
||||
}
|
||||
|
||||
List<ImageryDto.SyncDto> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
ImageryDto.SyncDto.class,
|
||||
imageryEntity.id,
|
||||
imageryEntity.year,
|
||||
imageryEntity.scene50k,
|
||||
imageryEntity.scene5k,
|
||||
imageryEntity.middlePath,
|
||||
imageryEntity.cogMiddlePath,
|
||||
imageryEntity.filename,
|
||||
imageryEntity.cogFilename
|
||||
)
|
||||
)
|
||||
.from(imageryEntity)
|
||||
.where(whereBuilder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
//.orderBy(mapSheetMngEntity.createdDttm.desc())
|
||||
.fetch();
|
||||
|
||||
Long countQuery =
|
||||
queryFactory
|
||||
.select(imageryEntity.id.count())
|
||||
.from(imageryEntity)
|
||||
.where(whereBuilder)
|
||||
.fetchOne();
|
||||
|
||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<MapSheetMngHstEntity> findMapSheetMngHstInfo(Long hstUid) {
|
||||
return Optional.ofNullable(
|
||||
@@ -166,4 +211,10 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
"{0} like '%" + searchReq.getSearchValue() + "%'",
|
||||
mapSheetMngHstEntity.mapSheetNum));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user