-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
280 additions
and
3 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
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
41 changes: 41 additions & 0 deletions
41
src/main/java/com/eum/bank/common/dto/request/AccountTransferHistoryRequestDTO.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,41 @@ | ||
package com.eum.bank.common.dto.request; | ||
|
||
import com.eum.bank.domain.account.entity.Account; | ||
import com.eum.bank.domain.account.entity.AccountTransferHistory; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
public class AccountTransferHistoryRequestDTO { | ||
|
||
// 내역 생성 | ||
@Getter | ||
@Builder | ||
public static class CreateAccountTransferHistory { | ||
@NotEmpty(message = "거래 내역을 생성할 계좌를 입력해주세요.") | ||
private Account ownerAccount; | ||
@NotEmpty(message = "거래 상대 계좌를 입력해주세요.") | ||
private Account oppenentAccount; | ||
@NotEmpty(message = "거래 금액을 입력해주세요.") | ||
private Long transferAmount; | ||
@NotEmpty(message = "거래 유형을 입력해주세요.") | ||
private String transferType; | ||
@NotEmpty(message = "거래 후 잔액을 입력해주세요.") | ||
private Long budgetAfterTransfer; | ||
@NotEmpty(message = "거래 메모를 입력해주세요.") | ||
private String memo; | ||
|
||
// toEntity | ||
public AccountTransferHistory toEntity() { | ||
return AccountTransferHistory.builder() | ||
.ownerAccount(ownerAccount) | ||
.oppenentAccount(oppenentAccount) | ||
.transferAmount(transferAmount) | ||
.transferType(transferType) | ||
.budgetAfterTransfer(budgetAfterTransfer) | ||
.memo(memo) | ||
.build(); | ||
} | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/com/eum/bank/common/dto/request/TotalTransferHistoryRequestDTO.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,33 @@ | ||
package com.eum.bank.common.dto.request; | ||
|
||
import com.eum.bank.domain.account.entity.Account; | ||
import com.eum.bank.domain.account.entity.TotalTransferHistory; | ||
import jakarta.validation.constraints.NotEmpty; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
public class TotalTransferHistoryRequestDTO { | ||
|
||
@Getter | ||
@Builder | ||
public static class CreateTotalTransferHistory { | ||
@NotEmpty(message = "송금자 계좌를 입력해주세요.") | ||
private Account senderAccount; | ||
@NotEmpty(message = "수취자 계좌를 입력해주세요.") | ||
private Account receiverAccount; | ||
@NotEmpty(message = "송금 금액을 입력해주세요.") | ||
private Long transferAmount; | ||
@NotEmpty(message = "거래유형을 입력해주세요.") | ||
private String transferType; | ||
|
||
// toEntity | ||
public TotalTransferHistory toEntity() { | ||
return TotalTransferHistory.builder() | ||
.senderAccount(senderAccount) | ||
.receiverAccount(receiverAccount) | ||
.transferAmount(transferAmount) | ||
.transferType(transferType) | ||
.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
30 changes: 30 additions & 0 deletions
30
src/main/java/com/eum/bank/common/dto/response/TotalTransferHistoryResponseDTO.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,30 @@ | ||
package com.eum.bank.common.dto.response; | ||
|
||
import com.eum.bank.domain.account.entity.TotalTransferHistory; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
public class TotalTransferHistoryResponseDTO { | ||
|
||
// 거래 내역 반환 | ||
@Builder | ||
@Getter | ||
public static class GetTotalTransferHistory { | ||
private Long id; | ||
private AccountResponseDTO.AccountInfo senderAccount; | ||
private AccountResponseDTO.AccountInfo receiverAccount; | ||
private Long transferAmount; | ||
private String transferType; | ||
|
||
// fromEntity | ||
public static GetTotalTransferHistory fromEntity(TotalTransferHistory totalTransferHistory) { | ||
return GetTotalTransferHistory.builder() | ||
.id(totalTransferHistory.getId()) | ||
.senderAccount(AccountResponseDTO.AccountInfo.fromEntity(totalTransferHistory.getSenderAccount())) | ||
.receiverAccount(AccountResponseDTO.AccountInfo.fromEntity(totalTransferHistory.getReceiverAccount())) | ||
.transferAmount(totalTransferHistory.getTransferAmount()) | ||
.transferType(totalTransferHistory.getTransferType()) | ||
.build(); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/eum/bank/config/PasswordEncoderConfig.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 com.eum.bank.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.crypto.factory.PasswordEncoderFactories; | ||
import org.springframework.security.crypto.password.PasswordEncoder; | ||
|
||
@Configuration | ||
public class PasswordEncoderConfig { | ||
@Bean | ||
public PasswordEncoder passwordEncoder() { | ||
return PasswordEncoderFactories.createDelegatingPasswordEncoder(); | ||
} | ||
} |
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
19 changes: 19 additions & 0 deletions
19
src/main/java/com/eum/bank/service/AccountTransferHistoryService.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,19 @@ | ||
package com.eum.bank.service; | ||
|
||
import com.eum.bank.common.dto.request.AccountTransferHistoryRequestDTO; | ||
import com.eum.bank.domain.account.entity.AccountTransferHistory; | ||
import com.eum.bank.repository.AccountTransferHistoryRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class AccountTransferHistoryService { | ||
|
||
private final AccountTransferHistoryRepository accountTransferHistoryRepository; | ||
|
||
// 저장 | ||
public AccountTransferHistory save(AccountTransferHistoryRequestDTO.CreateAccountTransferHistory dto) { | ||
return accountTransferHistoryRepository.save(dto.toEntity()); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/eum/bank/service/TotalTransferHistoryService.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,17 @@ | ||
package com.eum.bank.service; | ||
|
||
import com.eum.bank.common.dto.request.TotalTransferHistoryRequestDTO; | ||
import com.eum.bank.domain.account.entity.TotalTransferHistory; | ||
import com.eum.bank.repository.TotalTransferHistoryRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class TotalTransferHistoryService { | ||
private final TotalTransferHistoryRepository totalTransferHistoryRepository; | ||
|
||
public TotalTransferHistory save(TotalTransferHistoryRequestDTO.CreateTotalTransferHistory dto) { | ||
return totalTransferHistoryRepository.save(dto.toEntity()); | ||
} | ||
} |