From 706df2a934741e75e563e786e8dda6b9ea09a2b6 Mon Sep 17 00:00:00 2001 From: byung eun park Date: Thu, 17 Oct 2019 17:32:41 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=8C=EC=9E=84=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EB=AA=A8=EB=8D=B8=20=EC=83=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/data/entity/DateAuditEntity.java | 1 - .../totopia/server/init/DbInitializer.java | 106 +++++++++--------- .../game/entity/BettingHistoryEntity.java | 9 +- .../modules/game/entity/LeagueEntity.java | 9 +- .../modules/game/entity/MiniGameEntity.java | 66 +++++++++++ .../modules/game/entity/PowerBallEntity.java | 26 +++++ .../modules/game/entity/SportsEntity.java | 29 ----- .../game/entity/SportsEventEntity.java | 90 +++++++++++++++ .../game/entity/SportsEventResultEntity.java | 48 ++++++++ .../modules/game/entity/SportsTeamEntity.java | 39 +++++++ .../game/repository/SportsRepository.java | 7 -- .../modules/game/service/SportsService.java | 41 ------- .../{SportsName.java => SportsTypeName.java} | 4 +- ...opupConfig.java => PopupConfigEntity.java} | 2 +- .../special/entity/AlertConfigEntity.java | 39 +++++++ .../special/entity/CheckNoticeEntity.java | 30 +++++ .../special/entity/FixBonusEntity.java | 2 +- .../special/entity/MartinConfigEntity.java | 34 ++++++ .../special/entity/RouletteConfigEntity.java | 34 ++++++ .../modules/special/type/AlertConfigName.java | 14 +++ .../modules/user/entity/CommissionEntity.java | 4 +- .../game/repository/LeagueRepositoryTest.java | 6 +- 22 files changed, 490 insertions(+), 150 deletions(-) create mode 100644 src/main/java/com/totopia/server/modules/game/entity/MiniGameEntity.java create mode 100644 src/main/java/com/totopia/server/modules/game/entity/PowerBallEntity.java delete mode 100644 src/main/java/com/totopia/server/modules/game/entity/SportsEntity.java create mode 100644 src/main/java/com/totopia/server/modules/game/entity/SportsEventEntity.java create mode 100644 src/main/java/com/totopia/server/modules/game/entity/SportsEventResultEntity.java create mode 100644 src/main/java/com/totopia/server/modules/game/entity/SportsTeamEntity.java delete mode 100644 src/main/java/com/totopia/server/modules/game/repository/SportsRepository.java delete mode 100644 src/main/java/com/totopia/server/modules/game/service/SportsService.java rename src/main/java/com/totopia/server/modules/game/type/{SportsName.java => SportsTypeName.java} (76%) rename src/main/java/com/totopia/server/modules/info/entity/{PopupConfig.java => PopupConfigEntity.java} (95%) create mode 100644 src/main/java/com/totopia/server/modules/special/entity/AlertConfigEntity.java create mode 100644 src/main/java/com/totopia/server/modules/special/entity/CheckNoticeEntity.java create mode 100644 src/main/java/com/totopia/server/modules/special/entity/MartinConfigEntity.java create mode 100644 src/main/java/com/totopia/server/modules/special/entity/RouletteConfigEntity.java create mode 100644 src/main/java/com/totopia/server/modules/special/type/AlertConfigName.java diff --git a/src/main/java/com/totopia/server/commons/data/entity/DateAuditEntity.java b/src/main/java/com/totopia/server/commons/data/entity/DateAuditEntity.java index cd97de1..d8ece88 100644 --- a/src/main/java/com/totopia/server/commons/data/entity/DateAuditEntity.java +++ b/src/main/java/com/totopia/server/commons/data/entity/DateAuditEntity.java @@ -3,7 +3,6 @@ package com.totopia.server.commons.data.entity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.AllArgsConstructor; import lombok.Data; -import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; import org.springframework.data.annotation.CreatedDate; diff --git a/src/main/java/com/totopia/server/init/DbInitializer.java b/src/main/java/com/totopia/server/init/DbInitializer.java index 8ba1f1f..b8e4f00 100644 --- a/src/main/java/com/totopia/server/init/DbInitializer.java +++ b/src/main/java/com/totopia/server/init/DbInitializer.java @@ -2,10 +2,8 @@ package com.totopia.server.init; import com.totopia.server.modules.dashboard.repository.DashboardRepository; import com.totopia.server.modules.game.entity.LeagueEntity; -import com.totopia.server.modules.game.entity.SportsEntity; import com.totopia.server.modules.game.repository.LeagueRepository; -import com.totopia.server.modules.game.repository.SportsRepository; -import com.totopia.server.modules.game.type.SportsName; +import com.totopia.server.modules.game.type.SportsTypeName; import com.totopia.server.modules.site.entity.BankAccountsEntity; import com.totopia.server.modules.site.repository.BankAccountsRepository; import com.totopia.server.modules.user.entity.GradeEntity; @@ -47,8 +45,8 @@ public class DbInitializer implements CommandLineRunner { @Autowired GradeRepository gradeRepository; - @Autowired - SportsRepository sportsRepository; +// @Autowired +// SportsRepository sportsRepository; @Autowired LeagueRepository leagueRepository; @@ -66,9 +64,9 @@ public class DbInitializer implements CommandLineRunner { this.initDbGrade(); } - if (0 == sportsRepository.count()) { - this.initDbSports(); - } +// if (0 == sportsRepository.count()) { +// this.initDbSports(); +// } if (0 == userRepository.count()) { this.initDbUsers(); } @@ -132,25 +130,26 @@ public class DbInitializer implements CommandLineRunner { gradeRepository.save(grade); } - private void initDbSports() { - SportsEntity sportsEntity; - sportsEntity = SportsEntity.builder().name(SportsName.SOCCER).build(); - sportsRepository.save(sportsEntity); - sportsEntity = SportsEntity.builder().name(SportsName.BASEBALL).build(); - sportsRepository.save(sportsEntity); - sportsEntity = SportsEntity.builder().name(SportsName.BASKET_BALL).build(); - sportsRepository.save(sportsEntity); - sportsEntity = SportsEntity.builder().name(SportsName.E_SPORTS).build(); - sportsRepository.save(sportsEntity); - sportsEntity = SportsEntity.builder().name(SportsName.HAND_BALL).build(); - sportsRepository.save(sportsEntity); - sportsEntity = SportsEntity.builder().name(SportsName.TABLE_TENIS).build(); - sportsRepository.save(sportsEntity); - sportsEntity = SportsEntity.builder().name(SportsName.VALLEY_BALL).build(); - sportsRepository.save(sportsEntity); - sportsEntity = SportsEntity.builder().name(SportsName.TENNIS).build(); - sportsRepository.save(sportsEntity); - } +// private void initDbSports() { +// SportsTypeEntity sportsEntity; +// sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.SOCCER).build(); +// sportsRepository.save(sportsEntity); +// sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.BASEBALL).build(); +// sportsRepository.save(sportsEntity); +// sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.BASKET_BALL).build(); +// sportsRepository.save(sportsEntity); +// sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.E_SPORTS).build(); +// sportsRepository.save(sportsEntity); +// sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.HAND_BALL).build(); +// sportsRepository.save(sportsEntity); +// sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.TABLE_TENIS).build(); +// sportsRepository.save(sportsEntity); +// sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.VALLEY_BALL).build(); +// sportsRepository.save(sportsEntity); +// sportsEntity = SportsTypeEntity.builder().name(SportsTypeName.TENNIS).build(); +// sportsRepository.save(sportsEntity); +// } + private void initDbLeague() { LeagueEntity leagueEntity; @@ -160,7 +159,8 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Bundesliga I") .korName("분데스리가") .sevenMName("GER BI") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) +// .sportsEntities(Stream.of(SportsTypeEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); leagueEntity = LeagueEntity.builder() @@ -169,7 +169,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Bundesliga II") .korName("분데스리가 2") .sevenMName("GER B2") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -179,7 +179,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany 3.Liga") .korName("3.리가") .sevenMName("GER L3") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); leagueEntity = LeagueEntity.builder() @@ -188,7 +188,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Regionalliga West") .korName("레기오날리가 웨스트") .sevenMName("GER RL W") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); leagueEntity = LeagueEntity.builder() @@ -197,7 +197,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Regionalliga North") .korName("레기오날리가 노스") .sevenMName("GER RL N") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -207,7 +207,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Regionalliga North East") .korName("레기오날리가 노스 이스트") .sevenMName("GER RL NE") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -217,7 +217,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Oberliga Rheinland-Pfalz/Saar") .korName("오벨리가 Rheinland-Pfalz/Saar") .sevenMName("GER OL R") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -227,7 +227,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Regionalliga Bayern") .korName("레기오날리가 바이에른") .sevenMName("GER RL B") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -237,7 +237,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Oberliga Hamburg") .korName("오벨리가 함부르크") .sevenMName("GER OL H") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -247,7 +247,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Oberliga Bayern North") .korName("오벨리가 바이에른 노스") .sevenMName("GER OL BN") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -257,7 +257,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Oberliga Baden-Wuerttemberg") .korName("오벨리가 Baden-Wuerttemberg") .sevenMName("GER OL BW") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -267,7 +267,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Oberliga Westfalen") .korName("오벨리가 Westfalen") .sevenMName("GER OL W") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -277,7 +277,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Oberliga NOFV Sud") .korName("오벨리가 NOFV Sud") .sevenMName("GER OL NS") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -287,7 +287,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Germany Bundesliga Women") .korName("우먼 분데스리가") .sevenMName("Germany BW") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -297,7 +297,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Barclays Premier League") .korName("프리미어 리그") .sevenMName("Barclays PL") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -307,7 +307,7 @@ public class DbInitializer implements CommandLineRunner { .engName("England League 2") .korName("리그 2") .sevenMName("UK L2") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -317,7 +317,7 @@ public class DbInitializer implements CommandLineRunner { .engName("England National League") .korName("내셔널 리그") .sevenMName("UK NL") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -327,7 +327,7 @@ public class DbInitializer implements CommandLineRunner { .engName("England National League North") .korName("내셔널 리그 노스") .sevenMName("UK NLN") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -337,7 +337,7 @@ public class DbInitializer implements CommandLineRunner { .engName("England National League South") .korName("내셔널 리그 사우스") .sevenMName("UK NLS") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -347,7 +347,7 @@ public class DbInitializer implements CommandLineRunner { .engName("England Isthmian Premier Division") .korName("이스미안 프리미어 디비전") .sevenMName("Isthmian PD") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -357,7 +357,7 @@ public class DbInitializer implements CommandLineRunner { .engName("England Southern Premier League South") .korName("사우던 프리미어 리그 사우스") .sevenMName("England SPL S") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -367,7 +367,7 @@ public class DbInitializer implements CommandLineRunner { .engName("England Southern Premier League Central") .korName("사우던 프리미어 리그 센트럴") .sevenMName("England SPL C") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -377,7 +377,7 @@ public class DbInitializer implements CommandLineRunner { .engName("England Southern League Division One") .korName("사우던 리그 디비전 1") .sevenMName("UK SLD1") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -387,7 +387,7 @@ public class DbInitializer implements CommandLineRunner { .engName("England U23 Development League") .korName("유스 U23 디벨럽먼트 리그") .sevenMName("England U23 DL") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -397,7 +397,7 @@ public class DbInitializer implements CommandLineRunner { .engName("Lancashire Senior Cup") .korName("랭커셔 시니어 컵") .sevenMName("UK LS Cup") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); @@ -407,7 +407,7 @@ public class DbInitializer implements CommandLineRunner { .engName("England FA WSL") .korName("우먼 FA 슈퍼리그") .sevenMName("FA WSL") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) + .sportsType(SportsTypeName.SOCCER) .build(); this.leagueRepository.save(leagueEntity); diff --git a/src/main/java/com/totopia/server/modules/game/entity/BettingHistoryEntity.java b/src/main/java/com/totopia/server/modules/game/entity/BettingHistoryEntity.java index b068f27..d25f1bd 100644 --- a/src/main/java/com/totopia/server/modules/game/entity/BettingHistoryEntity.java +++ b/src/main/java/com/totopia/server/modules/game/entity/BettingHistoryEntity.java @@ -2,6 +2,7 @@ package com.totopia.server.modules.game.entity; import com.totopia.server.commons.data.entity.DateAuditEntity; import com.totopia.server.modules.game.type.BettingResultName; +import com.totopia.server.modules.user.entity.RoleEntity; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -9,6 +10,7 @@ import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; import javax.persistence.*; +import java.util.Set; @Entity @Table(name = "bet_history") @@ -28,9 +30,10 @@ public class BettingHistoryEntity extends DateAuditEntity { @Column(name = "league_id", nullable = false) private Long league; - @Basic - @Column(name = "sports_event_id", nullable = false) - private Long sportsEvent; + + @ManyToMany(fetch = FetchType.EAGER) + @JoinTable(name = "betting_history_sports_event", joinColumns = @JoinColumn(name = "bet_history_id"), inverseJoinColumns = @JoinColumn(name = "sports_event_id")) + private Set sportsEvents; @Basic @Column(name = "user_id", nullable = false) diff --git a/src/main/java/com/totopia/server/modules/game/entity/LeagueEntity.java b/src/main/java/com/totopia/server/modules/game/entity/LeagueEntity.java index 8c43ca1..122306d 100644 --- a/src/main/java/com/totopia/server/modules/game/entity/LeagueEntity.java +++ b/src/main/java/com/totopia/server/modules/game/entity/LeagueEntity.java @@ -1,11 +1,11 @@ package com.totopia.server.modules.game.entity; import com.totopia.server.commons.data.entity.DateAuditEntity; +import com.totopia.server.modules.game.type.SportsTypeName; import lombok.*; import lombok.experimental.SuperBuilder; import javax.persistence.*; -import java.util.Set; @Entity @Table(name = "league") @@ -36,8 +36,7 @@ public class LeagueEntity extends DateAuditEntity { @Column(name = "kor_country", nullable = true, length = 100) private String korCountry; - @ManyToMany(fetch = FetchType.EAGER) - @JoinTable(name = "league_sports", joinColumns = @JoinColumn(name = "league_id"), inverseJoinColumns = @JoinColumn(name = "sports_id")) - private Set sportsEntities; - + @Enumerated(EnumType.STRING) + @Column(name = "sports_type", length = 60) + private SportsTypeName sportsType; } diff --git a/src/main/java/com/totopia/server/modules/game/entity/MiniGameEntity.java b/src/main/java/com/totopia/server/modules/game/entity/MiniGameEntity.java new file mode 100644 index 0000000..25a89d3 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/game/entity/MiniGameEntity.java @@ -0,0 +1,66 @@ +package com.totopia.server.modules.game.entity; + +import com.totopia.server.commons.data.entity.UserDateAuditEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.MappedSuperclass; +import java.io.Serializable; +import java.util.Date; + +@MappedSuperclass +@SuperBuilder +@Data +@NoArgsConstructor +@AllArgsConstructor +public abstract class MiniGameEntity extends UserDateAuditEntity implements Serializable { + + @Basic + @Column(name = "home_name", nullable = false, length = 200) + private String homeName; + + @Basic + @Column(name = "draw_name", nullable = false, length = 200) + private String drawName; + + @Basic + @Column(name = "away_name", nullable = false, length = 200) + private String awayName; + + @Basic + @Column(name = "mini_game_type", nullable = false, length = 200) + private String miniGameType; + + @Basic + @Column(name = "mini_game_round", nullable = false) + private Long miniGameRound; + + @Basic + @Column(name = "result_status", nullable = false) + private Short resultStatus; + + @Basic + @Column(name = "betting_status", nullable = false) + private Short bettingStatus; + + @Basic + @Column(name = "match_date_time", nullable = false) + private Date matchDateTime; + + @Basic + @Column(name = "home_odds", nullable = false) + private Float homeOdds; + + @Basic + @Column(name = "draw_odds", nullable = false) + private Float drawOdds; + + @Basic + @Column(name = "away_odds", nullable = false) + private Float awayOdds; + +} diff --git a/src/main/java/com/totopia/server/modules/game/entity/PowerBallEntity.java b/src/main/java/com/totopia/server/modules/game/entity/PowerBallEntity.java new file mode 100644 index 0000000..6fad409 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/game/entity/PowerBallEntity.java @@ -0,0 +1,26 @@ +package com.totopia.server.modules.game.entity; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import javax.persistence.*; + +@Entity +@Table(name = "power_ball") +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class PowerBallEntity extends MiniGameEntity { + + @Id + @GeneratedValue(generator = "power_ball_generator") + @SequenceGenerator(name = "power_ball_generator", sequenceName = "power_ball_sequence", initialValue = 1) + private Long id; + + +} diff --git a/src/main/java/com/totopia/server/modules/game/entity/SportsEntity.java b/src/main/java/com/totopia/server/modules/game/entity/SportsEntity.java deleted file mode 100644 index df99b09..0000000 --- a/src/main/java/com/totopia/server/modules/game/entity/SportsEntity.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.totopia.server.modules.game.entity; - -import com.totopia.server.commons.data.entity.DateAuditEntity; -import com.totopia.server.modules.game.type.SportsName; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; - -import javax.persistence.*; - -@Entity -@Table(name = "sports") -@Data -@SuperBuilder -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class SportsEntity extends DateAuditEntity { - @Id - @GeneratedValue(generator = "sports_generator") - @SequenceGenerator(name = "sports_generator", sequenceName = "sports_sequence", initialValue = 1) - private Short id; - - @Enumerated(EnumType.STRING) - @Column(name = "name", length = 60) - private SportsName name; -} diff --git a/src/main/java/com/totopia/server/modules/game/entity/SportsEventEntity.java b/src/main/java/com/totopia/server/modules/game/entity/SportsEventEntity.java new file mode 100644 index 0000000..c3a4dfd --- /dev/null +++ b/src/main/java/com/totopia/server/modules/game/entity/SportsEventEntity.java @@ -0,0 +1,90 @@ +package com.totopia.server.modules.game.entity; + +import com.totopia.server.commons.data.entity.DateAuditEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import javax.persistence.*; +import java.util.Date; + +@Entity +@Table(name = "sports_event") +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class SportsEventEntity extends DateAuditEntity { + + @Id + @GeneratedValue(generator = "sports_event_generator") + @SequenceGenerator(name = "sports_event_generator", sequenceName = "sports_event_sequence", initialValue = 1) + private Long id; + + @Basic + @Column(name = "match_date_time", nullable = false) + private Date matchDateTime; + + @Basic + @Column(name = "result_status", nullable = false) + private Short resultStatus; + + @Basic + @Column(name = "betting_status", nullable = false) + private Short bettingStatus; + + @Basic + @Column(name = "game_way", nullable = false) + private Short gameWay; + + @Basic + @Column(name = "game_type", nullable = false) + private Short gameType; + + @Basic + @Column(name = "parse_status", nullable = false) + private Short parseStatus; + + @Basic + @Column(name = "sports_name", nullable = false) + private String sportsName; + + @Basic + @Column(name = "sports_kor_name", nullable = true) + private String sportsKorName; + + @Basic + @Column(name = "match_etc", nullable = true) + private String matchEtc; + + @Basic + @Column(name = "league_id", nullable = false) + private Long league; + + @Basic + @Column(name = "home_team", nullable = false, length = 100) + private String homeTeam; + + @Basic + @Column(name = "away_team", nullable = false, length = 100) + private String awayTeam; + + @Basic + @Column(name = "home_odds", nullable = false) + private Float homeOdds; + + @Basic + @Column(name = "draw_odds", nullable = false) + private Float drawOdds; + + @Basic + @Column(name = "away_odds", nullable = false) + private Float awayOdds; + + @Basic + @Column(name = "option_odds", nullable = false) + private Float optionOdds; +} diff --git a/src/main/java/com/totopia/server/modules/game/entity/SportsEventResultEntity.java b/src/main/java/com/totopia/server/modules/game/entity/SportsEventResultEntity.java new file mode 100644 index 0000000..cd40370 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/game/entity/SportsEventResultEntity.java @@ -0,0 +1,48 @@ +package com.totopia.server.modules.game.entity; + +import com.totopia.server.commons.data.entity.DateAuditEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import javax.persistence.*; +import java.util.Map; + +@Entity +@Table(name = "sports_event_result") +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class SportsEventResultEntity extends DateAuditEntity { + + @Id + @GeneratedValue(generator = "sports_event_result_generator") + @SequenceGenerator(name = "sports_event_result_generator", sequenceName = "sports_event_result_sequence", initialValue = 1) + private Long id; + +// @Column(name = "event_id", unique = true) +// private Long eventId; + + @Column(name = "status") + private Short status; + + @Column(name = "home_full_time_score") + private Short homeFullTimeScore; + + @Column(name = "home_final_score") + private Short homeFinalScore; + + @Column(name = "away_full_time_score") + private Short awayFullTimeScore; + + @Column(name = "away_final_score") + private Short awayFinalScore; + + @Column(name = "score_Info", columnDefinition = "json") + private Map scoreInfo; + +} diff --git a/src/main/java/com/totopia/server/modules/game/entity/SportsTeamEntity.java b/src/main/java/com/totopia/server/modules/game/entity/SportsTeamEntity.java new file mode 100644 index 0000000..db485a6 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/game/entity/SportsTeamEntity.java @@ -0,0 +1,39 @@ +package com.totopia.server.modules.game.entity; + +import com.totopia.server.commons.data.entity.DateAuditEntity; +import com.totopia.server.modules.game.type.SportsTypeName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import javax.persistence.*; + +@Entity +@Table(name = "sports_team_result") +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class SportsTeamEntity extends DateAuditEntity { + + @Id + @GeneratedValue(generator = "sports_team_generator") + @SequenceGenerator(name = "sports_team_generator", sequenceName = "sports_team_sequence", initialValue = 1) + private Long id; + + @Column(name = "eng_name", nullable = false, length = 200) + private String engName; + + @Column(name = "kor_name", nullable = true, length = 200) + private String korName; + + @Column(name = "country_code", nullable = true, length = 50) + private String countryCode; + + @Enumerated(EnumType.STRING) + @Column(name = "sports_type", length = 60) + private SportsTypeName sportsType; +} diff --git a/src/main/java/com/totopia/server/modules/game/repository/SportsRepository.java b/src/main/java/com/totopia/server/modules/game/repository/SportsRepository.java deleted file mode 100644 index 87f8d7d..0000000 --- a/src/main/java/com/totopia/server/modules/game/repository/SportsRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.totopia.server.modules.game.repository; - -import com.totopia.server.modules.game.entity.SportsEntity; -import org.springframework.data.jpa.repository.JpaRepository; - -public interface SportsRepository extends JpaRepository { -} diff --git a/src/main/java/com/totopia/server/modules/game/service/SportsService.java b/src/main/java/com/totopia/server/modules/game/service/SportsService.java deleted file mode 100644 index 1d2df42..0000000 --- a/src/main/java/com/totopia/server/modules/game/service/SportsService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.totopia.server.modules.game.service; - -import com.totopia.server.commons.exception.ResourceNotFoundException; -import com.totopia.server.modules.game.entity.SportsEntity; -import com.totopia.server.modules.game.repository.SportsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.stereotype.Service; - -@Service -public class SportsService { - - @Autowired - private SportsRepository sportsRepository; - - public Page getAllSportsByPageable(Pageable pageable) { - Page entities = null; - entities = this.sportsRepository.findAll(pageable); - return entities; - } - - public SportsEntity getSportsById(Short sportId) { - return this.sportsRepository.findById(sportId).orElseThrow(null); - } - - public SportsEntity save(SportsEntity sportsEntity) { - return this.sportsRepository.save(sportsEntity); - } - - public SportsEntity modify(SportsEntity sportsEntity) { - return this.sportsRepository.save(sportsEntity); - } - - public Short remove(Short sportsId) { - return sportsRepository.findById(sportsId).map(sports -> { - sportsRepository.delete(sports); - return sportsId; - }).orElseThrow(() -> new ResourceNotFoundException("Sports", "sportsId", sportsId)); - } -} diff --git a/src/main/java/com/totopia/server/modules/game/type/SportsName.java b/src/main/java/com/totopia/server/modules/game/type/SportsTypeName.java similarity index 76% rename from src/main/java/com/totopia/server/modules/game/type/SportsName.java rename to src/main/java/com/totopia/server/modules/game/type/SportsTypeName.java index a8e105d..a8c083c 100644 --- a/src/main/java/com/totopia/server/modules/game/type/SportsName.java +++ b/src/main/java/com/totopia/server/modules/game/type/SportsTypeName.java @@ -1,12 +1,12 @@ package com.totopia.server.modules.game.type; -public enum SportsName { +public enum SportsTypeName { SOCCER, BASEBALL, BASKET_BALL, E_SPORTS, TENNIS, - TABLE_TENIS, + TABLE_TENNIS, VALLEY_BALL, HAND_BALL } diff --git a/src/main/java/com/totopia/server/modules/info/entity/PopupConfig.java b/src/main/java/com/totopia/server/modules/info/entity/PopupConfigEntity.java similarity index 95% rename from src/main/java/com/totopia/server/modules/info/entity/PopupConfig.java rename to src/main/java/com/totopia/server/modules/info/entity/PopupConfigEntity.java index 5c9e039..bfc9cfb 100644 --- a/src/main/java/com/totopia/server/modules/info/entity/PopupConfig.java +++ b/src/main/java/com/totopia/server/modules/info/entity/PopupConfigEntity.java @@ -16,7 +16,7 @@ import javax.persistence.*; @NoArgsConstructor @AllArgsConstructor @Builder -public class PopupConfig extends UserDateAuditEntity { +public class PopupConfigEntity extends UserDateAuditEntity { @Id @GeneratedValue(generator = "bet_history_generator") diff --git a/src/main/java/com/totopia/server/modules/special/entity/AlertConfigEntity.java b/src/main/java/com/totopia/server/modules/special/entity/AlertConfigEntity.java new file mode 100644 index 0000000..9104742 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/special/entity/AlertConfigEntity.java @@ -0,0 +1,39 @@ +package com.totopia.server.modules.special.entity; + +import com.totopia.server.commons.data.entity.UserDateAuditEntity; +import com.totopia.server.modules.special.type.AlertConfigName; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import javax.persistence.*; + +@Entity +@Table(name = "alert_config") +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +@Builder +public class AlertConfigEntity extends UserDateAuditEntity { + @Id + @GeneratedValue(generator = "alert_config_generator") + @SequenceGenerator(name = "alert_config_generator", sequenceName = "alert_config_sequence", initialValue = 1) + private Short id; + + @Basic + @Column(name = "name", nullable = false, length = 100) + private String name; + + @Basic + @Column(name = "file_path", nullable = false, length = 200) + private String filePath; + + @Basic + @Column(name = "file_name", nullable = false, length = 200) + private String fileName; + + @Enumerated(EnumType.STRING) + @Column(name = "alert_type", length = 60) + private AlertConfigName alertType; +} diff --git a/src/main/java/com/totopia/server/modules/special/entity/CheckNoticeEntity.java b/src/main/java/com/totopia/server/modules/special/entity/CheckNoticeEntity.java new file mode 100644 index 0000000..4e6424b --- /dev/null +++ b/src/main/java/com/totopia/server/modules/special/entity/CheckNoticeEntity.java @@ -0,0 +1,30 @@ +package com.totopia.server.modules.special.entity; + +import com.totopia.server.commons.data.entity.UserDateAuditEntity; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import javax.persistence.*; + +@Entity +@Table(name = "check_notice") +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +@Builder +public class CheckNoticeEntity extends UserDateAuditEntity { + @Id + @GeneratedValue(generator = "check_notice_generator") + @SequenceGenerator(name = "check_notice_generator", sequenceName = "check_notice_sequence", initialValue = 1) + private Short id; + + @Basic + @Column(name = "enable", nullable = false) + private Boolean enable = true; + + @Basic + @Column(name = "contents", nullable = true, length = 2000) + private String contents; +} diff --git a/src/main/java/com/totopia/server/modules/special/entity/FixBonusEntity.java b/src/main/java/com/totopia/server/modules/special/entity/FixBonusEntity.java index b414f56..102b4f5 100644 --- a/src/main/java/com/totopia/server/modules/special/entity/FixBonusEntity.java +++ b/src/main/java/com/totopia/server/modules/special/entity/FixBonusEntity.java @@ -41,6 +41,6 @@ public class FixBonusEntity extends DateAuditEntity { private Short folder; @Basic - @Column(name = "allow", nullable = true) + @Column(name = "allow", nullable = false) private Boolean allow = true; } diff --git a/src/main/java/com/totopia/server/modules/special/entity/MartinConfigEntity.java b/src/main/java/com/totopia/server/modules/special/entity/MartinConfigEntity.java new file mode 100644 index 0000000..e57008f --- /dev/null +++ b/src/main/java/com/totopia/server/modules/special/entity/MartinConfigEntity.java @@ -0,0 +1,34 @@ +package com.totopia.server.modules.special.entity; + +import com.totopia.server.commons.data.entity.UserDateAuditEntity; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import javax.persistence.*; + +@Entity +@Table(name = "martin_config") +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +@Builder +public class MartinConfigEntity extends UserDateAuditEntity { + @Id + @GeneratedValue(generator = "martin_config_generator") + @SequenceGenerator(name = "martin_config_generator", sequenceName = "martin_config_sequence", initialValue = 1) + private Short id; + + @Basic + @Column(name = "name", nullable = false, length = 100) + private String name; + + @Basic + @Column(name = "martin_enable", nullable = false) + private Boolean refEnable = true; + + @Basic + @Column(name = "betting_odds", nullable = false) + private Float bettingOdds; +} diff --git a/src/main/java/com/totopia/server/modules/special/entity/RouletteConfigEntity.java b/src/main/java/com/totopia/server/modules/special/entity/RouletteConfigEntity.java new file mode 100644 index 0000000..a9a16fe --- /dev/null +++ b/src/main/java/com/totopia/server/modules/special/entity/RouletteConfigEntity.java @@ -0,0 +1,34 @@ +package com.totopia.server.modules.special.entity; + +import com.totopia.server.commons.data.entity.UserDateAuditEntity; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import javax.persistence.*; + +@Entity +@Table(name = "roulette_config") +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +@Builder +public class RouletteConfigEntity extends UserDateAuditEntity { + @Id + @GeneratedValue(generator = "roulette_config_generator") + @SequenceGenerator(name = "roulette_config_generator", sequenceName = "roulette_config_sequence", initialValue = 1) + private Short id; + + @Basic + @Column(name = "price", nullable = false) + private Integer price; + + @Basic + @Column(name = "percentage", nullable = false) + private Integer percentage; + + @Basic + @Column(name = "price_won", nullable = false, length = 64) + private String priceWon; +} diff --git a/src/main/java/com/totopia/server/modules/special/type/AlertConfigName.java b/src/main/java/com/totopia/server/modules/special/type/AlertConfigName.java new file mode 100644 index 0000000..07ed932 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/special/type/AlertConfigName.java @@ -0,0 +1,14 @@ +package com.totopia.server.modules.special.type; + +public enum AlertConfigName { + ALERT_DEPOSIT, + ALERT_WITHDRAW, + ALERT_QNA_USER, + ALERT_NEW_USER, + ALERT_NEW_BOARD, + ALERT_WARNING_BETTING_LIMIT, + ALERT_BETTING, + ALERT_WATCH_USER, + ALERT_SEND_MESSAGE, + ALERT_ANSWER_MESSAGE +} diff --git a/src/main/java/com/totopia/server/modules/user/entity/CommissionEntity.java b/src/main/java/com/totopia/server/modules/user/entity/CommissionEntity.java index 9f78b77..cd72d41 100644 --- a/src/main/java/com/totopia/server/modules/user/entity/CommissionEntity.java +++ b/src/main/java/com/totopia/server/modules/user/entity/CommissionEntity.java @@ -49,6 +49,6 @@ public class CommissionEntity extends UserDateAuditEntity { private String miniGameRaffleFees; @Enumerated(EnumType.STRING) - @Column(name = "type", length = 60) - private CommissionName type; + @Column(name = "commission_type", length = 60) + private CommissionName commissionType; } diff --git a/src/test/java/com/totopia/server/modules/game/repository/LeagueRepositoryTest.java b/src/test/java/com/totopia/server/modules/game/repository/LeagueRepositoryTest.java index c8b9c23..bb9bc55 100644 --- a/src/test/java/com/totopia/server/modules/game/repository/LeagueRepositoryTest.java +++ b/src/test/java/com/totopia/server/modules/game/repository/LeagueRepositoryTest.java @@ -1,9 +1,7 @@ package com.totopia.server.modules.game.repository; import com.totopia.server.modules.game.entity.LeagueEntity; -import com.totopia.server.modules.game.entity.SportsEntity; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -14,8 +12,6 @@ import java.util.HashSet; import java.util.stream.Collectors; import java.util.stream.Stream; -import static org.junit.Assert.*; - //@Ignore @RunWith(SpringRunner.class) @SpringBootTest @@ -36,7 +32,7 @@ public class LeagueRepositoryTest { .engName("Germany Bundesliga I") .korName("분데스리가") .sevenMName("GER BI") - .sportsEntities(Stream.of(SportsEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) +// .sportsEntities(Stream.of(SportsTypeEntity.builder().id(Short.valueOf((short) 1)).build()).collect(Collectors.toCollection(HashSet::new))) .build(); this.leagueRepository.save(leagueEntity);