diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/AdminCalculateQueryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/AdminCalculateQueryRepository.kt index 9c5b12d..947d3fe 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/AdminCalculateQueryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/AdminCalculateQueryRepository.kt @@ -129,6 +129,7 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) { QGetCalculateContentDonationQueryData( member.nickname, audioContent.title, + audioContent.price, getFormattedDate(audioContent.createdAt), donationFormattedDate, useCan.id.count(), diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/AdminCalculateService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/AdminCalculateService.kt index 593d877..649575e 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/AdminCalculateService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/AdminCalculateService.kt @@ -195,7 +195,7 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor @Transactional(readOnly = true) @Cacheable( cacheNames = ["cache_ttl_3_hours"], - key = "'calculateContentDonationList:' + " + "#startDateStr + ':' + #endDateStr" + key = "'calculateContentDonationList2:' + " + "#startDateStr + ':' + #endDateStr" ) fun getCalculateContentDonationList( startDateStr: String, @@ -222,8 +222,14 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor // 결제수수료 : 6.6% val paymentFee = totalKrw * 0.066f - // 정산금액 = (원화 - 결제수수료) 의 70% - val settlementAmount = (totalKrw.toFloat() - paymentFee) * 0.7 + // 정산금액 + // 유료콘텐츠 (원화 - 결제수수료) 의 90% + // 무료콘텐츠 (원화 - 결제수수료) 의 70% + val settlementAmount = if (it.price > 0) { + (totalKrw.toFloat() - paymentFee) * 0.9 + } else { + (totalKrw.toFloat() - paymentFee) * 0.7 + } // 원천세 = 정산금액의 3.3% val tax = settlementAmount * 0.033 @@ -234,6 +240,11 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor GetCalculateContentDonationResponse( nickname = it.nickname, title = it.title, + paidOrFree = if (it.price > 0) { + "유료" + } else { + "무료" + }, registrationDate = it.registrationDate, donationDate = it.donationDate, numberOfDonation = it.numberOfDonation.toInt(), diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/GetCalculateContentDonationQueryData.kt b/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/GetCalculateContentDonationQueryData.kt index 0dc5168..f479c92 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/GetCalculateContentDonationQueryData.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/GetCalculateContentDonationQueryData.kt @@ -7,6 +7,8 @@ data class GetCalculateContentDonationQueryData @QueryProjection constructor( val nickname: String, // 콘텐츠 제목 val title: String, + // 콘텐츠 가격 + val price: Int, // 콘텐츠 등록 날짜 val registrationDate: String, // 후원 날짜 diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/GetCalculateContentDonationResponse.kt b/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/GetCalculateContentDonationResponse.kt index a74b753..f3ec29c 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/GetCalculateContentDonationResponse.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/GetCalculateContentDonationResponse.kt @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty data class GetCalculateContentDonationResponse( @JsonProperty("nickname") val nickname: String, @JsonProperty("title") val title: String, + @JsonProperty("paidOrFree") val paidOrFree: String, @JsonProperty("registrationDate") val registrationDate: String, @JsonProperty("donationDate") val donationDate: String, @JsonProperty("numberOfDonation") val numberOfDonation: Int, diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/calculate/CreatorAdminCalculateQueryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/calculate/CreatorAdminCalculateQueryRepository.kt index c3c22c7..c7be50c 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/calculate/CreatorAdminCalculateQueryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/calculate/CreatorAdminCalculateQueryRepository.kt @@ -224,6 +224,7 @@ class CreatorAdminCalculateQueryRepository(private val queryFactory: JPAQueryFac QGetCalculateContentDonationQueryData( member.nickname, audioContent.title, + audioContent.price, getFormattedDate(audioContent.createdAt), donationFormattedDate, useCan.id.count(), diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/calculate/CreatorAdminCalculateService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/calculate/CreatorAdminCalculateService.kt index c55931f..62645f1 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/calculate/CreatorAdminCalculateService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/calculate/CreatorAdminCalculateService.kt @@ -210,7 +210,7 @@ class CreatorAdminCalculateService(private val repository: CreatorAdminCalculate @Transactional(readOnly = true) @Cacheable( cacheNames = ["cache_ttl_3_hours"], - key = "'creatorCalculateContentDonationList:' + " + + key = "'creatorCalculateContentDonationList2:' + " + "#startDateStr + ':' + #endDateStr + ':' + #memberId + ':' + #offset + ':' + #limit" ) fun getCalculateContentDonationList( @@ -242,8 +242,14 @@ class CreatorAdminCalculateService(private val repository: CreatorAdminCalculate // 결제수수료 : 6.6% val paymentFee = totalKrw * 0.066f - // 정산금액 = (원화 - 결제수수료) 의 70% - val settlementAmount = (totalKrw.toFloat() - paymentFee) * 0.7 + // 정산금액 + // 유료콘텐츠 (원화 - 결제수수료) 의 90% + // 무료콘텐츠 (원화 - 결제수수료) 의 70% + val settlementAmount = if (it.price > 0) { + (totalKrw.toFloat() - paymentFee) * 0.9 + } else { + (totalKrw.toFloat() - paymentFee) * 0.7 + } // 원천세 = 정산금액의 3.3% val tax = settlementAmount * 0.033 @@ -254,6 +260,11 @@ class CreatorAdminCalculateService(private val repository: CreatorAdminCalculate GetCalculateContentDonationResponse( nickname = it.nickname, title = it.title, + paidOrFree = if (it.price > 0) { + "유료" + } else { + "무료" + }, registrationDate = it.registrationDate, donationDate = it.donationDate, numberOfDonation = it.numberOfDonation.toInt(),