diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java b/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java index c01092f0..45133c4c 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java @@ -416,7 +416,11 @@ public class InferenceResultApiController { @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) }) @GetMapping(value = "/download/{uuid}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) - public ResponseEntity downloadShp(@PathVariable UUID uuid) throws IOException { + public ResponseEntity downloadShp( + @Parameter(description = "uuid", example = "0192efc6-9ec2-43ee-9a90-5b73e763c09f") + @PathVariable + UUID uuid) + throws IOException { String path; try { @@ -445,8 +449,21 @@ public class InferenceResultApiController { .body((Resource) resource); } + @Operation(summary = "shp 파일 다운로드 이력", description = "추론관리 분석결과 shp 파일 다운로드 이") @GetMapping(value = "/download-audit/{uuid}") - public ApiResponseDto> downloadAudit( + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(implementation = Page.class))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) + public ApiResponseDto> downloadAudit( @Parameter(description = "UUID", example = "0192efc6-9ec2-43ee-9a90-5b73e763c09f") @PathVariable UUID uuid, @@ -457,7 +474,7 @@ public class InferenceResultApiController { LocalDate strtDttm, @Parameter(description = "다운로드일 종료", example = "2026-01-01") @RequestParam(required = false) LocalDate endDttm, - @Parameter(description = "키워드", example = "변화탐지") @RequestParam(required = false) + @Parameter(description = "키워드", example = "관리자") @RequestParam(required = false) String searchValue, @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") int page, diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/service/InferenceResultService.java b/src/main/java/com/kamco/cd/kamcoback/inference/service/InferenceResultService.java index 00a2aaaa..d858d886 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/service/InferenceResultService.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/service/InferenceResultService.java @@ -569,7 +569,7 @@ public class InferenceResultService { * @param type 검색 구분 * @param searchValue 키워드 */ - public Page getDownloadAudit( + public Page getDownloadAudit( AuditLogDto.searchReq searchReq, DownloadReq downloadReq) { return auditLogCoreService.findLogByAccount(searchReq, downloadReq); } diff --git a/src/main/java/com/kamco/cd/kamcoback/log/dto/AuditLogDto.java b/src/main/java/com/kamco/cd/kamcoback/log/dto/AuditLogDto.java index 9f19692f..3fb528bc 100644 --- a/src/main/java/com/kamco/cd/kamcoback/log/dto/AuditLogDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/log/dto/AuditLogDto.java @@ -253,6 +253,16 @@ public class AuditLogDto { String requestUri; } + @Getter + @Setter + @AllArgsConstructor + public static class DownloadRes { + + String name; + String employeeNo; + @JsonFormatDttm ZonedDateTime downloadDttm; + } + @CodeExpose @Getter @AllArgsConstructor diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/core/AuditLogCoreService.java b/src/main/java/com/kamco/cd/kamcoback/postgres/core/AuditLogCoreService.java index 777e8ebb..be798e7e 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/core/AuditLogCoreService.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/core/AuditLogCoreService.java @@ -46,7 +46,7 @@ public class AuditLogCoreService return auditLogRepository.findLogByAccount(searchRange, searchValue); } - public Page findLogByAccount( + public Page findLogByAccount( AuditLogDto.searchReq searchReq, DownloadReq downloadReq) { return auditLogRepository.findDownloadLog(searchReq, downloadReq); } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryCustom.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryCustom.java index 5670eded..2ab99ad6 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryCustom.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryCustom.java @@ -16,7 +16,8 @@ public interface AuditLogRepositoryCustom { Page findLogByAccount( AuditLogDto.searchReq searchReq, String searchValue); - Page findDownloadLog(AuditLogDto.searchReq searchReq, DownloadReq downloadReq); + Page findDownloadLog( + AuditLogDto.searchReq searchReq, DownloadReq downloadReq); Page findLogByDailyResult( AuditLogDto.searchReq searchReq, LocalDate logDate); diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryImpl.java index f8c07ed2..fc5499e9 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/log/AuditLogRepositoryImpl.java @@ -160,7 +160,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport } @Override - public Page findDownloadLog(AuditLogDto.searchReq searchReq, DownloadReq req) { + public Page findDownloadLog( + AuditLogDto.searchReq searchReq, DownloadReq req) { Pageable pageable = searchReq.toPageable(); BooleanBuilder whereBuilder = new BooleanBuilder(); @@ -183,21 +184,14 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport } } - List foundContent = + List foundContent = queryFactory .select( Projections.constructor( - AuditLogDto.Basic.class, - auditLogEntity.id, - auditLogEntity.userUid, - auditLogEntity.eventType, - auditLogEntity.eventStatus, - auditLogEntity.menuUid, - auditLogEntity.ipAddress, - auditLogEntity.requestUri, - auditLogEntity.requestBody, - auditLogEntity.errorLogUid, - auditLogEntity.createdDate)) + AuditLogDto.DownloadRes.class, + memberEntity.name, + memberEntity.employeeNo, + auditLogEntity.createdDate.as("downloadDttm"))) .from(auditLogEntity) .leftJoin(memberEntity) .on(auditLogEntity.userUid.eq(memberEntity.id))