충전이벤트가 적용되지 않는 버그 수정
This commit is contained in:
parent
53bc8ed05a
commit
f2ecf3a676
|
@ -15,8 +15,6 @@ import kr.co.vividnext.sodalive.member.auth.AuthRepository
|
||||||
import org.springframework.context.ApplicationEventPublisher
|
import org.springframework.context.ApplicationEventPublisher
|
||||||
import org.springframework.data.repository.findByIdOrNull
|
import org.springframework.data.repository.findByIdOrNull
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import org.springframework.transaction.annotation.Propagation
|
|
||||||
import org.springframework.transaction.annotation.Transactional
|
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
import kotlin.math.round
|
import kotlin.math.round
|
||||||
|
|
||||||
|
@ -29,7 +27,6 @@ class ChargeEventService(
|
||||||
private val chargeEventRepository: ChargeEventRepository,
|
private val chargeEventRepository: ChargeEventRepository,
|
||||||
private val applicationEventPublisher: ApplicationEventPublisher
|
private val applicationEventPublisher: ApplicationEventPublisher
|
||||||
) {
|
) {
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
||||||
fun applyChargeEvent(chargeId: Long, memberId: Long) {
|
fun applyChargeEvent(chargeId: Long, memberId: Long) {
|
||||||
val charge = chargeRepository.findByIdOrNull(chargeId)
|
val charge = chargeRepository.findByIdOrNull(chargeId)
|
||||||
?: throw SodaException("이벤트가 적용되지 않았습니다.\n고객센터에 문의해 주세요.")
|
?: throw SodaException("이벤트가 적용되지 않았습니다.\n고객센터에 문의해 주세요.")
|
||||||
|
|
|
@ -3,6 +3,9 @@ package kr.co.vividnext.sodalive.can.charge.event
|
||||||
import kr.co.vividnext.sodalive.member.Member
|
import kr.co.vividnext.sodalive.member.Member
|
||||||
import org.springframework.scheduling.annotation.Async
|
import org.springframework.scheduling.annotation.Async
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
|
import org.springframework.transaction.annotation.Propagation
|
||||||
|
import org.springframework.transaction.annotation.Transactional
|
||||||
|
import org.springframework.transaction.event.TransactionPhase
|
||||||
import org.springframework.transaction.event.TransactionalEventListener
|
import org.springframework.transaction.event.TransactionalEventListener
|
||||||
|
|
||||||
class ChargeSpringEvent(
|
class ChargeSpringEvent(
|
||||||
|
@ -15,7 +18,8 @@ class ChargeSpringEventListener(
|
||||||
private val chargeEventService: ChargeEventService
|
private val chargeEventService: ChargeEventService
|
||||||
) {
|
) {
|
||||||
@Async
|
@Async
|
||||||
@TransactionalEventListener
|
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
fun applyChargeEvent(event: ChargeSpringEvent) {
|
fun applyChargeEvent(event: ChargeSpringEvent) {
|
||||||
chargeEventService.applyChargeEvent(event.chargeId, event.member.id!!)
|
chargeEventService.applyChargeEvent(event.chargeId, event.member.id!!)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue