Merge pull request '크리에이터 관리자, 관리자 - 일자별 콘텐츠 후원 정산 API' (#90) from test into main

Reviewed-on: #90
This commit is contained in:
klaus 2023-11-14 13:14:19 +00:00
commit 16328f73d9
6 changed files with 33 additions and 6 deletions

View File

@ -129,6 +129,7 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
QGetCalculateContentDonationQueryData( QGetCalculateContentDonationQueryData(
member.nickname, member.nickname,
audioContent.title, audioContent.title,
audioContent.price,
getFormattedDate(audioContent.createdAt), getFormattedDate(audioContent.createdAt),
donationFormattedDate, donationFormattedDate,
useCan.id.count(), useCan.id.count(),

View File

@ -195,7 +195,7 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
@Transactional(readOnly = true) @Transactional(readOnly = true)
@Cacheable( @Cacheable(
cacheNames = ["cache_ttl_3_hours"], cacheNames = ["cache_ttl_3_hours"],
key = "'calculateContentDonationList:' + " + "#startDateStr + ':' + #endDateStr" key = "'calculateContentDonationList2:' + " + "#startDateStr + ':' + #endDateStr"
) )
fun getCalculateContentDonationList( fun getCalculateContentDonationList(
startDateStr: String, startDateStr: String,
@ -222,8 +222,14 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
// 결제수수료 : 6.6% // 결제수수료 : 6.6%
val paymentFee = totalKrw * 0.066f 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% // 원천세 = 정산금액의 3.3%
val tax = settlementAmount * 0.033 val tax = settlementAmount * 0.033
@ -234,6 +240,11 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
GetCalculateContentDonationResponse( GetCalculateContentDonationResponse(
nickname = it.nickname, nickname = it.nickname,
title = it.title, title = it.title,
paidOrFree = if (it.price > 0) {
"유료"
} else {
"무료"
},
registrationDate = it.registrationDate, registrationDate = it.registrationDate,
donationDate = it.donationDate, donationDate = it.donationDate,
numberOfDonation = it.numberOfDonation.toInt(), numberOfDonation = it.numberOfDonation.toInt(),

View File

@ -7,6 +7,8 @@ data class GetCalculateContentDonationQueryData @QueryProjection constructor(
val nickname: String, val nickname: String,
// 콘텐츠 제목 // 콘텐츠 제목
val title: String, val title: String,
// 콘텐츠 가격
val price: Int,
// 콘텐츠 등록 날짜 // 콘텐츠 등록 날짜
val registrationDate: String, val registrationDate: String,
// 후원 날짜 // 후원 날짜

View File

@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
data class GetCalculateContentDonationResponse( data class GetCalculateContentDonationResponse(
@JsonProperty("nickname") val nickname: String, @JsonProperty("nickname") val nickname: String,
@JsonProperty("title") val title: String, @JsonProperty("title") val title: String,
@JsonProperty("paidOrFree") val paidOrFree: String,
@JsonProperty("registrationDate") val registrationDate: String, @JsonProperty("registrationDate") val registrationDate: String,
@JsonProperty("donationDate") val donationDate: String, @JsonProperty("donationDate") val donationDate: String,
@JsonProperty("numberOfDonation") val numberOfDonation: Int, @JsonProperty("numberOfDonation") val numberOfDonation: Int,

View File

@ -224,6 +224,7 @@ class CreatorAdminCalculateQueryRepository(private val queryFactory: JPAQueryFac
QGetCalculateContentDonationQueryData( QGetCalculateContentDonationQueryData(
member.nickname, member.nickname,
audioContent.title, audioContent.title,
audioContent.price,
getFormattedDate(audioContent.createdAt), getFormattedDate(audioContent.createdAt),
donationFormattedDate, donationFormattedDate,
useCan.id.count(), useCan.id.count(),

View File

@ -210,7 +210,7 @@ class CreatorAdminCalculateService(private val repository: CreatorAdminCalculate
@Transactional(readOnly = true) @Transactional(readOnly = true)
@Cacheable( @Cacheable(
cacheNames = ["cache_ttl_3_hours"], cacheNames = ["cache_ttl_3_hours"],
key = "'creatorCalculateContentDonationList:' + " + key = "'creatorCalculateContentDonationList2:' + " +
"#startDateStr + ':' + #endDateStr + ':' + #memberId + ':' + #offset + ':' + #limit" "#startDateStr + ':' + #endDateStr + ':' + #memberId + ':' + #offset + ':' + #limit"
) )
fun getCalculateContentDonationList( fun getCalculateContentDonationList(
@ -242,8 +242,14 @@ class CreatorAdminCalculateService(private val repository: CreatorAdminCalculate
// 결제수수료 : 6.6% // 결제수수료 : 6.6%
val paymentFee = totalKrw * 0.066f 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% // 원천세 = 정산금액의 3.3%
val tax = settlementAmount * 0.033 val tax = settlementAmount * 0.033
@ -254,6 +260,11 @@ class CreatorAdminCalculateService(private val repository: CreatorAdminCalculate
GetCalculateContentDonationResponse( GetCalculateContentDonationResponse(
nickname = it.nickname, nickname = it.nickname,
title = it.title, title = it.title,
paidOrFree = if (it.price > 0) {
"유료"
} else {
"무료"
},
registrationDate = it.registrationDate, registrationDate = it.registrationDate,
donationDate = it.donationDate, donationDate = it.donationDate,
numberOfDonation = it.numberOfDonation.toInt(), numberOfDonation = it.numberOfDonation.toInt(),