Skip to content

Commit

Permalink
release v1.1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Sep 8, 2024
2 parents 9029eb0 + 4dc2c88 commit 053a4fd
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,58 +37,58 @@ class SusuStatisticsDailySummaryJob(
parZipWithMDC(
{ withContext(Dispatchers.IO) { systemActionLogRepository.countByCreatedAtBetween(beforeOneDay, now) } },
{ withContext(Dispatchers.IO) { userRepository.countByCreatedAtBetween(beforeOneDay, now) } },
{ withContext(Dispatchers.IO) { envelopeRepository.count() } },
{ withContext(Dispatchers.IO) { envelopeRepository.countByCreatedAtBetween(beforeOneDay, now) } },
{ withContext(Dispatchers.IO) { ledgerRepository.countByCreatedAtBetween(beforeOneDay, now) } },
{ withContext(Dispatchers.IO) { friendRepository.countByCreatedAtBetween(beforeOneDay, now) } },
{ withContext(Dispatchers.IO) { userWithdrawRepository.countByCreatedAtBetween(beforeOneDay, now) } },
{ withContext(Dispatchers.IO) { reportHistoryRepository.countByCreatedAtBetween(beforeOneDay, now) } }
{ withContext(Dispatchers.IO) { reportHistoryRepository.countByCreatedAtBetween(beforeOneDay, now) } },
{ withContext(Dispatchers.IO) { userRepository.countActiveUsers() } }
) {
systemActionLogCount,
userCount,
totalEnvelopeCount,
dailyEnvelopeCount,
dailyLedgerCount,
friendCount,
userWithdrawCount,
dailyReportHistoryCount,
totalActiveUserCount,
->
DailySummaryMessage(
now = now,
systemActionLogCount = systemActionLogCount,
userCount = userCount,
totalEnvelopeCount = totalEnvelopeCount,
dailySystemActionLogCount = systemActionLogCount,
dailyUserCount = userCount,
dailyEnvelopeCount = dailyEnvelopeCount,
dailyLedgerCount = dailyLedgerCount,
friendCount = friendCount,
userWithdrawCount = userWithdrawCount,
dailyReportHistoryCount = dailyReportHistoryCount
dailyFriendCount = friendCount,
dailyUserWithdrawCount = userWithdrawCount,
dailyReportHistoryCount = dailyReportHistoryCount,
totalActiveUserCount = totalActiveUserCount,
)
}.run { discordClient.sendSummary(this.message()) }
}

