-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BE] FIX: 아이템 구매 통계 및 특정 기간동안 재화 사용량 반환 컨트롤러 AdminStatisticsControlle…
…rV5로 이동 & 재화 사용량 반환 시 날짜 기준 정렬 추가
- Loading branch information
Showing
13 changed files
with
335 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...main/java/org/ftclub/cabinet/admin/statistics/controller/AdminStatisticsControllerV5.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package org.ftclub.cabinet.admin.statistics.controller; | ||
|
||
import java.time.LocalDateTime; | ||
import lombok.RequiredArgsConstructor; | ||
import org.ftclub.cabinet.admin.item.service.AdminItemFacadeService; | ||
import org.ftclub.cabinet.admin.statistics.service.AdminStatisticsFacadeService; | ||
import org.ftclub.cabinet.auth.domain.AuthGuard; | ||
import org.ftclub.cabinet.auth.domain.AuthLevel; | ||
import org.ftclub.cabinet.dto.CoinCollectStatisticsDto; | ||
import org.ftclub.cabinet.dto.CoinStaticsDto; | ||
import org.ftclub.cabinet.dto.ItemStatisticsDto; | ||
import org.ftclub.cabinet.dto.TotalCoinAmountDto; | ||
import org.ftclub.cabinet.log.Logging; | ||
import org.springframework.format.annotation.DateTimeFormat; | ||
import org.springframework.format.annotation.DateTimeFormat.ISO; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/v5/admin/statistics") | ||
@RequiredArgsConstructor | ||
@Logging | ||
public class AdminStatisticsControllerV5 { | ||
|
||
private final AdminStatisticsFacadeService adminStatisticsFacadeService; | ||
private final AdminItemFacadeService adminItemFacadeService; | ||
|
||
/** | ||
* 특정 연도, 월의 동전 줍기 횟수를 횟수 별로 통계를 내서 반환 | ||
* | ||
* @param year | ||
* @param month 조회를 원하는 기간 | ||
* @return | ||
*/ | ||
@GetMapping("/coins/collect") | ||
@AuthGuard(level = AuthLevel.ADMIN_ONLY) | ||
public CoinCollectStatisticsDto getCoinCollectCountByMonth( | ||
@RequestParam("year") Integer year, | ||
@RequestParam("month") Integer month) { | ||
return adminStatisticsFacadeService.getCoinCollectCountByMonth(year, month); | ||
} | ||
|
||
/** | ||
* 전체 기간동안 동전의 발행량 및 사용량 반환 | ||
* | ||
* @return | ||
*/ | ||
@GetMapping("/coins") | ||
@AuthGuard(level = AuthLevel.ADMIN_ONLY) | ||
public TotalCoinAmountDto getTotalCoinAmount() { | ||
return adminStatisticsFacadeService.getTotalCoinAmount(); | ||
} | ||
|
||
/** | ||
* 아이템별 구매 인원 조회 | ||
* | ||
* @return | ||
*/ | ||
@GetMapping("/items") | ||
@AuthGuard(level = AuthLevel.ADMIN_ONLY) | ||
public ItemStatisticsDto getItemPurchaseStatistics() { | ||
return adminItemFacadeService.getItemPurchaseStatistics(); | ||
} | ||
|
||
/** | ||
* 특정 기간동안 재화 사용량 및 발행량 조회 | ||
* | ||
* @param startDate | ||
* @param endDate 조회를 원하는 기간 | ||
* @return | ||
*/ | ||
@GetMapping("/coins/use") | ||
@AuthGuard(level = AuthLevel.ADMIN_ONLY) | ||
public CoinStaticsDto getCoinStaticsDto( | ||
@RequestParam("startDate") @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime startDate, | ||
@RequestParam("endDate") @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime endDate) { | ||
return adminStatisticsFacadeService.getCoinStaticsDto(startDate.toLocalDate(), | ||
endDate.toLocalDate()); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
backend/src/main/java/org/ftclub/cabinet/dto/CoinCollectStatisticsDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.ftclub.cabinet.dto; | ||
|
||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@ToString | ||
@AllArgsConstructor | ||
public class CoinCollectStatisticsDto { | ||
|
||
private List<CoinCollectedCountDto> coinCollectStatistics; | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/org/ftclub/cabinet/dto/CoinCollectedCountDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.ftclub.cabinet.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@ToString | ||
@AllArgsConstructor | ||
public class CoinCollectedCountDto { | ||
|
||
private Integer coinCount; | ||
private Integer userCount; | ||
} |
12 changes: 12 additions & 0 deletions
12
backend/src/main/java/org/ftclub/cabinet/dto/TotalCoinAmountDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.ftclub.cabinet.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class TotalCoinAmountDto { | ||
|
||
private Long used; | ||
private Long unused; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.