parent
aa7c088504
commit
808030100f
|
@ -154,6 +154,24 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
|||
.fetch()
|
||||
}
|
||||
|
||||
fun getCalculateCommunityPostTotalCount(startDate: LocalDateTime?, endDate: LocalDateTime?): Int {
|
||||
val formattedDate = getFormattedDate(useCan.createdAt)
|
||||
return queryFactory
|
||||
.select(creatorCommunity.id)
|
||||
.from(useCan)
|
||||
.innerJoin(useCan.communityPost, creatorCommunity)
|
||||
.innerJoin(creatorCommunity.member, member)
|
||||
.where(
|
||||
useCan.isRefund.isFalse
|
||||
.and(useCan.canUsage.eq(CanUsage.PAID_COMMUNITY_POST))
|
||||
.and(useCan.createdAt.goe(startDate))
|
||||
.and(useCan.createdAt.loe(endDate))
|
||||
)
|
||||
.groupBy(formattedDate, creatorCommunity.id)
|
||||
.fetch()
|
||||
.size
|
||||
}
|
||||
|
||||
fun getCalculateCommunityPostList(
|
||||
startDate: LocalDateTime?,
|
||||
endDate: LocalDateTime?,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package kr.co.vividnext.sodalive.admin.calculate
|
||||
|
||||
import kr.co.vividnext.sodalive.creator.admin.calculate.GetCreatorCalculateCommunityPostResponse
|
||||
import kr.co.vividnext.sodalive.extensions.convertLocalDateTime
|
||||
import org.springframework.cache.annotation.Cacheable
|
||||
import org.springframework.stereotype.Service
|
||||
|
@ -71,12 +72,15 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
|||
endDateStr: String,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): List<GetCalculateCommunityPostResponse> {
|
||||
): GetCreatorCalculateCommunityPostResponse {
|
||||
val startDate = startDateStr.convertLocalDateTime()
|
||||
val endDate = endDateStr.convertLocalDateTime(hour = 23, minute = 59, second = 59)
|
||||
|
||||
return repository
|
||||
val totalCount = repository.getCalculateCommunityPostTotalCount(startDate, endDate)
|
||||
val items = repository
|
||||
.getCalculateCommunityPostList(startDate, endDate, offset, limit)
|
||||
.map { it.toGetCalculateCommunityPostResponse() }
|
||||
|
||||
return GetCreatorCalculateCommunityPostResponse(totalCount, items)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue