[KC-116] shp 파일 다운로드 이력 추가

This commit is contained in:
2026-01-19 17:42:12 +09:00
parent 183b4df7f8
commit a586c440fb
6 changed files with 41 additions and 19 deletions

View File

@@ -416,7 +416,11 @@ public class InferenceResultApiController {
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
}) })
@GetMapping(value = "/download/{uuid}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE) @GetMapping(value = "/download/{uuid}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public ResponseEntity<Resource> downloadShp(@PathVariable UUID uuid) throws IOException { public ResponseEntity<Resource> downloadShp(
@Parameter(description = "uuid", example = "0192efc6-9ec2-43ee-9a90-5b73e763c09f")
@PathVariable
UUID uuid)
throws IOException {
String path; String path;
try { try {
@@ -445,8 +449,21 @@ public class InferenceResultApiController {
.body((Resource) resource); .body((Resource) resource);
} }
@Operation(summary = "shp 파일 다운로드 이력", description = "추론관리 분석결과 shp 파일 다운로드 이")
@GetMapping(value = "/download-audit/{uuid}") @GetMapping(value = "/download-audit/{uuid}")
public ApiResponseDto<Page<AuditLogDto.Basic>> 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<Page<AuditLogDto.DownloadRes>> downloadAudit(
@Parameter(description = "UUID", example = "0192efc6-9ec2-43ee-9a90-5b73e763c09f") @Parameter(description = "UUID", example = "0192efc6-9ec2-43ee-9a90-5b73e763c09f")
@PathVariable @PathVariable
UUID uuid, UUID uuid,
@@ -457,7 +474,7 @@ public class InferenceResultApiController {
LocalDate strtDttm, LocalDate strtDttm,
@Parameter(description = "다운로드일 종료", example = "2026-01-01") @RequestParam(required = false) @Parameter(description = "다운로드일 종료", example = "2026-01-01") @RequestParam(required = false)
LocalDate endDttm, LocalDate endDttm,
@Parameter(description = "키워드", example = "변화탐지") @RequestParam(required = false) @Parameter(description = "키워드", example = "관리자") @RequestParam(required = false)
String searchValue, String searchValue,
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
int page, int page,

View File

@@ -569,7 +569,7 @@ public class InferenceResultService {
* @param type 검색 구분 * @param type 검색 구분
* @param searchValue 키워드 * @param searchValue 키워드
*/ */
public Page<AuditLogDto.Basic> getDownloadAudit( public Page<AuditLogDto.DownloadRes> getDownloadAudit(
AuditLogDto.searchReq searchReq, DownloadReq downloadReq) { AuditLogDto.searchReq searchReq, DownloadReq downloadReq) {
return auditLogCoreService.findLogByAccount(searchReq, downloadReq); return auditLogCoreService.findLogByAccount(searchReq, downloadReq);
} }

View File

@@ -253,6 +253,16 @@ public class AuditLogDto {
String requestUri; String requestUri;
} }
@Getter
@Setter
@AllArgsConstructor
public static class DownloadRes {
String name;
String employeeNo;
@JsonFormatDttm ZonedDateTime downloadDttm;
}
@CodeExpose @CodeExpose
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor

View File

@@ -46,7 +46,7 @@ public class AuditLogCoreService
return auditLogRepository.findLogByAccount(searchRange, searchValue); return auditLogRepository.findLogByAccount(searchRange, searchValue);
} }
public Page<AuditLogDto.Basic> findLogByAccount( public Page<AuditLogDto.DownloadRes> findLogByAccount(
AuditLogDto.searchReq searchReq, DownloadReq downloadReq) { AuditLogDto.searchReq searchReq, DownloadReq downloadReq) {
return auditLogRepository.findDownloadLog(searchReq, downloadReq); return auditLogRepository.findDownloadLog(searchReq, downloadReq);
} }

View File

@@ -16,7 +16,8 @@ public interface AuditLogRepositoryCustom {
Page<AuditLogDto.UserAuditList> findLogByAccount( Page<AuditLogDto.UserAuditList> findLogByAccount(
AuditLogDto.searchReq searchReq, String searchValue); AuditLogDto.searchReq searchReq, String searchValue);
Page<AuditLogDto.Basic> findDownloadLog(AuditLogDto.searchReq searchReq, DownloadReq downloadReq); Page<AuditLogDto.DownloadRes> findDownloadLog(
AuditLogDto.searchReq searchReq, DownloadReq downloadReq);
Page<AuditLogDto.DailyDetail> findLogByDailyResult( Page<AuditLogDto.DailyDetail> findLogByDailyResult(
AuditLogDto.searchReq searchReq, LocalDate logDate); AuditLogDto.searchReq searchReq, LocalDate logDate);

View File

@@ -160,7 +160,8 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
} }
@Override @Override
public Page<AuditLogDto.Basic> findDownloadLog(AuditLogDto.searchReq searchReq, DownloadReq req) { public Page<AuditLogDto.DownloadRes> findDownloadLog(
AuditLogDto.searchReq searchReq, DownloadReq req) {
Pageable pageable = searchReq.toPageable(); Pageable pageable = searchReq.toPageable();
BooleanBuilder whereBuilder = new BooleanBuilder(); BooleanBuilder whereBuilder = new BooleanBuilder();
@@ -183,21 +184,14 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
} }
} }
List<AuditLogDto.Basic> foundContent = List<AuditLogDto.DownloadRes> foundContent =
queryFactory queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
AuditLogDto.Basic.class, AuditLogDto.DownloadRes.class,
auditLogEntity.id, memberEntity.name,
auditLogEntity.userUid, memberEntity.employeeNo,
auditLogEntity.eventType, auditLogEntity.createdDate.as("downloadDttm")))
auditLogEntity.eventStatus,
auditLogEntity.menuUid,
auditLogEntity.ipAddress,
auditLogEntity.requestUri,
auditLogEntity.requestBody,
auditLogEntity.errorLogUid,
auditLogEntity.createdDate))
.from(auditLogEntity) .from(auditLogEntity)
.leftJoin(memberEntity) .leftJoin(memberEntity)
.on(auditLogEntity.userUid.eq(memberEntity.id)) .on(auditLogEntity.userUid.eq(memberEntity.id))