@@ -939,6 +939,9 @@ public AiJudgmentStatsDTO getAiJudgmentStats(UUID userId, String period) {
939939 return new AiJudgmentStatsDTO (satisfactionRate , dissatisfactionCount , trends );
940940 }
941941
942+ /**
943+ * LLM 지출분석 피드백 통계 조회
944+ */
942945 @ Override
943946 @ Transactional (readOnly = true )
944947 public ExpenseAnalyzerFeedbackStatsDTO getExpenseAnalyzerFeedbackStats (UUID userId , String period ) {
@@ -967,6 +970,9 @@ public ExpenseAnalyzerFeedbackStatsDTO getExpenseAnalyzerFeedbackStats(UUID user
967970 return new ExpenseAnalyzerFeedbackStatsDTO (totalFeedbacks , upCount , downCount , satisfactionRate , trends );
968971 }
969972
973+ /**
974+ * LLM 지출분석 내역 조회
975+ */
970976 @ Override
971977 public AdminExpenseAnalyzerHistoryResponseDTO getExpenseAnalyzerHistory (UUID userId , int page , int limit , String search , String rating , String dateFrom , String dateTo ) {
972978 log .info ("LLM 지출분석 내역 조회 : userId={}, page={}, limit={}, search={}, rating={}, dateFrom={}, dateTo={}" ,userId ,page ,limit ,search ,rating ,dateFrom ,dateTo );
@@ -977,11 +983,9 @@ public AdminExpenseAnalyzerHistoryResponseDTO getExpenseAnalyzerHistory(UUID use
977983
978984 Specification <ExpenseAnalysisHistory > spec = createExpenseAnalysisHistorySpecification (search ,rating , dateFrom , dateTo );
979985
980- Page <ExpenseAnalysisHistory > historyPage = expenseAnalysisHistoryRepository .findAll (spec , pageable );
986+ Page <AdminExpenseAnalyzerHistoryDTO > historyPage = expenseAnalysisHistoryRepository .findHistoryProjection (spec , pageable );
981987
982- List <AdminExpenseAnalyzerHistoryDTO > historyDTOs = historyPage .getContent ().stream ()
983- .map (AdminExpenseAnalyzerHistoryDTO ::from )
984- .collect (Collectors .toList ());
988+ List <AdminExpenseAnalyzerHistoryDTO > historyDTOs = historyPage .getContent ();
985989
986990 PaginationDTO pagination = new PaginationDTO (
987991 page ,
@@ -994,14 +998,23 @@ public AdminExpenseAnalyzerHistoryResponseDTO getExpenseAnalyzerHistory(UUID use
994998 return new AdminExpenseAnalyzerHistoryResponseDTO (historyDTOs , pagination );
995999 }
9961000
1001+ /**
1002+ * 검색 조건에 따라 ExpenseAnalysisHistory 엔티티에 대한 JPA Specification을 생성합니다.
1003+ *
1004+ * @param search 검색어 (이메일 또는 닉네임)
1005+ * @param rating 피드백 평점 (UP 또는 DOWN)
1006+ * @param dateForm 시작 날짜
1007+ * @param dateTo 종료 날짜
1008+ * @return 생성된 Specification
1009+ */
9971010 private Specification <ExpenseAnalysisHistory > createExpenseAnalysisHistorySpecification (String search , String rating , String dateForm , String dateTo ) {
9981011 return (root , query , criteriaBuilder ) -> {
9991012 List <Predicate > predicates = new ArrayList <>();
10001013
10011014 if (StringUtils .hasText (search )) {
10021015 predicates .add (criteriaBuilder .or (
1003- criteriaBuilder .like (criteriaBuilder . lower ( root .get ("user" ).get ("email" )) , "%" + search . toLowerCase () + "%" ),
1004- criteriaBuilder .like (criteriaBuilder . lower ( root .get ("user" ).get ("nickname" )) , "%" + search . toLowerCase () + "%" )
1016+ criteriaBuilder .like (root .get ("user" ).get ("email" ), "%" + search + "%" ),
1017+ criteriaBuilder .like (root .get ("user" ).get ("nickname" ), "%" + search + "%" )
10051018 ));
10061019 }
10071020 if (StringUtils .hasText (rating )) {
@@ -1018,6 +1031,13 @@ private Specification<ExpenseAnalysisHistory> createExpenseAnalysisHistorySpecif
10181031 }
10191032
10201033 @ Override
1034+ /**
1035+ * 특정 지출 분석 내역의 상세 정보를 조회합니다.
1036+ *
1037+ * @param userId 관리자 사용자 ID
1038+ * @param historyId 조회할 지출 분석 내역 ID
1039+ * @return 지출 분석 내역 상세 정보 DTO
1040+ */
10211041 public ExpenseAnalysisHistoryDTO getExpenseAnalyzerHistoryDetail (UUID userId , Long historyId ) {
10221042 log .info ("LLM 지출분석 상세 조회 : userId={}, historyId={}" ,userId ,historyId );
10231043
0 commit comments