관리자 콘텐츠 정산 API - 페이징 제거
This commit is contained in:
parent
c590eff460
commit
31208b5e99
|
@ -1,7 +1,6 @@
|
|||
package kr.co.vividnext.sodalive.admin.calculate
|
||||
|
||||
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||
import org.springframework.data.domain.Pageable
|
||||
import org.springframework.security.access.prepost.PreAuthorize
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
|
@ -21,14 +20,6 @@ class AdminCalculateController(private val service: AdminCalculateService) {
|
|||
@GetMapping("/content-list")
|
||||
fun getCalculateContentList(
|
||||
@RequestParam startDateStr: String,
|
||||
@RequestParam endDateStr: String,
|
||||
pageable: Pageable
|
||||
) = ApiResponse.ok(
|
||||
service.getCalculateContentList(
|
||||
startDateStr,
|
||||
endDateStr,
|
||||
pageable.offset,
|
||||
pageable.pageSize.toLong()
|
||||
)
|
||||
)
|
||||
@RequestParam endDateStr: String
|
||||
) = ApiResponse.ok(service.getCalculateContentList(startDateStr, endDateStr))
|
||||
}
|
||||
|
|
|
@ -46,30 +46,7 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
|||
.fetch()
|
||||
}
|
||||
|
||||
fun getCalculateContentTotalCount(startDate: LocalDateTime, endDate: LocalDateTime): Int {
|
||||
return queryFactory
|
||||
.select(audioContent.id)
|
||||
.from(useCanCalculate)
|
||||
.innerJoin(useCanCalculate.useCan, useCan)
|
||||
.innerJoin(useCan.order, order)
|
||||
.innerJoin(order.audioContent, audioContent)
|
||||
.innerJoin(audioContent.member, member)
|
||||
.where(
|
||||
useCanCalculate.status.eq(UseCanCalculateStatus.RECEIVED)
|
||||
.and(order.createdAt.goe(startDate))
|
||||
.and(order.createdAt.loe(endDate))
|
||||
)
|
||||
.groupBy(audioContent.id, order.type)
|
||||
.fetch()
|
||||
.size
|
||||
}
|
||||
|
||||
fun getCalculateContentList(
|
||||
startDate: LocalDateTime,
|
||||
endDate: LocalDateTime,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): List<GetCalculateContentQueryData> {
|
||||
fun getCalculateContentList(startDate: LocalDateTime, endDate: LocalDateTime): List<GetCalculateContentQueryData> {
|
||||
val orderFormattedDate = getFormattedDate(order.createdAt)
|
||||
return queryFactory
|
||||
.select(
|
||||
|
|
|
@ -72,12 +72,7 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
|||
.toList()
|
||||
}
|
||||
|
||||
fun getCalculateContentList(
|
||||
startDateStr: String,
|
||||
endDateStr: String,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): GetCalculateContentResponse {
|
||||
fun getCalculateContentList(startDateStr: String, endDateStr: String): List<GetCalculateContentResponse> {
|
||||
val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
||||
val startDate = LocalDate.parse(startDateStr, dateTimeFormatter).atTime(0, 0, 0)
|
||||
.atZone(ZoneId.of("Asia/Seoul"))
|
||||
|
@ -89,10 +84,8 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
|||
.withZoneSameInstant(ZoneId.of("UTC"))
|
||||
.toLocalDateTime()
|
||||
|
||||
val totalCount = repository.getCalculateContentTotalCount(startDate, endDate)
|
||||
|
||||
val items = repository
|
||||
.getCalculateContentList(startDate, endDate, offset, limit)
|
||||
return repository
|
||||
.getCalculateContentList(startDate, endDate)
|
||||
.map {
|
||||
val orderTypeStr = if (it.orderType == OrderType.RENTAL) {
|
||||
"대여"
|
||||
|
@ -115,7 +108,7 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
|||
// 입금액
|
||||
val depositAmount = settlementAmount - tax
|
||||
|
||||
GetCalculateContentItemResponse(
|
||||
GetCalculateContentResponse(
|
||||
nickname = it.nickname,
|
||||
title = it.title,
|
||||
registrationDate = it.registrationDate,
|
||||
|
@ -132,10 +125,5 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
|||
)
|
||||
}
|
||||
.toList()
|
||||
|
||||
return GetCalculateContentResponse(
|
||||
totalCount = totalCount,
|
||||
items = items
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
package kr.co.vividnext.sodalive.admin.calculate
|
||||
|
||||
data class GetCalculateContentResponse(
|
||||
val totalCount: Int,
|
||||
val items: List<GetCalculateContentItemResponse>
|
||||
)
|
||||
|
||||
data class GetCalculateContentItemResponse(
|
||||
// 등록 크리에이터 닉네임
|
||||
val nickname: String,
|
||||
// 콘텐츠 제목
|
||||
|
|
Loading…
Reference in New Issue