크리에이터 관리자 - 정산 API 캐시 추가
This commit is contained in:
parent
b464f7ae4c
commit
d382d85d26
|
@ -7,7 +7,9 @@ import kr.co.vividnext.sodalive.admin.calculate.GetCumulativeSalesByContentRespo
|
|||
import kr.co.vividnext.sodalive.can.use.CanUsage
|
||||
import kr.co.vividnext.sodalive.content.order.OrderType
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import org.springframework.cache.annotation.Cacheable
|
||||
import org.springframework.stereotype.Service
|
||||
import org.springframework.transaction.annotation.Transactional
|
||||
import java.time.LocalDate
|
||||
import java.time.ZoneId
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
@ -15,6 +17,11 @@ import kotlin.math.roundToInt
|
|||
|
||||
@Service
|
||||
class CreatorAdminCalculateService(private val repository: CreatorAdminCalculateQueryRepository) {
|
||||
@Transactional(readOnly = true)
|
||||
@Cacheable(
|
||||
cacheNames = ["default"],
|
||||
key = "'creatorCalculateLive:' + " + "#member + ':' + #startDateStr + ':' + #endDateStr"
|
||||
)
|
||||
fun getCalculateLive(startDateStr: String, endDateStr: String, member: Member): List<GetCalculateLiveResponse> {
|
||||
val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
||||
val startDate = LocalDate.parse(startDateStr, dateTimeFormatter).atTime(0, 0, 0)
|
||||
|
@ -77,6 +84,11 @@ class CreatorAdminCalculateService(private val repository: CreatorAdminCalculate
|
|||
.toList()
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
@Cacheable(
|
||||
cacheNames = ["cache_ttl_3_hours"],
|
||||
key = "'creatorCalculateContentList:' + " + "#memberId + ':' + #startDateStr + ':' + #endDateStr"
|
||||
)
|
||||
fun getCalculateContentList(
|
||||
startDateStr: String,
|
||||
endDateStr: String,
|
||||
|
@ -141,6 +153,11 @@ class CreatorAdminCalculateService(private val repository: CreatorAdminCalculate
|
|||
return GetCalculateContentListResponse(totalCount, items)
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
@Cacheable(
|
||||
cacheNames = ["cache_ttl_3_hours"],
|
||||
key = "'creatorCumulativeSalesByContent:' + " + "#memberId + ':' + #offset + ':' + #limit"
|
||||
)
|
||||
fun getCumulativeSalesByContent(memberId: Long, offset: Long, limit: Long): GetCumulativeSalesByContentResponse {
|
||||
val totalCount = repository.getCumulativeSalesByContentTotalCount(memberId)
|
||||
val items = repository
|
||||
|
|
Loading…
Reference in New Issue