영상관리 추가 수정
This commit is contained in:
@@ -40,10 +40,9 @@ public class MapSheetMngApiController {
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping("/mng-list")
|
||||
public ApiResponseDto<Page<MapSheetMngDto.MngDto>> findMapSheetMngList(
|
||||
@RequestBody MapSheetMngDto.MngSearchReq searchReq) {
|
||||
public ApiResponseDto<List<MapSheetMngDto.MngDto>> findMapSheetMngList() {
|
||||
|
||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngList(searchReq));
|
||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngList());
|
||||
}
|
||||
|
||||
@Operation(summary = "영상데이터관리 상세", description = "영상데이터관리 상세")
|
||||
|
||||
@@ -151,7 +151,6 @@ public class MapSheetMngDto {
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class ErrorDataDto {
|
||||
// private Integer rowNum;
|
||||
private Long hstUid;
|
||||
@@ -163,10 +162,12 @@ public class MapSheetMngDto {
|
||||
private String syncState;
|
||||
private String syncCheckState;
|
||||
|
||||
private Long fileUid;
|
||||
private String fileName;
|
||||
//private Long fileUid;
|
||||
private String tfwFileName;
|
||||
private String tifFileName;
|
||||
|
||||
//private List<MngFIleDto> fileArray;
|
||||
|
||||
private List<MngFIleDto> fileArray;
|
||||
|
||||
public ErrorDataDto(
|
||||
Long hstUid,
|
||||
@@ -176,7 +177,9 @@ public class MapSheetMngDto {
|
||||
Integer mapCodeSrc,
|
||||
ZonedDateTime createdDttm,
|
||||
String syncState,
|
||||
String syncCheckState) {
|
||||
String syncCheckState,
|
||||
String tfwFileName,
|
||||
String tifFileName) {
|
||||
this.hstUid = hstUid;
|
||||
this.map50kName = map50kName;
|
||||
this.map5kName = map5kName;
|
||||
@@ -185,6 +188,8 @@ public class MapSheetMngDto {
|
||||
this.createdDttm = createdDttm;
|
||||
this.syncState = syncState;
|
||||
this.syncCheckState = syncCheckState;
|
||||
this.tfwFileName = tfwFileName;
|
||||
this.tifFileName = tifFileName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -213,8 +213,8 @@ public class MapSheetMngService {
|
||||
}
|
||||
|
||||
|
||||
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.MngSearchReq searchReq) {
|
||||
return mapSheetMngCoreService.findMapSheetMngList(searchReq);
|
||||
public List<MapSheetMngDto.MngDto> findMapSheetMngList() {
|
||||
return mapSheetMngCoreService.findMapSheetMngList();
|
||||
}
|
||||
|
||||
public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy) {
|
||||
|
||||
@@ -37,9 +37,8 @@ public class MapSheetMngCoreService {
|
||||
return mapSheetMngRepository.findMapSheetErrorList(searchReq);
|
||||
}
|
||||
|
||||
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(
|
||||
MapSheetMngDto.@Valid MngSearchReq searchReq) {
|
||||
return mapSheetMngRepository.findMapSheetMngList(searchReq);
|
||||
public List<MapSheetMngDto.MngDto> findMapSheetMngList() {
|
||||
return mapSheetMngRepository.findMapSheetMngList();
|
||||
}
|
||||
|
||||
public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy) {
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
|
||||
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.MngSearchReq searchReq);
|
||||
List<MapSheetMngDto.MngDto> findMapSheetMngList();
|
||||
|
||||
MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy);
|
||||
|
||||
|
||||
@@ -47,14 +47,14 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.MngSearchReq searchReq) {
|
||||
public List<MapSheetMngDto.MngDto> findMapSheetMngList() {
|
||||
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
//Pageable pageable = searchReq.toPageable();
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
|
||||
if (searchReq.getMngYyyy() != null) {
|
||||
whereBuilder.and(mapSheetMngEntity.mngYyyy.eq(searchReq.getMngYyyy()));
|
||||
}
|
||||
//if (searchReq.getMngYyyy() != null) {
|
||||
//whereBuilder.and(mapSheetMngEntity.mngYyyy.eq(searchReq.getMngYyyy()));
|
||||
//}
|
||||
|
||||
NumberExpression<Long> totalCount = mapSheetMngHstEntity.count().as("syncTotCnt");
|
||||
|
||||
@@ -155,9 +155,9 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
.leftJoin(mapSheetMngHstEntity)
|
||||
.on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy))
|
||||
.where(whereBuilder)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetMngEntity.createdDttm.desc())
|
||||
//.offset(pageable.getOffset())
|
||||
//.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetMngEntity.mngYyyy.desc())
|
||||
.groupBy(mapSheetMngEntity.mngYyyy)
|
||||
.fetch();
|
||||
|
||||
@@ -168,7 +168,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
.where(whereBuilder)
|
||||
.fetchOne();
|
||||
|
||||
return new PageImpl<>(foundContent, pageable, countQuery);
|
||||
return foundContent;
|
||||
}
|
||||
|
||||
public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy){
|
||||
@@ -322,86 +322,46 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
.likeIgnoreCase("%" + searchReq.getSearchValue() + "%")));
|
||||
}
|
||||
|
||||
List<Tuple> tuples =
|
||||
queryFactory
|
||||
.select(
|
||||
mapSheetMngHstEntity.hstUid,
|
||||
mapSheetMngHstEntity.mapSheetName,
|
||||
mapInkx5kEntity.mapidNm,
|
||||
mapSheetMngHstEntity.mapSheetNum,
|
||||
mapSheetMngHstEntity.mapSheetCodeSrc,
|
||||
mapSheetMngHstEntity.createdDate,
|
||||
mapSheetMngHstEntity.syncState,
|
||||
mapSheetMngHstEntity.syncCheckState,
|
||||
mapSheetMngFileEntity.fileUid,
|
||||
mapSheetMngFileEntity.filePath,
|
||||
mapSheetMngFileEntity.fileName,
|
||||
mapSheetMngFileEntity.fileSize,
|
||||
mapSheetMngFileEntity.fileState)
|
||||
.from(mapSheetMngHstEntity)
|
||||
.innerJoin(mapInkx5kEntity)
|
||||
.on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo))
|
||||
.leftJoin(mapSheetMngFileEntity)
|
||||
.on(mapSheetMngFileEntity.hstUid.eq(mapSheetMngHstEntity.hstUid))
|
||||
.where(whereBuilder)
|
||||
.orderBy(mapSheetMngHstEntity.createdDate.desc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
List<MapSheetMngDto.ErrorDataDto> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
MapSheetMngDto.ErrorDataDto.class,
|
||||
mapSheetMngHstEntity.hstUid,
|
||||
Expressions.stringTemplate(
|
||||
"concat({0},substring({1}, 0, 6))",
|
||||
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum).as("map50kName"),
|
||||
Expressions.stringTemplate(
|
||||
"concat({0},substring({1}, 6, 8))",
|
||||
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum).as("map5kName"),
|
||||
Expressions.stringTemplate(
|
||||
"concat({0},substring({1}, 6, 8))",
|
||||
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum).as("mapSrcName"),
|
||||
mapInkx5kEntity.fid,
|
||||
mapSheetMngHstEntity.createdDate,
|
||||
mapSheetMngHstEntity.syncState,
|
||||
mapSheetMngHstEntity.syncCheckState,
|
||||
Expressions.stringTemplate(
|
||||
"MAX(CASE WHEN {0} = 'tfw' THEN {1} END)",
|
||||
mapSheetMngFileEntity.fileExt, mapSheetMngFileEntity.fileName
|
||||
),
|
||||
Expressions.stringTemplate(
|
||||
"MAX(CASE WHEN {0} = 'tif' THEN {1} END)",
|
||||
mapSheetMngFileEntity.fileExt, mapSheetMngFileEntity.fileName
|
||||
)
|
||||
)
|
||||
)
|
||||
.from(mapSheetMngHstEntity)
|
||||
.innerJoin(mapInkx5kEntity).on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo))
|
||||
.leftJoin(mapSheetMngFileEntity).on(mapSheetMngHstEntity.hstUid.eq(mapSheetMngFileEntity.hstUid))
|
||||
.where(whereBuilder)
|
||||
.groupBy(mapSheetMngHstEntity.hstUid, mapInkx5kEntity.fid, mapInkx5kEntity.mapidNm)
|
||||
.orderBy(mapSheetMngHstEntity.createdDate.desc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
Map<Long, MapSheetMngDto.ErrorDataDto> resultMap = new LinkedHashMap<>();
|
||||
|
||||
for (Tuple t : tuples) {
|
||||
|
||||
Long hstUid = t.get(mapSheetMngHstEntity.hstUid);
|
||||
|
||||
MapSheetMngDto.ErrorDataDto dto =
|
||||
resultMap.computeIfAbsent(
|
||||
hstUid,
|
||||
id -> {
|
||||
String map50kName =
|
||||
t.get(mapSheetMngHstEntity.mapSheetName)
|
||||
+ t.get(mapSheetMngHstEntity.mapSheetNum).substring(0, 5);
|
||||
|
||||
String map5kName =
|
||||
t.get(mapSheetMngHstEntity.mapSheetName)
|
||||
+ t.get(mapSheetMngHstEntity.mapSheetNum).substring(5, 8);
|
||||
|
||||
String mapSrcName =
|
||||
t.get(mapSheetMngHstEntity.mapSheetName)
|
||||
+ t.get(mapSheetMngHstEntity.mapSheetNum).substring(5, 8);
|
||||
|
||||
MapSheetMngDto.ErrorDataDto newDto =
|
||||
new MapSheetMngDto.ErrorDataDto(
|
||||
id,
|
||||
map50kName,
|
||||
map5kName,
|
||||
mapSrcName,
|
||||
t.get(mapSheetMngHstEntity.mapSheetCodeSrc),
|
||||
t.get(mapSheetMngHstEntity.createdDate),
|
||||
t.get(mapSheetMngHstEntity.syncState),
|
||||
t.get(mapSheetMngHstEntity.syncCheckState));
|
||||
|
||||
newDto.setFileArray(new ArrayList<>());
|
||||
return newDto;
|
||||
});
|
||||
|
||||
// 파일 정보가 있는 경우만 추가
|
||||
Long fileUid = t.get(mapSheetMngFileEntity.fileUid);
|
||||
if (fileUid != null) {
|
||||
MapSheetMngDto.MngFIleDto fileDto = new MapSheetMngDto.MngFIleDto();
|
||||
fileDto.setFileUid(fileUid);
|
||||
fileDto.setFilePath(t.get(mapSheetMngFileEntity.filePath));
|
||||
fileDto.setFileName(t.get(mapSheetMngFileEntity.fileName));
|
||||
fileDto.setFileSize(t.get(mapSheetMngFileEntity.fileSize));
|
||||
fileDto.setFileState(t.get(mapSheetMngFileEntity.fileState));
|
||||
fileDto.setHstUid(hstUid);
|
||||
|
||||
dto.getFileArray().add(fileDto);
|
||||
}
|
||||
}
|
||||
|
||||
List<MapSheetMngDto.ErrorDataDto> foundContent = new ArrayList<>(resultMap.values());
|
||||
|
||||
Long countQuery =
|
||||
queryFactory
|
||||
|
||||
Reference in New Issue
Block a user