Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 메인 서버 배포 #260

Merged
merged 8 commits into from
Sep 29, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface AdminService {
SmsGetResponse updateConsultIsPaid(Long consultId);
List<CounselorGetProfileResponse> getPendingCounselors();

void updateProfileStatus(Long counselorId, Boolean isPassed);
void updateProfileStatus(Long counselorId, Boolean isPassed, String reason);

List<PaymentGetRefundWaitingResponse> getRefundWaitingPayments();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public List<CounselorGetProfileResponse> getPendingCounselors() {

@Transactional
@Override
public void updateProfileStatus(Long counselorId, Boolean isPassed) {
public void updateProfileStatus(Long counselorId, Boolean isPassed, String reason) {
Counselor counselor = counselorService.getCounselorByCounselorId(counselorId);
if ((counselor.getProfileStatus() == null) ||
(!counselor.getProfileStatus().equals(ProfileStatus.EVALUATION_PENDING))) {
Expand All @@ -124,6 +124,7 @@ public void updateProfileStatus(Long counselorId, Boolean isPassed) {
emailService.sendEmail(email, EmailType.COUNSELOR_PROFILE_FAIL, "");
}
counselor.updateProfileStatusAndProfileUpdatedAt(profileStatus);
counselor.updateProfileReason(reason);

if (counselor.getProfileStatus().equals(ProfileStatus.EVALUATION_COMPLETE)) {
Customer customer = customerService.getCustomerByCounselor(counselor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@ public ResponseEntity<List<CounselorGetProfileResponse>> getPendingCounselors()
}

@Operation(summary = "상담사 프로필 심사 상태 수정",
description = "상담사 프로필 심사 상태 수정(최초 심사 통과 시 COUNSELOR 권한 부여), " +
"주소 형식: /api/v1/admins/pending-profiles/{counselorId}?isPassed=true")
description =
"상담사 프로필 심사 상태 수정(최초 심사 통과 시 COUNSELOR 권한 부여), reason의 경우 리젝시에만 보내주면 되는 optional한 값입니다."
+
"주소 형식: /api/v1/admins/pending-profiles/{counselorId}?isPassed=true&reason='test'")

@ApiResponses({
@ApiResponse(responseCode = "200", description = "수정 성공"),
@ApiResponse(responseCode = "400", description = "심사 중이 아닌 상담사 프로필에 대한 요청",
Expand All @@ -88,12 +91,13 @@ public ResponseEntity<List<CounselorGetProfileResponse>> getPendingCounselors()
})
@Parameters({
@Parameter(name = "counselorId", description = "상담사 아이디"),
@Parameter(name = "isPassed", description = "심사 통과 여부")
@Parameter(name = "isPassed", description = "심사 통과 여부"),
@Parameter(name = "reason", description = "리젝 사유")
})
@PatchMapping("/pending-profiles/{counselorId}")
public ResponseEntity<Void> updateProfileStatus(@PathVariable Long counselorId,
@RequestParam Boolean isPassed) {
adminService.updateProfileStatus(counselorId, isPassed);
@RequestParam Boolean isPassed, @RequestParam(required = false) String reason) {
adminService.updateProfileStatus(counselorId, isPassed, reason);
return ResponseEntity.ok().build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public class ChatTaskScheduler {
private final ChatRepository chatRepository;
private final ChatNoticeService chatNoticeService;

private static final int TEN_MINUTE = 60000; //1분
private static final int TWENTY_FIVE_MINUTE = 120000; //2분
private static final int THIRTY_MINUTE = 300000; //7분 //테스트용으로 남겨둡니다.
// private static final int TEN_MINUTE = 600000;
// private static final int TWENTY_FIVE_MINUTE = 1500000;
// private static final int THIRTY_MINUTE = 1800000;
// private static final int TEN_MINUTE = 60000; //1분
// private static final int TWENTY_FIVE_MINUTE = 120000; //2분
// private static final int THIRTY_MINUTE = 300000; //7분 //테스트용으로 남겨둡니다.
private static final int TEN_MINUTE = 600000;
private static final int TWENTY_FIVE_MINUTE = 1500000;
private static final int THIRTY_MINUTE = 1800000;
private static final int ONE_DAY = 24 * 60 * 60 * 1000;

public void checkSendRequest(Chat oldChat) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,6 @@ List<CounselorGetRandomListResponse> getRandomCounselorsByCustomer(Long customer
String sortType, int index);

List<CounselorGetRandomListResponse> getAllRandomCounselors(String sortType, int index);

String getCounselorFailureReason(Long counselorId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,14 @@ public List<Counselor> getCounselorsByNicknameOrEmail(String keyword) {
return counselorRepository.findAllByNicknameOrEmail(keyword);
}

@Override
public String getCounselorFailureReason(Long customerId) {
Counselor counselor = getCounselorByCustomerId(customerId);
if (counselor.getProfileStatus() == ProfileStatus.EVALUATION_FAIL)
return counselor.getFailureReason();
return "";
}

@Scheduled(cron = "0 0 * * * *", zone = "Asia/Seoul")
public void updateRealtimeCounselors() {
List<Counselor> counselors = counselorRepository.findAllByProfileStatusIsEvaluationCompleteAndIsActivatedIsTrue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public class Counselor extends BaseEntity {
@Enumerated(EnumType.STRING)
private ProfileStatus profileStatus;

@Column(name = "failure_reason")
private String failureReason;

@ElementCollection(targetClass = ConsultCost.class, fetch = FetchType.LAZY)
@JoinTable(name = "consult_costs", joinColumns = @JoinColumn(name = "counselor_id"))
@Column(name = "consult_costs")
Expand Down Expand Up @@ -174,6 +177,10 @@ public void updateIsEducated(Boolean isEducated) {
}
}

public void updateProfileReason(String reason) {
this.failureReason = reason;
}

public void updateTotalReviewAndRatingAverage(Integer rating) {
double preTotalRating = this.ratingAverage * this.totalReview;
this.totalReview += 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,15 @@ public ResponseEntity<Long> getCounselorId(
counselorService.getCounselorByCustomerId(customUserDetails.getCustomer()
.getCustomerId()).getCounselorId());
}

@Operation(summary = "프로필 리젝 사유 조회",
description = "프로필 리젝 사유 리턴하는 함수, 프로필 상태가 실패가 아니면 빈 문자열이 리턴됩니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "조회 성공")
})
@GetMapping("/profile-rejection")
public ResponseEntity<String> getCounselorFailureReason(@AuthenticationPrincipal CustomUserDetails customUserDetails) {
return ResponseEntity.ok(counselorService.getCounselorFailureReason(customUserDetails.getCustomer()
.getCustomerId()));
}
}
Loading