private data class DailySummaryMessage(
val now: LocalDateTime,
val systemActionLogCount: Long,
val userCount: Long,
val totalEnvelopeCount: Long,
val dailySystemActionLogCount: Long,
val dailyUserCount: Long,
val dailyEnvelopeCount: Long,
val dailyLedgerCount: Long,
val friendCount: Long,
val userWithdrawCount: Long,
val dailyFriendCount: Long,
val dailyUserWithdrawCount: Long,
val dailyReportHistoryCount: Long,
val totalActiveUserCount: Long,
) {
fun message(): DiscordMessageModel {
return DiscordMessageModel(
"""
**[ 일단위 통계 알림 ${now.format("yyyyMMdd HH:mm:ss")} ]**
- 전날 종합 api 호출수 : $systemActionLogCount
- 전날 종합 유저 가입수 : $userCount
- 전날 종합 봉투 생성수 : $dailyEnvelopeCount
- 전체 봉투 생성수 : $totalEnvelopeCount
- 전날 종합 장부 생성수 : $dailyLedgerCount
- 전날 종합 친구 생성수 : $friendCount
- 전날 종합 유저 탈퇴수 : $userWithdrawCount
- 전날 종합 api 호출수 : $dailySystemActionLogCount
- 총합 실제 유저수 : $totalActiveUserCount
- 전날 신규 가입 유저수 : $dailyUserCount
- 전날 유저 탈퇴수 : $dailyUserWithdrawCount
- 전날 신규 봉투 생성수 : $dailyEnvelopeCount
- 전날 신규 장부 생성수 : $dailyLedgerCount
- 전날 신규 친구 생성수 : $dailyFriendCount
- 전날 종합 신고수 : $dailyReportHistoryCount
""".trimIndent()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,13 @@ class EnvelopeQRepositoryImpl : EnvelopeQRepository, QuerydslRepositorySupport(E
).from(qEnvelope)
.join(qFriend).on(qEnvelope.friendId.eq(qFriend.id))
.join(qFriendRelationship).on(qEnvelope.friendId.eq(qFriendRelationship.friendId))
.join(qCategoryAssignment).on(qEnvelope.id.eq(qCategoryAssignment.targetId))
.join(qCategoryAssignment).on(
qEnvelope.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
)
.where(
qEnvelope.id.eq(id),
qEnvelope.uid.eq(uid),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
).fetchFirst()
}

Expand Down Expand Up @@ -232,10 +234,12 @@ class EnvelopeQRepositoryImpl : EnvelopeQRepository, QuerydslRepositorySupport(E
qEnvelope.id.count()
)
).from(qEnvelope)
.join(qCategoryAssignment).on(qEnvelope.id.eq(qCategoryAssignment.targetId))
.join(qCategoryAssignment).on(
qEnvelope.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
)
.where(
qEnvelope.ledgerId.isNull,
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
).groupBy(qCategoryAssignment.categoryId)
.fetch()
}
Expand All @@ -248,9 +252,11 @@ class EnvelopeQRepositoryImpl : EnvelopeQRepository, QuerydslRepositorySupport(E
qEnvelope.id.count()
)
).from(qEnvelope)
.join(qCategoryAssignment).on(qEnvelope.id.eq(qCategoryAssignment.targetId))
.join(qCategoryAssignment).on(
qEnvelope.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
)
.where(
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE),
qEnvelope.ledgerId.isNull,
qEnvelope.uid.notIn(uid)
).groupBy(qCategoryAssignment.categoryId)
Expand All @@ -268,9 +274,11 @@ class EnvelopeQRepositoryImpl : EnvelopeQRepository, QuerydslRepositorySupport(E
qEnvelope.id.count()
)
).from(qEnvelope)
.join(qCategoryAssignment).on(qEnvelope.id.eq(qCategoryAssignment.targetId))
.join(qCategoryAssignment).on(
qEnvelope.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
)
.where(
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE),
qEnvelope.ledgerId.isNull,
qEnvelope.uid.notIn(uid),
qEnvelope.createdAt.after(targetDate)
Expand All @@ -286,11 +294,13 @@ class EnvelopeQRepositoryImpl : EnvelopeQRepository, QuerydslRepositorySupport(E
qEnvelope.id.count()
)
).from(qEnvelope)
.join(qCategoryAssignment).on(qEnvelope.id.eq(qCategoryAssignment.targetId))
.join(qCategoryAssignment).on(
qEnvelope.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
)
.where(
qEnvelope.uid.eq(uid),
qEnvelope.ledgerId.isNull,
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
).groupBy(qCategoryAssignment.categoryId)
.fetch()
}
Expand All @@ -312,7 +322,10 @@ class EnvelopeQRepositoryImpl : EnvelopeQRepository, QuerydslRepositorySupport(E
).from(qEnvelope)
.join(qUser).on(qEnvelope.uid.eq(qUser.id))
.join(qFriendRelationship).on(qEnvelope.friendId.eq(qFriendRelationship.friendId))
.join(qCategoryAssignment).on(qEnvelope.id.eq(qCategoryAssignment.targetId))
.join(qCategoryAssignment).on(
qEnvelope.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
)
.where(
qEnvelope.amount.between(minAmount, maxAmount),
qEnvelope.uid.notIn(uid)
Expand Down Expand Up @@ -343,8 +356,8 @@ class EnvelopeQRepositoryImpl : EnvelopeQRepository, QuerydslRepositorySupport(E
.join(qUser).on(qEnvelope.uid.eq(qUser.id))
.join(qFriendRelationship).on(qEnvelope.friendId.eq(qFriendRelationship.friendId))
.join(qCategoryAssignment).on(
qEnvelope.id.eq(qCategoryAssignment.targetId)
.and(qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE))
qEnvelope.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
)
.where(
qEnvelope.amount.between(minAmount, maxAmount),
Expand All @@ -366,8 +379,8 @@ class EnvelopeQRepositoryImpl : EnvelopeQRepository, QuerydslRepositorySupport(E
.join(qFriend).on(qEnvelope.friendId.eq(qFriend.id))
.join(qFriendRelationship).on(qEnvelope.friendId.eq(qFriendRelationship.friendId))
.join(qCategoryAssignment).on(
qEnvelope.id.eq(qCategoryAssignment.targetId)
.and(qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE))
qEnvelope.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
)

/** where */
Expand Down Expand Up @@ -441,12 +454,14 @@ class EnvelopeQRepositoryImpl : EnvelopeQRepository, QuerydslRepositorySupport(E
).from(qEnvelope)
.join(qFriend).on(qEnvelope.friendId.eq(qFriend.id))
.join(qFriendRelationship).on(qEnvelope.friendId.eq(qFriendRelationship.friendId))
.join(qCategoryAssignment).on(qEnvelope.id.eq(qCategoryAssignment.targetId))
.join(qCategoryAssignment).on(
qEnvelope.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
)
.leftJoin(qLedger).on(qEnvelope.ledgerId.eq(qLedger.id))
.where(
qEnvelope.uid.eq(uid),
qEnvelope.type.eq(envelopeType),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.ENVELOPE)
)

return querydsl.executeSlice(query, pageable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ class LedgerQRepositoryImpl : LedgerQRepository, QuerydslRepositorySupport(Ledge
val query = JPAQuery<QLedger>(entityManager)
.select(QSearchLedgerModel(qLedger, qCategoryAssignment))
.from(qLedger)
.join(qCategoryAssignment).on(qLedger.id.eq(qCategoryAssignment.targetId))
.join(qCategoryAssignment).on(
qLedger.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.LEDGER)
)
.where(
qLedger.uid.eq(spec.uid),
qLedger.title.isContains(spec.title),
qCategoryAssignment.categoryId.isIn(spec.categoryIds),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.LEDGER),
qLedger.startAt.isGoe(spec.fromStartAt),
qLedger.startAt.isLoe(spec.toStartAt)
)
Expand All @@ -65,11 +67,13 @@ class LedgerQRepositoryImpl : LedgerQRepository, QuerydslRepositorySupport(Ledge
return JPAQuery<QLedger>(entityManager)
.select(QLedgerDetailModel(qLedger, qCategoryAssignment))
.from(qLedger)
.join(qCategoryAssignment).on(qLedger.id.eq(qCategoryAssignment.targetId))
.join(qCategoryAssignment).on(
qLedger.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.LEDGER)
)
.where(
qLedger.id.eq(id),
qLedger.uid.eq(uid),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.LEDGER)
qLedger.uid.eq(uid)
).fetchOne()
}

