generated from pricelees/issue-pr-template
refactor: 서비스 로그 메시지에서 클래스명 제외
This commit is contained in:
parent
6ca70520b5
commit
bcc03dab58
@ -20,29 +20,29 @@ class AdminService(
|
|||||||
) {
|
) {
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findCredentialsByAccount(account: String): AdminLoginCredentials {
|
fun findCredentialsByAccount(account: String): AdminLoginCredentials {
|
||||||
log.info { "[AdminService.findCredentialsByAccount] 관리자 조회 시작: account=${account}" }
|
log.info { "[findCredentialsByAccount] 관리자 조회 시작: account=${account}" }
|
||||||
|
|
||||||
return adminRepository.findByAccount(account)
|
return adminRepository.findByAccount(account)
|
||||||
?.let {
|
?.let {
|
||||||
log.info { "[AdminService.findCredentialsByAccount] 관리자 조회 완료: account=${account}, id=${it.id}" }
|
log.info { "[findCredentialsByAccount] 관리자 조회 완료: account=${account}, id=${it.id}" }
|
||||||
it.toCredentials()
|
it.toCredentials()
|
||||||
}
|
}
|
||||||
?: run {
|
?: run {
|
||||||
log.info { "[AdminService.findCredentialsByAccount] 관리자 조회 실패: account=${account}" }
|
log.info { "[findCredentialsByAccount] 관리자 조회 실패: account=${account}" }
|
||||||
throw AdminException(AdminErrorCode.ADMIN_NOT_FOUND)
|
throw AdminException(AdminErrorCode.ADMIN_NOT_FOUND)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findOperatorOrUnknown(id: Long): Auditor {
|
fun findOperatorOrUnknown(id: Long): Auditor {
|
||||||
log.info { "[AdminService.findOperatorById] 작업자 정보 조회 시작: id=${id}" }
|
log.info { "[findOperatorById] 작업자 정보 조회 시작: id=${id}" }
|
||||||
|
|
||||||
return adminRepository.findByIdOrNull(id)?.let { admin ->
|
return adminRepository.findByIdOrNull(id)?.let { admin ->
|
||||||
Auditor(admin.id, admin.name).also {
|
Auditor(admin.id, admin.name).also {
|
||||||
log.info { "[AdminService.findOperatorById] 작업자 정보 조회 완료: id=${admin.id}, name=${admin.name}" }
|
log.info { "[findOperatorById] 작업자 정보 조회 완료: id=${admin.id}, name=${admin.name}" }
|
||||||
}
|
}
|
||||||
} ?: run {
|
} ?: run {
|
||||||
log.warn { "[AdminService.findOperatorById] 작업자 정보 조회 실패. id=${id}" }
|
log.warn { "[findOperatorById] 작업자 정보 조회 실패. id=${id}" }
|
||||||
Auditor.UNKNOWN
|
Auditor.UNKNOWN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class AuthService(
|
|||||||
request: LoginRequest,
|
request: LoginRequest,
|
||||||
context: LoginContext
|
context: LoginContext
|
||||||
): LoginSuccessResponse {
|
): LoginSuccessResponse {
|
||||||
log.info { "[AuthService.login] 로그인 시작: account=${request.account}, type=${request.principalType}, context=${context}" }
|
log.info { "[login] 로그인 시작: account=${request.account}, type=${request.principalType}, context=${context}" }
|
||||||
val (credentials, extraClaims) = getCredentials(request)
|
val (credentials, extraClaims) = getCredentials(request)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -40,7 +40,7 @@ class AuthService(
|
|||||||
loginHistoryService.createSuccessHistory(credentials.id, request.principalType, context)
|
loginHistoryService.createSuccessHistory(credentials.id, request.principalType, context)
|
||||||
|
|
||||||
return credentials.toResponse(accessToken).also {
|
return credentials.toResponse(accessToken).also {
|
||||||
log.info { "[AuthService.login] 로그인 완료: account=${request.account}, context=${context}" }
|
log.info { "[login] 로그인 완료: account=${request.account}, context=${context}" }
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@ -48,12 +48,12 @@ class AuthService(
|
|||||||
|
|
||||||
when (e) {
|
when (e) {
|
||||||
is AuthException -> {
|
is AuthException -> {
|
||||||
log.info { "[AuthService.login] 로그인 실패: account = ${request.account}" }
|
log.info { "[login] 로그인 실패: account = ${request.account}" }
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
log.warn { "[AuthService.login] 로그인 실패: message=${e.message} account = ${request.account}" }
|
log.warn { "[login] 로그인 실패: message=${e.message} account = ${request.account}" }
|
||||||
throw AuthException(AuthErrorCode.TEMPORARY_AUTH_ERROR)
|
throw AuthException(AuthErrorCode.TEMPORARY_AUTH_ERROR)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ class AuthService(
|
|||||||
credentials: LoginCredentials
|
credentials: LoginCredentials
|
||||||
) {
|
) {
|
||||||
if (credentials.password != request.password) {
|
if (credentials.password != request.password) {
|
||||||
log.info { "[AuthService.login] 비밀번호 불일치로 인한 로그인 실패: account = ${request.account}" }
|
log.info { "[login] 비밀번호 불일치로 인한 로그인 실패: account = ${request.account}" }
|
||||||
throw AuthException(AuthErrorCode.LOGIN_FAILED)
|
throw AuthException(AuthErrorCode.LOGIN_FAILED)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class LoginHistoryService(
|
|||||||
success: Boolean,
|
success: Boolean,
|
||||||
context: LoginContext
|
context: LoginContext
|
||||||
) {
|
) {
|
||||||
log.info { "[LoginHistoryService.createHistory] 로그인 이력 저장 시작: id=${principalId}, type=${principalType}, success=${success}" }
|
log.info { "[createHistory] 로그인 이력 저장 시작: id=${principalId}, type=${principalType}, success=${success}" }
|
||||||
|
|
||||||
runCatching {
|
runCatching {
|
||||||
LoginHistoryEntity(
|
LoginHistoryEntity(
|
||||||
@ -54,10 +54,10 @@ class LoginHistoryService(
|
|||||||
userAgent = context.userAgent,
|
userAgent = context.userAgent,
|
||||||
).also {
|
).also {
|
||||||
loginHistoryRepository.save(it)
|
loginHistoryRepository.save(it)
|
||||||
log.info { "[LoginHistoryService.createHistory] 로그인 이력 저장 완료: principalId=${principalId}, historyId=${it.id}" }
|
log.info { "[createHistory] 로그인 이력 저장 완료: principalId=${principalId}, historyId=${it.id}" }
|
||||||
}
|
}
|
||||||
}.onFailure {
|
}.onFailure {
|
||||||
log.warn { "[LoginHistoryService] 로그인 이력 저장 중 예외 발생: message=${it.message} id=${principalId}, type=${principalType}, success=${success}, context=${context}" }
|
log.warn { "[createHistory] 로그인 이력 저장 중 예외 발생: message=${it.message} id=${principalId}, type=${principalType}, success=${success}, context=${context}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class PaymentService(
|
|||||||
|
|
||||||
PaymentCreateResponse(paymentId = payment.id, detailId = detail.id)
|
PaymentCreateResponse(paymentId = payment.id, detailId = detail.id)
|
||||||
} ?: run {
|
} ?: run {
|
||||||
log.warn { "[PaymentService.confirm] 결제 확정 중 예상치 못한 null 반환" }
|
log.warn { "[confirm] 결제 확정 중 예상치 못한 null 반환" }
|
||||||
throw PaymentException(PaymentErrorCode.PAYMENT_UNEXPECTED_ERROR)
|
throw PaymentException(PaymentErrorCode.PAYMENT_UNEXPECTED_ERROR)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,13 +64,13 @@ class PaymentService(
|
|||||||
cancelResponse = clientCancelResponse
|
cancelResponse = clientCancelResponse
|
||||||
)
|
)
|
||||||
}.also {
|
}.also {
|
||||||
log.info { "[PaymentService.cancel] 결제 취소 완료: paymentId=${payment.id}" }
|
log.info { "[cancel] 결제 취소 완료: paymentId=${payment.id}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findDetailByReservationId(reservationId: Long): PaymentWithDetailResponse? {
|
fun findDetailByReservationId(reservationId: Long): PaymentWithDetailResponse? {
|
||||||
log.info { "[PaymentService.findDetailByReservationId] 예약 결제 정보 조회 시작: reservationId=$reservationId" }
|
log.info { "[findDetailByReservationId] 예약 결제 정보 조회 시작: reservationId=$reservationId" }
|
||||||
|
|
||||||
val payment: PaymentEntity? = findByReservationIdOrNull(reservationId)
|
val payment: PaymentEntity? = findByReservationIdOrNull(reservationId)
|
||||||
val paymentDetail: PaymentDetailEntity? = payment?.let { findDetailByPaymentIdOrNull(it.id) }
|
val paymentDetail: PaymentDetailEntity? = payment?.let { findDetailByPaymentIdOrNull(it.id) }
|
||||||
@ -83,49 +83,49 @@ class PaymentService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun findByReservationIdOrThrow(reservationId: Long): PaymentEntity {
|
private fun findByReservationIdOrThrow(reservationId: Long): PaymentEntity {
|
||||||
log.info { "[PaymentService.findByReservationIdOrThrow] 결제 정보 조회 시작: reservationId=: $reservationId" }
|
log.info { "[findByReservationIdOrThrow] 결제 정보 조회 시작: reservationId=: $reservationId" }
|
||||||
|
|
||||||
return paymentRepository.findByReservationId(reservationId)
|
return paymentRepository.findByReservationId(reservationId)
|
||||||
?.also { log.info { "[PaymentService.findByReservationIdOrThrow] 결제 정보 조회 완료: reservationId=$reservationId, paymentId=${it.id}" } }
|
?.also { log.info { "[findByReservationIdOrThrow] 결제 정보 조회 완료: reservationId=$reservationId, paymentId=${it.id}" } }
|
||||||
?: run {
|
?: run {
|
||||||
log.warn { "[PaymentService.findByReservationIdOrThrow] 결제 정보 조회 실패: reservationId=$reservationId" }
|
log.warn { "[findByReservationIdOrThrow] 결제 정보 조회 실패: reservationId=$reservationId" }
|
||||||
throw PaymentException(PaymentErrorCode.PAYMENT_NOT_FOUND)
|
throw PaymentException(PaymentErrorCode.PAYMENT_NOT_FOUND)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findByReservationIdOrNull(reservationId: Long): PaymentEntity? {
|
private fun findByReservationIdOrNull(reservationId: Long): PaymentEntity? {
|
||||||
log.info { "[PaymentService.findByReservationIdOrThrow] 결제 정보 조회 시작: reservationId=: $reservationId" }
|
log.info { "[findByReservationIdOrThrow] 결제 정보 조회 시작: reservationId=: $reservationId" }
|
||||||
|
|
||||||
return paymentRepository.findByReservationId(reservationId)
|
return paymentRepository.findByReservationId(reservationId)
|
||||||
.also {
|
.also {
|
||||||
if (it != null) {
|
if (it != null) {
|
||||||
log.info { "[PaymentService.findByReservationIdOrThrow] 결제 정보 조회 완료: reservationId=$reservationId, paymentId=${it.id}" }
|
log.info { "[findByReservationIdOrThrow] 결제 정보 조회 완료: reservationId=$reservationId, paymentId=${it.id}" }
|
||||||
} else {
|
} else {
|
||||||
log.warn { "[PaymentService.findByReservationIdOrThrow] 결제 정보 조회 실패: reservationId=$reservationId" }
|
log.warn { "[findByReservationIdOrThrow] 결제 정보 조회 실패: reservationId=$reservationId" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findDetailByPaymentIdOrNull(paymentId: Long): PaymentDetailEntity? {
|
private fun findDetailByPaymentIdOrNull(paymentId: Long): PaymentDetailEntity? {
|
||||||
log.info { "[PaymentService.findDetailByPaymentIdOrThrow] 결제 상세 정보 조회 시작: paymentId=$paymentId" }
|
log.info { "[findDetailByPaymentIdOrThrow] 결제 상세 정보 조회 시작: paymentId=$paymentId" }
|
||||||
|
|
||||||
return paymentDetailRepository.findByPaymentId(paymentId).also {
|
return paymentDetailRepository.findByPaymentId(paymentId).also {
|
||||||
if (it != null) {
|
if (it != null) {
|
||||||
log.info { "[PaymentService.findDetailByPaymentIdOrThrow] 결제 상세 정보 조회 완료: paymentId=$paymentId, detailId=${it.id}}" }
|
log.info { "[findDetailByPaymentIdOrThrow] 결제 상세 정보 조회 완료: paymentId=$paymentId, detailId=${it.id}}" }
|
||||||
} else {
|
} else {
|
||||||
log.warn { "[PaymentService.findDetailByPaymentIdOrThrow] 결제 상세 정보 조회 실패: paymentId=$paymentId" }
|
log.warn { "[findDetailByPaymentIdOrThrow] 결제 상세 정보 조회 실패: paymentId=$paymentId" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findCancelByPaymentIdOrNull(paymentId: Long): CanceledPaymentEntity? {
|
private fun findCancelByPaymentIdOrNull(paymentId: Long): CanceledPaymentEntity? {
|
||||||
log.info { "[PaymentService.findDetailByReservationId] 취소 결제 정보 조회 시작: paymentId=${paymentId}" }
|
log.info { "[findDetailByReservationId] 취소 결제 정보 조회 시작: paymentId=${paymentId}" }
|
||||||
|
|
||||||
return canceledPaymentRepository.findByPaymentId(paymentId).also {
|
return canceledPaymentRepository.findByPaymentId(paymentId).also {
|
||||||
if (it == null) {
|
if (it == null) {
|
||||||
log.info { "[PaymentService.findDetailByReservationId] 취소 결제 정보가 없음: paymentId=${paymentId}" }
|
log.info { "[findDetailByReservationId] 취소 결제 정보가 없음: paymentId=${paymentId}" }
|
||||||
} else {
|
} else {
|
||||||
log.info { "[PaymentService.findDetailByReservationId] 취소 결제 정보 조회 완료: paymentId=${paymentId}, cancelId=${it.id}" }
|
log.info { "[findDetailByReservationId] 취소 결제 정보 조회 완료: paymentId=${paymentId}, cancelId=${it.id}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,56 +17,56 @@ class RegionService(
|
|||||||
) {
|
) {
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun readAllSido(): SidoListResponse {
|
fun readAllSido(): SidoListResponse {
|
||||||
log.info { "[RegionService.readAllSido] 모든 시/도 조회 시작" }
|
log.info { "[readAllSido] 모든 시/도 조회 시작" }
|
||||||
val result: List<Pair<String, String>> = regionRepository.readAllSido()
|
val result: List<Pair<String, String>> = regionRepository.readAllSido()
|
||||||
|
|
||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
log.warn { "[RegionService.readAllSido] 시/도 조회 실패" }
|
log.warn { "[readAllSido] 시/도 조회 실패" }
|
||||||
throw RegionException(RegionErrorCode.SIDO_CODE_NOT_FOUND)
|
throw RegionException(RegionErrorCode.SIDO_CODE_NOT_FOUND)
|
||||||
}
|
}
|
||||||
|
|
||||||
return SidoListResponse(result.map { SidoResponse(code = it.first, name = it.second) }).also {
|
return SidoListResponse(result.map { SidoResponse(code = it.first, name = it.second) }).also {
|
||||||
log.info { "[RegionService.readAllSido] ${it.sidoList.size}개의 시/도 조회 완료" }
|
log.info { "[readAllSido] ${it.sidoList.size}개의 시/도 조회 완료" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findSigunguBySido(sidoCode: String): SigunguListResponse {
|
fun findSigunguBySido(sidoCode: String): SigunguListResponse {
|
||||||
log.info { "[RegionService.findSigunguBySido] 시/군/구 조회 시작: sidoCode=${sidoCode}" }
|
log.info { "[findSigunguBySido] 시/군/구 조회 시작: sidoCode=${sidoCode}" }
|
||||||
val result: List<Pair<String, String>> = regionRepository.findAllSigunguBySido(sidoCode)
|
val result: List<Pair<String, String>> = regionRepository.findAllSigunguBySido(sidoCode)
|
||||||
|
|
||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
log.warn { "[RegionService.findSigunguBySido] 시/군/구 조회 실패: sidoCode=${sidoCode}" }
|
log.warn { "[findSigunguBySido] 시/군/구 조회 실패: sidoCode=${sidoCode}" }
|
||||||
throw RegionException(RegionErrorCode.SIGUNGU_CODE_NOT_FOUND)
|
throw RegionException(RegionErrorCode.SIGUNGU_CODE_NOT_FOUND)
|
||||||
}
|
}
|
||||||
|
|
||||||
return SigunguListResponse(result.map { SigunguResponse(code = it.first, name = it.second) }).also {
|
return SigunguListResponse(result.map { SigunguResponse(code = it.first, name = it.second) }).also {
|
||||||
log.info { "[RegionService.findSigunguBySido] sidoCode=${sidoCode}인 ${it.sigunguList.size}개의 시/군/구 조회 완료" }
|
log.info { "[findSigunguBySido] sidoCode=${sidoCode}인 ${it.sigunguList.size}개의 시/군/구 조회 완료" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findRegionCode(sidoCode: String, sigunguCode: String): RegionCodeResponse {
|
fun findRegionCode(sidoCode: String, sigunguCode: String): RegionCodeResponse {
|
||||||
log.info { "[RegionService.findRegionCode] 지역 코드 조회 시작: sidoCode=${sidoCode} / sigunguCode=${sigunguCode}" }
|
log.info { "[findRegionCode] 지역 코드 조회 시작: sidoCode=${sidoCode} / sigunguCode=${sigunguCode}" }
|
||||||
|
|
||||||
return regionRepository.findRegionCode(sidoCode, sigunguCode)?.let {
|
return regionRepository.findRegionCode(sidoCode, sigunguCode)?.let {
|
||||||
log.info { "[RegionService.findRegionCode] 지역 코드 조회 완료: code=${it} sidoCode=${sidoCode} / sigunguCode=${sigunguCode}" }
|
log.info { "[findRegionCode] 지역 코드 조회 완료: code=${it} sidoCode=${sidoCode} / sigunguCode=${sigunguCode}" }
|
||||||
RegionCodeResponse(it)
|
RegionCodeResponse(it)
|
||||||
} ?: run {
|
} ?: run {
|
||||||
log.warn { "[RegionService.findRegionCode] 지역 코드 조회 실패: sidoCode=${sidoCode} / sigunguCode=${sigunguCode}" }
|
log.warn { "[findRegionCode] 지역 코드 조회 실패: sidoCode=${sidoCode} / sigunguCode=${sigunguCode}" }
|
||||||
throw RegionException(RegionErrorCode.REGION_CODE_NOT_FOUND)
|
throw RegionException(RegionErrorCode.REGION_CODE_NOT_FOUND)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findRegionInfo(regionCode: String): RegionInfoResponse {
|
fun findRegionInfo(regionCode: String): RegionInfoResponse {
|
||||||
log.info { "[RegionService.findRegionInfo] 지역 정보 조회 시작: regionCode=${regionCode}" }
|
log.info { "[findRegionInfo] 지역 정보 조회 시작: regionCode=${regionCode}" }
|
||||||
|
|
||||||
return regionRepository.findByCode(regionCode)?.let {
|
return regionRepository.findByCode(regionCode)?.let {
|
||||||
log.info { "[RegionService.findRegionInfo] 지역 정보 조회 완료: code=${it} regionCode=${regionCode}" }
|
log.info { "[findRegionInfo] 지역 정보 조회 완료: code=${it} regionCode=${regionCode}" }
|
||||||
RegionInfoResponse(it.code, it.sidoName, it.sigunguName)
|
RegionInfoResponse(it.code, it.sidoName, it.sigunguName)
|
||||||
} ?: run {
|
} ?: run {
|
||||||
log.warn { "[RegionService.findRegionInfo] 지역 정보 조회 실패: regionCode=${regionCode}" }
|
log.warn { "[findRegionInfo] 지역 정보 조회 실패: regionCode=${regionCode}" }
|
||||||
throw RegionException(RegionErrorCode.REGION_CODE_NOT_FOUND)
|
throw RegionException(RegionErrorCode.REGION_CODE_NOT_FOUND)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,19 +40,19 @@ class ReservationService(
|
|||||||
user: CurrentUserContext,
|
user: CurrentUserContext,
|
||||||
request: PendingReservationCreateRequest
|
request: PendingReservationCreateRequest
|
||||||
): PendingReservationCreateResponse {
|
): PendingReservationCreateResponse {
|
||||||
log.info { "[ReservationService.createPendingReservation] Pending 예약 생성 시작: schedule=${request.scheduleId}" }
|
log.info { "[createPendingReservation] Pending 예약 생성 시작: schedule=${request.scheduleId}" }
|
||||||
|
|
||||||
validateCanCreate(request)
|
validateCanCreate(request)
|
||||||
|
|
||||||
val reservation: ReservationEntity = request.toEntity(id = idGenerator.create(), userId = user.id)
|
val reservation: ReservationEntity = request.toEntity(id = idGenerator.create(), userId = user.id)
|
||||||
|
|
||||||
return PendingReservationCreateResponse(reservationRepository.save(reservation).id)
|
return PendingReservationCreateResponse(reservationRepository.save(reservation).id)
|
||||||
.also { log.info { "[ReservationService.createPendingReservation] Pending 예약 생성 완료: reservationId=${it}, schedule=${request.scheduleId}" } }
|
.also { log.info { "[createPendingReservation] Pending 예약 생성 완료: reservationId=${it}, schedule=${request.scheduleId}" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun confirmReservation(id: Long) {
|
fun confirmReservation(id: Long) {
|
||||||
log.info { "[ReservationService.confirmReservation] Pending 예약 확정 시작: reservationId=${id}" }
|
log.info { "[confirmReservation] Pending 예약 확정 시작: reservationId=${id}" }
|
||||||
val reservation: ReservationEntity = findOrThrow(id)
|
val reservation: ReservationEntity = findOrThrow(id)
|
||||||
|
|
||||||
run {
|
run {
|
||||||
@ -63,13 +63,13 @@ class ReservationService(
|
|||||||
changeStatus = ScheduleStatus.RESERVED
|
changeStatus = ScheduleStatus.RESERVED
|
||||||
)
|
)
|
||||||
}.also {
|
}.also {
|
||||||
log.info { "[ReservationService.confirmReservation] Pending 예약 확정 완료: reservationId=${id}" }
|
log.info { "[confirmReservation] Pending 예약 확정 완료: reservationId=${id}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun cancelReservation(user: CurrentUserContext, reservationId: Long, request: ReservationCancelRequest) {
|
fun cancelReservation(user: CurrentUserContext, reservationId: Long, request: ReservationCancelRequest) {
|
||||||
log.info { "[ReservationService.cancelReservation] 예약 취소 시작: userId=${user.id}, reservationId=${reservationId}" }
|
log.info { "[cancelReservation] 예약 취소 시작: userId=${user.id}, reservationId=${reservationId}" }
|
||||||
|
|
||||||
val reservation: ReservationEntity = findOrThrow(reservationId)
|
val reservation: ReservationEntity = findOrThrow(reservationId)
|
||||||
|
|
||||||
@ -82,13 +82,13 @@ class ReservationService(
|
|||||||
saveCanceledReservation(user, reservation, request.cancelReason)
|
saveCanceledReservation(user, reservation, request.cancelReason)
|
||||||
reservation.cancel()
|
reservation.cancel()
|
||||||
}.also {
|
}.also {
|
||||||
log.info { "[ReservationService.cancelReservation] 예약 취소 완료: reservationId=${reservationId}" }
|
log.info { "[cancelReservation] 예약 취소 완료: reservationId=${reservationId}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findAllUserReservationOverview(user: CurrentUserContext): ReservationOverviewListResponse {
|
fun findAllUserReservationOverview(user: CurrentUserContext): ReservationOverviewListResponse {
|
||||||
log.info { "[ReservationService.findSummaryByMemberId] 예약 조회 시작: userId=${user.id}" }
|
log.info { "[findSummaryByMemberId] 예약 조회 시작: userId=${user.id}" }
|
||||||
|
|
||||||
val reservations: List<ReservationEntity> = reservationRepository.findAllByUserIdAndStatusIsIn(
|
val reservations: List<ReservationEntity> = reservationRepository.findAllByUserIdAndStatusIsIn(
|
||||||
userId = user.id,
|
userId = user.id,
|
||||||
@ -99,13 +99,13 @@ class ReservationService(
|
|||||||
val schedule: ScheduleOverviewResponse = scheduleService.findScheduleOverviewById(it.scheduleId)
|
val schedule: ScheduleOverviewResponse = scheduleService.findScheduleOverviewById(it.scheduleId)
|
||||||
it.toOverviewResponse(schedule)
|
it.toOverviewResponse(schedule)
|
||||||
}).also {
|
}).also {
|
||||||
log.info { "[ReservationService.findSummaryByMemberId] ${it.reservations.size}개의 예약 조회 완료: userId=${user.id}" }
|
log.info { "[findSummaryByMemberId] ${it.reservations.size}개의 예약 조회 완료: userId=${user.id}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findDetailById(id: Long): ReservationDetailResponse {
|
fun findDetailById(id: Long): ReservationDetailResponse {
|
||||||
log.info { "[ReservationService.findDetailById] 예약 상세 조회 시작: reservationId=${id}" }
|
log.info { "[findDetailById] 예약 상세 조회 시작: reservationId=${id}" }
|
||||||
|
|
||||||
val reservation: ReservationEntity = findOrThrow(id)
|
val reservation: ReservationEntity = findOrThrow(id)
|
||||||
val user: UserContactResponse = userService.findContactById(reservation.userId)
|
val user: UserContactResponse = userService.findContactById(reservation.userId)
|
||||||
@ -115,17 +115,17 @@ class ReservationService(
|
|||||||
user = user,
|
user = user,
|
||||||
payment = paymentDetail
|
payment = paymentDetail
|
||||||
).also {
|
).also {
|
||||||
log.info { "[ReservationService.findDetailById] 예약 상세 조회 완료: reservationId=${id}" }
|
log.info { "[findDetailById] 예약 상세 조회 완료: reservationId=${id}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findOrThrow(id: Long): ReservationEntity {
|
private fun findOrThrow(id: Long): ReservationEntity {
|
||||||
log.info { "[ReservationService.findOrThrow] 예약 조회 시작: reservationId=${id}" }
|
log.info { "[findOrThrow] 예약 조회 시작: reservationId=${id}" }
|
||||||
|
|
||||||
return reservationRepository.findByIdOrNull(id)
|
return reservationRepository.findByIdOrNull(id)
|
||||||
?.also { log.info { "[ReservationService.findOrThrow] 예약 조회 완료: reservationId=${id}" } }
|
?.also { log.info { "[findOrThrow] 예약 조회 완료: reservationId=${id}" } }
|
||||||
?: run {
|
?: run {
|
||||||
log.warn { "[ReservationService.findOrThrow] 예약 조회 실패: reservationId=${id}" }
|
log.warn { "[findOrThrow] 예약 조회 실패: reservationId=${id}" }
|
||||||
throw ReservationException(ReservationErrorCode.RESERVATION_NOT_FOUND)
|
throw ReservationException(ReservationErrorCode.RESERVATION_NOT_FOUND)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ class ReservationService(
|
|||||||
cancelReason: String
|
cancelReason: String
|
||||||
) {
|
) {
|
||||||
if (reservation.userId != user.id) {
|
if (reservation.userId != user.id) {
|
||||||
log.warn { "[ReservationService.createCanceledPayment] 예약자 본인 또는 관리자가 아닌 회원의 취소 요청: reservationId=${reservation.id}, userId=${user.id}" }
|
log.warn { "[createCanceledPayment] 예약자 본인 또는 관리자가 아닌 회원의 취소 요청: reservationId=${reservation.id}, userId=${user.id}" }
|
||||||
throw ReservationException(ReservationErrorCode.NO_PERMISSION_TO_CANCEL_RESERVATION)
|
throw ReservationException(ReservationErrorCode.NO_PERMISSION_TO_CANCEL_RESERVATION)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,11 +43,11 @@ class ScheduleService(
|
|||||||
// ========================================
|
// ========================================
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun getStoreScheduleByDate(storeId: Long, date: LocalDate): ScheduleWithThemeListResponse {
|
fun getStoreScheduleByDate(storeId: Long, date: LocalDate): ScheduleWithThemeListResponse {
|
||||||
log.info { "[ScheduleService.getStoreScheduleByDate] 매장 일정 조회: storeId=${storeId}, date=$date" }
|
log.info { "[getStoreScheduleByDate] 매장 일정 조회: storeId=${storeId}, date=$date" }
|
||||||
val currentDate = LocalDate.now()
|
val currentDate = LocalDate.now()
|
||||||
|
|
||||||
if (date.isBefore(currentDate)) {
|
if (date.isBefore(currentDate)) {
|
||||||
log.warn { "[ScheduleService.getStoreScheduleByDate] 이전 날짜 선택으로 인한 실패: date=${date}" }
|
log.warn { "[getStoreScheduleByDate] 이전 날짜 선택으로 인한 실패: date=${date}" }
|
||||||
throw ScheduleException(ScheduleErrorCode.PAST_DATE_TIME)
|
throw ScheduleException(ScheduleErrorCode.PAST_DATE_TIME)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class ScheduleService(
|
|||||||
|
|
||||||
return schedules.toResponse()
|
return schedules.toResponse()
|
||||||
.also {
|
.also {
|
||||||
log.info { "[ScheduleService.getStoreScheduleByDate] storeId=${storeId}, date=$date 인 ${it.schedules.size}개 일정 조회 완료" }
|
log.info { "[getStoreScheduleByDate] storeId=${storeId}, date=$date 인 ${it.schedules.size}개 일정 조회 완료" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,20 +66,20 @@ class ScheduleService(
|
|||||||
// ========================================
|
// ========================================
|
||||||
@Transactional
|
@Transactional
|
||||||
fun holdSchedule(id: Long) {
|
fun holdSchedule(id: Long) {
|
||||||
log.info { "[ScheduleService.holdSchedule] 일정 Holding 시작: id=$id" }
|
log.info { "[holdSchedule] 일정 Holding 시작: id=$id" }
|
||||||
val result: Int = scheduleRepository.changeStatus(
|
val result: Int = scheduleRepository.changeStatus(
|
||||||
id = id,
|
id = id,
|
||||||
currentStatus = ScheduleStatus.AVAILABLE,
|
currentStatus = ScheduleStatus.AVAILABLE,
|
||||||
changeStatus = ScheduleStatus.HOLD
|
changeStatus = ScheduleStatus.HOLD
|
||||||
).also {
|
).also {
|
||||||
log.info { "[ScheduleService.holdSchedule] $it 개의 row 변경 완료" }
|
log.info { "[holdSchedule] $it 개의 row 변경 완료" }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
throw ScheduleException(ScheduleErrorCode.SCHEDULE_NOT_AVAILABLE)
|
throw ScheduleException(ScheduleErrorCode.SCHEDULE_NOT_AVAILABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info { "[ScheduleService.holdSchedule] 일정 Holding 완료: id=$id" }
|
log.info { "[holdSchedule] 일정 Holding 완료: id=$id" }
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================
|
// ========================================
|
||||||
@ -87,7 +87,7 @@ class ScheduleService(
|
|||||||
// ========================================
|
// ========================================
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun searchSchedules(storeId: Long, date: LocalDate?, themeId: Long?): AdminScheduleSummaryListResponse {
|
fun searchSchedules(storeId: Long, date: LocalDate?, themeId: Long?): AdminScheduleSummaryListResponse {
|
||||||
log.info { "[ScheduleService.searchSchedules] 일정 검색 시작: storeId=$storeId, date=$date, themeId=$themeId" }
|
log.info { "[searchSchedules] 일정 검색 시작: storeId=$storeId, date=$date, themeId=$themeId" }
|
||||||
|
|
||||||
val searchDate = date ?: LocalDate.now()
|
val searchDate = date ?: LocalDate.now()
|
||||||
|
|
||||||
@ -98,13 +98,13 @@ class ScheduleService(
|
|||||||
|
|
||||||
return schedules.toAdminSummaryListResponse()
|
return schedules.toAdminSummaryListResponse()
|
||||||
.also {
|
.also {
|
||||||
log.info { "[ScheduleService.searchSchedules] ${it.schedules.size} 개의 일정 조회 완료" }
|
log.info { "[searchSchedules] ${it.schedules.size} 개의 일정 조회 완료" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findScheduleAudit(id: Long): AuditingInfo {
|
fun findScheduleAudit(id: Long): AuditingInfo {
|
||||||
log.info { "[ScheduleService.findDetail] 일정 감사 정보 조회 시작: id=$id" }
|
log.info { "[findDetail] 일정 감사 정보 조회 시작: id=$id" }
|
||||||
|
|
||||||
val schedule: ScheduleEntity = findOrThrow(id)
|
val schedule: ScheduleEntity = findOrThrow(id)
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ class ScheduleService(
|
|||||||
val updatedBy: Auditor = adminService.findOperatorOrUnknown(schedule.updatedBy)
|
val updatedBy: Auditor = adminService.findOperatorOrUnknown(schedule.updatedBy)
|
||||||
|
|
||||||
return AuditingInfo(schedule.createdAt, createdBy, schedule.updatedAt, updatedBy)
|
return AuditingInfo(schedule.createdAt, createdBy, schedule.updatedAt, updatedBy)
|
||||||
.also { log.info { "[ScheduleService.findDetail] 일정 감사 정보 조회 완료: id=$id" } }
|
.also { log.info { "[findDetail] 일정 감사 정보 조회 완료: id=$id" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================
|
// ========================================
|
||||||
@ -120,7 +120,7 @@ class ScheduleService(
|
|||||||
// ========================================
|
// ========================================
|
||||||
@Transactional
|
@Transactional
|
||||||
fun createSchedule(storeId: Long, request: ScheduleCreateRequest): ScheduleCreateResponse {
|
fun createSchedule(storeId: Long, request: ScheduleCreateRequest): ScheduleCreateResponse {
|
||||||
log.info { "[ScheduleService.createSchedule] 일정 생성 시작: storeId=${storeId}, date=${request.date}, time=${request.time}, themeId=${request.themeId}" }
|
log.info { "[createSchedule] 일정 생성 시작: storeId=${storeId}, date=${request.date}, time=${request.time}, themeId=${request.themeId}" }
|
||||||
|
|
||||||
scheduleValidator.validateCanCreate(storeId, request)
|
scheduleValidator.validateCanCreate(storeId, request)
|
||||||
|
|
||||||
@ -136,16 +136,16 @@ class ScheduleService(
|
|||||||
|
|
||||||
return ScheduleCreateResponse(schedule.id)
|
return ScheduleCreateResponse(schedule.id)
|
||||||
.also {
|
.also {
|
||||||
log.info { "[ScheduleService.createSchedule] 일정 생성 완료: id=${it.id}" }
|
log.info { "[createSchedule] 일정 생성 완료: id=${it.id}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun updateSchedule(id: Long, request: ScheduleUpdateRequest) {
|
fun updateSchedule(id: Long, request: ScheduleUpdateRequest) {
|
||||||
log.info { "[ScheduleService.updateSchedule] 일정 수정 시작: id=$id, request=${request}" }
|
log.info { "[updateSchedule] 일정 수정 시작: id=$id, request=${request}" }
|
||||||
|
|
||||||
if (request.isAllParamsNull()) {
|
if (request.isAllParamsNull()) {
|
||||||
log.info { "[ScheduleService.updateSchedule] 일정 변경 사항 없음: id=$id" }
|
log.info { "[updateSchedule] 일정 변경 사항 없음: id=$id" }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,20 +154,20 @@ class ScheduleService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
schedule.modifyIfNotNull(request.time, request.status).also {
|
schedule.modifyIfNotNull(request.time, request.status).also {
|
||||||
log.info { "[ScheduleService.updateSchedule] 일정 수정 완료: id=$id, request=${request}" }
|
log.info { "[updateSchedule] 일정 수정 완료: id=$id, request=${request}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun deleteSchedule(id: Long) {
|
fun deleteSchedule(id: Long) {
|
||||||
log.info { "[ScheduleService.deleteSchedule] 일정 삭제 시작: id=$id" }
|
log.info { "[deleteSchedule] 일정 삭제 시작: id=$id" }
|
||||||
|
|
||||||
val schedule: ScheduleEntity = findOrThrow(id).also {
|
val schedule: ScheduleEntity = findOrThrow(id).also {
|
||||||
scheduleValidator.validateCanDelete(it)
|
scheduleValidator.validateCanDelete(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduleRepository.delete(schedule).also {
|
scheduleRepository.delete(schedule).also {
|
||||||
log.info { "[ScheduleService.deleteSchedule] 일정 삭제 완료: id=$id" }
|
log.info { "[deleteSchedule] 일정 삭제 완료: id=$id" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,24 +176,24 @@ class ScheduleService(
|
|||||||
// ========================================
|
// ========================================
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findSummaryWithLock(id: Long): ScheduleSummaryResponse {
|
fun findSummaryWithLock(id: Long): ScheduleSummaryResponse {
|
||||||
log.info { "[ScheduleService.findDateTimeById] 일정 개요 조회 시작 : id=$id" }
|
log.info { "[findDateTimeById] 일정 개요 조회 시작 : id=$id" }
|
||||||
|
|
||||||
val schedule: ScheduleEntity = scheduleRepository.findByIdForUpdate(id)
|
val schedule: ScheduleEntity = scheduleRepository.findByIdForUpdate(id)
|
||||||
?: run {
|
?: run {
|
||||||
log.warn { "[ScheduleService.updateSchedule] 일정 조회 실패. id=$id" }
|
log.warn { "[updateSchedule] 일정 조회 실패. id=$id" }
|
||||||
throw ScheduleException(ScheduleErrorCode.SCHEDULE_NOT_FOUND)
|
throw ScheduleException(ScheduleErrorCode.SCHEDULE_NOT_FOUND)
|
||||||
}
|
}
|
||||||
|
|
||||||
return schedule.toSummaryResponse()
|
return schedule.toSummaryResponse()
|
||||||
.also {
|
.also {
|
||||||
log.info { "[ScheduleService.findDateTimeById] 일정 개요 조회 완료: id=$id" }
|
log.info { "[findDateTimeById] 일정 개요 조회 완료: id=$id" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findScheduleOverviewById(id: Long): ScheduleOverviewResponse {
|
fun findScheduleOverviewById(id: Long): ScheduleOverviewResponse {
|
||||||
val overview: ScheduleOverview = scheduleRepository.findOverviewByIdOrNull(id) ?: run {
|
val overview: ScheduleOverview = scheduleRepository.findOverviewByIdOrNull(id) ?: run {
|
||||||
log.warn { "[ScheduleService.findScheduleOverview] 일정 개요 조회 실패: id=$id" }
|
log.warn { "[findScheduleOverview] 일정 개요 조회 실패: id=$id" }
|
||||||
throw ScheduleException(ScheduleErrorCode.SCHEDULE_NOT_FOUND)
|
throw ScheduleException(ScheduleErrorCode.SCHEDULE_NOT_FOUND)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,10 +202,10 @@ class ScheduleService(
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun changeStatus(scheduleId: Long, currentStatus: ScheduleStatus, changeStatus: ScheduleStatus) {
|
fun changeStatus(scheduleId: Long, currentStatus: ScheduleStatus, changeStatus: ScheduleStatus) {
|
||||||
log.info { "[ScheduleService.reserveSchedule] 일정 상태 변경 시작: id=${scheduleId}, currentStatus=${currentStatus}, changeStatus=${changeStatus}" }
|
log.info { "[reserveSchedule] 일정 상태 변경 시작: id=${scheduleId}, currentStatus=${currentStatus}, changeStatus=${changeStatus}" }
|
||||||
|
|
||||||
scheduleRepository.changeStatus(scheduleId, currentStatus, changeStatus).also {
|
scheduleRepository.changeStatus(scheduleId, currentStatus, changeStatus).also {
|
||||||
log.info { "[ScheduleService.reserveSchedule] 일정 상태 변경 완료: id=${scheduleId}, currentStatus=${currentStatus}, changeStatus=${changeStatus}" }
|
log.info { "[reserveSchedule] 일정 상태 변경 완료: id=${scheduleId}, currentStatus=${currentStatus}, changeStatus=${changeStatus}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,12 +213,12 @@ class ScheduleService(
|
|||||||
// Common (공통 메서드)
|
// Common (공통 메서드)
|
||||||
// ========================================
|
// ========================================
|
||||||
private fun findOrThrow(id: Long): ScheduleEntity {
|
private fun findOrThrow(id: Long): ScheduleEntity {
|
||||||
log.info { "[ScheduleService.findOrThrow] 일정 조회 시작: id=$id" }
|
log.info { "[findOrThrow] 일정 조회 시작: id=$id" }
|
||||||
|
|
||||||
return scheduleRepository.findByIdOrNull(id)
|
return scheduleRepository.findByIdOrNull(id)
|
||||||
?.also { log.info { "[ScheduleService.findOrThrow] 일정 조회 완료: id=$id" } }
|
?.also { log.info { "[findOrThrow] 일정 조회 완료: id=$id" } }
|
||||||
?: run {
|
?: run {
|
||||||
log.warn { "[ScheduleService.updateSchedule] 일정 조회 실패. id=$id" }
|
log.warn { "[updateSchedule] 일정 조회 실패. id=$id" }
|
||||||
throw ScheduleException(ScheduleErrorCode.SCHEDULE_NOT_FOUND)
|
throw ScheduleException(ScheduleErrorCode.SCHEDULE_NOT_FOUND)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,19 +27,19 @@ class StoreService(
|
|||||||
) {
|
) {
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun getDetail(id: Long): DetailStoreResponse {
|
fun getDetail(id: Long): DetailStoreResponse {
|
||||||
log.info { "[StoreService.getDetail] 매장 상세 조회 시작: id=${id}" }
|
log.info { "[getDetail] 매장 상세 조회 시작: id=${id}" }
|
||||||
|
|
||||||
val store: StoreEntity = findOrThrow(id)
|
val store: StoreEntity = findOrThrow(id)
|
||||||
val region = regionService.findRegionInfo(store.regionCode)
|
val region = regionService.findRegionInfo(store.regionCode)
|
||||||
val audit = getAuditInfo(store)
|
val audit = getAuditInfo(store)
|
||||||
|
|
||||||
return store.toDetailResponse(region, audit)
|
return store.toDetailResponse(region, audit)
|
||||||
.also { log.info { "[StoreService.getDetail] 매장 상세 조회 완료: id=${id}" } }
|
.also { log.info { "[getDetail] 매장 상세 조회 완료: id=${id}" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun register(request: StoreRegisterRequest): StoreRegisterResponse {
|
fun register(request: StoreRegisterRequest): StoreRegisterResponse {
|
||||||
log.info { "[StoreService.register] 매장 등록 시작: name=${request.name}" }
|
log.info { "[register] 매장 등록 시작: name=${request.name}" }
|
||||||
|
|
||||||
storeValidator.validateCanRegister(request)
|
storeValidator.validateCanRegister(request)
|
||||||
|
|
||||||
@ -56,37 +56,37 @@ class StoreService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return StoreRegisterResponse(store.id).also {
|
return StoreRegisterResponse(store.id).also {
|
||||||
log.info { "[StoreService.register] 매장 등록 완료: id=${store.id}, name=${request.name}" }
|
log.info { "[register] 매장 등록 완료: id=${store.id}, name=${request.name}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun update(id: Long, request: StoreUpdateRequest) {
|
fun update(id: Long, request: StoreUpdateRequest) {
|
||||||
log.info { "[StoreService.update] 매장 수정 시작: id=${id}, request=${request}" }
|
log.info { "[update] 매장 수정 시작: id=${id}, request=${request}" }
|
||||||
|
|
||||||
storeValidator.validateCanUpdate(request)
|
storeValidator.validateCanUpdate(request)
|
||||||
|
|
||||||
findOrThrow(id).apply {
|
findOrThrow(id).apply {
|
||||||
this.modifyIfNotNull(request.name, request.address, request.contact)
|
this.modifyIfNotNull(request.name, request.address, request.contact)
|
||||||
}.also {
|
}.also {
|
||||||
log.info { "[StoreService.update] 매장 수정 완료: id=${id}" }
|
log.info { "[update] 매장 수정 완료: id=${id}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun disableById(id: Long) {
|
fun disableById(id: Long) {
|
||||||
log.info { "[StoreService.inactive] 매장 비활성화 시작: id=${id}" }
|
log.info { "[inactive] 매장 비활성화 시작: id=${id}" }
|
||||||
|
|
||||||
findOrThrow(id).apply {
|
findOrThrow(id).apply {
|
||||||
this.disable()
|
this.disable()
|
||||||
}.also {
|
}.also {
|
||||||
log.info { "[StoreService.inactive] 매장 비활성화 완료: id=${id}" }
|
log.info { "[inactive] 매장 비활성화 완료: id=${id}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun getAllActiveStores(sidoCode: String?, sigunguCode: String?): SimpleStoreListResponse {
|
fun getAllActiveStores(sidoCode: String?, sigunguCode: String?): SimpleStoreListResponse {
|
||||||
log.info { "[StoreService.getAllActiveStores] 전체 매장 조회 시작" }
|
log.info { "[getAllActiveStores] 전체 매장 조회 시작" }
|
||||||
|
|
||||||
val regionCode: String? = when {
|
val regionCode: String? = when {
|
||||||
sidoCode == null && sigunguCode != null -> throw StoreException(StoreErrorCode.SIDO_CODE_REQUIRED)
|
sidoCode == null && sigunguCode != null -> throw StoreException(StoreErrorCode.SIDO_CODE_REQUIRED)
|
||||||
@ -95,21 +95,21 @@ class StoreService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return storeRepository.findAllActiveStoresByRegion(regionCode).toSimpleListResponse()
|
return storeRepository.findAllActiveStoresByRegion(regionCode).toSimpleListResponse()
|
||||||
.also { log.info { "[StoreService.getAllActiveStores] 전체 매장 조회 완료: total=${it.stores.size}" } }
|
.also { log.info { "[getAllActiveStores] 전체 매장 조회 완료: total=${it.stores.size}" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findStoreInfo(id: Long): StoreInfoResponse {
|
fun findStoreInfo(id: Long): StoreInfoResponse {
|
||||||
log.info { "[StoreService.findStoreInfo] 매장 정보 조회 시작: id=${id}" }
|
log.info { "[findStoreInfo] 매장 정보 조회 시작: id=${id}" }
|
||||||
|
|
||||||
val store: StoreEntity = findOrThrow(id)
|
val store: StoreEntity = findOrThrow(id)
|
||||||
|
|
||||||
return store.toInfoResponse()
|
return store.toInfoResponse()
|
||||||
.also { log.info { "[StoreService.findStoreInfo] 매장 정보 조회 완료: id=${id}" } }
|
.also { log.info { "[findStoreInfo] 매장 정보 조회 완료: id=${id}" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getAuditInfo(store: StoreEntity): AuditingInfo {
|
private fun getAuditInfo(store: StoreEntity): AuditingInfo {
|
||||||
log.info { "[StoreService.getAuditInfo] 감사 정보 조회 시작: storeId=${store.id}" }
|
log.info { "[getAuditInfo] 감사 정보 조회 시작: storeId=${store.id}" }
|
||||||
val createdBy = adminService.findOperatorOrUnknown(store.createdBy)
|
val createdBy = adminService.findOperatorOrUnknown(store.createdBy)
|
||||||
val updatedBy = adminService.findOperatorOrUnknown(store.updatedBy)
|
val updatedBy = adminService.findOperatorOrUnknown(store.updatedBy)
|
||||||
|
|
||||||
@ -119,19 +119,19 @@ class StoreService(
|
|||||||
updatedAt = store.updatedAt,
|
updatedAt = store.updatedAt,
|
||||||
updatedBy = updatedBy
|
updatedBy = updatedBy
|
||||||
).also {
|
).also {
|
||||||
log.info { "[StoreService.getAuditInfo] 감사 정보 조회 완료: storeId=${store.id}" }
|
log.info { "[getAuditInfo] 감사 정보 조회 완료: storeId=${store.id}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findOrThrow(id: Long): StoreEntity {
|
private fun findOrThrow(id: Long): StoreEntity {
|
||||||
log.info { "[StoreService.findOrThrow] 매장 조회 시작: id=${id}" }
|
log.info { "[findOrThrow] 매장 조회 시작: id=${id}" }
|
||||||
|
|
||||||
return storeRepository.findActiveStoreById(id)
|
return storeRepository.findActiveStoreById(id)
|
||||||
?.also {
|
?.also {
|
||||||
log.info { "[StoreService.findOrThrow] 매장 조회 완료: id=${id}" }
|
log.info { "[findOrThrow] 매장 조회 완료: id=${id}" }
|
||||||
}
|
}
|
||||||
?: run {
|
?: run {
|
||||||
log.warn { "[StoreService.findOrThrow] 매장 조회 실패: id=${id}" }
|
log.warn { "[findOrThrow] 매장 조회 실패: id=${id}" }
|
||||||
throw StoreException(StoreErrorCode.STORE_NOT_FOUND)
|
throw StoreException(StoreErrorCode.STORE_NOT_FOUND)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,15 +36,15 @@ class ThemeService(
|
|||||||
// ========================================
|
// ========================================
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findInfoById(id: Long): ThemeInfoResponse {
|
fun findInfoById(id: Long): ThemeInfoResponse {
|
||||||
log.info { "[ThemeService.findById] 테마 조회 시작: id=$id" }
|
log.info { "[findInfoById] 테마 조회 시작: id=$id" }
|
||||||
|
|
||||||
return findOrThrow(id).toInfoResponse()
|
return findOrThrow(id).toInfoResponse()
|
||||||
.also { log.info { "[ThemeService.findById] 테마 조회 완료: id=$id" } }
|
.also { log.info { "[findInfoById] 테마 조회 완료: id=$id" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findMostReservedThemeLastWeek(count: Int): ThemeInfoListResponse {
|
fun findMostReservedThemeLastWeek(count: Int): ThemeInfoListResponse {
|
||||||
log.info { "[ThemeService.findMostReservedThemeLastWeek] 인기 테마 조회 시작: count=$count" }
|
log.info { "[findMostReservedThemeLastWeek] 인기 테마 조회 시작: count=$count" }
|
||||||
|
|
||||||
val previousWeekSunday = DateUtils.getSundayOfPreviousWeek(LocalDate.now())
|
val previousWeekSunday = DateUtils.getSundayOfPreviousWeek(LocalDate.now())
|
||||||
val previousWeekSaturday = previousWeekSunday.plusDays(6)
|
val previousWeekSaturday = previousWeekSunday.plusDays(6)
|
||||||
@ -52,7 +52,7 @@ class ThemeService(
|
|||||||
return themeRepository.findMostReservedThemeByDateAndCount(previousWeekSunday, previousWeekSaturday, count)
|
return themeRepository.findMostReservedThemeByDateAndCount(previousWeekSunday, previousWeekSaturday, count)
|
||||||
.toListResponse()
|
.toListResponse()
|
||||||
.also {
|
.also {
|
||||||
log.info { "[ThemeService.findMostReservedThemeLastWeek] ${it.themes.size} / $count 개의 인기 테마 조회 완료" }
|
log.info { "[findMostReservedThemeLastWeek] ${it.themes.size} / $count 개의 인기 테마 조회 완료" }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -62,16 +62,16 @@ class ThemeService(
|
|||||||
// ========================================
|
// ========================================
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findAdminThemes(): AdminThemeSummaryListResponse {
|
fun findAdminThemes(): AdminThemeSummaryListResponse {
|
||||||
log.info { "[ThemeService.findAdminThemes] 관리자 페이지에서의 테마 목록 조회 시작" }
|
log.info { "[findAdminThemes] 관리자 페이지에서의 테마 목록 조회 시작" }
|
||||||
|
|
||||||
return themeRepository.findAll()
|
return themeRepository.findAll()
|
||||||
.toAdminThemeSummaryListResponse()
|
.toAdminThemeSummaryListResponse()
|
||||||
.also { log.info { "[ThemeService.findAdminThemes] ${it.themes.size}개 테마 조회 완료" } }
|
.also { log.info { "[findAdminThemes] ${it.themes.size}개 테마 조회 완료" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findAdminThemeDetail(id: Long): AdminThemeDetailResponse {
|
fun findAdminThemeDetail(id: Long): AdminThemeDetailResponse {
|
||||||
log.info { "[ThemeService.findAdminThemeDetail] 관리자 페이지에서의 테마 상세 정보 조회 시작: id=${id}" }
|
log.info { "[findAdminThemeDetail] 관리자 페이지에서의 테마 상세 정보 조회 시작: id=${id}" }
|
||||||
|
|
||||||
val theme: ThemeEntity = findOrThrow(id)
|
val theme: ThemeEntity = findOrThrow(id)
|
||||||
|
|
||||||
@ -80,12 +80,12 @@ class ThemeService(
|
|||||||
val audit = AuditingInfo(theme.createdAt, createdBy, theme.updatedAt, updatedBy)
|
val audit = AuditingInfo(theme.createdAt, createdBy, theme.updatedAt, updatedBy)
|
||||||
|
|
||||||
return theme.toAdminThemeDetailResponse(audit)
|
return theme.toAdminThemeDetailResponse(audit)
|
||||||
.also { log.info { "[ThemeService.findAdminThemeDetail] 테마 상세 조회 완료: id=$id, name=${theme.name}" } }
|
.also { log.info { "[findAdminThemeDetail] 테마 상세 조회 완료: id=$id, name=${theme.name}" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun createTheme(request: ThemeCreateRequest): ThemeCreateResponse {
|
fun createTheme(request: ThemeCreateRequest): ThemeCreateResponse {
|
||||||
log.info { "[ThemeService.createTheme] 테마 생성 시작: name=${request.name}" }
|
log.info { "[createTheme] 테마 생성 시작: name=${request.name}" }
|
||||||
|
|
||||||
themeValidator.validateCanCreate(request)
|
themeValidator.validateCanCreate(request)
|
||||||
|
|
||||||
@ -93,27 +93,27 @@ class ThemeService(
|
|||||||
.also { themeRepository.save(it) }
|
.also { themeRepository.save(it) }
|
||||||
|
|
||||||
return ThemeCreateResponse(theme.id).also {
|
return ThemeCreateResponse(theme.id).also {
|
||||||
log.info { "[ThemeService.createTheme] 테마 생성 완료: id=${theme.id}, name=${theme.name}" }
|
log.info { "[createTheme] 테마 생성 완료: id=${theme.id}, name=${theme.name}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun deleteTheme(id: Long) {
|
fun deleteTheme(id: Long) {
|
||||||
log.info { "[ThemeService.deleteTheme] 테마 삭제 시작: id=${id}" }
|
log.info { "[deleteTheme] 테마 삭제 시작: id=${id}" }
|
||||||
|
|
||||||
val theme: ThemeEntity = findOrThrow(id)
|
val theme: ThemeEntity = findOrThrow(id)
|
||||||
|
|
||||||
themeRepository.delete(theme).also {
|
themeRepository.delete(theme).also {
|
||||||
log.info { "[ThemeService.deleteTheme] 테마 삭제 완료: id=$id, name=${theme.name}" }
|
log.info { "[deleteTheme] 테마 삭제 완료: id=$id, name=${theme.name}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun updateTheme(id: Long, request: ThemeUpdateRequest) {
|
fun updateTheme(id: Long, request: ThemeUpdateRequest) {
|
||||||
log.info { "[ThemeService.updateTheme] 테마 수정 시작: id=${id}, request=${request}" }
|
log.info { "[updateTheme] 테마 수정 시작: id=${id}, request=${request}" }
|
||||||
|
|
||||||
if (request.isAllParamsNull()) {
|
if (request.isAllParamsNull()) {
|
||||||
log.info { "[ThemeService.updateTheme] 테마 변경 사항 없음: id=${id}" }
|
log.info { "[updateTheme] 테마 변경 사항 없음: id=${id}" }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ class ThemeService(
|
|||||||
request.expectedMinutesTo,
|
request.expectedMinutesTo,
|
||||||
request.isActive,
|
request.isActive,
|
||||||
).also {
|
).also {
|
||||||
log.info { "[ThemeService.updateTheme] 테마 수정 완료: id=$id, request=${request}" }
|
log.info { "[updateTheme] 테마 수정 완료: id=$id, request=${request}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,12 +143,12 @@ class ThemeService(
|
|||||||
// ========================================
|
// ========================================
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findActiveThemes(): SimpleActiveThemeListResponse {
|
fun findActiveThemes(): SimpleActiveThemeListResponse {
|
||||||
log.info { "[ThemeService.findActiveThemes] open 상태인 모든 테마 조회 시작" }
|
log.info { "[findActiveThemes] open 상태인 모든 테마 조회 시작" }
|
||||||
|
|
||||||
return themeRepository.findActiveThemes()
|
return themeRepository.findActiveThemes()
|
||||||
.toSimpleActiveThemeResponse()
|
.toSimpleActiveThemeResponse()
|
||||||
.also {
|
.also {
|
||||||
log.info { "[ThemeService.findActiveThemes] ${it.themes.size}개 테마 조회 완료" }
|
log.info { "[findActiveThemes] ${it.themes.size}개 테마 조회 완료" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,12 +156,12 @@ class ThemeService(
|
|||||||
// Common (공통 메서드)
|
// Common (공통 메서드)
|
||||||
// ========================================
|
// ========================================
|
||||||
private fun findOrThrow(id: Long): ThemeEntity {
|
private fun findOrThrow(id: Long): ThemeEntity {
|
||||||
log.info { "[ThemeService.findOrThrow] 테마 조회 시작: id=$id" }
|
log.info { "[findOrThrow] 테마 조회 시작: id=$id" }
|
||||||
|
|
||||||
return themeRepository.findByIdOrNull(id)
|
return themeRepository.findByIdOrNull(id)
|
||||||
?.also { log.info { "[ThemeService.findOrThrow] 테마 조회 완료: id=$id" } }
|
?.also { log.info { "[findOrThrow] 테마 조회 완료: id=$id" } }
|
||||||
?: run {
|
?: run {
|
||||||
log.warn { "[ThemeService.updateTheme] 테마 조회 실패: id=$id" }
|
log.warn { "[updateTheme] 테마 조회 실패: id=$id" }
|
||||||
throw ThemeException(ThemeErrorCode.THEME_NOT_FOUND)
|
throw ThemeException(ThemeErrorCode.THEME_NOT_FOUND)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,59 +30,59 @@ class UserService(
|
|||||||
) {
|
) {
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findContextById(id: Long): CurrentUserContext {
|
fun findContextById(id: Long): CurrentUserContext {
|
||||||
log.info { "[UserService.findContextById] 현재 로그인된 회원 조회 시작: id=${id}" }
|
log.info { "[findContextById] 현재 로그인된 회원 조회 시작: id=${id}" }
|
||||||
val user: UserEntity = findOrThrow(id)
|
val user: UserEntity = findOrThrow(id)
|
||||||
|
|
||||||
return CurrentUserContext(user.id, user.name)
|
return CurrentUserContext(user.id, user.name)
|
||||||
.also {
|
.also {
|
||||||
log.info { "[UserService.findContextById] 현재 로그인된 회원 조회 완료: id=${id}" }
|
log.info { "[findContextById] 현재 로그인된 회원 조회 완료: id=${id}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findCredentialsByAccount(email: String): UserLoginCredentials {
|
fun findCredentialsByAccount(email: String): UserLoginCredentials {
|
||||||
log.info { "[UserService.findCredentialsByAccount] 회원 조회 시작: email=${email}" }
|
log.info { "[findCredentialsByAccount] 회원 조회 시작: email=${email}" }
|
||||||
|
|
||||||
return userRepository.findByEmail(email)
|
return userRepository.findByEmail(email)
|
||||||
?.let {
|
?.let {
|
||||||
log.info { "[UserService.findCredentialsByAccount] 회원 조회 완료: id=${it.id}" }
|
log.info { "[findCredentialsByAccount] 회원 조회 완료: id=${it.id}" }
|
||||||
it.toCredentials()
|
it.toCredentials()
|
||||||
}
|
}
|
||||||
?: run {
|
?: run {
|
||||||
log.info { "[UserService.findCredentialsByAccount] 회원 조회 실패" }
|
log.info { "[findCredentialsByAccount] 회원 조회 실패" }
|
||||||
throw UserException(UserErrorCode.USER_NOT_FOUND)
|
throw UserException(UserErrorCode.USER_NOT_FOUND)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun findContactById(id: Long) : UserContactResponse {
|
fun findContactById(id: Long) : UserContactResponse {
|
||||||
log.info { "[UserService.findContactById] 회원 연락 정보 조회 시작: id=${id}" }
|
log.info { "[findContactById] 회원 연락 정보 조회 시작: id=${id}" }
|
||||||
|
|
||||||
val user = findOrThrow(id)
|
val user = findOrThrow(id)
|
||||||
|
|
||||||
return UserContactResponse(user.id, user.name, user.phone)
|
return UserContactResponse(user.id, user.name, user.phone)
|
||||||
.also {
|
.also {
|
||||||
log.info { "[UserService.findContactById] 회원 연락 정보 조회 완료: id=${id}, name=${it.name}" }
|
log.info { "[findContactById] 회원 연락 정보 조회 완료: id=${id}, name=${it.name}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun signup(request: UserCreateRequest): UserCreateResponse {
|
fun signup(request: UserCreateRequest): UserCreateResponse {
|
||||||
log.info { "[UserService.signup] 회원가입 시작: request:$request" }
|
log.info { "[signup] 회원가입 시작: request:$request" }
|
||||||
|
|
||||||
userValidator.validateCanSignup(request.email, request.phone)
|
userValidator.validateCanSignup(request.email, request.phone)
|
||||||
|
|
||||||
val user: UserEntity = userRepository.save(
|
val user: UserEntity = userRepository.save(
|
||||||
request.toEntity(id = idGenerator.create(), status = UserStatus.ACTIVE)
|
request.toEntity(id = idGenerator.create(), status = UserStatus.ACTIVE)
|
||||||
).also {
|
).also {
|
||||||
log.info { "[UserService.signup] 회원 저장 완료: id:${it.id}" }
|
log.info { "[signup] 회원 저장 완료: id:${it.id}" }
|
||||||
}.also {
|
}.also {
|
||||||
createHistory(user = it, reason = SIGNUP)
|
createHistory(user = it, reason = SIGNUP)
|
||||||
}
|
}
|
||||||
|
|
||||||
return UserCreateResponse(user.id, user.name)
|
return UserCreateResponse(user.id, user.name)
|
||||||
.also {
|
.also {
|
||||||
log.info { "[UserService.signup] 회원가입 완료: id:${it.id}" }
|
log.info { "[signup] 회원가입 완료: id:${it.id}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ class UserService(
|
|||||||
return userStatusHistoryRepository.save(
|
return userStatusHistoryRepository.save(
|
||||||
UserStatusHistoryEntity(id = idGenerator.create(), userId = user.id, reason = reason, status = user.status)
|
UserStatusHistoryEntity(id = idGenerator.create(), userId = user.id, reason = reason, status = user.status)
|
||||||
).also {
|
).also {
|
||||||
log.info { "[UserService.signup] 회원 상태 이력 저장 완료: userStatusHistoryId:${it.id}" }
|
log.info { "[signup] 회원 상태 이력 저장 완료: userStatusHistoryId:${it.id}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,18 +23,18 @@ class TosspayService(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun confirm(request: PaymentConfirmRequest): PaymentResponse {
|
fun confirm(request: PaymentConfirmRequest): PaymentResponse {
|
||||||
log.info { "[TosspayService.confirm] 결제 확정 시작: paymentKey=${request.paymentKey}, amount=${request.amount}" }
|
log.info { "[confirm] 결제 확정 시작: paymentKey=${request.paymentKey}, amount=${request.amount}" }
|
||||||
|
|
||||||
val payment = choosePayment(request).also { saveAmount(request.paymentKey, it) }
|
val payment = choosePayment(request).also { saveAmount(request.paymentKey, it) }
|
||||||
|
|
||||||
return payment.toResponse()
|
return payment.toResponse()
|
||||||
.also {
|
.also {
|
||||||
log.info { "[TosspayService.confirm] 결제 확정 완료: paymentKey=${request.paymentKey}, amount=${request.amount}" }
|
log.info { "[confirm] 결제 확정 완료: paymentKey=${request.paymentKey}, amount=${request.amount}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun cancel(paymentKey: String, request: PaymentCancelRequest): PaymentResponse {
|
fun cancel(paymentKey: String, request: PaymentCancelRequest): PaymentResponse {
|
||||||
log.info { "[TosspayService.cancel] 결제 취소 시작: paymentKey=${paymentKey}" }
|
log.info { "[cancel] 결제 취소 시작: paymentKey=${paymentKey}" }
|
||||||
|
|
||||||
val orderAmount = orderAmountRepository.findByPaymentKey(paymentKey)
|
val orderAmount = orderAmountRepository.findByPaymentKey(paymentKey)
|
||||||
?: throw TosspayException(TosspayCancelErrorCode.NOT_FOUND_PAYMENT)
|
?: throw TosspayException(TosspayCancelErrorCode.NOT_FOUND_PAYMENT)
|
||||||
@ -50,12 +50,12 @@ class TosspayService(
|
|||||||
return Payment.randomForCancellation(paymentKey, cancellation)
|
return Payment.randomForCancellation(paymentKey, cancellation)
|
||||||
.toResponse()
|
.toResponse()
|
||||||
.also {
|
.also {
|
||||||
log.info { "[TosspayService.cancel] 결제 취소 완료: paymentKey=${paymentKey}" }
|
log.info { "[cancel] 결제 취소 완료: paymentKey=${paymentKey}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun choosePayment(request: PaymentConfirmRequest): Payment {
|
private fun choosePayment(request: PaymentConfirmRequest): Payment {
|
||||||
log.info { "[TosspayService.choosePayment] 랜덤 결제 정보 생성 시작: paymentKey=${request.paymentKey}, amount=${request.amount}" }
|
log.info { "[choosePayment] 랜덤 결제 정보 생성 시작: paymentKey=${request.paymentKey}, amount=${request.amount}" }
|
||||||
val randomValue = Math.random()
|
val randomValue = Math.random()
|
||||||
|
|
||||||
// 70%는 간편결제에 배정
|
// 70%는 간편결제에 배정
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user