Merge pull request '콘텐츠 누적 매출 API - orderType 추가' (#80) from test into main

Reviewed-on: #80
This commit is contained in:
klaus 2023-11-13 14:48:47 +00:00
commit 26b55e6fcf
3 changed files with 14 additions and 2 deletions

View File

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

View File

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

View File

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