test #384
@@ -68,6 +68,19 @@ class AdminMemberStatisticsRepository(private val queryFactory: JPAQueryFactory)
|
|||||||
.size
|
.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getTotalSignUpLineCount(startDate: LocalDateTime, endDate: LocalDateTime): Int {
|
||||||
|
return queryFactory
|
||||||
|
.select(member.id)
|
||||||
|
.from(member)
|
||||||
|
.where(
|
||||||
|
member.createdAt.goe(startDate),
|
||||||
|
member.createdAt.loe(endDate),
|
||||||
|
member.provider.eq(MemberProvider.LINE)
|
||||||
|
)
|
||||||
|
.fetch()
|
||||||
|
.size
|
||||||
|
}
|
||||||
|
|
||||||
fun getTotalAuthCount(startDate: LocalDateTime, endDate: LocalDateTime): Int {
|
fun getTotalAuthCount(startDate: LocalDateTime, endDate: LocalDateTime): Int {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(auth.id)
|
.select(auth.id)
|
||||||
@@ -189,6 +202,25 @@ class AdminMemberStatisticsRepository(private val queryFactory: JPAQueryFactory)
|
|||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getSignUpLineCountInRange(startDate: LocalDateTime, endDate: LocalDateTime): List<DateAndMemberCount> {
|
||||||
|
return queryFactory
|
||||||
|
.select(
|
||||||
|
QDateAndMemberCount(
|
||||||
|
getFormattedDate(member.createdAt),
|
||||||
|
member.id.countDistinct().castToNum(Int::class.java)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.from(member)
|
||||||
|
.where(
|
||||||
|
member.createdAt.goe(startDate),
|
||||||
|
member.createdAt.loe(endDate),
|
||||||
|
member.provider.eq(MemberProvider.LINE)
|
||||||
|
)
|
||||||
|
.groupBy(getFormattedDate(member.createdAt))
|
||||||
|
.orderBy(getFormattedDate(member.createdAt).desc())
|
||||||
|
.fetch()
|
||||||
|
}
|
||||||
|
|
||||||
fun getAuthCountInRange(startDate: LocalDateTime, endDate: LocalDateTime): List<DateAndMemberCount> {
|
fun getAuthCountInRange(startDate: LocalDateTime, endDate: LocalDateTime): List<DateAndMemberCount> {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
|
|||||||
startDate = startDateTime,
|
startDate = startDateTime,
|
||||||
endDate = endDateTime
|
endDate = endDateTime
|
||||||
)
|
)
|
||||||
|
val totalSignUpLineCount = repository.getTotalSignUpLineCount(
|
||||||
|
startDate = startDateTime,
|
||||||
|
endDate = endDateTime
|
||||||
|
)
|
||||||
val totalAuthCount = repository.getTotalAuthCount(startDate = startDateTime, endDate = endDateTime)
|
val totalAuthCount = repository.getTotalAuthCount(startDate = startDateTime, endDate = endDateTime)
|
||||||
val totalSignOutCount = repository.getTotalSignOutCount(startDate = startDateTime, endDate = endDateTime)
|
val totalSignOutCount = repository.getTotalSignOutCount(startDate = startDateTime, endDate = endDateTime)
|
||||||
val totalPaymentMemberCount = repository.getPaymentMemberCount(startDate = startDateTime, endDate = endDateTime)
|
val totalPaymentMemberCount = repository.getPaymentMemberCount(startDate = startDateTime, endDate = endDateTime)
|
||||||
@@ -92,6 +96,11 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
|
|||||||
endDate = endDateTime
|
endDate = endDateTime
|
||||||
).associateBy({ it.date }, { it.memberCount })
|
).associateBy({ it.date }, { it.memberCount })
|
||||||
|
|
||||||
|
val signUpLineCountInRange = repository.getSignUpLineCountInRange(
|
||||||
|
startDate = startDateTime,
|
||||||
|
endDate = endDateTime
|
||||||
|
).associateBy({ it.date }, { it.memberCount })
|
||||||
|
|
||||||
val authCountInRange = repository.getAuthCountInRange(
|
val authCountInRange = repository.getAuthCountInRange(
|
||||||
startDate = startDateTime,
|
startDate = startDateTime,
|
||||||
endDate = endDateTime
|
endDate = endDateTime
|
||||||
@@ -121,6 +130,7 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
|
|||||||
signUpEmailCount = signUpEmailCountInRange[date] ?: 0,
|
signUpEmailCount = signUpEmailCountInRange[date] ?: 0,
|
||||||
signUpKakaoCount = signUpKakaoCountInRange[date] ?: 0,
|
signUpKakaoCount = signUpKakaoCountInRange[date] ?: 0,
|
||||||
signUpGoogleCount = signUpGoogleCountInRange[date] ?: 0,
|
signUpGoogleCount = signUpGoogleCountInRange[date] ?: 0,
|
||||||
|
signUpLineCount = signUpLineCountInRange[date] ?: 0,
|
||||||
signOutCount = signOutCountInRange[date] ?: 0,
|
signOutCount = signOutCountInRange[date] ?: 0,
|
||||||
paymentMemberCount = paymentMemberCountInRangeMap[date] ?: 0
|
paymentMemberCount = paymentMemberCountInRangeMap[date] ?: 0
|
||||||
)
|
)
|
||||||
@@ -134,6 +144,7 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
|
|||||||
totalSignUpEmailCount = totalSignUpEmailCount,
|
totalSignUpEmailCount = totalSignUpEmailCount,
|
||||||
totalSignUpKakaoCount = totalSignUpKakaoCount,
|
totalSignUpKakaoCount = totalSignUpKakaoCount,
|
||||||
totalSignUpGoogleCount = totalSignUpGoogleCount,
|
totalSignUpGoogleCount = totalSignUpGoogleCount,
|
||||||
|
totalSignUpLineCount = totalSignUpLineCount,
|
||||||
totalSignOutCount = totalSignOutCount,
|
totalSignOutCount = totalSignOutCount,
|
||||||
totalPaymentMemberCount = totalPaymentMemberCount,
|
totalPaymentMemberCount = totalPaymentMemberCount,
|
||||||
items = items
|
items = items
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ data class GetMemberStatisticsResponse(
|
|||||||
val totalSignUpEmailCount: Int,
|
val totalSignUpEmailCount: Int,
|
||||||
val totalSignUpKakaoCount: Int,
|
val totalSignUpKakaoCount: Int,
|
||||||
val totalSignUpGoogleCount: Int,
|
val totalSignUpGoogleCount: Int,
|
||||||
|
val totalSignUpLineCount: Int,
|
||||||
val totalSignOutCount: Int,
|
val totalSignOutCount: Int,
|
||||||
val totalPaymentMemberCount: Int,
|
val totalPaymentMemberCount: Int,
|
||||||
val items: List<GetMemberStatisticsItem>
|
val items: List<GetMemberStatisticsItem>
|
||||||
@@ -19,6 +20,7 @@ data class GetMemberStatisticsItem(
|
|||||||
val signUpEmailCount: Int,
|
val signUpEmailCount: Int,
|
||||||
val signUpKakaoCount: Int,
|
val signUpKakaoCount: Int,
|
||||||
val signUpGoogleCount: Int,
|
val signUpGoogleCount: Int,
|
||||||
|
val signUpLineCount: Int,
|
||||||
val signOutCount: Int,
|
val signOutCount: Int,
|
||||||
val paymentMemberCount: Int
|
val paymentMemberCount: Int
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user