마케팅 트래킹

- 복합키를 AUTO_INCREMENT의 단일키로 변경
- AppLaunch 트래킹 추가
This commit is contained in:
2025-03-26 13:09:09 +09:00
parent ba9c71a4ec
commit c466ecb77c
7 changed files with 67 additions and 42 deletions

View File

@@ -18,16 +18,16 @@ class AdminAdStatisticsRepository(private val queryFactory: JPAQueryFactory) {
endDate: LocalDateTime
): Int {
return queryFactory
.select(adTrackingHistory.id.pid)
.select(adTrackingHistory.pid)
.from(adTrackingHistory)
.where(
adTrackingHistory.id.createdAt.goe(startDate),
adTrackingHistory.id.createdAt.loe(endDate)
adTrackingHistory.createdAt.goe(startDate),
adTrackingHistory.createdAt.loe(endDate)
)
.groupBy(
getFormattedDate(adTrackingHistory.id.createdAt),
getFormattedDate(adTrackingHistory.createdAt),
adTrackingHistory.mediaGroup,
adTrackingHistory.id.pid,
adTrackingHistory.pid,
adTrackingHistory.pidName
)
.fetch()
@@ -41,45 +41,45 @@ class AdminAdStatisticsRepository(private val queryFactory: JPAQueryFactory) {
limit: Long
): List<GetAdminAdStatisticsItem> {
val signUpCount = CaseBuilder()
.`when`(adTrackingHistory.id.type.eq(AdTrackingHistoryType.SIGNUP))
.`when`(adTrackingHistory.type.eq(AdTrackingHistoryType.SIGNUP))
.then(1)
.otherwise(0)
.sum()
val loginCount = CaseBuilder()
.`when`(adTrackingHistory.id.type.eq(AdTrackingHistoryType.LOGIN))
.`when`(adTrackingHistory.type.eq(AdTrackingHistoryType.LOGIN))
.then(1)
.otherwise(0)
.sum()
val firstPaymentCount = CaseBuilder()
.`when`(adTrackingHistory.id.type.eq(AdTrackingHistoryType.FIRST_PAYMENT))
.`when`(adTrackingHistory.type.eq(AdTrackingHistoryType.FIRST_PAYMENT))
.then(1)
.otherwise(0)
.sum()
val firstPaymentTotalAmount = CaseBuilder()
.`when`(adTrackingHistory.id.type.eq(AdTrackingHistoryType.FIRST_PAYMENT))
.`when`(adTrackingHistory.type.eq(AdTrackingHistoryType.FIRST_PAYMENT))
.then(adTrackingHistory.price)
.otherwise(Expressions.constant(0.0))
.sum()
val repeatPaymentCount = CaseBuilder()
.`when`(adTrackingHistory.id.type.eq(AdTrackingHistoryType.REPEAT_PAYMENT))
.`when`(adTrackingHistory.type.eq(AdTrackingHistoryType.REPEAT_PAYMENT))
.then(1)
.otherwise(0)
.sum()
val repeatPaymentTotalAmount = CaseBuilder()
.`when`(adTrackingHistory.id.type.eq(AdTrackingHistoryType.REPEAT_PAYMENT))
.`when`(adTrackingHistory.type.eq(AdTrackingHistoryType.REPEAT_PAYMENT))
.then(adTrackingHistory.price)
.otherwise(Expressions.constant(0.0))
.sum()
val allPaymentCount = CaseBuilder()
.`when`(
adTrackingHistory.id.type.eq(AdTrackingHistoryType.FIRST_PAYMENT)
.or(adTrackingHistory.id.type.eq(AdTrackingHistoryType.REPEAT_PAYMENT))
adTrackingHistory.type.eq(AdTrackingHistoryType.FIRST_PAYMENT)
.or(adTrackingHistory.type.eq(AdTrackingHistoryType.REPEAT_PAYMENT))
)
.then(1)
.otherwise(0)
@@ -87,8 +87,8 @@ class AdminAdStatisticsRepository(private val queryFactory: JPAQueryFactory) {
val allPaymentTotalAmount = CaseBuilder()
.`when`(
adTrackingHistory.id.type.eq(AdTrackingHistoryType.FIRST_PAYMENT)
.or(adTrackingHistory.id.type.eq(AdTrackingHistoryType.REPEAT_PAYMENT))
adTrackingHistory.type.eq(AdTrackingHistoryType.FIRST_PAYMENT)
.or(adTrackingHistory.type.eq(AdTrackingHistoryType.REPEAT_PAYMENT))
)
.then(adTrackingHistory.price)
.otherwise(Expressions.constant(0.0))
@@ -97,9 +97,9 @@ class AdminAdStatisticsRepository(private val queryFactory: JPAQueryFactory) {
return queryFactory
.select(
QGetAdminAdStatisticsItem(
getFormattedDate(adTrackingHistory.id.createdAt),
getFormattedDate(adTrackingHistory.createdAt),
adTrackingHistory.mediaGroup,
adTrackingHistory.id.pid,
adTrackingHistory.pid,
adTrackingHistory.pidName,
loginCount,
signUpCount,
@@ -113,16 +113,16 @@ class AdminAdStatisticsRepository(private val queryFactory: JPAQueryFactory) {
)
.from(adTrackingHistory)
.where(
adTrackingHistory.id.createdAt.goe(startDate),
adTrackingHistory.id.createdAt.loe(endDate)
adTrackingHistory.createdAt.goe(startDate),
adTrackingHistory.createdAt.loe(endDate)
)
.groupBy(
getFormattedDate(adTrackingHistory.id.createdAt),
getFormattedDate(adTrackingHistory.createdAt),
adTrackingHistory.mediaGroup,
adTrackingHistory.id.pid,
adTrackingHistory.pid,
adTrackingHistory.pidName
)
.orderBy(getFormattedDate(adTrackingHistory.id.createdAt).desc())
.orderBy(getFormattedDate(adTrackingHistory.createdAt).desc())
.offset(offset)
.limit(limit)
.fetch()