-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
284 additions
and
184 deletions.
There are no files selected for viewing
51 changes: 0 additions & 51 deletions
51
src/main/java/com/sparta/binplay/controller/StatisticController.java
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
src/main/java/com/sparta/binplay/controller/StatisticsVideoController.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 com.sparta.binplay.controller; | ||
|
||
import com.sparta.binplay.service.StatisticsVideoService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/stat") | ||
public class StatisticsVideoController { | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/sparta/binplay/dto/request/PaymentVideoRequestDto.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 com.sparta.binplay.dto.request; | ||
|
||
import com.sparta.binplay.entity.Videos; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class PaymentVideoRequestDto { | ||
private Double totalAmount; | ||
private Videos video; | ||
|
||
public PaymentVideoRequestDto(Double totalAmount, Videos video) { | ||
this.totalAmount = totalAmount; | ||
this.video = video; | ||
} | ||
} |
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
25 changes: 25 additions & 0 deletions
25
src/main/java/com/sparta/binplay/dto/response/PaymentVideoResponseDto.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,25 @@ | ||
package com.sparta.binplay.dto.response; | ||
|
||
import com.sparta.binplay.entity.PaymentVideo; | ||
import lombok.*; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@Setter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class PaymentVideoResponseDto { | ||
private Long paymentId; | ||
private Double totalAmount; | ||
private LocalDateTime createAt; | ||
|
||
public static PaymentVideoResponseDto from(PaymentVideo payment) { | ||
return PaymentVideoResponseDto.builder() | ||
.paymentId(payment.getPaymentVideoId()) | ||
.totalAmount(payment.getTotalAmount()) | ||
.createAt(payment.getCreatedAt()) | ||
.build(); | ||
} | ||
} |
31 changes: 0 additions & 31 deletions
31
src/main/java/com/sparta/binplay/dto/response/StatisticResponseDto.java
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
src/main/java/com/sparta/binplay/dto/response/StatisticVideoResponseDto.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,27 @@ | ||
package com.sparta.binplay.dto.response; | ||
|
||
import com.sparta.binplay.entity.StatisticVideo; | ||
import lombok.*; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@Setter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class StatisticVideoResponseDto { | ||
private Long statVideoId; | ||
private long dailyViewCount; | ||
private int dailyPlayTime; | ||
private LocalDateTime createdAt; | ||
|
||
public static StatisticVideoResponseDto from(StatisticVideo statisticVideo) { | ||
return StatisticVideoResponseDto.builder() | ||
.statVideoId(statisticVideo.getStatVideoId()) | ||
.dailyViewCount(statisticVideo.getDailyViewCount()) | ||
.dailyPlayTime(statisticVideo.getDailyPlayTime()) | ||
.createdAt(statisticVideo.getCreatedAt()) | ||
.build(); | ||
} | ||
} |
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,30 @@ | ||
package com.sparta.binplay.entity; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedDate; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name="payments_ad") | ||
@NoArgsConstructor | ||
public class PaymentAd { | ||
@Id | ||
@Column(name="payment_ad_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long paymentAdId; | ||
|
||
@Column(name="total_amount", nullable = false) | ||
private Double totalAmount; | ||
|
||
@CreatedDate | ||
@Column(name="created_at", updatable = false) | ||
private LocalDateTime createdAt; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "ad_view_id", nullable = false) | ||
private AdViews adView; | ||
} |
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,39 @@ | ||
package com.sparta.binplay.entity; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedDate; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name="statistics_ad") | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class StatisticAd extends Timestamped{ | ||
@Id | ||
@Column(name = "stat_ad_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long statAdId; | ||
|
||
@Column(name="daily_view_count", nullable = false) | ||
private long dailyViewCount; | ||
|
||
@CreatedDate | ||
@Column(name="created_at", updatable = false) //업데이트를 막음 | ||
private LocalDateTime createdAt; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "ad_view_id", nullable = false) | ||
private AdViews adView; | ||
|
||
public StatisticAd(Long dailyViewCount, AdViews adView) { | ||
this.dailyViewCount = dailyViewCount; | ||
this.adView = adView; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/com/sparta/binplay/entity/StatisticVideo.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,52 @@ | ||
package com.sparta.binplay.entity; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedDate; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name="statistics_video") | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class StatisticVideo extends Timestamped{ | ||
@Id | ||
@Column(name = "stat_video_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long statVideoId; | ||
|
||
@Column(name="daily_view_count", nullable = false) | ||
private long dailyViewCount; | ||
|
||
@Column(name="daily_play_time", nullable = false) | ||
private int dailyPlayTime; | ||
|
||
@CreatedDate | ||
@Column(name="created_at", updatable = false) //업데이트를 막음 | ||
private LocalDateTime createdAt; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "video_id") | ||
private Videos video; | ||
|
||
public StatisticVideo(long dailyViewCount, int dailyPlayTime, Videos video) { | ||
this.dailyViewCount = dailyViewCount; | ||
this.dailyPlayTime = dailyPlayTime; | ||
this.video = video; | ||
} | ||
|
||
public StatisticVideo update(Long diailyViewCount, Integer dailyPlayTime) { | ||
return StatisticVideo.builder() | ||
.statVideoId(this.statVideoId) // ID를 유지하여 동일 엔티티로 인식 | ||
.dailyViewCount(diailyViewCount) | ||
.dailyPlayTime(dailyPlayTime) | ||
.video(this.video) | ||
.build(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
src/main/java/com/sparta/binplay/repository/PaymentAdRepository.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,9 @@ | ||
package com.sparta.binplay.repository; | ||
|
||
import com.sparta.binplay.entity.PaymentVideo; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface PaymentAdRepository extends JpaRepository<PaymentVideo, Long> { | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/sparta/binplay/repository/PaymentVideoRepository.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,13 @@ | ||
package com.sparta.binplay.repository; | ||
|
||
import com.sparta.binplay.entity.PaymentVideo; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Repository | ||
public interface PaymentVideoRepository extends JpaRepository<PaymentVideo, Long> { | ||
List<PaymentVideo> findAllByCreatedAtBetween(LocalDateTime startDate, LocalDateTime endDate); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/sparta/binplay/repository/StatisticAdRepository.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,9 @@ | ||
package com.sparta.binplay.repository; | ||
|
||
import com.sparta.binplay.entity.StatisticAd; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface StatisticAdRepository extends JpaRepository<StatisticAd, Long> { | ||
} |
18 changes: 0 additions & 18 deletions
18
src/main/java/com/sparta/binplay/repository/StatisticRepository.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.