fix: 캔 가격, Payment의 price 타입 Int, Double -> BigDecimal로 변경

This commit is contained in:
2025-10-01 20:37:53 +09:00
parent 78ff13a654
commit 0c17ea2dcd
18 changed files with 56 additions and 56 deletions

View File

@@ -3,11 +3,12 @@ package kr.co.vividnext.sodalive.admin.can
import kr.co.vividnext.sodalive.can.Can
import kr.co.vividnext.sodalive.can.CanStatus
import kr.co.vividnext.sodalive.extensions.moneyFormat
import java.math.BigDecimal
data class AdminCanRequest(
val can: Int,
val rewardCan: Int,
val price: Double
val price: BigDecimal
) {
fun toEntity(): Can {
var title = "${can.moneyFormat()}"

View File

@@ -20,11 +20,10 @@ class AdminChargeStatusService(val repository: AdminChargeStatusQueryRepository)
.withZoneSameInstant(ZoneId.of("UTC"))
.toLocalDateTime()
var totalChargeAmount = 0.toDouble()
var totalChargeAmount = 0.toBigDecimal()
var totalChargeCount = 0L
val chargeStatusList = repository.getChargeStatus(startDate, endDate)
.asSequence()
.map {
val chargeAmount = if (it.paymentGateWay == PaymentGateway.PG) {
it.pgChargeAmount

View File

@@ -1,13 +1,14 @@
package kr.co.vividnext.sodalive.admin.charge
import com.querydsl.core.annotations.QueryProjection
import java.math.BigDecimal
data class GetChargeStatusDetailQueryDto @QueryProjection constructor(
val memberId: Long,
val nickname: String,
val method: String,
val appleChargeAmount: Double,
val pgChargeAmount: Double,
val appleChargeAmount: BigDecimal,
val pgChargeAmount: BigDecimal,
val locale: String,
val datetime: String
)

View File

@@ -2,11 +2,12 @@ package kr.co.vividnext.sodalive.admin.charge
import com.querydsl.core.annotations.QueryProjection
import kr.co.vividnext.sodalive.can.payment.PaymentGateway
import java.math.BigDecimal
data class GetChargeStatusQueryDto @QueryProjection constructor(
val date: String,
val appleChargeAmount: Double,
val pgChargeAmount: Double,
val appleChargeAmount: BigDecimal,
val pgChargeAmount: BigDecimal,
val chargeCount: Long,
val paymentGateWay: PaymentGateway
)

View File

@@ -1,8 +1,10 @@
package kr.co.vividnext.sodalive.admin.charge
import java.math.BigDecimal
data class GetChargeStatusResponse(
val date: String,
val chargeAmount: Double,
val chargeAmount: BigDecimal,
val chargeCount: Long,
val pg: String
)

View File

@@ -3,7 +3,6 @@ package kr.co.vividnext.sodalive.admin.statistics.ad
import com.querydsl.core.types.dsl.CaseBuilder
import com.querydsl.core.types.dsl.DateTimePath
import com.querydsl.core.types.dsl.Expressions
import com.querydsl.core.types.dsl.NumberExpression
import com.querydsl.core.types.dsl.StringTemplate
import com.querydsl.jpa.impl.JPAQueryFactory
import kr.co.vividnext.sodalive.marketing.AdTrackingHistoryType
@@ -67,7 +66,7 @@ class AdminAdStatisticsRepository(private val queryFactory: JPAQueryFactory) {
val firstPaymentTotalAmount = CaseBuilder()
.`when`(adTrackingHistory.type.eq(AdTrackingHistoryType.FIRST_PAYMENT))
.then(adTrackingHistory.price)
.otherwise(Expressions.constant(0.0))
.otherwise(0.toBigDecimal())
.sum()
val repeatPaymentCount = CaseBuilder()
@@ -79,7 +78,7 @@ class AdminAdStatisticsRepository(private val queryFactory: JPAQueryFactory) {
val repeatPaymentTotalAmount = CaseBuilder()
.`when`(adTrackingHistory.type.eq(AdTrackingHistoryType.REPEAT_PAYMENT))
.then(adTrackingHistory.price)
.otherwise(Expressions.constant(0.0))
.otherwise(0.toBigDecimal())
.sum()
val allPaymentCount = CaseBuilder()
@@ -97,7 +96,7 @@ class AdminAdStatisticsRepository(private val queryFactory: JPAQueryFactory) {
.or(adTrackingHistory.type.eq(AdTrackingHistoryType.REPEAT_PAYMENT))
)
.then(adTrackingHistory.price)
.otherwise(Expressions.constant(0.0))
.otherwise(0.toBigDecimal())
.sum()
return queryFactory
@@ -111,11 +110,11 @@ class AdminAdStatisticsRepository(private val queryFactory: JPAQueryFactory) {
loginCount,
signUpCount,
firstPaymentCount,
roundedValueDecimalPlaces2(firstPaymentTotalAmount),
firstPaymentTotalAmount,
repeatPaymentCount,
roundedValueDecimalPlaces2(repeatPaymentTotalAmount),
repeatPaymentTotalAmount,
allPaymentCount,
roundedValueDecimalPlaces2(allPaymentTotalAmount)
allPaymentTotalAmount
)
)
.from(adTrackingHistory)
@@ -148,13 +147,4 @@ class AdminAdStatisticsRepository(private val queryFactory: JPAQueryFactory) {
"%Y-%m-%d"
)
}
private fun roundedValueDecimalPlaces2(valueExpression: NumberExpression<Double>): NumberExpression<Double> {
return Expressions.numberTemplate(
Double::class.java,
"ROUND({0}, {1})",
valueExpression,
2
)
}
}

View File

@@ -1,6 +1,7 @@
package kr.co.vividnext.sodalive.admin.statistics.ad
import com.querydsl.core.annotations.QueryProjection
import java.math.BigDecimal
data class GetAdminAdStatisticsResponse(
val totalCount: Int,
@@ -16,9 +17,9 @@ data class GetAdminAdStatisticsItem @QueryProjection constructor(
val loginCount: Int,
val signUpCount: Int,
val firstPaymentCount: Int,
val firstPaymentTotalAmount: Double,
val firstPaymentTotalAmount: BigDecimal,
val repeatPaymentCount: Int,
val repeatPaymentTotalAmount: Double,
val repeatPaymentTotalAmount: BigDecimal,
val allPaymentCount: Int,
val allPaymentTotalAmount: Double
val allPaymentTotalAmount: BigDecimal
)