Merge pull request '관리자 캔 충전내역 - 애플 인 앱 결제에 PG결제가 같이 나오던 버그 수정' (#26) from test into main
Reviewed-on: #26
This commit is contained in:
		| @@ -5,6 +5,7 @@ import com.querydsl.jpa.impl.JPAQueryFactory | ||||
| import kr.co.vividnext.sodalive.can.QCan.can1 | ||||
| import kr.co.vividnext.sodalive.can.charge.ChargeStatus | ||||
| import kr.co.vividnext.sodalive.can.charge.QCharge.charge | ||||
| import kr.co.vividnext.sodalive.can.payment.PaymentGateway | ||||
| import kr.co.vividnext.sodalive.can.payment.PaymentStatus | ||||
| import kr.co.vividnext.sodalive.can.payment.QPayment.payment | ||||
| import kr.co.vividnext.sodalive.member.QMember.member | ||||
| @@ -50,7 +51,11 @@ class AdminChargeStatusQueryRepository(private val queryFactory: JPAQueryFactory | ||||
|             .fetch() | ||||
|     } | ||||
|  | ||||
|     fun getChargeStatusDetail(startDate: LocalDateTime, endDate: LocalDateTime): List<GetChargeStatusDetailQueryDto> { | ||||
|     fun getChargeStatusDetail( | ||||
|         startDate: LocalDateTime, | ||||
|         endDate: LocalDateTime, | ||||
|         paymentGateway: PaymentGateway | ||||
|     ): List<GetChargeStatusDetailQueryDto> { | ||||
|         val formattedDate = Expressions.stringTemplate( | ||||
|             "DATE_FORMAT({0}, {1})", | ||||
|             Expressions.dateTimeTemplate( | ||||
| @@ -83,6 +88,7 @@ class AdminChargeStatusQueryRepository(private val queryFactory: JPAQueryFactory | ||||
|                     .and(charge.createdAt.loe(endDate)) | ||||
|                     .and(charge.status.eq(ChargeStatus.CHARGE)) | ||||
|                     .and(payment.status.eq(PaymentStatus.COMPLETE)) | ||||
|                     .and(payment.paymentGateway.eq(paymentGateway)) | ||||
|             ) | ||||
|             .orderBy(formattedDate.desc()) | ||||
|             .fetch() | ||||
|   | ||||
| @@ -74,25 +74,14 @@ class AdminChargeStatusService(val repository: AdminChargeStatusQueryRepository) | ||||
|             .withZoneSameInstant(ZoneId.of("UTC")) | ||||
|             .toLocalDateTime() | ||||
|  | ||||
|         return repository.getChargeStatusDetail(startDate, endDate) | ||||
|         return repository.getChargeStatusDetail(startDate, endDate, paymentGateway) | ||||
|             .asSequence() | ||||
|             .filter { | ||||
|                 if (paymentGateway == PaymentGateway.APPLE_IAP) { | ||||
|                     it.appleChargeAmount > 0 | ||||
|                 } else { | ||||
|                     it.pgChargeAmount > 0 | ||||
|                 } | ||||
|             } | ||||
|             .map { | ||||
|                 GetChargeStatusDetailResponse( | ||||
|                     memberId = it.memberId, | ||||
|                     nickname = it.nickname, | ||||
|                     method = it.method, | ||||
|                     amount = if (paymentGateway == PaymentGateway.APPLE_IAP) { | ||||
|                         it.appleChargeAmount.toInt() | ||||
|                     } else { | ||||
|                         it.pgChargeAmount | ||||
|                     }, | ||||
|                     amount = it.appleChargeAmount.toInt(), | ||||
|                     datetime = it.datetime | ||||
|                 ) | ||||
|             } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user