fix: 주문한 콘텐츠에 댓글 작성 이벤트
- 포인트 받은 현황을 조회할 때 주문 ID를 같이 조회하도록 만들어서 주문한 콘텐츠에 댓글 작성 이벤트의 경우 주문별로 참여할 수 있도록 수정
This commit is contained in:
parent
6df043dfac
commit
aa23d6d50f
|
@ -8,21 +8,35 @@ import java.time.LocalDateTime
|
||||||
interface PointGrantLogRepository : JpaRepository<PointGrantLog, Long>, PointGrantLogQueryRepository
|
interface PointGrantLogRepository : JpaRepository<PointGrantLog, Long>, PointGrantLogQueryRepository
|
||||||
|
|
||||||
interface PointGrantLogQueryRepository {
|
interface PointGrantLogQueryRepository {
|
||||||
fun countByMemberIdAndPolicyIdAndStartDate(memberId: Long, policyId: Long, startDate: LocalDateTime): Int
|
fun countByMemberIdAndPolicyIdAndStartDate(
|
||||||
|
memberId: Long,
|
||||||
|
policyId: Long,
|
||||||
|
startDate: LocalDateTime,
|
||||||
|
orderId: Long? = null
|
||||||
|
): Int
|
||||||
}
|
}
|
||||||
|
|
||||||
class PointGrantLogQueryRepositoryImpl(
|
class PointGrantLogQueryRepositoryImpl(
|
||||||
private val queryFactory: JPAQueryFactory
|
private val queryFactory: JPAQueryFactory
|
||||||
) : PointGrantLogQueryRepository {
|
) : PointGrantLogQueryRepository {
|
||||||
override fun countByMemberIdAndPolicyIdAndStartDate(memberId: Long, policyId: Long, startDate: LocalDateTime): Int {
|
override fun countByMemberIdAndPolicyIdAndStartDate(
|
||||||
|
memberId: Long,
|
||||||
|
policyId: Long,
|
||||||
|
startDate: LocalDateTime,
|
||||||
|
orderId: Long?
|
||||||
|
): Int {
|
||||||
|
var where = pointGrantLog.memberId.eq(memberId)
|
||||||
|
.and(pointGrantLog.policyId.eq(policyId))
|
||||||
|
.and(pointGrantLog.createdAt.goe(startDate))
|
||||||
|
|
||||||
|
if (orderId != null) {
|
||||||
|
where = where.and(pointGrantLog.orderId.eq(orderId))
|
||||||
|
}
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(pointGrantLog.id)
|
.select(pointGrantLog.id)
|
||||||
.from(pointGrantLog)
|
.from(pointGrantLog)
|
||||||
.where(
|
.where(where)
|
||||||
pointGrantLog.memberId.eq(memberId),
|
|
||||||
pointGrantLog.policyId.eq(policyId),
|
|
||||||
pointGrantLog.createdAt.goe(startDate)
|
|
||||||
)
|
|
||||||
.fetch()
|
.fetch()
|
||||||
.size
|
.size
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,8 @@ class UserActionService(
|
||||||
policyTypeDailyStartDate
|
policyTypeDailyStartDate
|
||||||
} else {
|
} else {
|
||||||
policy.startDate
|
policy.startDate
|
||||||
}
|
},
|
||||||
|
orderId = order?.id
|
||||||
)
|
)
|
||||||
if (grantedCount >= policy.availableCount) return@execute
|
if (grantedCount >= policy.availableCount) return@execute
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue