Skip to content

Commit 340ef3c

Browse files
authored
Refactor/374 대시보드 기능 리팩토링 (#375)
* refactor/336 입금 환전 내역 수정 * refactor/336 입금 환전 내역 수정 * refactor/336 작가 수익 테스트 수정 * refactor/336 대시보드 메인현황 팔로우수 추가 * refactor/336 대시보드 메인현황 팔로우수 테스트 케이스 작성 * refactor/336 대시보드 팔로우 작가 조회 * refactor/336 대시보드 팔로우 작가 조회 * refactor/336 Response 수정 * refactor/354리뷰 mock 제거 실제 db연동 * refactor/354 레파지토리에 찜 기능 조회 추가 * refactor/354 찜 테스트 기능 추가 및 테스트 오류 수정 * refactor/354 찜 기능 수정 및 팔로우 기능 수정 * refactor/354 찜 기능 수정 및 팔로우 기능 수정 * refactor/354 찜 기능 수정 및 팔로우 기능 수정 * refactor/367 이미지 사용 우선 순위 변경 * refactor/367 상품명 정렬 수정 * refactor/367 교환 요청 조회 정렬 메모리->db 정렬로 변경 * refactor/367 메인현황-상품명 정렬 추가, * refactor/367 관리자대시보드-카테고리 조회 제거 * refactor/367 관리자대시보드-사용자관리 수수료율 정리 수정 * refactor/367 관리자대시보드-전체 펀딩 목록보기 Resoponse간소화 * refactor/367 관리자대시보드-전체 펀딩 목록보기 Resoponse간소화 * refactor/367 관리자대시보드-입점 승인 정렬 수정
1 parent d53827f commit 340ef3c

File tree

10 files changed

+187
-209
lines changed

10 files changed

+187
-209
lines changed

src/main/java/com/back/domain/artist/repository/ArtistApplicationRepository.java

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,52 @@ public interface ArtistApplicationRepository extends JpaRepository<ArtistApplica
1818
Optional<ArtistApplication> findFirstByUserIdOrderByCreateDateDesc(Long userId); // 최근 신청 1건 조회
1919
boolean existsByUserIdAndStatus(Long userId, ApplicationStatus status); // 중복 신청 방지용 - 특정 상태의 작가 신청서 존재 여부 확인
2020

21-
2221
// ==== 관리자용 ==== //
23-
Page<ArtistApplication> findAllByOrderByCreateDateDesc(Pageable pageable); // 모든 작가 신청서 조회
24-
Page<ArtistApplication> findByStatusOrderByCreateDateDesc( // 상태별 작가 신청서 조회
25-
ApplicationStatus status, Pageable pageable);
2622
long countByStatus(ApplicationStatus status); // 대시보드 통계용 - 특정 상태의 작가 신청서 개수 조회
2723

28-
// 검색
29-
@Query("SELECT a FROM ArtistApplication a WHERE a.artistName LIKE %:artistName% ORDER BY a.createDate DESC")
30-
Page<ArtistApplication> findByArtistNameContainingOrderByCreateDateDesc( // 작가명 검색
31-
@Param("artistName") String artistName, Pageable pageable
32-
);
33-
3424
// userId로 조회
3525
Optional<ArtistApplication> findByUserId(Long userId);
26+
27+
// ==== 관리자 대시보드용 - 동적 정렬 지원 ==== //
28+
/**
29+
* 관리자 입점 신청 목록 조회 (검색 + 필터링 + 동적 정렬)
30+
*
31+
* 기능:
32+
* - 작가명, 이메일, 작가ID로 검색 (keyword)
33+
* - 상태별 필터링 (status)
34+
* - 작가ID, 작가명, 신청일자, 상태로 정렬 (sort, order)
35+
*
36+
* @param keyword 검색어 (작가명/이메일/작가ID)
37+
* @param status 신청 상태 (PENDING/APPROVED/REJECTED/CANCELLED)
38+
* @param sort 정렬 기준 (artistId/artistName/submittedAt/status)
39+
* @param order 정렬 순서 (ASC/DESC)
40+
* @param pageable 페이징 정보
41+
* @return 입점 신청 목록
42+
*/
43+
@Query("""
44+
SELECT a FROM ArtistApplication a
45+
LEFT JOIN FETCH a.user u
46+
WHERE (:keyword IS NULL OR
47+
LOWER(a.artistName) LIKE LOWER(CONCAT('%', :keyword, '%')) OR
48+
LOWER(u.email) LIKE LOWER(CONCAT('%', :keyword, '%')) OR
49+
CAST(u.id AS string) LIKE CONCAT('%', :keyword, '%'))
50+
AND (:status IS NULL OR a.status = :status)
51+
ORDER BY
52+
CASE WHEN :sort = 'artistId' AND :order = 'ASC' THEN u.id END ASC,
53+
CASE WHEN :sort = 'artistId' AND :order = 'DESC' THEN u.id END DESC,
54+
CASE WHEN :sort = 'artistName' AND :order = 'ASC' THEN a.artistName END ASC,
55+
CASE WHEN :sort = 'artistName' AND :order = 'DESC' THEN a.artistName END DESC,
56+
CASE WHEN :sort = 'submittedAt' AND :order = 'ASC' THEN a.createDate END ASC,
57+
CASE WHEN :sort = 'submittedAt' AND :order = 'DESC' THEN a.createDate END DESC,
58+
CASE WHEN :sort = 'status' AND :order = 'ASC' THEN a.status END ASC,
59+
CASE WHEN :sort = 'status' AND :order = 'DESC' THEN a.status END DESC,
60+
a.createDate DESC
61+
""")
62+
Page<ArtistApplication> findArtistApplicationsForAdmin(
63+
@Param("keyword") String keyword,
64+
@Param("status") ApplicationStatus status,
65+
@Param("sort") String sort,
66+
@Param("order") String order,
67+
Pageable pageable
68+
);
3669
}

