Compare commits
No commits in common. "ffa8e5aebb2326211892ca22f32d3b9c77a77ac7" and "cbbfe014cc8781bb86f3be569377856f51dc5d95" have entirely different histories.
ffa8e5aebb
...
cbbfe014cc
|
@ -10,7 +10,6 @@ import kr.co.vividnext.sodalive.can.payment.PaymentStatus
|
||||||
import kr.co.vividnext.sodalive.can.payment.QPayment.payment
|
import kr.co.vividnext.sodalive.can.payment.QPayment.payment
|
||||||
import kr.co.vividnext.sodalive.member.QMember.member
|
import kr.co.vividnext.sodalive.member.QMember.member
|
||||||
import kr.co.vividnext.sodalive.member.QSignOut.signOut
|
import kr.co.vividnext.sodalive.member.QSignOut.signOut
|
||||||
import kr.co.vividnext.sodalive.member.auth.QAuth.auth
|
|
||||||
import org.springframework.stereotype.Repository
|
import org.springframework.stereotype.Repository
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
@ -28,18 +27,6 @@ class AdminMemberStatisticsRepository(private val queryFactory: JPAQueryFactory)
|
||||||
.size
|
.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 {
|
fun getTotalSignOutCount(startDate: LocalDateTime, endDate: LocalDateTime): Int {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(signOut.id)
|
.select(signOut.id)
|
||||||
|
@ -92,24 +79,6 @@ class AdminMemberStatisticsRepository(private val queryFactory: JPAQueryFactory)
|
||||||
.fetch()
|
.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> {
|
fun getSignOutCountInRange(startDate: LocalDateTime, endDate: LocalDateTime): List<DateAndMemberCount> {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
|
|
|
@ -46,7 +46,6 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
|
||||||
.toLocalDateTime()
|
.toLocalDateTime()
|
||||||
|
|
||||||
val totalSignUpCount = repository.getTotalSignUpCount(startDate = startDateTime, endDate = endDateTime)
|
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 totalSignOutCount = repository.getTotalSignOutCount(startDate = startDateTime, endDate = endDateTime)
|
||||||
val totalPaymentMemberCount = repository.getPaymentMemberCount(startDate = startDateTime, endDate = endDateTime)
|
val totalPaymentMemberCount = repository.getPaymentMemberCount(startDate = startDateTime, endDate = endDateTime)
|
||||||
|
|
||||||
|
@ -65,11 +64,6 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
|
||||||
endDate = endDateTime
|
endDate = endDateTime
|
||||||
).associateBy({ it.date }, { it.memberCount })
|
).associateBy({ it.date }, { it.memberCount })
|
||||||
|
|
||||||
val authCountInRange = repository.getAuthCountInRange(
|
|
||||||
startDate = startDateTime,
|
|
||||||
endDate = endDateTime
|
|
||||||
).associateBy({ it.date }, { it.memberCount })
|
|
||||||
|
|
||||||
val signOutCountInRange = repository.getSignOutCountInRange(
|
val signOutCountInRange = repository.getSignOutCountInRange(
|
||||||
startDate = startDateTime,
|
startDate = startDateTime,
|
||||||
endDate = endDateTime
|
endDate = endDateTime
|
||||||
|
@ -89,7 +83,6 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
|
||||||
val date = it.format(formatter)
|
val date = it.format(formatter)
|
||||||
GetMemberStatisticsItem(
|
GetMemberStatisticsItem(
|
||||||
date = date,
|
date = date,
|
||||||
authCount = authCountInRange[date] ?: 0,
|
|
||||||
signUpCount = signUpCountInRange[date] ?: 0,
|
signUpCount = signUpCountInRange[date] ?: 0,
|
||||||
signOutCount = signOutCountInRange[date] ?: 0,
|
signOutCount = signOutCountInRange[date] ?: 0,
|
||||||
paymentMemberCount = paymentMemberCountInRangeMap[date] ?: 0
|
paymentMemberCount = paymentMemberCountInRangeMap[date] ?: 0
|
||||||
|
@ -99,7 +92,6 @@ class AdminMemberStatisticsService(private val repository: AdminMemberStatistics
|
||||||
|
|
||||||
return GetMemberStatisticsResponse(
|
return GetMemberStatisticsResponse(
|
||||||
totalCount = dateRange.totalDays,
|
totalCount = dateRange.totalDays,
|
||||||
totalAuthCount = totalAuthCount,
|
|
||||||
totalSignUpCount = totalSignUpCount,
|
totalSignUpCount = totalSignUpCount,
|
||||||
totalSignOutCount = totalSignOutCount,
|
totalSignOutCount = totalSignOutCount,
|
||||||
totalPaymentMemberCount = totalPaymentMemberCount,
|
totalPaymentMemberCount = totalPaymentMemberCount,
|
||||||
|
|
|
@ -2,7 +2,6 @@ package kr.co.vividnext.sodalive.admin.statistics.member
|
||||||
|
|
||||||
data class GetMemberStatisticsResponse(
|
data class GetMemberStatisticsResponse(
|
||||||
val totalCount: Int,
|
val totalCount: Int,
|
||||||
val totalAuthCount: Int,
|
|
||||||
val totalSignUpCount: Int,
|
val totalSignUpCount: Int,
|
||||||
val totalSignOutCount: Int,
|
val totalSignOutCount: Int,
|
||||||
val totalPaymentMemberCount: Int,
|
val totalPaymentMemberCount: Int,
|
||||||
|
@ -11,7 +10,6 @@ data class GetMemberStatisticsResponse(
|
||||||
|
|
||||||
data class GetMemberStatisticsItem(
|
data class GetMemberStatisticsItem(
|
||||||
val date: String,
|
val date: String,
|
||||||
val authCount: Int,
|
|
||||||
val signUpCount: Int,
|
val signUpCount: Int,
|
||||||
val signOutCount: Int,
|
val signOutCount: Int,
|
||||||
val paymentMemberCount: Int
|
val paymentMemberCount: Int
|
||||||
|
|
Loading…
Reference in New Issue