Compare commits
4 Commits
6ac94174c8
...
c422bb3d6e
| Author | SHA1 | Date | |
|---|---|---|---|
| c422bb3d6e | |||
| 96ab4da1b0 | |||
| 0ba23f7987 | |||
| d51edfc9a2 |
20
docs/20260305_관리자정산콘텐츠크리에이터별조회SQL오류수정.md
Normal file
20
docs/20260305_관리자정산콘텐츠크리에이터별조회SQL오류수정.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# 관리자 정산 콘텐츠 크리에이터별 조회 SQL 오류 수정 작업 계획
|
||||||
|
|
||||||
|
- [x] `/admin/calculate/content-by-creator` 호출 경로(Controller/Service/Repository)와 SQL 생성 지점을 확인한다.
|
||||||
|
- [x] `ONLY_FULL_GROUP_BY` 위반 원인(`content_settlement_ratio` 비집계 컬럼)을 제거하는 최소 수정안을 적용한다.
|
||||||
|
- [x] 수정된 쿼리가 기존 응답 스키마/정산 계산 로직과 호환되는지 코드 레벨로 검증한다.
|
||||||
|
- [x] `lsp_diagnostics`, 관련 테스트, 빌드를 실행해 정상 동작을 검증한다.
|
||||||
|
|
||||||
|
## 검증 기록
|
||||||
|
|
||||||
|
### 1차 수정
|
||||||
|
- 무엇을: `AdminCalculateQueryRepository#getCalculateContentByCreator`의 `groupBy`를 `member.id`에서 `member.id, creatorSettlementRatio.contentSettlementRatio`로 수정해 SELECT의 비집계 컬럼(`contentSettlementRatio`)이 GROUP BY에 포함되도록 변경했다.
|
||||||
|
- 왜: `/admin/calculate/content-by-creator` 조회 시 `creator_settlement_ratio.content_settlement_ratio`가 SELECT 절에 존재하지만 GROUP BY에 없어 MySQL `ONLY_FULL_GROUP_BY` 모드에서 SQLSyntaxErrorException이 발생했기 때문이다.
|
||||||
|
- 어떻게:
|
||||||
|
- 경로/원인 확인: `AdminCalculateController#getCalculateContentByCreator` -> `AdminCalculateService#getCalculateContentByCreator` -> `AdminCalculateQueryRepository#getCalculateContentByCreator` 호출 체인을 확인했다.
|
||||||
|
- 코드 수정: `src/main/kotlin/kr/co/vividnext/sodalive/admin/calculate/AdminCalculateQueryRepository.kt`의 콘텐츠 크리에이터별 조회 쿼리 `groupBy`를 보완했다.
|
||||||
|
- 검증 실행 결과:
|
||||||
|
- `lsp_diagnostics` (`AdminCalculateQueryRepository.kt`) -> Kotlin LSP 미설정으로 진단 불가
|
||||||
|
- `./gradlew test` -> 성공
|
||||||
|
- `./gradlew build -x test` -> 성공
|
||||||
|
- `./gradlew tasks --all` -> 성공
|
||||||
14
docs/20260305_관리자정산페이징추가.md
Normal file
14
docs/20260305_관리자정산페이징추가.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
- [x] 페이징 미적용 관리자 정산 API 식별
|
||||||
|
- [x] Controller에 Pageable 파라미터 추가 및 Service 호출에 offset/limit 전달
|
||||||
|
- [x] Service/Repository 쿼리에 offset/limit 반영
|
||||||
|
- [x] 정적 진단 및 테스트/빌드 검증
|
||||||
|
|
||||||
|
## 검증 기록
|
||||||
|
|
||||||
|
### 1차 구현
|
||||||
|
- 무엇을: 관리자 정산 API 중 페이징이 없던 `/admin/calculate/live`, `/admin/calculate/content-list`, `/admin/calculate/content-donation-list`에 `Pageable` 기반 페이징을 추가하고, 응답을 `totalCount + items` 구조로 변경했다. 또한 동일 쿼리를 사용하는 엑셀 다운로드 로직이 기존과 동일하게 전체 데이터를 내려주도록 totalCount 기반 전체 조회 방식으로 맞췄다.
|
||||||
|
- 왜: 조회 건수가 많아질 수 있는 정산 목록 API에서 페이지 단위 조회를 지원해 응답 크기와 조회 성능을 안정적으로 관리하기 위해서다.
|
||||||
|
- 어떻게:
|
||||||
|
- 정적 진단: `lsp_diagnostics`로 Kotlin 파일 진단을 시도했으나, 실행 환경에 Kotlin LSP가 설정되어 있지 않아 수행 불가(도구 에러 확인).
|
||||||
|
- 테스트: `./gradlew test` 실행, `BUILD SUCCESSFUL` 확인.
|
||||||
|
- 빌드: `./gradlew build -x test` 실행, `BUILD SUCCESSFUL` 확인.
|
||||||
@@ -21,8 +21,16 @@ class AdminCalculateController(private val service: AdminCalculateService) {
|
|||||||
@GetMapping("/live")
|
@GetMapping("/live")
|
||||||
fun getCalculateLive(
|
fun getCalculateLive(
|
||||||
@RequestParam startDateStr: String,
|
@RequestParam startDateStr: String,
|
||||||
@RequestParam endDateStr: String
|
@RequestParam endDateStr: String,
|
||||||
) = ApiResponse.ok(service.getCalculateLive(startDateStr, endDateStr))
|
pageable: Pageable
|
||||||
|
) = ApiResponse.ok(
|
||||||
|
service.getCalculateLive(
|
||||||
|
startDateStr,
|
||||||
|
endDateStr,
|
||||||
|
pageable.offset,
|
||||||
|
pageable.pageSize.toLong()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
@GetMapping("/live/excel")
|
@GetMapping("/live/excel")
|
||||||
fun downloadCalculateLiveExcel(
|
fun downloadCalculateLiveExcel(
|
||||||
@@ -36,8 +44,16 @@ 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()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
@GetMapping("/content-list/excel")
|
@GetMapping("/content-list/excel")
|
||||||
fun downloadCalculateContentListExcel(
|
fun downloadCalculateContentListExcel(
|
||||||
@@ -56,8 +72,16 @@ class AdminCalculateController(private val service: AdminCalculateService) {
|
|||||||
@GetMapping("/content-donation-list")
|
@GetMapping("/content-donation-list")
|
||||||
fun getCalculateContentDonationList(
|
fun getCalculateContentDonationList(
|
||||||
@RequestParam startDateStr: String,
|
@RequestParam startDateStr: String,
|
||||||
@RequestParam endDateStr: String
|
@RequestParam endDateStr: String,
|
||||||
) = ApiResponse.ok(service.getCalculateContentDonationList(startDateStr, endDateStr))
|
pageable: Pageable
|
||||||
|
) = ApiResponse.ok(
|
||||||
|
service.getCalculateContentDonationList(
|
||||||
|
startDateStr,
|
||||||
|
endDateStr,
|
||||||
|
pageable.offset,
|
||||||
|
pageable.pageSize.toLong()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
@GetMapping("/content-donation-list/excel")
|
@GetMapping("/content-donation-list/excel")
|
||||||
fun downloadCalculateContentDonationListExcel(
|
fun downloadCalculateContentDonationListExcel(
|
||||||
|
|||||||
@@ -18,7 +18,33 @@ import java.time.LocalDateTime
|
|||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
||||||
fun getCalculateLive(startDate: LocalDateTime, endDate: LocalDateTime): List<GetCalculateLiveQueryData> {
|
fun getCalculateLiveTotalCount(startDate: LocalDateTime, endDate: LocalDateTime): Int {
|
||||||
|
return queryFactory
|
||||||
|
.select(liveRoom.id)
|
||||||
|
.from(useCan)
|
||||||
|
.innerJoin(useCan.room, liveRoom)
|
||||||
|
.innerJoin(liveRoom.member, member)
|
||||||
|
.leftJoin(creatorSettlementRatio)
|
||||||
|
.on(
|
||||||
|
member.id.eq(creatorSettlementRatio.member.id)
|
||||||
|
.and(creatorSettlementRatio.deletedAt.isNull)
|
||||||
|
)
|
||||||
|
.where(
|
||||||
|
useCan.isRefund.isFalse
|
||||||
|
.and(useCan.createdAt.goe(startDate))
|
||||||
|
.and(useCan.createdAt.loe(endDate))
|
||||||
|
)
|
||||||
|
.groupBy(liveRoom.id, useCan.canUsage, creatorSettlementRatio.liveSettlementRatio)
|
||||||
|
.fetch()
|
||||||
|
.size
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getCalculateLive(
|
||||||
|
startDate: LocalDateTime,
|
||||||
|
endDate: LocalDateTime,
|
||||||
|
offset: Long,
|
||||||
|
limit: Long
|
||||||
|
): List<GetCalculateLiveQueryData> {
|
||||||
val formattedDate = getFormattedDate(liveRoom.beginDateTime)
|
val formattedDate = getFormattedDate(liveRoom.beginDateTime)
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
@@ -50,10 +76,50 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
|||||||
)
|
)
|
||||||
.groupBy(liveRoom.id, useCan.canUsage, creatorSettlementRatio.liveSettlementRatio)
|
.groupBy(liveRoom.id, useCan.canUsage, creatorSettlementRatio.liveSettlementRatio)
|
||||||
.orderBy(member.nickname.desc(), liveRoom.id.desc(), useCan.canUsage.desc(), formattedDate.desc())
|
.orderBy(member.nickname.desc(), liveRoom.id.desc(), useCan.canUsage.desc(), formattedDate.desc())
|
||||||
|
.offset(offset)
|
||||||
|
.limit(limit)
|
||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCalculateContentList(startDate: LocalDateTime, endDate: LocalDateTime): List<GetCalculateContentQueryData> {
|
fun getCalculateContentListTotalCount(startDate: LocalDateTime, endDate: LocalDateTime): Int {
|
||||||
|
val orderFormattedDate = getFormattedDate(order.createdAt)
|
||||||
|
val pointGroup = CaseBuilder()
|
||||||
|
.`when`(order.point.loe(0)).then(0)
|
||||||
|
.otherwise(1)
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(audioContent.id)
|
||||||
|
.from(order)
|
||||||
|
.innerJoin(order.audioContent, audioContent)
|
||||||
|
.innerJoin(audioContent.member, member)
|
||||||
|
.leftJoin(creatorSettlementRatio)
|
||||||
|
.on(
|
||||||
|
member.id.eq(creatorSettlementRatio.member.id)
|
||||||
|
.and(creatorSettlementRatio.deletedAt.isNull)
|
||||||
|
)
|
||||||
|
.where(
|
||||||
|
order.createdAt.goe(startDate)
|
||||||
|
.and(order.createdAt.loe(endDate))
|
||||||
|
.and(order.isActive.isTrue)
|
||||||
|
)
|
||||||
|
.groupBy(
|
||||||
|
audioContent.id,
|
||||||
|
order.type,
|
||||||
|
orderFormattedDate,
|
||||||
|
order.can,
|
||||||
|
pointGroup,
|
||||||
|
creatorSettlementRatio.contentSettlementRatio
|
||||||
|
)
|
||||||
|
.fetch()
|
||||||
|
.size
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getCalculateContentList(
|
||||||
|
startDate: LocalDateTime,
|
||||||
|
endDate: LocalDateTime,
|
||||||
|
offset: Long,
|
||||||
|
limit: Long
|
||||||
|
): List<GetCalculateContentQueryData> {
|
||||||
val orderFormattedDate = getFormattedDate(order.createdAt)
|
val orderFormattedDate = getFormattedDate(order.createdAt)
|
||||||
val pointGroup = CaseBuilder()
|
val pointGroup = CaseBuilder()
|
||||||
.`when`(order.point.loe(0)).then(0)
|
.`when`(order.point.loe(0)).then(0)
|
||||||
@@ -96,6 +162,8 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
|||||||
creatorSettlementRatio.contentSettlementRatio
|
creatorSettlementRatio.contentSettlementRatio
|
||||||
)
|
)
|
||||||
.orderBy(member.id.desc(), orderFormattedDate.desc(), audioContent.id.asc())
|
.orderBy(member.id.desc(), orderFormattedDate.desc(), audioContent.id.asc())
|
||||||
|
.offset(offset)
|
||||||
|
.limit(limit)
|
||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,11 +235,33 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
|||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getCalculateContentDonationListTotalCount(startDate: LocalDateTime, endDate: LocalDateTime): Int {
|
||||||
|
val donationFormattedDate = getFormattedDate(useCan.createdAt)
|
||||||
|
|
||||||
|
return queryFactory
|
||||||
|
.select(audioContent.id)
|
||||||
|
.from(useCan)
|
||||||
|
.innerJoin(useCan.audioContent, audioContent)
|
||||||
|
.innerJoin(audioContent.member, member)
|
||||||
|
.where(
|
||||||
|
useCan.isRefund.isFalse
|
||||||
|
.and(useCan.canUsage.eq(CanUsage.DONATION))
|
||||||
|
.and(useCan.createdAt.goe(startDate))
|
||||||
|
.and(useCan.createdAt.loe(endDate))
|
||||||
|
)
|
||||||
|
.groupBy(donationFormattedDate, audioContent.id)
|
||||||
|
.fetch()
|
||||||
|
.size
|
||||||
|
}
|
||||||
|
|
||||||
fun getCalculateContentDonationList(
|
fun getCalculateContentDonationList(
|
||||||
startDate: LocalDateTime,
|
startDate: LocalDateTime,
|
||||||
endDate: LocalDateTime
|
endDate: LocalDateTime,
|
||||||
|
offset: Long,
|
||||||
|
limit: Long
|
||||||
): List<GetCalculateContentDonationQueryData> {
|
): List<GetCalculateContentDonationQueryData> {
|
||||||
val donationFormattedDate = getFormattedDate(useCan.createdAt)
|
val donationFormattedDate = getFormattedDate(useCan.createdAt)
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(
|
.select(
|
||||||
QGetCalculateContentDonationQueryData(
|
QGetCalculateContentDonationQueryData(
|
||||||
@@ -195,6 +285,8 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
|||||||
)
|
)
|
||||||
.groupBy(donationFormattedDate, audioContent.id)
|
.groupBy(donationFormattedDate, audioContent.id)
|
||||||
.orderBy(member.id.asc(), donationFormattedDate.desc(), audioContent.id.desc())
|
.orderBy(member.id.asc(), donationFormattedDate.desc(), audioContent.id.desc())
|
||||||
|
.offset(offset)
|
||||||
|
.limit(limit)
|
||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,7 +453,7 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
|||||||
.and(order.createdAt.loe(endDate))
|
.and(order.createdAt.loe(endDate))
|
||||||
.and(order.isActive.isTrue)
|
.and(order.isActive.isTrue)
|
||||||
)
|
)
|
||||||
.groupBy(member.id)
|
.groupBy(member.id, creatorSettlementRatio.contentSettlementRatio)
|
||||||
.orderBy(member.id.desc())
|
.orderBy(member.id.desc())
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
|
|||||||
@@ -15,29 +15,43 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
|||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
@Cacheable(
|
@Cacheable(
|
||||||
cacheNames = ["cache_ttl_3_hours"],
|
cacheNames = ["cache_ttl_3_hours"],
|
||||||
key = "'calculateLive:' + " + "#startDateStr + ':' + #endDateStr"
|
key = "'calculateLive:' + " + "#startDateStr + ':' + #endDateStr + ':' + #offset + ':' + #limit"
|
||||||
)
|
)
|
||||||
fun getCalculateLive(startDateStr: String, endDateStr: String): List<GetCalculateLiveResponse> {
|
fun getCalculateLive(
|
||||||
|
startDateStr: String,
|
||||||
|
endDateStr: String,
|
||||||
|
offset: Long,
|
||||||
|
limit: Long
|
||||||
|
): GetCalculateLiveListResponse {
|
||||||
val startDate = startDateStr.convertLocalDateTime()
|
val startDate = startDateStr.convertLocalDateTime()
|
||||||
val endDate = endDateStr.convertLocalDateTime(hour = 23, minute = 59, second = 59)
|
val endDate = endDateStr.convertLocalDateTime(hour = 23, minute = 59, second = 59)
|
||||||
|
val totalCount = repository.getCalculateLiveTotalCount(startDate, endDate)
|
||||||
return repository
|
val items = repository
|
||||||
.getCalculateLive(startDate, endDate)
|
.getCalculateLive(startDate, endDate, offset, limit)
|
||||||
.map { it.toGetCalculateLiveResponse() }
|
.map { it.toGetCalculateLiveResponse() }
|
||||||
|
|
||||||
|
return GetCalculateLiveListResponse(totalCount, items)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
@Cacheable(
|
@Cacheable(
|
||||||
cacheNames = ["cache_ttl_3_hours"],
|
cacheNames = ["cache_ttl_3_hours"],
|
||||||
key = "'calculateContent:' + " + "#startDateStr + ':' + #endDateStr"
|
key = "'calculateContent:' + " + "#startDateStr + ':' + #endDateStr + ':' + #offset + ':' + #limit"
|
||||||
)
|
)
|
||||||
fun getCalculateContentList(startDateStr: String, endDateStr: String): List<GetCalculateContentResponse> {
|
fun getCalculateContentList(
|
||||||
|
startDateStr: String,
|
||||||
|
endDateStr: String,
|
||||||
|
offset: Long,
|
||||||
|
limit: Long
|
||||||
|
): GetCalculateContentListResponse {
|
||||||
val startDate = startDateStr.convertLocalDateTime()
|
val startDate = startDateStr.convertLocalDateTime()
|
||||||
val endDate = endDateStr.convertLocalDateTime(hour = 23, minute = 59, second = 59)
|
val endDate = endDateStr.convertLocalDateTime(hour = 23, minute = 59, second = 59)
|
||||||
|
val totalCount = repository.getCalculateContentListTotalCount(startDate, endDate)
|
||||||
return repository
|
val items = repository
|
||||||
.getCalculateContentList(startDate, endDate)
|
.getCalculateContentList(startDate, endDate, offset, limit)
|
||||||
.map { it.toGetCalculateContentResponse() }
|
.map { it.toGetCalculateContentResponse() }
|
||||||
|
|
||||||
|
return GetCalculateContentListResponse(totalCount, items)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
@@ -57,18 +71,22 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
|||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
@Cacheable(
|
@Cacheable(
|
||||||
cacheNames = ["cache_ttl_3_hours"],
|
cacheNames = ["cache_ttl_3_hours"],
|
||||||
key = "'calculateContentDonationList2:' + " + "#startDateStr + ':' + #endDateStr"
|
key = "'calculateContentDonationList2:' + " + "#startDateStr + ':' + #endDateStr + ':' + #offset + ':' + #limit"
|
||||||
)
|
)
|
||||||
fun getCalculateContentDonationList(
|
fun getCalculateContentDonationList(
|
||||||
startDateStr: String,
|
startDateStr: String,
|
||||||
endDateStr: String
|
endDateStr: String,
|
||||||
): List<GetCalculateContentDonationResponse> {
|
offset: Long,
|
||||||
|
limit: Long
|
||||||
|
): GetCalculateContentDonationListResponse {
|
||||||
val startDate = startDateStr.convertLocalDateTime()
|
val startDate = startDateStr.convertLocalDateTime()
|
||||||
val endDate = endDateStr.convertLocalDateTime(hour = 23, minute = 59, second = 59)
|
val endDate = endDateStr.convertLocalDateTime(hour = 23, minute = 59, second = 59)
|
||||||
|
val totalCount = repository.getCalculateContentDonationListTotalCount(startDate, endDate)
|
||||||
return repository
|
val items = repository
|
||||||
.getCalculateContentDonationList(startDate, endDate)
|
.getCalculateContentDonationList(startDate, endDate, offset, limit)
|
||||||
.map { it.toGetCalculateContentDonationResponse() }
|
.map { it.toGetCalculateContentDonationResponse() }
|
||||||
|
|
||||||
|
return GetCalculateContentDonationListResponse(totalCount, items)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
@@ -147,9 +165,14 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
|||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun downloadCalculateLiveExcel(startDateStr: String, endDateStr: String): StreamingResponseBody {
|
fun downloadCalculateLiveExcel(startDateStr: String, endDateStr: String): StreamingResponseBody {
|
||||||
val (startDate, endDate) = toDateRange(startDateStr, endDateStr)
|
val (startDate, endDate) = toDateRange(startDateStr, endDateStr)
|
||||||
val items = repository
|
val totalCount = repository.getCalculateLiveTotalCount(startDate, endDate)
|
||||||
.getCalculateLive(startDate, endDate)
|
val items = if (totalCount == 0) {
|
||||||
.map { it.toGetCalculateLiveResponse() }
|
emptyList()
|
||||||
|
} else {
|
||||||
|
repository
|
||||||
|
.getCalculateLive(startDate, endDate, 0L, totalCount.toLong())
|
||||||
|
.map { it.toGetCalculateLiveResponse() }
|
||||||
|
}
|
||||||
|
|
||||||
return createExcelStream(
|
return createExcelStream(
|
||||||
sheetName = "라이브 정산",
|
sheetName = "라이브 정산",
|
||||||
@@ -191,9 +214,14 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
|||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun downloadCalculateContentListExcel(startDateStr: String, endDateStr: String): StreamingResponseBody {
|
fun downloadCalculateContentListExcel(startDateStr: String, endDateStr: String): StreamingResponseBody {
|
||||||
val (startDate, endDate) = toDateRange(startDateStr, endDateStr)
|
val (startDate, endDate) = toDateRange(startDateStr, endDateStr)
|
||||||
val items = repository
|
val totalCount = repository.getCalculateContentListTotalCount(startDate, endDate)
|
||||||
.getCalculateContentList(startDate, endDate)
|
val items = if (totalCount == 0) {
|
||||||
.map { it.toGetCalculateContentResponse() }
|
emptyList()
|
||||||
|
} else {
|
||||||
|
repository
|
||||||
|
.getCalculateContentList(startDate, endDate, 0L, totalCount.toLong())
|
||||||
|
.map { it.toGetCalculateContentResponse() }
|
||||||
|
}
|
||||||
|
|
||||||
return createExcelStream(
|
return createExcelStream(
|
||||||
sheetName = "콘텐츠 정산",
|
sheetName = "콘텐츠 정산",
|
||||||
@@ -235,9 +263,14 @@ class AdminCalculateService(private val repository: AdminCalculateQueryRepositor
|
|||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
fun downloadCalculateContentDonationListExcel(startDateStr: String, endDateStr: String): StreamingResponseBody {
|
fun downloadCalculateContentDonationListExcel(startDateStr: String, endDateStr: String): StreamingResponseBody {
|
||||||
val (startDate, endDate) = toDateRange(startDateStr, endDateStr)
|
val (startDate, endDate) = toDateRange(startDateStr, endDateStr)
|
||||||
val items = repository
|
val totalCount = repository.getCalculateContentDonationListTotalCount(startDate, endDate)
|
||||||
.getCalculateContentDonationList(startDate, endDate)
|
val items = if (totalCount == 0) {
|
||||||
.map { it.toGetCalculateContentDonationResponse() }
|
emptyList()
|
||||||
|
} else {
|
||||||
|
repository
|
||||||
|
.getCalculateContentDonationList(startDate, endDate, 0L, totalCount.toLong())
|
||||||
|
.map { it.toGetCalculateContentDonationResponse() }
|
||||||
|
}
|
||||||
|
|
||||||
return createExcelStream(
|
return createExcelStream(
|
||||||
sheetName = "콘텐츠 후원 정산",
|
sheetName = "콘텐츠 후원 정산",
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package kr.co.vividnext.sodalive.admin.calculate
|
||||||
|
|
||||||
|
data class GetCalculateContentDonationListResponse(
|
||||||
|
val totalCount: Int,
|
||||||
|
val items: List<GetCalculateContentDonationResponse>
|
||||||
|
)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package kr.co.vividnext.sodalive.admin.calculate
|
||||||
|
|
||||||
|
data class GetCalculateContentListResponse(
|
||||||
|
val totalCount: Int,
|
||||||
|
val items: List<GetCalculateContentResponse>
|
||||||
|
)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package kr.co.vividnext.sodalive.admin.calculate
|
||||||
|
|
||||||
|
data class GetCalculateLiveListResponse(
|
||||||
|
val totalCount: Int,
|
||||||
|
val items: List<GetCalculateLiveResponse>
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user