영상데이터관리 > 오류 처리 내역 변경
This commit is contained in:
@@ -43,8 +43,6 @@ public class MapSheetMngApiController {
|
||||
public ApiResponseDto<Page<MapSheetMngDto.MngDto>> findMapSheetMngList(
|
||||
@RequestBody MapSheetMngDto.MngSearchReq searchReq) {
|
||||
|
||||
System.out.println("kkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngList(searchReq));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.kamco.cd.kamcoback.mapsheet.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import com.kamco.cd.kamcoback.config.enums.EnumType;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FolderDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -122,6 +124,12 @@ public class MapSheetMngDto {
|
||||
@Schema(description = "정렬", example = "id desc")
|
||||
private String sort;
|
||||
|
||||
@Schema(description = "오류종류(페어누락:NOTPAIR,중복파일:DUPLICATE,손상파일:FAULT)", example = "NOTPAIR")
|
||||
private String syncState;
|
||||
|
||||
@Schema(description = "처리유형(처리:DONE,미처리:NOTYET)", example = "DONE")
|
||||
private String syncCheckState;
|
||||
|
||||
@Schema(description = "검색어", example = "부산3959")
|
||||
private String searchValue;
|
||||
|
||||
@@ -146,13 +154,52 @@ public class MapSheetMngDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class ErrorDataDto {
|
||||
//private Integer rowNum;
|
||||
private Long hstUid;
|
||||
private Integer rowNum;
|
||||
private String map50kName;
|
||||
private String map5kName;
|
||||
private String mapSrcName;
|
||||
private Integer mapCodeSrc;
|
||||
private String createdDttm;
|
||||
private DataState dataState;
|
||||
@JsonFormatDttm private ZonedDateTime createdDttm;
|
||||
private String syncState;
|
||||
private String syncCheckState;
|
||||
|
||||
private Long fileUid;
|
||||
private String fileName;
|
||||
|
||||
private List<MngFIleDto> fileArray;
|
||||
|
||||
public ErrorDataDto(
|
||||
Long hstUid,
|
||||
String map50kName,
|
||||
String map5kName,
|
||||
String mapSrcName,
|
||||
Integer mapCodeSrc,
|
||||
ZonedDateTime createdDttm,
|
||||
String syncState,
|
||||
String syncCheckState) {
|
||||
this.hstUid = hstUid;
|
||||
this.map50kName = map50kName;
|
||||
this.map5kName = map5kName;
|
||||
this.mapSrcName = mapSrcName;
|
||||
this.mapCodeSrc = mapCodeSrc;
|
||||
this.createdDttm = createdDttm;
|
||||
this.syncState = syncState;
|
||||
this.syncCheckState = syncCheckState;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Schema(name = "MngFIleDto", description = "관리파일정보")
|
||||
@Getter
|
||||
@Setter
|
||||
public static class MngFIleDto {
|
||||
private Long fileUid;
|
||||
private String filePath;
|
||||
private String fileName;
|
||||
private Long fileSize;
|
||||
private String fileState;
|
||||
private Long hstUid;
|
||||
}
|
||||
|
||||
@Schema(name = "DmlReturn", description = "영상관리 DML 수행 후 리턴")
|
||||
|
||||
@@ -7,8 +7,11 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngFileEntity.mapS
|
||||
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngHstEntity.mapSheetMngHstEntity;
|
||||
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngFIleDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngFileEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.Tuple;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||
@@ -19,9 +22,14 @@ import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import org.hibernate.query.Query;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
@@ -154,36 +162,135 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
MapSheetMngDto.@Valid ErrorSearchReq searchReq) {
|
||||
|
||||
Pageable pageable = PageRequest.of(searchReq.getPage(), searchReq.getSize());
|
||||
List<MapSheetMngDto.ErrorDataDto> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
MapSheetMngDto.ErrorDataDto.class,
|
||||
mapSheetMngHstEntity.hstUid,
|
||||
rowNum(),
|
||||
Expressions.stringTemplate(
|
||||
"concat({0}, {1})",
|
||||
mapSheetMngHstEntity.mapSheetName, mapInkx50kEntity.mapidcdNo),
|
||||
Expressions.stringTemplate(
|
||||
"concat({0}, substring({1}, {2}, {3}))",
|
||||
mapSheetMngHstEntity.mapSheetName, mapSheetMngHstEntity.mapSheetNum, 6, 8),
|
||||
mapSheetMngHstEntity.mapSheetCodeSrc,
|
||||
Expressions.stringTemplate(
|
||||
"to_char({0}, 'YYYY-MM-DD')", mapSheetMngHstEntity.createdDate),
|
||||
mapSheetMngHstEntity.dataState))
|
||||
.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))
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(mapSheetMngHstEntity.createdDate.desc())
|
||||
.fetch();
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
|
||||
whereBuilder.and(mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()));
|
||||
whereBuilder.and(mapSheetMngHstEntity.syncState.ne("DONE").and(mapSheetMngHstEntity.syncState.ne("NOTYET")));
|
||||
|
||||
if (searchReq.getSyncState() != null && ! searchReq.getSyncState().isEmpty()) {
|
||||
if( searchReq.getSyncState().equals("NOTPAIR") )
|
||||
{
|
||||
whereBuilder.and(mapSheetMngHstEntity.syncState.eq("NOTPAIR")
|
||||
.or(mapSheetMngHstEntity.syncState.eq("NOFILE")));
|
||||
}
|
||||
else if( searchReq.getSyncState().equals("FAULT") )
|
||||
{
|
||||
whereBuilder.and(mapSheetMngHstEntity.syncState.eq("SIZEERROR")
|
||||
.or(mapSheetMngHstEntity.syncState.eq("TYPEERROR")));
|
||||
}
|
||||
else
|
||||
{
|
||||
whereBuilder.and(mapSheetMngHstEntity.syncState.eq(searchReq.getSyncState()));
|
||||
}
|
||||
}
|
||||
|
||||
if (searchReq.getSyncCheckState() != null && ! searchReq.getSyncCheckState().isEmpty()) {
|
||||
whereBuilder.and(mapSheetMngHstEntity.syncCheckState.eq(searchReq.getSyncCheckState()));
|
||||
}
|
||||
|
||||
if (searchReq.getSearchValue() != null && ! searchReq.getSearchValue().isEmpty()) {
|
||||
whereBuilder.and(mapSheetMngHstEntity.mapSheetNum.eq(searchReq.getSearchValue())
|
||||
.or(mapSheetMngHstEntity.refMapSheetNum.eq(searchReq.getSearchValue()))
|
||||
.or(Expressions.stringTemplate(
|
||||
"concat({0},substring({1}, 0, 6))",
|
||||
mapInkx5kEntity.mapidNm,
|
||||
mapSheetMngHstEntity.mapSheetNum
|
||||
).likeIgnoreCase(searchReq.getSearchValue()))
|
||||
.or(Expressions.stringTemplate(
|
||||
"concat({0},substring({1}, 6, 8))",
|
||||
mapInkx5kEntity.mapidNm,
|
||||
mapSheetMngHstEntity.mapSheetNum
|
||||
).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();
|
||||
|
||||
|
||||
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
|
||||
@@ -193,10 +300,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);
|
||||
|
||||
Reference in New Issue
Block a user