src/main/java/com/back/domain/artist/service/ArtistApplicationAdminService.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,15 @@ public class ArtistApplicationAdminService {
3434
* TODO: 대시보드 파트와 겹치는 부분이어서 통합 고려
3535
*/
3636
public Page<ArtistApplicationSimpleResponse> getAllApplications(Pageable pageable) {
37+
// 새로운 동적 쿼리 사용 (keyword, status null로 전체 조회, 기본 정렬: submittedAt DESC)
3738
Page<ArtistApplication> applications =
38-
artistApplicationRepository.findAllByOrderByCreateDateDesc(pageable);
39+
artistApplicationRepository.findArtistApplicationsForAdmin(
40+
null, // keyword: 검색어 없음 (전체 조회)
41+
null, // status: 상태 필터 없음 (전체 조회)
42+
"submittedAt", // 신청일자 기준 정렬
43+
"DESC", // 최신순
44+
pageable
45+
);
3946

4047
return applications.map(ArtistApplicationSimpleResponse::from);
4148
}

src/main/java/com/back/domain/dashboard/admin/dto/response/AdminArtistApplicationResponse.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ public record Application(
5959
* 작가 정보
6060
*/
6161
public record Artist(
62-
/** 회원 ID */
62+
/** 작가 ID (User ID) */
63+
Long artistId,
64+
/** 회원 ID (이메일) */
6365
String memberId,
6466
/** 작가명 */
6567
String name

src/main/java/com/back/domain/dashboard/admin/dto/response/AdminFundingApprovalResponse.java

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,18 @@ public record AdminFundingApprovalResponse(
2525
) {
2626

2727
/**
28-
* 펀딩 승인 대기 정보
28+
* 펀딩 승인 대기 정보 (화면 표시 필드만)
2929
*/
3030
public record FundingApproval(
3131
/** 펀딩 ID */
3232
Long fundingId,
33-
/** 펀딩 제목 */
34-
String title,
35-
/** 작가 정보 */
36-
Artist artist,
37-
/** 목표 금액 */
38-
long targetAmount,
39-
/** 펀딩 시작일 */
40-
String startDate,
41-
/** 펀딩 종료일 */
42-
String endDate,
43-
/** 펀딩 신청일 */
44-
String registeredAt,
45-
/** 메인 이미지 */
46-
String mainImage
47-
) {}
48-
49-
/**
50-
* 작가 정보
51-
*/
52-
public record Artist(
5333
/** 작가 ID */
54-
Long id,
34+
Long artistId,
5535
/** 작가명 */
56-
String name,
57-
/** 이메일 */
58-
String email
36+
String artistName,
37+
/** 펀딩 제목 */
38+
String title,
39+
/** 신청일자 */
40+
String registeredAt
5941
) {}
6042
}

src/main/java/com/back/domain/dashboard/admin/dto/response/AdminFundingResponse.java

Lines changed: 9 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -24,80 +24,22 @@ public record AdminFundingResponse(
2424
) {
2525

2626
/**
27-
* 펀딩 정보
27+
* 펀딩 정보 (화면 표시 필드만, 평면 구조)
2828
*/
2929
public record Funding(
30-
/** 펀딩 ID */
30+
/** 펀딩 ID (기본키) */
3131
Long fundingId,
32+
/** 작가 ID */
33+
Long artistId,
34+
/** 작가명 */
35+
String artistName,
3236
/** 펀딩 제목 */
3337
String title,
34-
/** 작가 정보 */
35-
Artist artist,
36-
/** 카테고리 정보 */
37-
Category category,
38-
/** 펀딩 상태 */
39-
String status,
40-
/** 목표 금액 */
41-
long targetAmount,
42-
/** 현재 금액 */
43-
long currentAmount,
4438
/** 달성률 (%) */
4539
int achievementRate,
46-
/** 후원자 수 */
47-
int supporterCount,
40+
/** 펀딩 상태 */
41+
String status,
4842
/** 마감일 */
49-
String endDate,
50-
/** 등록일 */
51-
String registeredAt,
52-
/** 남은 일수 */
53-
int remainingDays,
54-
/** 메인 이미지 */
55-
String mainImage,
56-
/** 권한 정보 */
57-
Permissions permissions,
58-
/** 플래그 정보 */
59-
Flags flags
60-
) {}
61-
62-
/**
63-
* 작가 정보
64-
*/
65-
public record Artist(
66-
/** 작가 ID */
67-
Long id,
68-
/** 회원 ID */
69-
String memberId,
70-
/** 작가명 */
71-
String name
72-
) {}
73-
74-
/**
75-
* 카테고리 정보
76-
*/
77-
public record Category(
78-
/** 카테고리 ID */
79-
Long id,
80-
/** 카테고리명 */
81-
String name
82-
) {}
83-
84-
/**
85-
* 권한 정보
86-
*/
87-
public record Permissions(
88-
/** 일시정지 가능 여부 */
89-
boolean canPause,
90-
/** 판매 전환 승인 가능 여부 */
91-
boolean canApproveSale
92-
) {}
93-
94-
/**
95-
* 플래그 정보
96-
*/
97-
public record Flags(
98-
/** 목표 달성 여부 */
99-
boolean goalAchieved,
100-
/** 마감 임박 여부 */
101-
boolean dueSoon
43+
String endDate
10244
) {}
10345
}

src/main/java/com/back/domain/dashboard/admin/dto/response/AdminProductResponse.java

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,39 +31,17 @@ public record AdminProductResponse(
3131
* 상품 정보
3232
*/
3333
public record Product(
34-
/** 상품 ID */
34+
/** 상품 ID (기본키) */
3535
Long productId,
3636
/** 상품 번호 */
3737
String productNumber,
3838
/** 상품명 */
3939
String name,
40-
/** 작가 정보 */
41-
Artist artist,
40+
/** 작가명 */
41+
String artistName,
4242
/** 판매 상태 */
4343
String sellingStatus,
44-
/** 카테고리 정보 */
45-
Category category,
4644
/** 등록일 */
4745
LocalDate registeredAt
4846
) {}
49-
50-
/**
51-
* 작가 정보
52-
*/
53-
public record Artist(
54-
/** 작가 ID */
55-
Long id,
56-
/** 작가명 */
57-
String name
58-
) {}
59-
60-
/**
61-
* 카테고리 정보
62-
*/
63-
public record Category(
64-
/** 카테고리 ID */
65-
Long id,
66-
/** 카테고리명 */
67-
String name
68-
) {}
6947
}

0 commit comments

Comments
 (0)