Expand All @@ -82,8 +86,10 @@ class LedgerQRepositoryImpl : LedgerQRepository, QuerydslRepositorySupport(Ledge
)
)
.from(qLedger)
.join(qCategoryAssignment).on(qLedger.id.eq(qCategoryAssignment.targetId))
.where(qCategoryAssignment.targetType.eq(CategoryAssignmentType.LEDGER))
.join(qCategoryAssignment).on(
qLedger.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.LEDGER)
)
.groupBy(qCategoryAssignment.categoryId)
.fetch()
}
Expand Down Expand Up @@ -118,9 +124,11 @@ class LedgerQRepositoryImpl : LedgerQRepository, QuerydslRepositorySupport(Ledge
)
)
.from(qLedger)
.join(qCategoryAssignment).on(qLedger.id.eq(qCategoryAssignment.targetId))
.join(qCategoryAssignment).on(
qLedger.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.LEDGER)
)
.where(
qCategoryAssignment.targetType.eq(CategoryAssignmentType.LEDGER),
qLedger.uid.notIn(uid),
qLedger.createdAt.after(targetDate)
)
Expand All @@ -138,8 +146,8 @@ class LedgerQRepositoryImpl : LedgerQRepository, QuerydslRepositorySupport(Ledge
)
.from(qLedger)
.join(qCategoryAssignment).on(
qLedger.id.eq(qCategoryAssignment.targetId)
.and(qCategoryAssignment.targetType.eq(CategoryAssignmentType.LEDGER))
qLedger.id.eq(qCategoryAssignment.targetId),
qCategoryAssignment.targetType.eq(CategoryAssignmentType.LEDGER)
)
.where(qLedger.uid.eq(uid))
.groupBy(qCategoryAssignment.categoryId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import org.springframework.transaction.annotation.Transactional
@Transactional(readOnly = true)
interface UserQRepository {
fun getUserAndUserStatus(uid: Long): UserAndUserStatusModel?

fun countActiveUsers(): Long
}

class UserQRepositoryImpl : UserQRepository, QuerydslRepositorySupport(User::class.java) {
Expand All @@ -36,4 +38,15 @@ class UserQRepositoryImpl : UserQRepository, QuerydslRepositorySupport(User::cla
.where(qUser.id.isEquals(uid))
.fetchFirst()
}

override fun countActiveUsers(): Long {
return JPAQuery<QUser>(entityManager)
.select(qUser.count())
.from(qUser)
.where(
qUser.oauthInfo.oAuthId.contains("withdraw").not(),
qUser.id.goe(200000)
)
.fetchOne() ?: 0L
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=1.1.14
version=1.1.15
kotlin.code.style=official

0 comments on commit 053a4fd

Please sign in to comment.