Skip to content

Commit 11b4e22

Browse files
authored
Feat/247 알림 기능 구현 및 대시보드 코드 수정 (#272)
* feat/164 creatAt이었던 부분이 creatDate를 참조해야되는 문제 해결 * refactor/204 주문 조회 db 연결 * refactor/204 주문 조회 db 연결 * refactor/204 참여한 펀딩 조회 코드 개선 * refactor/204 작가용 대시보드 펀딩-통계 부분 제거 * refactor/204 작가용 대시보드 사용자 설정 실제 db 연결 * refactor/204 관리자용 대쉬보드- GA4 사용 안해서 제거 * refactor/204 작가용 대시보드- 취소 요청 실제 db로 연동 * refactor/204 작가용 대시보드- 타임존 변경, 테스트 문제 해결 * refactor/204 작가용 대시보드- 교환 요청 실제 db랑 연결 * refactor/204 작가용 대시보드- 교환 요청 테스트 코드 추가 * refactor/204 작가용 대시보드- 테스트코드 정리 * refactor/204 작가용 대시보드- serviceimpl 코드 정리 * refactor/204 작가용 대시보드- serviceimpl 코드 정리 * refactor/216 작가용 대시보드- 주문 조회 실제 db 연동 * refactor/216 대시보드-메인현황 실제 db랑 연동 (팔로우빼고) * refactor/216 대시보드-메인현황 실제 db랑 연동 (팔로우빼고) * refactor/216 대시보드-메인현황 실제 db 테스트 코드 구현 * refactor/231 관리자 대시보드- 펀딩 실 db연결 * refactor/231 GA4 Uuid 사용으로 변경 * refactor/231 펀딩 카테고리 id 제거 * refactor/231 관리자 대시보드 매출/정산 DB 연동 구현 * refactor/231 관리자 대시보드 매출/정산 DB 연동 구현 * refactor/231 관리자 대시보드 메인현황 실제 DB랑 연동-펀딩 알림 미완 * refactor/231 관리자 대시보드 메인현황 실제 DB랑 연동-펀딩 알림 미완 * refactor/231 관리자 대시보드 메인현황 실제 DB랑 연동-펀딩 알림 미완 * refactor/231 관리자 대시보드 메인현황 실제 DB랑 연동 테스트 구현 * refactor/231 관리자 대시보드 메인현황 실제 DB랑 연동 테스트 구현 * refactor/231 고객용 대시보드 교환/반품 신청 모달 실제 DB랑 연동 * refactor/231 고객용 대시보드 교환/반품 신청 모달 실제 DB랑 연동 -테스트케이스 구현 * feat/247 교환/반품 상세보기 삭제 * feat/247 알림 기능 구현 * feat/247 알림 테스트 코드 구현 * feat/247 작가 신청 취소 상태 추가 * feat/247 service에 삭제를 취소로 변경 * feat/247 controller 사용자 취소 추가 * feat/247 고객용 대시보드 작가 신청 내역 조회 실제 db연동 * feat/247 고객용 대시보드 작가 신청 내역 조회 테스트 코드 작성 * feat/247 주석 정리 * feat/247 swagger 명칭 정리 * feat/247 service mock 테스트 실제 db 테스트로 수정 * feat/247 펀딩 테스트 수정 * feat/247 작가 신청 취소 테스트 수정 * feat/247 작가 신청 취소 테스트 삭제
1 parent 264e7fe commit 11b4e22

File tree

28 files changed

+1892
-1300
lines changed

28 files changed

+1892
-1300
lines changed

.claude/settings.local.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(./gradlew test:*)"
5+
],
6+
"deny": [],
7+
"ask": []
8+
}
9+
}

src/main/java/com/back/domain/artist/entity/ApplicationStatus.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
public enum ApplicationStatus {
44
PENDING, // 대기중
55
APPROVED, // 승인
6-
REJECTED // 거절
6+
REJECTED, // 거절
7+
CANCELLED // 취소
78
}

src/main/java/com/back/domain/artist/entity/ArtistApplication.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ public void reject(Long reviewerId, String reviewerName, String rejectionReason)
137137
this.rejectionReason = rejectionReason;
138138
}
139139

140+
/**
141+
* 신청서 취소 (사용자가 취소)
142+
*/
143+
public void cancel() {
144+
validateCanChangeStatus();
145+
this.status = ApplicationStatus.CANCELLED;
146+
this.reviewedAt = LocalDateTime.now();
147+
}
148+
140149

141150
// ==== 상태 검증 메서드들 ==== //
142151

@@ -152,6 +161,10 @@ public boolean isRejected() {
152161
return ApplicationStatus.REJECTED.equals(this.status);
153162
}
154163

