Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public class CreateRecommendLoanProductUseCaseImpl implements
@EventListener
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void execute(CreateRecommendedLoanProductEvent event) {
//TODO 혹여 해당 부분이 실패할 경우 어떻게 해야할지 강구

List<RecommendedLoanProduct> recommendedLoanProductList = event.contentList().stream()
.map(content ->
RecommendedLoanProduct.of(
Expand All @@ -53,10 +51,14 @@ public void execute(CreateRecommendedLoanProductEvent event) {
List<RecommendedLoanProduct> recommendedLoanProducts =
loanProductRepository.saveAllRecommendedLoanProduct(event.profileId(), recommendedLoanProductList);

log.info("Created {} recommended loan product events", recommendedLoanProducts.stream().filter(it ->
it.getLoanProductBadges().contains(LoanProductBadge.LOWEST_MIN_INTEREST_RATE)
).toList().size());

RecommendedLoanProduct first = recommendedLoanProducts.stream()
.filter(it ->
it.getLoanProductBadges().contains(LoanProductBadge.LOWEST_MIN_INTEREST_RATE)
).findFirst().orElseThrow(() -> new BusinessException(ErrorCode.INVALID_ANNUAL_INCOME));
).findFirst().orElseThrow(() -> new BusinessException(ErrorCode.EMPTY_BADGES));

profileRepository.updateProfileAfterRecommend(
event.profileId(), recommendedLoanProductList.size(), first.getMinInterestRate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public enum ErrorCode {
PROFILE_SEQUENCE_CANNOT_BE_NULL("프로필의 순번이 NULL일 수 없습니다.", "PRF-0008", CustomHttpStatus.BAD_REQUEST),
CREDITS_CANNOT_BE_NULL("프로필의 신용점수, 신용상태 둘다 NULL일 수 없습니다.", "PRF-0009", CustomHttpStatus.BAD_REQUEST),
OUT_OF_RANGE_CREDIT_GRADE_STATUS("신용점수에 맞는 신용 등급이 존재하지 않습니다.", "PRF-0010", CustomHttpStatus.BAD_REQUEST),
INVALID_ANNUAL_INCOME("유효하지 않은 연수입 입니다. 값을 확인해주세요.", "PRF-0011", CustomHttpStatus.BAD_REQUEST),
INVALID_ANNUAL_INCOME("유효하지 않은 연수입니다. 값을 확인해주세요.", "PRF-0011", CustomHttpStatus.BAD_REQUEST),
INVALID_PUBLIC_SERVANT_FIELDS("공무워 직군 관련 필드에 문제가 있습니다.", "PRF-0012", CustomHttpStatus.BAD_REQUEST),
INVALID_FREELANCER_FIELDS("프리랜서 직군 관련 필드에 문제가 있습니다.", "PRF-0013", CustomHttpStatus.BAD_REQUEST),
UNSUPPORTED_OCCUPATION("지원하지 않는 직군입니다.", "PRF-0014", CustomHttpStatus.BAD_REQUEST),
Expand Down