Compare commits

...

2 Commits

Author SHA1 Message Date
klaus ffa8e5aebb Merge pull request '일별 전체 회원 수 통계' (#300) from test into main
Reviewed-on: #300
2025-03-31 03:50:18 +00:00
Klaus ae439b7e64 일별 전체 회원 수 통계
- 본인인증 수 추가
2025-03-31 12:37:32 +09:00
3 changed files with 41 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import kr.co.vividnext.sodalive.can.payment.PaymentStatus
import kr.co.vividnext.sodalive.can.payment.QPayment.payment
import kr.co.vividnext.sodalive.member.QMember.member
import kr.co.vividnext.sodalive.member.QSignOut.signOut
import kr.co.vividnext.sodalive.member.auth.QAuth.auth
import org.springframework.stereotype.Repository
import java.time.LocalDateTime
@ -27,6 +28,18 @@ class AdminMemberStatisticsRepository(private val queryFactory: JPAQueryFactory)
.size
}
fun getTotalAuthCount(startDate: LocalDateTime, endDate: LocalDateTime): Int {
return queryFactory
.select(auth.id)
.from(auth)
.where(
auth.createdAt.goe(startDate),
auth.createdAt.loe(endDate)
)
.fetch()
.size
}
fun getTotalSignOutCount(startDate: LocalDateTime, endDate: LocalDateTime): Int {
return queryFactory
.select(signOut.id)
@ -79,6 +92,24 @@ class AdminMemberStatisticsRepository(private val queryFactory: JPAQueryFactory)
.fetch()
}
fun getAuthCountInRange(startDate: LocalDateTime, endDate: LocalDateTime): List<DateAndMemberCount> {
return queryFactory
.select(
QDateAndMemberCount(
getFormattedDate(auth.createdAt),
auth.id.countDistinct().castToNum(Int::class.java)
)
)
.from(auth)
.where(
auth.createdAt.goe(startDate),
auth.createdAt.loe(endDate)
)
.groupBy(getFormattedDate(auth.createdAt))
.orderBy(getFormattedDate(auth.createdAt).desc())
.fetch()
}
fun getSignOutCountInRange(startDate: LocalDateTime, endDate: LocalDateTime): List<DateAndMemberCount> {
return queryFactory
.select(

View File

@ -46,6 +46,7 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
.toLocalDateTime()
val totalSignUpCount = repository.getTotalSignUpCount(startDate = startDateTime, endDate = endDateTime)
val totalAuthCount = repository.getTotalAuthCount(startDate = startDateTime, endDate = endDateTime)
val totalSignOutCount = repository.getTotalSignOutCount(startDate = startDateTime, endDate = endDateTime)
val totalPaymentMemberCount = repository.getPaymentMemberCount(startDate = startDateTime, endDate = endDateTime)
@ -64,6 +65,11 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
endDate = endDateTime
).associateBy({ it.date }, { it.memberCount })
val authCountInRange = repository.getAuthCountInRange(
startDate = startDateTime,
endDate = endDateTime
).associateBy({ it.date }, { it.memberCount })
val signOutCountInRange = repository.getSignOutCountInRange(
startDate = startDateTime,
endDate = endDateTime
@ -83,6 +89,7 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
val date = it.format(formatter)
GetMemberStatisticsItem(
date = date,
authCount = authCountInRange[date] ?: 0,
signUpCount = signUpCountInRange[date] ?: 0,
signOutCount = signOutCountInRange[date] ?: 0,
paymentMemberCount = paymentMemberCountInRangeMap[date] ?: 0
@ -92,6 +99,7 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
return GetMemberStatisticsResponse(
totalCount = dateRange.totalDays,
totalAuthCount = totalAuthCount,
totalSignUpCount = totalSignUpCount,
totalSignOutCount = totalSignOutCount,
totalPaymentMemberCount = totalPaymentMemberCount,

View File

@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.admin.statistics.member
data class GetMemberStatisticsResponse(
val totalCount: Int,
val totalAuthCount: Int,
val totalSignUpCount: Int,
val totalSignOutCount: Int,
val totalPaymentMemberCount: Int,
@ -10,6 +11,7 @@ data class GetMemberStatisticsResponse(
data class GetMemberStatisticsItem(
val date: String,
val authCount: Int,
val signUpCount: Int,
val signOutCount: Int,
val paymentMemberCount: Int