164+
public boolean isCancelled() {
165+
return ApplicationStatus.CANCELLED.equals(this.status);
166+
}
167+
155168
private void validateCanChangeStatus() {
156169
if (!isPending()) throw new ServiceException("500", "대기중 상태의 신청서만 승인/거절할 수 있습니다.");
157170

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import com.back.domain.artist.entity.ArtistDocument;
1010
import com.back.domain.artist.entity.DocumentType;
1111
import com.back.domain.artist.repository.ArtistApplicationRepository;
12+
import com.back.domain.notification.entity.NotificationType;
13+
import com.back.domain.notification.service.NotificationService;
1214
import com.back.domain.user.entity.User;
1315
import com.back.domain.user.repository.UserRepository;
1416
import com.back.global.exception.ServiceException;
@@ -33,6 +35,7 @@ public class ArtistApplicationService {
3335

3436
private final ArtistApplicationRepository artistApplicationRepository;
3537
private final UserRepository userRepository;
38+
private final NotificationService notificationService;
3639

3740
/**
3841
* 작가 신청서 생성
@@ -60,6 +63,17 @@ public Long createApplication(Long userId, ArtistApplicationRequest request) {
6063

6164
log.info("작가 신청서 생성 완료: userId={}, applicationId={}", userId, savedApplication.getId());
6265

66+
// 6. 알림 발송 - 모든 관리자에게 작가 인증 신청 알림
67+
List<User> admins = userRepository.findAllAdmins();
68+
for (User admin : admins) {
69+
notificationService.sendNotification(
70+
admin,
71+
NotificationType.ARTIST_VERIFICATION_REQUEST,
72+
user.getName() + "님이 작가 인증을 신청했습니다.",
73+
"/admin/artist-applications/" + savedApplication.getId()
74+
);
75+
}
76+
6377
return savedApplication.getId();
6478
}
6579

@@ -95,7 +109,7 @@ public ArtistApplicationResponse getApplicationById(Long userId, Long applicatio
95109
}
96110

97111
/**
98-
* 작가 신청 취소 (삭제)
112+
* 작가 신청 취소 (상태 변경)
99113
*/
100114
@Transactional
101115
public void cancelApplication(Long userId, Long applicationId) {
@@ -105,8 +119,8 @@ public void cancelApplication(Long userId, Long applicationId) {
105119
// 2. 취소 가능한 상태인지 확인
106120
validateCancellable(application);
107121

108-
// 3. 신청서 삭제
109-
artistApplicationRepository.delete(application);
122+
// 3. 신청서 상태를 취소로 변경
123+
application.cancel();
110124

111125
log.info("작가 신청 취소 완료: userId={}, applicationId={}", userId, applicationId);
112126
}

src/main/java/com/back/domain/dashboard/admin/controller/AdminDashboardController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
@RequestMapping("/api/dashboard/admin")
4141
@RequiredArgsConstructor
4242
@Slf4j
43-
@Tag(name = "AdminDashboardController", description = "관리자 대시보드 컨트롤러")
43+
@Tag(name = "관리자용 대시보드", description = "관리자 대시보드 컨트롤러")
4444
public class AdminDashboardController {
4545

4646
private final AdminDashboardService adminDashboardService;

src/main/java/com/back/domain/dashboard/artist/controller/ArtistDashboardController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
@RequestMapping("/api/dashboard/artist")
4343
@RequiredArgsConstructor
4444
@Slf4j
45-
@Tag(name = "ArtistDashboardController", description = "작가 대시보드 컨트롤러")
45+
@Tag(name = "작가용 대시보드", description = "작가 대시보드 컨트롤러")
4646
public class ArtistDashboardController {
4747

4848
private final ArtistDashboardService artistDashboardService;

src/main/java/com/back/domain/dashboard/customer/controller/DashboardController.java

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
@RequestMapping("/api/dashboard")
3737
@RequiredArgsConstructor
3838
@Slf4j
39-
@Tag(name = "CustomerDashboardController", description = "고객용 대시보드 컨트롤러")
39+
@Tag(name = "고객용 대시보드", description = "고객용 대시보드 컨트롤러")
4040
public class DashboardController {
4141

4242
private final DashboardService dashboardService;
@@ -170,24 +170,6 @@ public ResponseEntity<RsData<FundingResponse.List>> getFundingParticipations(
170170
return ResponseEntity.ok(RsData.ok("참여한 펀딩 목록 조회 성공", response));
171171
}
172172

173-
/**
174-
* 교환/반품 신청 모달 상품 정보 조회
175-
*/
176-
@GetMapping("/returns/orders/{orderId}/form-data")
177-
@Operation(summary = "교환/반품 신청 모달 상품 정보 조회", description = "교환/반품 신청 시 필요한 주문 상품 정보를 조회합니다")
178-
public ResponseEntity<RsData<ReturnResponse.FormData>> getReturnFormData(
179-
@AuthenticationPrincipal CustomUserDetails userDetails,
180-
@PathVariable
181-
@Min(value = 1, message = "주문 ID는 1 이상이어야 합니다")
182-
Long orderId) {
183-
184-
log.info("교환/반품 신청 모달 상품 정보 조회 - userId: {}, orderId: {}",
185-
userDetails.getUserId(), orderId);
186-
187-
ReturnResponse.FormData response = dashboardService.getReturnFormData(
188-
userDetails.getUserId(), orderId);
189-
return ResponseEntity.ok(RsData.ok("교환/반품 신청 모달 상품 정보 조회 성공", response));
190-
}
191173

192174
/**
193175
* 캐시 정보 조회

src/main/java/com/back/domain/dashboard/customer/dto/response/ReturnResponse.java

Lines changed: 0 additions & 94 deletions
This file was deleted.

src/main/java/com/back/domain/dashboard/customer/service/DashboardService.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ public interface DashboardService {
4444
*/
4545
FundingResponse.List getFundingParticipations(Long userId, FundingSearchRequest request);
4646

47-
/**
48-
* 교환/반품 신청 모달 상품 정보 조회
49-
* @param userId 사용자 ID
50-
* @param orderId 주문 ID
51-
* @return 주문 상품 정보 (Summary만 포함, Form과 Permission은 null)
52-
*/
53-
ReturnResponse.FormData getReturnFormData(Long userId, Long orderId);
54-
5547
/**
5648
* 캐시 정보 조회
5749
*/

0 commit comments

Comments
 (0)