영상관리 > 오류 데이터 처리 변경
This commit is contained in:
@@ -253,8 +253,8 @@ public class FIleChecker {
|
||||
List<Basic> fileList = new ArrayList<>();
|
||||
SimpleDateFormat dttmFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
//int fileTotCnt = 0;
|
||||
//long fileTotSize = 0;
|
||||
// int fileTotCnt = 0;
|
||||
// long fileTotSize = 0;
|
||||
|
||||
try (Stream<Path> stream = Files.walk(startPath, maxDepth)) {
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ 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;
|
||||
@@ -154,7 +153,7 @@ public class MapSheetMngDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class ErrorDataDto {
|
||||
//private Integer rowNum;
|
||||
// private Integer rowNum;
|
||||
private Long hstUid;
|
||||
private String map50kName;
|
||||
private String map5kName;
|
||||
@@ -187,7 +186,6 @@ public class MapSheetMngDto {
|
||||
this.syncState = syncState;
|
||||
this.syncCheckState = syncCheckState;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Schema(name = "MngFIleDto", description = "관리파일정보")
|
||||
|
||||
@@ -7,8 +7,6 @@ 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;
|
||||
@@ -23,13 +21,11 @@ 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;
|
||||
@@ -62,7 +58,8 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
NumberExpression<Long> totalCount = mapSheetMngHstEntity.count().as("syncTotCnt");
|
||||
|
||||
NumberExpression<Long> doneCount = new CaseBuilder()
|
||||
NumberExpression<Long> doneCount =
|
||||
new CaseBuilder()
|
||||
.when(mapSheetMngHstEntity.dataState.eq("DONE"))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
@@ -95,46 +92,63 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
new CaseBuilder()
|
||||
.when(mapSheetMngHstEntity.syncState.eq("NOFILE")
|
||||
.or( mapSheetMngHstEntity.syncState.eq("NOTPAIR")))
|
||||
.when(
|
||||
mapSheetMngHstEntity
|
||||
.syncState
|
||||
.eq("NOFILE")
|
||||
.or(mapSheetMngHstEntity.syncState.eq("NOTPAIR")))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
new CaseBuilder()
|
||||
.when(mapSheetMngHstEntity.syncCheckState.eq("DONE")
|
||||
.and( mapSheetMngHstEntity.syncState.eq("NOFILE")
|
||||
.or(mapSheetMngHstEntity.syncState.eq("NOTPAIR")) )
|
||||
)
|
||||
.when(
|
||||
mapSheetMngHstEntity
|
||||
.syncCheckState
|
||||
.eq("DONE")
|
||||
.and(
|
||||
mapSheetMngHstEntity
|
||||
.syncState
|
||||
.eq("NOFILE")
|
||||
.or(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
|
||||
new CaseBuilder()
|
||||
.when(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
new CaseBuilder()
|
||||
.when(mapSheetMngHstEntity.syncCheckState.eq("DONE")
|
||||
.and(mapSheetMngHstEntity.syncState.eq("DUPLICATE")) )
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
|
||||
new CaseBuilder()
|
||||
.when(mapSheetMngHstEntity.syncState.eq("TYPEERROR")
|
||||
.or( mapSheetMngHstEntity.syncState.eq("SIZEERROR")))
|
||||
.when(
|
||||
mapSheetMngHstEntity
|
||||
.syncCheckState
|
||||
.eq("DONE")
|
||||
.and(mapSheetMngHstEntity.syncState.eq("DUPLICATE")))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
new CaseBuilder()
|
||||
.when(mapSheetMngHstEntity.syncCheckState.eq("DONE")
|
||||
.and(mapSheetMngHstEntity.syncState.eq("TYPEERROR")
|
||||
.or( mapSheetMngHstEntity.syncState.eq("SIZEERROR"))) )
|
||||
.when(
|
||||
mapSheetMngHstEntity
|
||||
.syncState
|
||||
.eq("TYPEERROR")
|
||||
.or(mapSheetMngHstEntity.syncState.eq("SIZEERROR")))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
new CaseBuilder()
|
||||
.when(
|
||||
mapSheetMngHstEntity
|
||||
.syncCheckState
|
||||
.eq("DONE")
|
||||
.and(
|
||||
mapSheetMngHstEntity
|
||||
.syncState
|
||||
.eq("TYPEERROR")
|
||||
.or(mapSheetMngHstEntity.syncState.eq("SIZEERROR"))))
|
||||
.then(1L)
|
||||
.otherwise(0L)
|
||||
.sum(),
|
||||
|
||||
mapSheetMngEntity.createdDttm,
|
||||
mapSheetMngHstEntity.syncEndDttm.max()))
|
||||
.from(mapSheetMngEntity)
|
||||
@@ -165,48 +179,51 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
|
||||
whereBuilder.and(mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()));
|
||||
whereBuilder.and(mapSheetMngHstEntity.syncState.ne("DONE").and(mapSheetMngHstEntity.syncState.ne("NOTYET")));
|
||||
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")
|
||||
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")
|
||||
} else if (searchReq.getSyncState().equals("FAULT")) {
|
||||
whereBuilder.and(
|
||||
mapSheetMngHstEntity
|
||||
.syncState
|
||||
.eq("SIZEERROR")
|
||||
.or(mapSheetMngHstEntity.syncState.eq("TYPEERROR")));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
whereBuilder.and(mapSheetMngHstEntity.syncState.eq(searchReq.getSyncState()));
|
||||
}
|
||||
}
|
||||
|
||||
if (searchReq.getSyncCheckState() != null && ! searchReq.getSyncCheckState().isEmpty()) {
|
||||
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())
|
||||
if (searchReq.getSearchValue() != null && !searchReq.getSearchValue().isEmpty()) {
|
||||
whereBuilder.and(
|
||||
mapSheetMngHstEntity
|
||||
.mapSheetNum
|
||||
.eq(searchReq.getSearchValue())
|
||||
.or(mapSheetMngHstEntity.refMapSheetNum.eq(searchReq.getSearchValue()))
|
||||
.or(Expressions.stringTemplate(
|
||||
.or(
|
||||
Expressions.stringTemplate(
|
||||
"concat({0},substring({1}, 0, 6))",
|
||||
mapInkx5kEntity.mapidNm,
|
||||
mapSheetMngHstEntity.mapSheetNum
|
||||
).likeIgnoreCase(searchReq.getSearchValue()))
|
||||
.or(Expressions.stringTemplate(
|
||||
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum)
|
||||
.likeIgnoreCase(searchReq.getSearchValue()))
|
||||
.or(
|
||||
Expressions.stringTemplate(
|
||||
"concat({0},substring({1}, 6, 8))",
|
||||
mapInkx5kEntity.mapidNm,
|
||||
mapSheetMngHstEntity.mapSheetNum
|
||||
).likeIgnoreCase(searchReq.getSearchValue()))
|
||||
);
|
||||
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum)
|
||||
.likeIgnoreCase(searchReq.getSearchValue())));
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<Tuple> tuples = queryFactory
|
||||
List<Tuple> tuples =
|
||||
queryFactory
|
||||
.select(
|
||||
mapSheetMngHstEntity.hstUid,
|
||||
mapSheetMngHstEntity.mapSheetName,
|
||||
@@ -220,8 +237,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
mapSheetMngFileEntity.filePath,
|
||||
mapSheetMngFileEntity.fileName,
|
||||
mapSheetMngFileEntity.fileSize,
|
||||
mapSheetMngFileEntity.fileState
|
||||
)
|
||||
mapSheetMngFileEntity.fileState)
|
||||
.from(mapSheetMngHstEntity)
|
||||
.innerJoin(mapInkx5kEntity)
|
||||
.on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo))
|
||||
@@ -233,7 +249,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
|
||||
Map<Long, MapSheetMngDto.ErrorDataDto> resultMap = new LinkedHashMap<>();
|
||||
|
||||
for (Tuple t : tuples) {
|
||||
@@ -241,9 +256,9 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
Long hstUid = t.get(mapSheetMngHstEntity.hstUid);
|
||||
|
||||
MapSheetMngDto.ErrorDataDto dto =
|
||||
resultMap.computeIfAbsent(hstUid, id -> {
|
||||
|
||||
|
||||
resultMap.computeIfAbsent(
|
||||
hstUid,
|
||||
id -> {
|
||||
String map50kName =
|
||||
t.get(mapSheetMngHstEntity.mapSheetName)
|
||||
+ t.get(mapSheetMngHstEntity.mapSheetNum).substring(0, 5);
|
||||
@@ -256,8 +271,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
t.get(mapSheetMngHstEntity.mapSheetName)
|
||||
+ t.get(mapSheetMngHstEntity.mapSheetNum).substring(5, 8);
|
||||
|
||||
|
||||
|
||||
MapSheetMngDto.ErrorDataDto newDto =
|
||||
new MapSheetMngDto.ErrorDataDto(
|
||||
id,
|
||||
@@ -267,8 +280,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
t.get(mapSheetMngHstEntity.mapSheetCodeSrc),
|
||||
t.get(mapSheetMngHstEntity.createdDate),
|
||||
t.get(mapSheetMngHstEntity.syncState),
|
||||
t.get(mapSheetMngHstEntity.syncCheckState)
|
||||
);
|
||||
t.get(mapSheetMngHstEntity.syncCheckState));
|
||||
|
||||
newDto.setFileArray(new ArrayList<>());
|
||||
return newDto;
|
||||
@@ -291,7 +303,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
List<MapSheetMngDto.ErrorDataDto> foundContent = new ArrayList<>(resultMap.values());
|
||||
|
||||
|
||||
Long countQuery =
|
||||
queryFactory
|
||||
.select(mapSheetMngHstEntity.hstUid.count())
|
||||
|
||||
Reference in New Issue
Block a user