일별 전체 회원 수 통계 #300
@@ -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.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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -27,6 +28,18 @@ 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)
 | 
				
			||||||
@@ -79,6 +92,24 @@ 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,6 +46,7 @@ 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)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -64,6 +65,11 @@ 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
 | 
				
			||||||
@@ -83,6 +89,7 @@ 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
 | 
				
			||||||
@@ -92,6 +99,7 @@ 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,6 +2,7 @@ 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,
 | 
				
			||||||
@@ -10,6 +11,7 @@ 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
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user