콘텐츠 누적 매출 API - orderType 추가 #80

Merged
klaus merged 1 commits from test into main 2023-11-13 14:48:48 +00:00
3 changed files with 14 additions and 2 deletions

View File

@ -108,6 +108,7 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
member.nickname,
audioContent.title,
getFormattedDate(audioContent.createdAt),
order.type,
order.can,
order.id.count(),
order.can.sum()
@ -116,10 +117,10 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
.from(order)
.innerJoin(order.audioContent, audioContent)
.innerJoin(audioContent.member, member)
.groupBy(member.id, audioContent.id, order.can)
.groupBy(member.id, audioContent.id, order.type, order.can)
.offset(offset)
.limit(limit)
.orderBy(member.id.desc(), audioContent.id.asc())
.orderBy(member.id.desc(), audioContent.id.desc())
.fetch()
}
}

View File

@ -141,6 +141,12 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
.getCumulativeSalesByContent(offset, limit)
.asSequence()
.map {
val orderTypeStr = if (it.orderType == OrderType.RENTAL) {
"대여"
} else {
"소장"
}
// 원화 = totalCoin * 100 ( 캔 1개 = 100원 )
val totalKrw = it.totalCan * 100
@ -160,6 +166,7 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
nickname = it.nickname,
title = it.title,
registrationDate = it.registrationDate,
orderType = orderTypeStr,
orderPrice = it.orderPrice,
numberOfPeople = it.numberOfPeople.toInt(),
totalCan = it.totalCan,

View File

@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.admin.calculate
import com.fasterxml.jackson.annotation.JsonProperty
import com.querydsl.core.annotations.QueryProjection
import kr.co.vividnext.sodalive.content.order.OrderType
data class GetCumulativeSalesByContentQueryData @QueryProjection constructor(
// 등록 크리에이터 닉네임
@ -10,6 +11,8 @@ data class GetCumulativeSalesByContentQueryData @QueryProjection constructor(
val title: String,
// 콘텐츠 등록 날짜
val registrationDate: String,
// 대여/소장 구분
val orderType: OrderType,
// 판매 금액(캔)
val orderPrice: Int,
// 인원
@ -27,6 +30,7 @@ data class CumulativeSalesByContentItem(
@JsonProperty("nickname") val nickname: String,
@JsonProperty("title") val title: String,
@JsonProperty("registrationDate") val registrationDate: String,
@JsonProperty("orderType") val orderType: String,
@JsonProperty("orderPrice") val orderPrice: Int,
@JsonProperty("numberOfPeople") val numberOfPeople: Int,
@JsonProperty("totalCan") val totalCan: Int,