Compare commits
2 Commits
472b51dd85
...
31208b5e99
Author | SHA1 | Date |
---|---|---|
|
31208b5e99 | |
|
c590eff460 |
|
@ -1,7 +1,6 @@
|
||||||
package kr.co.vividnext.sodalive.admin.calculate
|
package kr.co.vividnext.sodalive.admin.calculate
|
||||||
|
|
||||||
import kr.co.vividnext.sodalive.common.ApiResponse
|
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||||
import org.springframework.data.domain.Pageable
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize
|
import org.springframework.security.access.prepost.PreAuthorize
|
||||||
import org.springframework.web.bind.annotation.GetMapping
|
import org.springframework.web.bind.annotation.GetMapping
|
||||||
import org.springframework.web.bind.annotation.RequestMapping
|
import org.springframework.web.bind.annotation.RequestMapping
|
||||||
|
@ -21,14 +20,6 @@ class AdminCalculateController(private val service: AdminCalculateService) {
|
||||||
@GetMapping("/content-list")
|
@GetMapping("/content-list")
|
||||||
fun getCalculateContentList(
|
fun getCalculateContentList(
|
||||||
@RequestParam startDateStr: String,
|
@RequestParam startDateStr: String,
|
||||||
@RequestParam endDateStr: String,
|
@RequestParam endDateStr: String
|
||||||
pageable: Pageable
|
) = ApiResponse.ok(service.getCalculateContentList(startDateStr, endDateStr))
|
||||||
) = ApiResponse.ok(
|
|
||||||
service.getCalculateContentList(
|
|
||||||
startDateStr,
|
|
||||||
endDateStr,
|
|
||||||
pageable.offset,
|
|
||||||
pageable.pageSize.toLong()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,12 +46,7 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCalculateContentList(
|
fun getCalculateContentList(startDate: LocalDateTime, endDate: LocalDateTime): List<GetCalculateContentQueryData> {
|
||||||
startDate: LocalDateTime,
|
|
||||||
endDate: LocalDateTime,
|
|
||||||
offset: Long,
|
|
||||||
limit: Long
|
|
||||||
): List<GetCalculateContentQueryData> {
|
|
||||||
val orderFormattedDate = getFormattedDate(order.createdAt)
|
val orderFormattedDate = getFormattedDate(order.createdAt)
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
|
|
|
@ -72,12 +72,7 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
||||||
.toList()
|
.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCalculateContentList(
|
fun getCalculateContentList(startDateStr: String, endDateStr: String): List<GetCalculateContentResponse> {
|
||||||
startDateStr: String,
|
|
||||||
endDateStr: String,
|
|
||||||
offset: Long,
|
|
||||||
limit: Long
|
|
||||||
): List<GetCalculateContentResponse> {
|
|
||||||
val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
||||||
val startDate = LocalDate.parse(startDateStr, dateTimeFormatter).atTime(0, 0, 0)
|
val startDate = LocalDate.parse(startDateStr, dateTimeFormatter).atTime(0, 0, 0)
|
||||||
.atZone(ZoneId.of("Asia/Seoul"))
|
.atZone(ZoneId.of("Asia/Seoul"))
|
||||||
|
@ -90,7 +85,7 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
||||||
.toLocalDateTime()
|
.toLocalDateTime()
|
||||||
|
|
||||||
return repository
|
return repository
|
||||||
.getCalculateContentList(startDate, endDate, offset, limit)
|
.getCalculateContentList(startDate, endDate)
|
||||||
.map {
|
.map {
|
||||||
val orderTypeStr = if (it.orderType == OrderType.RENTAL) {
|
val orderTypeStr = if (it.orderType == OrderType.RENTAL) {
|
||||||
"대여"
|
"대여"
|
||||||
|
|
Loading…
Reference in New Issue