fix: 유저 행동 데이터 기록시 포인트 지급 조건 수정
- 지급유형(매일, 전체) 추가 - 참여가능 횟수 추가 - 주문한 콘텐츠에 댓글을 쓰면 포인트 지급을 위해 포인트 지급 이력에 orderId 추가
This commit is contained in:
@@ -12,5 +12,6 @@ data class PointGrantLog(
|
||||
val point: Int,
|
||||
@Enumerated(EnumType.STRING)
|
||||
val actionType: ActionType,
|
||||
val policyId: Long?
|
||||
val policyId: Long?,
|
||||
val orderId: Long?
|
||||
) : BaseEntity()
|
||||
|
@@ -3,25 +3,27 @@ package kr.co.vividnext.sodalive.point
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||
import kr.co.vividnext.sodalive.point.QPointGrantLog.pointGrantLog
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import java.time.LocalDateTime
|
||||
|
||||
interface PointGrantLogRepository : JpaRepository<PointGrantLog, Long>, PointGrantLogQueryRepository
|
||||
|
||||
interface PointGrantLogQueryRepository {
|
||||
fun existsByMemberIdAndPolicyId(memberId: Long, policyId: Long): Boolean
|
||||
fun countByMemberIdAndPolicyIdAndStartDate(memberId: Long, policyId: Long, startDate: LocalDateTime): Int
|
||||
}
|
||||
|
||||
class PointGrantLogQueryRepositoryImpl(
|
||||
private val queryFactory: JPAQueryFactory
|
||||
) : PointGrantLogQueryRepository {
|
||||
override fun existsByMemberIdAndPolicyId(memberId: Long, policyId: Long): Boolean {
|
||||
override fun countByMemberIdAndPolicyIdAndStartDate(memberId: Long, policyId: Long, startDate: LocalDateTime): Int {
|
||||
return queryFactory
|
||||
.select(pointGrantLog.id)
|
||||
.from(pointGrantLog)
|
||||
.where(
|
||||
pointGrantLog.memberId.eq(memberId),
|
||||
pointGrantLog.policyId.eq(policyId)
|
||||
pointGrantLog.policyId.eq(policyId),
|
||||
pointGrantLog.createdAt.goe(startDate)
|
||||
)
|
||||
.fetch()
|
||||
.isNotEmpty()
|
||||
.size
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.point
|
||||
|
||||
import kr.co.vividnext.sodalive.common.BaseEntity
|
||||
import kr.co.vividnext.sodalive.useraction.ActionType
|
||||
import kr.co.vividnext.sodalive.useraction.PolicyType
|
||||
import java.time.LocalDateTime
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.EnumType
|
||||
@@ -11,8 +12,11 @@ import javax.persistence.Enumerated
|
||||
data class PointRewardPolicy(
|
||||
var title: String,
|
||||
@Enumerated(EnumType.STRING)
|
||||
val policyType: PolicyType,
|
||||
@Enumerated(EnumType.STRING)
|
||||
val actionType: ActionType,
|
||||
val threshold: Int,
|
||||
val availableCount: Int,
|
||||
val pointAmount: Int,
|
||||
var startDate: LocalDateTime,
|
||||
var endDate: LocalDateTime? = null,
|
||||
|
Reference in New Issue
Block a user