|
18 | 18 | import store.lastdance.domain.user.UserRole; |
19 | 19 | import store.lastdance.dto.admin.*; |
20 | 20 | import store.lastdance.dto.common.ErrorResponseDTO; |
| 21 | +import store.lastdance.dto.expense.ExpenseAnalysisHistoryDTO; |
21 | 22 | import store.lastdance.security.oauth.CustomOAuth2User; |
22 | 23 | import store.lastdance.service.admin.AdminService; |
23 | 24 | import store.lastdance.dto.response.ApiResponse; |
@@ -537,4 +538,116 @@ public ResponseEntity<ApiResponse<AiJudgmentStatsDTO>> getAiJudgmentStats( |
537 | 538 | return ResponseEntity.ok(ApiResponse.success(stats, "AI 피드백 통계 조회 성공")); |
538 | 539 | } |
539 | 540 |
|
| 541 | + @Operation( |
| 542 | + summary = "LLM 지출분석 피드백 통계 조회", |
| 543 | + description = "LLM 지출분석 피드백에 대한 통계 정보를 조회합니다. 만족도, 불만족 카운트, 추세 등을 포함합니다.", |
| 544 | + security = @SecurityRequirement(name = "bearerAuth") |
| 545 | + ) |
| 546 | + @ApiResponses(value = { |
| 547 | + @io.swagger.v3.oas.annotations.responses.ApiResponse( |
| 548 | + responseCode = "200", |
| 549 | + description = "LLM 지출분석 피드백 통계 조회 성공", |
| 550 | + content = @Content(schema = @Schema(implementation = ExpenseAnalyzerFeedbackStatsDTO.class)) |
| 551 | + ), |
| 552 | + @io.swagger.v3.oas.annotations.responses.ApiResponse( |
| 553 | + responseCode = "400", |
| 554 | + description = "잘못된 기간 파라미터", |
| 555 | + content = @Content(schema = @Schema(implementation = ErrorResponseDTO.class)) |
| 556 | + ), |
| 557 | + @io.swagger.v3.oas.annotations.responses.ApiResponse( |
| 558 | + responseCode = "403", |
| 559 | + description = "관리자 권한 없음", |
| 560 | + content = @Content(schema = @Schema(implementation = ErrorResponseDTO.class)) |
| 561 | + ) |
| 562 | + }) |
| 563 | + @GetMapping("/expense/analyzer/stats") |
| 564 | + public ResponseEntity<ApiResponse<ExpenseAnalyzerFeedbackStatsDTO>> getExpenseAnalyzerFeedbackStats( |
| 565 | + @Parameter(description = "조회 기간 (daily, weekly, monthly)") @RequestParam(value = "period", defaultValue = "weekly") String period, |
| 566 | + @AuthenticationPrincipal CustomOAuth2User user) { |
| 567 | + |
| 568 | + log.info("LLM 지출분석 피드백 통계 요청: period={}, adminEmail={}", period, user.getEmail()); |
| 569 | + |
| 570 | + ExpenseAnalyzerFeedbackStatsDTO stats = adminService.getExpenseAnalyzerFeedbackStats(user.getUserId(), period); |
| 571 | + |
| 572 | + log.info("LLM 지출분석 피드백 통계 응답: {}", stats); |
| 573 | + |
| 574 | + return ResponseEntity.ok(ApiResponse.success(stats, "LLM 지출분석 피드백 통계 조회 성공")); |
| 575 | + } |
| 576 | + |
| 577 | + @Operation( |
| 578 | + summary = "LLM 지출분석 내역 조회", |
| 579 | + description = "LLM 지출분석 내역을 조회합니다. 사용자, 평가, 날짜 등으로 필터링할 수 있습니다.", |
| 580 | + security = @SecurityRequirement(name = "bearerAuth") |
| 581 | + ) |
| 582 | + @ApiResponses(value = { |
| 583 | + @io.swagger.v3.oas.annotations.responses.ApiResponse( |
| 584 | + responseCode = "200", |
| 585 | + description = "LLM 지출분석 내역 조회 성공", |
| 586 | + content = @Content(schema = @Schema(implementation = AdminExpenseAnalyzerHistoryResponseDTO.class)) |
| 587 | + ), |
| 588 | + @io.swagger.v3.oas.annotations.responses.ApiResponse( |
| 589 | + responseCode = "403", |
| 590 | + description = "관리자 권한 없음", |
| 591 | + content = @Content(schema = @Schema(implementation = ErrorResponseDTO.class)) |
| 592 | + ) |
| 593 | + }) |
| 594 | + @GetMapping("/expense/analyzer") |
| 595 | + public ResponseEntity<ApiResponse<AdminExpenseAnalyzerHistoryResponseDTO>> getExpenseAnalyzerHistory( |
| 596 | + @Parameter(description = "페이지 번호 (1부터 시작)") @RequestParam(value = "page", defaultValue = "1") int page, |
| 597 | + @Parameter(description = "페이지당 조회할 항목 수") @RequestParam(value = "limit", defaultValue = "20") int limit, |
| 598 | + @Parameter(description = "검색 키워드 (사용자 이메일, 닉네임)") @RequestParam(value = "search", required = false) String search, |
| 599 | + @Parameter(description = "평가 필터 (UP, DOWN)") @RequestParam(value = "rating", required = false) String rating, |
| 600 | + @Parameter(description = "시작 날짜 (YYYY-MM-DD)") @RequestParam(value = "dateFrom", required = false) String dateFrom, |
| 601 | + @Parameter(description = "종료 날짜 (YYYY-MM-DD)") @RequestParam(value = "dateTo", required = false) String dateTo, |
| 602 | + @AuthenticationPrincipal CustomOAuth2User user) { |
| 603 | + |
| 604 | + log.info("LLM 지출분석 내역 요청: page={}, limit={}, search={}, rating={}, dateFrom={}, dateTo={}, adminEmail={}", |
| 605 | + page, limit, search, rating, dateFrom, dateTo, user.getEmail()); |
| 606 | + |
| 607 | + AdminExpenseAnalyzerHistoryResponseDTO historyList = adminService.getExpenseAnalyzerHistory( |
| 608 | + user.getUserId(), page, limit, search, rating, dateFrom, dateTo |
| 609 | + ); |
| 610 | + |
| 611 | + if (historyList != null && historyList.histories() != null) { |
| 612 | + log.info("LLM 지출분석 내역 응답: {}건 조회", historyList.histories().size()); |
| 613 | + } |
| 614 | + |
| 615 | + return ResponseEntity.ok(ApiResponse.success(historyList, "LLM 지출분석 내역 조회 성공")); |
| 616 | + } |
| 617 | + |
| 618 | + @Operation( |
| 619 | + summary = "LLM 지출분석 상세 조회", |
| 620 | + description = "특정 LLM 지출분석의 상세 정보를 조회합니다.", |
| 621 | + security = @SecurityRequirement(name = "bearerAuth") |
| 622 | + ) |
| 623 | + @ApiResponses(value = { |
| 624 | + @io.swagger.v3.oas.annotations.responses.ApiResponse( |
| 625 | + responseCode = "200", |
| 626 | + description = "LLM 지출분석 상세 조회 성공", |
| 627 | + content = @Content(schema = @Schema(implementation = ExpenseAnalysisHistoryDTO.class)) |
| 628 | + ), |
| 629 | + @io.swagger.v3.oas.annotations.responses.ApiResponse( |
| 630 | + responseCode = "403", |
| 631 | + description = "관리자 권한 없음", |
| 632 | + content = @Content(schema = @Schema(implementation = ErrorResponseDTO.class)) |
| 633 | + ), |
| 634 | + @io.swagger.v3.oas.annotations.responses.ApiResponse( |
| 635 | + responseCode = "404", |
| 636 | + description = "내역을 찾을 수 없음", |
| 637 | + content = @Content(schema = @Schema(implementation = ErrorResponseDTO.class)) |
| 638 | + ) |
| 639 | + }) |
| 640 | + @GetMapping("/expense/analyzer/{historyId}") |
| 641 | + public ResponseEntity<ApiResponse<ExpenseAnalysisHistoryDTO>> getExpenseAnalyzerHistoryDetail( |
| 642 | + @Parameter(description = "조회할 내역 ID", required = true) @PathVariable Long historyId, |
| 643 | + @AuthenticationPrincipal CustomOAuth2User user) { |
| 644 | + |
| 645 | + log.info("LLM 지출분석 상세 요청: historyId={}, adminEmail={}", historyId, user.getEmail()); |
| 646 | + |
| 647 | + ExpenseAnalysisHistoryDTO historyDetail = adminService.getExpenseAnalyzerHistoryDetail(user.getUserId(), historyId); |
| 648 | + |
| 649 | + log.info("LLM 지출분석 상세 응답: {}", historyDetail); |
| 650 | + |
| 651 | + return ResponseEntity.ok(ApiResponse.success(historyDetail, "LLM 지출분석 상세 조회 성공")); |
| 652 | + } |
540 | 653 | } |
0 commit comments