From ac73b0ba26dc73c5ba4589e5fcf2a43f503e7892 Mon Sep 17 00:00:00 2001 From: byung eun park Date: Sun, 27 Oct 2019 19:04:08 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B1=85=ED=82=B9=20=EC=83=81=ED=83=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/commons/data/entity/DateAuditEntity.java | 1 + .../commons/data/entity/UserDateAuditEntity.java | 5 +---- .../server/modules/moneys/entity/DepositEntity.java | 5 ++--- .../server/modules/moneys/entity/PayEntity.java | 4 ++-- .../server/modules/moneys/entity/WithdrawEntity.java | 4 ++-- .../server/modules/moneys/type/BankingName.java | 5 ----- .../server/modules/moneys/type/BankingStateName.java | 5 +++++ .../modules/user/repository/BankRepositoryTest.java | 4 ++-- .../modules/user/repository/DepositRepositoryTest.java | 10 +++++----- .../user/repository/WithdrawRepositoryTest.java | 7 +++---- 10 files changed, 23 insertions(+), 27 deletions(-) delete mode 100644 src/main/java/com/totopia/server/modules/moneys/type/BankingName.java create mode 100644 src/main/java/com/totopia/server/modules/moneys/type/BankingStateName.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 d8ece88..23ed808 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 @@ -2,6 +2,7 @@ package com.totopia.server.commons.data.entity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; diff --git a/src/main/java/com/totopia/server/commons/data/entity/UserDateAuditEntity.java b/src/main/java/com/totopia/server/commons/data/entity/UserDateAuditEntity.java index b8fdea3..5928b03 100644 --- a/src/main/java/com/totopia/server/commons/data/entity/UserDateAuditEntity.java +++ b/src/main/java/com/totopia/server/commons/data/entity/UserDateAuditEntity.java @@ -1,10 +1,7 @@ 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.*; import lombok.experimental.SuperBuilder; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.LastModifiedBy; diff --git a/src/main/java/com/totopia/server/modules/moneys/entity/DepositEntity.java b/src/main/java/com/totopia/server/modules/moneys/entity/DepositEntity.java index a3f9ee2..acee828 100644 --- a/src/main/java/com/totopia/server/modules/moneys/entity/DepositEntity.java +++ b/src/main/java/com/totopia/server/modules/moneys/entity/DepositEntity.java @@ -1,8 +1,7 @@ package com.totopia.server.modules.moneys.entity; -import com.totopia.server.commons.data.entity.DateAuditEntity; import com.totopia.server.commons.data.entity.UserDateAuditEntity; -import com.totopia.server.modules.moneys.type.BankingName; +import com.totopia.server.modules.moneys.type.BankingStateName; import lombok.*; import lombok.experimental.SuperBuilder; @@ -48,6 +47,6 @@ public class DepositEntity extends UserDateAuditEntity implements Serializable { @Basic @Enumerated(EnumType.STRING) @Column(name = "status", length = 60) - private BankingName status; + private BankingStateName status; } diff --git a/src/main/java/com/totopia/server/modules/moneys/entity/PayEntity.java b/src/main/java/com/totopia/server/modules/moneys/entity/PayEntity.java index d3dc3d0..e6dbdd9 100644 --- a/src/main/java/com/totopia/server/modules/moneys/entity/PayEntity.java +++ b/src/main/java/com/totopia/server/modules/moneys/entity/PayEntity.java @@ -1,7 +1,7 @@ package com.totopia.server.modules.moneys.entity; import com.totopia.server.commons.data.entity.UserDateAuditEntity; -import com.totopia.server.modules.moneys.type.BankingName; +import com.totopia.server.modules.moneys.type.BankingStateName; import lombok.*; import lombok.experimental.SuperBuilder; @@ -36,6 +36,6 @@ public class PayEntity extends UserDateAuditEntity { @Basic @Enumerated(EnumType.STRING) @Column(name = "banking_type", length = 60) - private BankingName bankingType; + private BankingStateName bankingType; } diff --git a/src/main/java/com/totopia/server/modules/moneys/entity/WithdrawEntity.java b/src/main/java/com/totopia/server/modules/moneys/entity/WithdrawEntity.java index 5c8b158..3a16c42 100644 --- a/src/main/java/com/totopia/server/modules/moneys/entity/WithdrawEntity.java +++ b/src/main/java/com/totopia/server/modules/moneys/entity/WithdrawEntity.java @@ -1,7 +1,7 @@ package com.totopia.server.modules.moneys.entity; import com.totopia.server.commons.data.entity.UserDateAuditEntity; -import com.totopia.server.modules.moneys.type.BankingName; +import com.totopia.server.modules.moneys.type.BankingStateName; import lombok.*; import lombok.experimental.SuperBuilder; @@ -38,5 +38,5 @@ public class WithdrawEntity extends UserDateAuditEntity implements Serializable @Basic @Enumerated(EnumType.STRING) @Column(name = "status", length = 60) - private BankingName status; + private BankingStateName status; } diff --git a/src/main/java/com/totopia/server/modules/moneys/type/BankingName.java b/src/main/java/com/totopia/server/modules/moneys/type/BankingName.java deleted file mode 100644 index 6b0a097..0000000 --- a/src/main/java/com/totopia/server/modules/moneys/type/BankingName.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.totopia.server.modules.moneys.type; - -public enum BankingName { - BANKING_WAITING, BANKING_HOLD, BANKING_COMPLETE, BANKING_DEPOSIT, BANKING_WITHDRAW -} diff --git a/src/main/java/com/totopia/server/modules/moneys/type/BankingStateName.java b/src/main/java/com/totopia/server/modules/moneys/type/BankingStateName.java new file mode 100644 index 0000000..3dcca63 --- /dev/null +++ b/src/main/java/com/totopia/server/modules/moneys/type/BankingStateName.java @@ -0,0 +1,5 @@ +package com.totopia.server.modules.moneys.type; + +public enum BankingStateName { + WAITING, HOLD, COMPLETE, DEPOSIT, WITHDRAW +} diff --git a/src/test/java/com/totopia/server/modules/user/repository/BankRepositoryTest.java b/src/test/java/com/totopia/server/modules/user/repository/BankRepositoryTest.java index b69a9f2..ab99914 100644 --- a/src/test/java/com/totopia/server/modules/user/repository/BankRepositoryTest.java +++ b/src/test/java/com/totopia/server/modules/user/repository/BankRepositoryTest.java @@ -65,7 +65,7 @@ public class BankRepositoryTest { break; } idx++; - bankAccount.setUserId(user.getId()); + bankAccount.setCreatedBy(user.getId()); bankAccount.setUpdatedAt(new Date()); this.bankRepository.save(bankAccount); } @@ -96,7 +96,7 @@ public class BankRepositoryTest { break; } idx++; - account.setUserId(account.getId()); + account.setUpdatedBy(account.getId()); this.bankRepository.save(account); } diff --git a/src/test/java/com/totopia/server/modules/user/repository/DepositRepositoryTest.java b/src/test/java/com/totopia/server/modules/user/repository/DepositRepositoryTest.java index 1924d37..cac636c 100644 --- a/src/test/java/com/totopia/server/modules/user/repository/DepositRepositoryTest.java +++ b/src/test/java/com/totopia/server/modules/user/repository/DepositRepositoryTest.java @@ -5,7 +5,7 @@ import com.totopia.server.modules.moneys.entity.DepositEntity; import com.totopia.server.modules.moneys.repository.BankRepository; import com.totopia.server.modules.moneys.repository.DepositRepository; import com.totopia.server.modules.user.entity.UserEntity; -import com.totopia.server.modules.moneys.type.BankingName; +import com.totopia.server.modules.moneys.type.BankingStateName; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -42,13 +42,13 @@ public class DepositRepositoryTest { public void insertTest() throws Exception { DepositEntity en = DepositEntity.builder() .price(10000) - .depositAccount("192-921-021-22") - .approveUser(accounts.get(0).getId()) + .bankAccounts((short) 1) .bank(accounts.get(2).getId()) - .status(BankingName.BANKING_WAITING) + .status(BankingStateName.WAITING) .build(); + en.setCreatedBy(1L); // DepositEntity entity = new DepositEntity(); // // entity.setAmountOfMoney(2000000); @@ -65,7 +65,7 @@ public class DepositRepositoryTest { @Test public void updateTest() throws Exception { DepositEntity entity = this.depositRepository.findById(1L).orElse(null); - entity.setStatus(BankingName.BANKING_COMPLETE); + entity.setStatus(BankingStateName.COMPLETE); this.depositRepository.save(entity); // assertEquals(entity.getDepositUser().longValue(), 2L); } diff --git a/src/test/java/com/totopia/server/modules/user/repository/WithdrawRepositoryTest.java b/src/test/java/com/totopia/server/modules/user/repository/WithdrawRepositoryTest.java index e06fa8f..59e58db 100644 --- a/src/test/java/com/totopia/server/modules/user/repository/WithdrawRepositoryTest.java +++ b/src/test/java/com/totopia/server/modules/user/repository/WithdrawRepositoryTest.java @@ -5,7 +5,7 @@ import com.totopia.server.modules.moneys.repository.BankRepository; import com.totopia.server.modules.moneys.repository.WithdrawRepository; import com.totopia.server.modules.user.entity.UserEntity; import com.totopia.server.modules.moneys.entity.WithdrawEntity; -import com.totopia.server.modules.moneys.type.BankingName; +import com.totopia.server.modules.moneys.type.BankingStateName; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -39,12 +39,11 @@ public class WithdrawRepositoryTest { public void insertTest() throws Exception { WithdrawEntity en = WithdrawEntity.builder() .price(10000) - - .approveUser(accounts.get(0).getId()) .bank(accounts.get(2).getId()) - .status(BankingName.BANKING_WAITING) + .status(BankingStateName.WAITING) .build(); + en.setCreatedBy(accounts.get(0).getId()); this.withdrawRepository.save(en); } } \ No newline at end of file