Compare commits
No commits in common. "31208b5e9908a82949b333d4f3fa4a43eb940777" and "472b51dd85a2c21aa4c7e839afecbb59a9a3615c" have entirely different histories.
31208b5e99
...
472b51dd85
|
@ -1,6 +1,7 @@
|
||||||
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
|
||||||
|
@ -20,6 +21,14 @@ 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,
|
||||||
) = ApiResponse.ok(service.getCalculateContentList(startDateStr, endDateStr))
|
pageable: Pageable
|
||||||
|
) = ApiResponse.ok(
|
||||||
|
service.getCalculateContentList(
|
||||||
|
startDateStr,
|
||||||
|
endDateStr,
|
||||||
|
pageable.offset,
|
||||||
|
pageable.pageSize.toLong()
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,12 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCalculateContentList(startDate: LocalDateTime, endDate: LocalDateTime): List<GetCalculateContentQueryData> {
|
fun getCalculateContentList(
|
||||||
|
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,7 +72,12 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
||||||
.toList()
|
.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCalculateContentList(startDateStr: String, endDateStr: String): List<GetCalculateContentResponse> {
|
fun getCalculateContentList(
|
||||||
|
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"))
|
||||||
|
@ -85,7 +90,7 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
||||||
.toLocalDateTime()
|
.toLocalDateTime()
|
||||||
|
|
||||||
return repository
|
return repository
|
||||||
.getCalculateContentList(startDate, endDate)
|
.getCalculateContentList(startDate, endDate, offset, limit)
|
||||||
.map {
|
.map {
|
||||||
val orderTypeStr = if (it.orderType == OrderType.RENTAL) {
|
val orderTypeStr = if (it.orderType == OrderType.RENTAL) {
|
||||||
"대여"
|
"대여"
|
||||||
|
|
Loading…
Reference in New Issue