spotlessApply 적용

This commit is contained in:
2025-12-17 11:31:34 +09:00
parent 3efb5302df
commit 7dad0496d0
5 changed files with 149 additions and 161 deletions

View File

@@ -1,7 +1,6 @@
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;

View File

@@ -9,7 +9,6 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetMngHstEntity.mapSh
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
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;
@@ -20,10 +19,7 @@ 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.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.hibernate.query.Query;
@@ -49,12 +45,12 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
@Override
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,8 +151,8 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
.leftJoin(mapSheetMngHstEntity)
.on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy))
.where(whereBuilder)
//.offset(pageable.getOffset())
//.limit(pageable.getPageSize())
// .offset(pageable.getOffset())
// .limit(pageable.getPageSize())
.orderBy(mapSheetMngEntity.mngYyyy.desc())
.groupBy(mapSheetMngEntity.mngYyyy)
.fetch();
@@ -171,102 +167,102 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
return foundContent;
}
public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy){
public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy) {
BooleanBuilder whereBuilder = new BooleanBuilder();
whereBuilder.and(mapSheetMngEntity.mngYyyy.eq(mngYyyy));
MapSheetMngDto.MngDto foundContent =
queryFactory
.select(
Projections.constructor(
MapSheetMngDto.MngDto.class,
Expressions.numberTemplate(
Integer.class,
"row_number() over(order by {0} desc)",
mapSheetMngEntity.createdDttm),
mapSheetMngEntity.mngYyyy,
mapSheetMngEntity.mngState,
mapSheetMngEntity.syncState,
mapSheetMngEntity.syncCheckState,
mapSheetMngHstEntity.count(),
new CaseBuilder()
.when(mapSheetMngHstEntity.dataState.eq("DONE"))
.then(1L)
.otherwise(0L)
.sum()
.as("syncStateDoneCnt"),
new CaseBuilder()
.when(mapSheetMngHstEntity.syncState.ne("NOTYET"))
.then(1L)
.otherwise(0L)
.sum(),
new CaseBuilder()
.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"))))
.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")))
.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)
.leftJoin(mapSheetMngHstEntity)
.on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy))
.where(whereBuilder)
.groupBy(mapSheetMngEntity.mngYyyy)
.fetchOne();
queryFactory
.select(
Projections.constructor(
MapSheetMngDto.MngDto.class,
Expressions.numberTemplate(
Integer.class,
"row_number() over(order by {0} desc)",
mapSheetMngEntity.createdDttm),
mapSheetMngEntity.mngYyyy,
mapSheetMngEntity.mngState,
mapSheetMngEntity.syncState,
mapSheetMngEntity.syncCheckState,
mapSheetMngHstEntity.count(),
new CaseBuilder()
.when(mapSheetMngHstEntity.dataState.eq("DONE"))
.then(1L)
.otherwise(0L)
.sum()
.as("syncStateDoneCnt"),
new CaseBuilder()
.when(mapSheetMngHstEntity.syncState.ne("NOTYET"))
.then(1L)
.otherwise(0L)
.sum(),
new CaseBuilder()
.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"))))
.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")))
.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)
.leftJoin(mapSheetMngHstEntity)
.on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy))
.where(whereBuilder)
.groupBy(mapSheetMngEntity.mngYyyy)
.fetchOne();
return foundContent;
}
@@ -323,45 +319,44 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
}
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();
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();
Long countQuery =
queryFactory