Merge remote-tracking branch 'origin/feat/dev_251201' into feat/dev_251201

# Conflicts:
#	src/main/java/com/kamco/cd/kamcoback/mapsheet/dto/MapSheetMngDto.java
This commit is contained in:
Moon
2025-12-17 15:07:35 +09:00
5 changed files with 142 additions and 152 deletions

View File

@@ -15,13 +15,7 @@ import lombok.NoArgsConstructor;
@Table(name = "tb_audit_log") @Table(name = "tb_audit_log")
public class AuditLogEntity extends CommonCreateEntity { public class AuditLogEntity extends CommonCreateEntity {
@Id @Id
@GeneratedValue( @GeneratedValue(strategy = GenerationType.IDENTITY)
strategy = GenerationType.SEQUENCE,
generator = "tb_audit_log_audit_log_uid_seq_gen")
@SequenceGenerator(
name = "tb_audit_log_audit_log_uid_seq_gen",
sequenceName = "tb_audit_log_audit_log_uid_seq",
allocationSize = 1)
@Column(name = "audit_log_uid", nullable = false) @Column(name = "audit_log_uid", nullable = false)
private Long id; private Long id;

View File

@@ -5,24 +5,19 @@ import com.kamco.cd.kamcoback.log.dto.EventType;
import com.kamco.cd.kamcoback.postgres.CommonCreateEntity; import com.kamco.cd.kamcoback.postgres.CommonCreateEntity;
import jakarta.persistence.*; import jakarta.persistence.*;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import java.time.ZonedDateTime;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.time.ZonedDateTime;
@Entity @Entity
@Getter @Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED) @NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "tb_error_log") @Table(name = "tb_error_log")
public class ErrorLogEntity extends CommonCreateEntity { public class ErrorLogEntity extends CommonCreateEntity {
@Id @Id
@GeneratedValue( @GeneratedValue(strategy = GenerationType.IDENTITY)
strategy = GenerationType.SEQUENCE,
generator = "tb_error_log_error_log_uid_seq_gen")
@SequenceGenerator(
name = "tb_error_log_error_log_uid_seq_gen",
sequenceName = "tb_error_log_error_log_uid_seq",
allocationSize = 1)
@Column(name = "error_log_uid", nullable = false) @Column(name = "error_log_uid", nullable = false)
private Long id; private Long id;

View File

@@ -103,5 +103,4 @@ public class MapSheetMngHstEntity extends CommonDateEntity {
@Size(max = 100) @Size(max = 100)
@Column(name = "sync_check_tfw_file_name", length = 100) @Column(name = "sync_check_tfw_file_name", length = 100)
private String syncCheckTfwFileName; private String syncCheckTfwFileName;
} }

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.mapsheet.dto.MapSheetMngDto;
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity; import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
import com.querydsl.core.BooleanBuilder; import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.Tuple;
import com.querydsl.core.types.Projections; import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.CaseBuilder; import com.querydsl.core.types.dsl.CaseBuilder;
@@ -20,10 +19,7 @@ import com.querydsl.jpa.impl.JPAQueryFactory;
import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext; import jakarta.persistence.PersistenceContext;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import org.hibernate.query.Query; import org.hibernate.query.Query;
@@ -49,12 +45,12 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
@Override @Override
public List<MapSheetMngDto.MngDto> findMapSheetMngList() { public List<MapSheetMngDto.MngDto> findMapSheetMngList() {
//Pageable pageable = searchReq.toPageable(); // Pageable pageable = searchReq.toPageable();
BooleanBuilder whereBuilder = new BooleanBuilder(); BooleanBuilder whereBuilder = new BooleanBuilder();
//if (searchReq.getMngYyyy() != null) { // if (searchReq.getMngYyyy() != null) {
//whereBuilder.and(mapSheetMngEntity.mngYyyy.eq(searchReq.getMngYyyy())); // whereBuilder.and(mapSheetMngEntity.mngYyyy.eq(searchReq.getMngYyyy()));
//} // }
NumberExpression<Long> totalCount = mapSheetMngHstEntity.count().as("syncTotCnt"); NumberExpression<Long> totalCount = mapSheetMngHstEntity.count().as("syncTotCnt");
@@ -155,8 +151,8 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
.leftJoin(mapSheetMngHstEntity) .leftJoin(mapSheetMngHstEntity)
.on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy)) .on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy))
.where(whereBuilder) .where(whereBuilder)
//.offset(pageable.getOffset()) // .offset(pageable.getOffset())
//.limit(pageable.getPageSize()) // .limit(pageable.getPageSize())
.orderBy(mapSheetMngEntity.mngYyyy.desc()) .orderBy(mapSheetMngEntity.mngYyyy.desc())
.groupBy(mapSheetMngEntity.mngYyyy) .groupBy(mapSheetMngEntity.mngYyyy)
.fetch(); .fetch();
@@ -171,102 +167,102 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
return foundContent; return foundContent;
} }
public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy){ public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy) {
BooleanBuilder whereBuilder = new BooleanBuilder(); BooleanBuilder whereBuilder = new BooleanBuilder();
whereBuilder.and(mapSheetMngEntity.mngYyyy.eq(mngYyyy)); whereBuilder.and(mapSheetMngEntity.mngYyyy.eq(mngYyyy));
MapSheetMngDto.MngDto foundContent = MapSheetMngDto.MngDto foundContent =
queryFactory queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
MapSheetMngDto.MngDto.class, MapSheetMngDto.MngDto.class,
Expressions.numberTemplate( Expressions.numberTemplate(
Integer.class, Integer.class,
"row_number() over(order by {0} desc)", "row_number() over(order by {0} desc)",
mapSheetMngEntity.createdDttm), mapSheetMngEntity.createdDttm),
mapSheetMngEntity.mngYyyy, mapSheetMngEntity.mngYyyy,
mapSheetMngEntity.mngState, mapSheetMngEntity.mngState,
mapSheetMngEntity.syncState, mapSheetMngEntity.syncState,
mapSheetMngEntity.syncCheckState, mapSheetMngEntity.syncCheckState,
mapSheetMngHstEntity.count(), mapSheetMngHstEntity.count(),
new CaseBuilder() new CaseBuilder()
.when(mapSheetMngHstEntity.dataState.eq("DONE")) .when(mapSheetMngHstEntity.dataState.eq("DONE"))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum() .sum()
.as("syncStateDoneCnt"), .as("syncStateDoneCnt"),
new CaseBuilder() new CaseBuilder()
.when(mapSheetMngHstEntity.syncState.ne("NOTYET")) .when(mapSheetMngHstEntity.syncState.ne("NOTYET"))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapSheetMngHstEntity
.syncState .syncState
.eq("NOFILE") .eq("NOFILE")
.or(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))) .or(mapSheetMngHstEntity.syncState.eq("NOTPAIR")))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapSheetMngHstEntity
.syncCheckState .syncCheckState
.eq("DONE") .eq("DONE")
.and( .and(
mapSheetMngHstEntity mapSheetMngHstEntity
.syncState .syncState
.eq("NOFILE") .eq("NOFILE")
.or(mapSheetMngHstEntity.syncState.eq("NOTPAIR")))) .or(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when(mapSheetMngHstEntity.syncState.eq("DUPLICATE")) .when(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapSheetMngHstEntity
.syncCheckState .syncCheckState
.eq("DONE") .eq("DONE")
.and(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))) .and(mapSheetMngHstEntity.syncState.eq("DUPLICATE")))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapSheetMngHstEntity
.syncState .syncState
.eq("TYPEERROR") .eq("TYPEERROR")
.or(mapSheetMngHstEntity.syncState.eq("SIZEERROR"))) .or(mapSheetMngHstEntity.syncState.eq("SIZEERROR")))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
new CaseBuilder() new CaseBuilder()
.when( .when(
mapSheetMngHstEntity mapSheetMngHstEntity
.syncCheckState .syncCheckState
.eq("DONE") .eq("DONE")
.and( .and(
mapSheetMngHstEntity mapSheetMngHstEntity
.syncState .syncState
.eq("TYPEERROR") .eq("TYPEERROR")
.or(mapSheetMngHstEntity.syncState.eq("SIZEERROR")))) .or(mapSheetMngHstEntity.syncState.eq("SIZEERROR"))))
.then(1L) .then(1L)
.otherwise(0L) .otherwise(0L)
.sum(), .sum(),
mapSheetMngEntity.createdDttm, mapSheetMngEntity.createdDttm,
mapSheetMngHstEntity.syncEndDttm.max())) mapSheetMngHstEntity.syncEndDttm.max()))
.from(mapSheetMngEntity) .from(mapSheetMngEntity)
.leftJoin(mapSheetMngHstEntity) .leftJoin(mapSheetMngHstEntity)
.on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy)) .on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy))
.where(whereBuilder) .where(whereBuilder)
.groupBy(mapSheetMngEntity.mngYyyy) .groupBy(mapSheetMngEntity.mngYyyy)
.fetchOne(); .fetchOne();
return foundContent; return foundContent;
} }
@@ -323,39 +319,39 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
} }
List<MapSheetMngDto.ErrorDataDto> foundContent = List<MapSheetMngDto.ErrorDataDto> foundContent =
queryFactory queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
MapSheetMngDto.ErrorDataDto.class, MapSheetMngDto.ErrorDataDto.class,
mapSheetMngHstEntity.hstUid, mapSheetMngHstEntity.hstUid,
Expressions.stringTemplate( Expressions.stringTemplate(
"concat({0},substring({1}, 0, 6))", "concat({0},substring({1}, 0, 6))",
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum).as("map50kName"), mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum)
Expressions.stringTemplate( .as("map50kName"),
"concat({0},substring({1}, 6, 8))", Expressions.stringTemplate(
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum).as("map5kName"), "concat({0},substring({1}, 6, 8))",
Expressions.stringTemplate( mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum)
"concat({0},substring({1}, 6, 8))", .as("map5kName"),
mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum).as("mapSrcName"), Expressions.stringTemplate(
mapInkx5kEntity.fid, "concat({0},substring({1}, 6, 8))",
mapSheetMngHstEntity.createdDate, mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum)
mapSheetMngHstEntity.syncState, .as("mapSrcName"),
mapSheetMngHstEntity.syncTfwFileName, mapInkx5kEntity.fid,
mapSheetMngHstEntity.syncTifFileName, mapSheetMngHstEntity.createdDate,
mapSheetMngHstEntity.syncCheckState, mapSheetMngHstEntity.syncState,
mapSheetMngHstEntity.syncCheckTfwFileName, mapSheetMngHstEntity.syncTfwFileName,
mapSheetMngHstEntity.syncCheckTifFileName mapSheetMngHstEntity.syncTifFileName,
) mapSheetMngHstEntity.syncCheckState,
) mapSheetMngHstEntity.syncCheckTfwFileName,
.from(mapSheetMngHstEntity) mapSheetMngHstEntity.syncCheckTifFileName))
.innerJoin(mapInkx5kEntity).on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo)) .from(mapSheetMngHstEntity)
.where(whereBuilder) .innerJoin(mapInkx5kEntity)
.orderBy(mapSheetMngHstEntity.createdDate.desc()) .on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo))
.offset(pageable.getOffset()) .where(whereBuilder)
.limit(pageable.getPageSize()) .orderBy(mapSheetMngHstEntity.createdDate.desc())
.fetch(); .offset(pageable.getOffset())
.limit(pageable.getPageSize())
.fetch();
Long countQuery = Long countQuery =
queryFactory queryFactory

View File

@@ -134,8 +134,14 @@ public class MembersRepositoryImpl implements MembersRepositoryCustom {
.orderBy(memberEntity.createdDttm.desc()) .orderBy(memberEntity.createdDttm.desc())
.fetch(); .fetch();
long total = queryFactory.select(memberEntity).from(memberEntity).fetchCount(); long total =
Optional.ofNullable(
queryFactory
.select(memberEntity.count())
.from(memberEntity)
.where(builder)
.fetchOne())
.orElse(0L);
return new PageImpl<>(content, pageable, total); return new PageImpl<>(content, pageable, total);
} }