관리자

- 커뮤니티 게시물 정산 페이징 적용
This commit is contained in:
Klaus 2024-05-29 00:13:58 +09:00
parent aa7c088504
commit 808030100f
2 changed files with 24 additions and 2 deletions

View File

@ -154,6 +154,24 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
.fetch() .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( fun getCalculateCommunityPostList(
startDate: LocalDateTime?, startDate: LocalDateTime?,
endDate: LocalDateTime?, endDate: LocalDateTime?,

View File

@ -1,5 +1,6 @@
package kr.co.vividnext.sodalive.admin.calculate package kr.co.vividnext.sodalive.admin.calculate
import kr.co.vividnext.sodalive.creator.admin.calculate.GetCreatorCalculateCommunityPostResponse
import kr.co.vividnext.sodalive.extensions.convertLocalDateTime import kr.co.vividnext.sodalive.extensions.convertLocalDateTime
import org.springframework.cache.annotation.Cacheable import org.springframework.cache.annotation.Cacheable
import org.springframework.stereotype.Service import org.springframework.stereotype.Service
@ -71,12 +72,15 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
endDateStr: String, endDateStr: String,
offset: Long, offset: Long,
limit: Long limit: Long
): List<GetCalculateCommunityPostResponse> { ): GetCreatorCalculateCommunityPostResponse {
val startDate = startDateStr.convertLocalDateTime() val startDate = startDateStr.convertLocalDateTime()
val endDate = endDateStr.convertLocalDateTime(hour = 23, minute = 59, second = 59) 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) .getCalculateCommunityPostList(startDate, endDate, offset, limit)
.map { it.toGetCalculateCommunityPostResponse() } .map { it.toGetCalculateCommunityPostResponse() }
return GetCreatorCalculateCommunityPostResponse(totalCount, items)
} }
} }