From 6ec840e694c6271c36f5b324c3776c20bf8801e6 Mon Sep 17 00:00:00 2001 From: Moon Date: Fri, 12 Dec 2025 14:00:59 +0900 Subject: [PATCH] =?UTF-8?q?=EC=98=81=EC=83=81=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapsheet/MapSheetMngApiController.java | 7 +- .../mapsheet/dto/MapSheetMngDto.java | 10 +- .../mapsheet/service/MapSheetMngService.java | 3 +- .../postgres/core/MapSheetMngCoreService.java | 3 +- .../entity/MapSheetMngFileEntity.java | 1 - .../mapsheet/MapSheetMngRepositoryCustom.java | 3 +- .../mapsheet/MapSheetMngRepositoryImpl.java | 106 ++++++++---------- 7 files changed, 52 insertions(+), 81 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/mapsheet/MapSheetMngApiController.java b/src/main/java/com/kamco/cd/kamcoback/mapsheet/MapSheetMngApiController.java index 31380a60..07a9d293 100644 --- a/src/main/java/com/kamco/cd/kamcoback/mapsheet/MapSheetMngApiController.java +++ b/src/main/java/com/kamco/cd/kamcoback/mapsheet/MapSheetMngApiController.java @@ -26,8 +26,6 @@ public class MapSheetMngApiController { private final CommonCodeService commonCodeService; private final MapSheetMngService mapSheetMngService; - - @Operation(summary = "영상데이터관리목록 조회", description = "영상데이터관리목록 조회") @ApiResponses( value = { @@ -67,8 +65,6 @@ public class MapSheetMngApiController { return ApiResponseDto.ok(mapSheetMngService.mngDataSave(AddReq)); } - - /** * 오류데이터 목록 조회 * @@ -77,11 +73,10 @@ public class MapSheetMngApiController { */ @PostMapping("/error-list") public ApiResponseDto> findMapSheetErrorList( - @RequestBody @Valid MapSheetMngDto.ErrorSearchReq searchReq) { + @RequestBody @Valid MapSheetMngDto.ErrorSearchReq searchReq) { return ApiResponseDto.ok(mapSheetMngService.findMapSheetErrorList(searchReq)); } - /** * @param hstUidList * @return diff --git a/src/main/java/com/kamco/cd/kamcoback/mapsheet/dto/MapSheetMngDto.java b/src/main/java/com/kamco/cd/kamcoback/mapsheet/dto/MapSheetMngDto.java index cfc4c2c1..1130f3ac 100644 --- a/src/main/java/com/kamco/cd/kamcoback/mapsheet/dto/MapSheetMngDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/mapsheet/dto/MapSheetMngDto.java @@ -80,7 +80,6 @@ public class MapSheetMngDto { @JsonFormatDttm private ZonedDateTime rgstEndDttm; } - @Schema(name = "ErrorSearchReq", description = "영상관리 오류데이터 검색 요청") @Getter @Setter @@ -109,15 +108,13 @@ public class MapSheetMngDto { String[] sortParams = sort.split(","); String property = sortParams[0]; Sort.Direction direction = - sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC; + sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC; return PageRequest.of(page, size, Sort.by(direction, property)); } return PageRequest.of(page, size); } } - - @Schema(name = "ErrorDataDto", description = "영상관리 오류데이터 검색 리턴") @Getter @Setter @@ -133,11 +130,6 @@ public class MapSheetMngDto { private DataState dataState; } - - - - - @Schema(name = "DmlReturn", description = "영상관리 DML 수행 후 리턴") @Getter @Setter diff --git a/src/main/java/com/kamco/cd/kamcoback/mapsheet/service/MapSheetMngService.java b/src/main/java/com/kamco/cd/kamcoback/mapsheet/service/MapSheetMngService.java index ae41bd8e..96a1a1d8 100644 --- a/src/main/java/com/kamco/cd/kamcoback/mapsheet/service/MapSheetMngService.java +++ b/src/main/java/com/kamco/cd/kamcoback/mapsheet/service/MapSheetMngService.java @@ -218,8 +218,7 @@ public class MapSheetMngService { return mapSheetMngCoreService.findMapSheetErrorList(searchReq); } - public Page findMapSheetMngList( - MapSheetMngDto.MngSearchReq searchReq) { + public Page findMapSheetMngList(MapSheetMngDto.MngSearchReq searchReq) { return mapSheetMngCoreService.findMapSheetMngList(searchReq); } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/core/MapSheetMngCoreService.java b/src/main/java/com/kamco/cd/kamcoback/postgres/core/MapSheetMngCoreService.java index be5c4f63..d7c6c6cc 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/core/MapSheetMngCoreService.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/core/MapSheetMngCoreService.java @@ -20,7 +20,6 @@ import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Page; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @@ -133,7 +132,7 @@ public class MapSheetMngCoreService { entity.setMngYyyy(addReq.getMngYyyy()); entity.setMngPath(addReq.getMngPath()); - //mapSheetMngRepository.deleteMngAll(addReq.getMngYyyy()); + // mapSheetMngRepository.deleteMngAll(addReq.getMngYyyy()); MapSheetMngEntity saved = mapSheetMngRepository.save(entity); int hstCnt = mapSheetMngRepository.insertMapSheetOrgDataToMapSheetMngHst(saved.getMngYyyy()); diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetMngFileEntity.java b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetMngFileEntity.java index b822662b..e3a1e930 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetMngFileEntity.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetMngFileEntity.java @@ -50,5 +50,4 @@ public class MapSheetMngFileEntity { @Column(name = "hst_uid") private Long hstUid; - } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryCustom.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryCustom.java index 72a72f31..79229bce 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryCustom.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryCustom.java @@ -8,7 +8,6 @@ import org.springframework.data.domain.Page; public interface MapSheetMngRepositoryCustom { - Page findMapSheetMngList(MapSheetMngDto.MngSearchReq searchReq); Optional findMapSheetMngHstInfo(Long hstUid); @@ -18,5 +17,5 @@ public interface MapSheetMngRepositoryCustom { void deleteMngAll(int mngYyyy); Page findMapSheetErrorList( - MapSheetMngDto.@Valid ErrorSearchReq searchReq); + MapSheetMngDto.@Valid ErrorSearchReq searchReq); } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java index 65b6d8b6..385d6915 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java @@ -34,18 +34,15 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport private final JPAQueryFactory queryFactory; private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)"); - @PersistenceContext - private EntityManager em; + @PersistenceContext private EntityManager em; public MapSheetMngRepositoryImpl(JPAQueryFactory queryFactory) { super(MapSheetMngHstEntity.class); this.queryFactory = queryFactory; } - @Override - public Page findMapSheetMngList( - MapSheetMngDto.MngSearchReq searchReq) { + public Page findMapSheetMngList(MapSheetMngDto.MngSearchReq searchReq) { Pageable pageable = searchReq.toPageable(); BooleanBuilder whereBuilder = new BooleanBuilder(); @@ -116,73 +113,67 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport return new PageImpl<>(foundContent, pageable, countQuery); } - - - - - @Override public Page findMapSheetErrorList( - MapSheetMngDto.@Valid ErrorSearchReq searchReq) { + MapSheetMngDto.@Valid ErrorSearchReq searchReq) { Pageable pageable = PageRequest.of(searchReq.getPage(), searchReq.getSize()); List 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(); + 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(); Long countQuery = - queryFactory - .select(mapSheetMngHstEntity.hstUid.count()) - .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)) - .fetchOne(); + queryFactory + .select(mapSheetMngHstEntity.hstUid.count()) + .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)) + .fetchOne(); return new PageImpl<>(foundContent, pageable, countQuery); } @Override - public void deleteMngAll(int mngYyyy){ - - } + public void deleteMngAll(int mngYyyy) {} @Override public int insertMapSheetOrgDataToMapSheetMngHst(int mngYyyy) { - String sql = """ + String sql = + """ INSERT INTO tb_map_sheet_mng_hst ( mng_yyyy @@ -214,7 +205,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport int exeCnt = query.executeUpdate(); // 실행 (영향받은 행의 개수 반환) return exeCnt; - } @Override @@ -226,8 +216,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport .fetchOne()); } - - private NumberExpression rowNum() { return Expressions.numberTemplate( Integer.class, "row_number() over(order by {0} desc)", mapSheetMngHstEntity.createdDate);