-
Notifications
You must be signed in to change notification settings - Fork 0
feature: 매칭 수락 거절 분리 추가, 코인 상태 타입 추가 #23
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
Conversation
matchingeRepository.findByIdAndRecvId(matchingVO.id(), userId) | ||
.map(el -> { | ||
Optional.ofNullable(userServiceClient.viewCoin(userId, authentication)) | ||
.filter(coin -> coin >= 10000L) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private void minusCoin(){
Optional.ofNullable(userServiceClient.viewCoin(userId, authentication))
.filter(coin -> coin >= 10000L)
.map(coin -> {
el.setStatusCd("MATCHED");
userServiceClient.updateCoin(userId, authentication, new UserCoinDTO(String.valueOf(userId), -10000L, CoinActionType.CONSUME));
return coin;
})
.orElseThrow(() -> new BusinessException(MessageCode.INSUFFICIENT_COIN));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coin = userServiceClient.viewCoin(userId, authentication);
if (coin !=null && coin >= 10000L) {
userServiceClient.updateCoin(userId, authentication, new UserCoinDTO(String.valueOf(userId), -10000L, CoinActionType.CONSUME));
return;
}
new BusinessException(MessageCode.INSUFFICIENT_COIN));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matchingeRepository.findByIdAndRecvId(matchingVO.id(), userId)
.map(el -> {
minusCoin();
el.setStatusCd("MATCHED");
}
.orElseThrow(() -> new BusinessException(MessageCode.MATCHING_NOT_FOUND));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obj ojb = matchingeRepository.findByIdAndRecvId(matchingVO.id(), userId).orElseThrow(() -> new BusinessException(MessageCode.MATCHING_NOT_FOUND));
matchingeRepository.delete(obj)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
람다식 이중부분은 단순하게 변경되었습니다
return userCoinRepository.save(new UserCoin(userCoinVO.userId(), userCoinVO.balance())); | ||
}); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obj = userCoinRepository.findByUserId(userCoinVO.userId());
if obj != null{
l.setBalance(el.getBalance() + userCoinVO.balance());
kafkaProducer.sendMessage("coin-topic", new UserCoinLogVO(userCoinVO.userId(), userCoinVO.balance(), userCoinVO.coinActionType().getCode(), LocalDateTime.now(), userCoinVO.userId()), false);
userCoinRepository.save(el);
return
}
kafkaProducer.sendMessage("coin-topic", new UserCoinLogVO(userCoinVO.userId(), userCoinVO.balance(), userCoinVO.coinActionType().getCode(), LocalDateTime.now(), userCoinVO.userId()), false);
userCoinRepository.save(new UserCoin(userCoinVO.userId(), userCoinVO.balance()));
매칭 수락 거절 분리 추가, 코인 상태 타입 추가