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