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