Compare commits

..

No commits in common. "545836d43cd08c577b6fa4c9a68aa56687b5223d" and "219f83dec06c93f345ef1daae7f3e9031862f391" have entirely different histories.

2 changed files with 33 additions and 6 deletions

View File

@ -61,7 +61,12 @@ class AdminMemberStatisticsRepository(private val queryFactory: JPAQueryFactory)
.sumOf { it.memberCount }
}
fun getSignUpCountInRange(startDate: LocalDateTime, endDate: LocalDateTime): List<DateAndMemberCount> {
fun getSignUpCountInRange(
startDate: LocalDateTime,
endDate: LocalDateTime,
offset: Long,
limit: Long
): List<DateAndMemberCount> {
return queryFactory
.select(
QDateAndMemberCount(
@ -76,10 +81,17 @@ class AdminMemberStatisticsRepository(private val queryFactory: JPAQueryFactory)
)
.groupBy(getFormattedDate(member.createdAt))
.orderBy(getFormattedDate(member.createdAt).desc())
.offset(offset)
.limit(limit)
.fetch()
}
fun getSignOutCountInRange(startDate: LocalDateTime, endDate: LocalDateTime): List<DateAndMemberCount> {
fun getSignOutCountInRange(
startDate: LocalDateTime,
endDate: LocalDateTime,
offset: Long,
limit: Long
): List<DateAndMemberCount> {
return queryFactory
.select(
QDateAndMemberCount(
@ -94,10 +106,17 @@ class AdminMemberStatisticsRepository(private val queryFactory: JPAQueryFactory)
)
.groupBy(getFormattedDate(signOut.createdAt))
.orderBy(getFormattedDate(signOut.createdAt).desc())
.offset(offset)
.limit(limit)
.fetch()
}
fun getPaymentMemberCountInRange(startDate: LocalDateTime, endDate: LocalDateTime): List<DateAndMemberCount> {
fun getPaymentMemberCountInRange(
startDate: LocalDateTime,
endDate: LocalDateTime,
offset: Long,
limit: Long
): List<DateAndMemberCount> {
return queryFactory
.select(
QDateAndMemberCount(
@ -116,6 +135,8 @@ class AdminMemberStatisticsRepository(private val queryFactory: JPAQueryFactory)
)
.groupBy(getFormattedDate(charge.createdAt))
.orderBy(getFormattedDate(charge.createdAt).desc())
.offset(offset)
.limit(limit)
.fetch()
}

View File

@ -61,17 +61,23 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
val signUpCountInRange = repository.getSignUpCountInRange(
startDate = startDateTime,
endDate = endDateTime
endDate = endDateTime,
offset = pageable.offset,
limit = pageable.pageSize.toLong()
).associateBy({ it.date }, { it.memberCount })
val signOutCountInRange = repository.getSignOutCountInRange(
startDate = startDateTime,
endDate = endDateTime
endDate = endDateTime,
offset = pageable.offset,
limit = pageable.pageSize.toLong()
).associateBy({ it.date }, { it.memberCount })
val paymentMemberCountInRange = repository.getPaymentMemberCountInRange(
startDate = startDateTime,
endDate = endDateTime
endDate = endDateTime,
offset = pageable.offset,
limit = pageable.pageSize.toLong()
)
val paymentMemberCountInRangeMap = paymentMemberCountInRange.associateBy({ it.date }, { it.memberCount })