Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #112 from FinFellows/develop
Browse files Browse the repository at this point in the history
[FIX]: 배열 쿼리로 수정 (#111)
  • Loading branch information
sejineer authored Jan 12, 2024
2 parents de1f703 + 9a228d5 commit 283acb7
Show file tree
Hide file tree
Showing 18 changed files with 284 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

import com.finfellows.domain.product.dto.condition.CmaSearchCondition;
import com.finfellows.domain.product.dto.condition.FinancialProductSearchCondition;
import com.finfellows.domain.product.dto.request.BankUploadReq;
import com.finfellows.domain.product.dto.response.*;
import com.finfellows.global.config.security.token.UserPrincipal;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

public interface FinancialProductService {
Expand All @@ -15,8 +18,9 @@ public interface FinancialProductService {
Page<SearchFinancialProductRes> findSavingProducts(UserPrincipal userPrincipal, FinancialProductSearchCondition financialProductSearchCondition, Pageable pageable);
DepositDetailRes getDepositDetail(UserPrincipal userPrincipal, Long depositId);
SavingDetailRes getSavingDetail(UserPrincipal userPrincipal, Long savingId);
List<String> findBanks(String bankType);
List<SearchBankRes> findBanks(String[] bankType);
Page<SearchCmaRes> findCmaProducts(UserPrincipal userPrincipal, CmaSearchCondition cmaSearchCondition, Pageable pageable);
CmaDetailRes getCmaDetail(UserPrincipal userPrincipal, Long cmaId);
Void bankUpload(BankUploadReq bankUploadReq, String bankLogoImg) throws IOException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
import com.finfellows.domain.bookmark.domain.FinancialProductBookmark;
import com.finfellows.domain.bookmark.domain.repository.CmaBookmarkRepository;
import com.finfellows.domain.bookmark.domain.repository.FinancialProductBookmarkRepository;
import com.finfellows.domain.product.domain.CMA;
import com.finfellows.domain.product.domain.FinancialProduct;
import com.finfellows.domain.product.domain.FinancialProductOption;
import com.finfellows.domain.product.domain.FinancialProductType;
import com.finfellows.domain.product.domain.*;
import com.finfellows.domain.product.domain.repository.BankRepository;
import com.finfellows.domain.product.domain.repository.CmaRepository;
import com.finfellows.domain.product.domain.repository.FinancialProductOptionRepository;
import com.finfellows.domain.product.domain.repository.FinancialProductRepository;
import com.finfellows.domain.product.dto.condition.CmaSearchCondition;
import com.finfellows.domain.product.dto.condition.FinancialProductSearchCondition;
import com.finfellows.domain.product.dto.request.BankUploadReq;
import com.finfellows.domain.product.dto.response.*;
import com.finfellows.domain.product.exception.InvalidFinancialProductException;
import com.finfellows.domain.product.exception.ProductTypeMismatchException;
Expand All @@ -37,6 +36,7 @@ public class FinancialProductServiceImpl implements FinancialProductService {
private final FinancialProductBookmarkRepository financialProductBookmarkRepository;
private final CmaBookmarkRepository cmaBookmarkRepository;
private final CmaRepository cmaRepository;
private final BankRepository bankRepository;

@Override
public Page<SearchFinancialProductRes> findDepositProducts(final UserPrincipal userPrincipal, final FinancialProductSearchCondition financialProductSearchCondition, final Pageable pageable) {
Expand Down Expand Up @@ -107,7 +107,7 @@ public SavingDetailRes getSavingDetail(final UserPrincipal userPrincipal, final
}

@Override
public List<String> findBanks(final String bankGroupNo) {
public List<SearchBankRes> findBanks(final String[] bankGroupNo) {
return financialProductRepository.findBanks(bankGroupNo);
}

Expand All @@ -131,4 +131,20 @@ public CmaDetailRes getCmaDetail(UserPrincipal userPrincipal, Long cmaId) {
return CmaDetailRes.toDto(cma, bookmark);
}

@Override
@Transactional
public Void bankUpload(BankUploadReq bankUploadReq, String bankLogoImg) {
Bank bank = Bank.builder()
.bankName(bankUploadReq.getKor_co_nm())
.bankCode(bankUploadReq.getFin_co_no())
.bankLogoUrl(bankLogoImg)
.bankUrl(bankUploadReq.getHomp_url())
.bankTel(bankUploadReq.getCal_tel())
.build();

bankRepository.save(bank);

return null;
}

}
40 changes: 40 additions & 0 deletions src/main/java/com/finfellows/domain/product/domain/Bank.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.finfellows.domain.product.domain;

import com.finfellows.domain.common.BaseEntity;
import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "Bank")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
public class Bank extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", updatable = false)
private Long id;

private String bankName;

private String bankCode;

private String bankLogoUrl;

private String bankUrl;

private String bankTel;

@Builder
public Bank(String bankName, String bankCode, String bankLogoUrl, String bankUrl, String bankTel) {
this.bankName = bankName;
this.bankCode = bankCode;
this.bankLogoUrl = bankLogoUrl;
this.bankUrl = bankUrl;
this.bankTel = bankTel;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.finfellows.domain.product.domain.repository;

import com.finfellows.domain.product.domain.Bank;
import org.springframework.data.jpa.repository.JpaRepository;

public interface BankRepository extends JpaRepository<Bank, Long> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.finfellows.domain.product.domain.FinancialProductType;
import com.finfellows.domain.product.dto.condition.CmaSearchCondition;
import com.finfellows.domain.product.dto.condition.FinancialProductSearchCondition;
import com.finfellows.domain.product.dto.response.SearchBankRes;
import com.finfellows.domain.product.dto.response.SearchCmaRes;
import com.finfellows.domain.product.dto.response.SearchFinancialProductRes;
import org.springframework.data.domain.Page;
Expand All @@ -14,7 +15,7 @@ public interface FinancialProductQueryDslRepository {

Page<SearchFinancialProductRes> findFinancialProducts(FinancialProductSearchCondition financialProductSearchCondition, Pageable pageable, FinancialProductType financialProductType);
Page<SearchFinancialProductRes> findFinancialProductsWithAuthorization(FinancialProductSearchCondition financialProductSearchCondition, Pageable pageable, FinancialProductType financialProductType, Long userId);
List<String> findBanks(String bankGroupNo);
List<SearchBankRes> findBanks(String[] bankGroupNo);
Page<SearchCmaRes> findCmaProductsWithAuthorization(CmaSearchCondition cmaSearchCondition, Pageable pageable, Long userId);
Page<SearchCmaRes> findCmaProducts(CmaSearchCondition cmaSearchCondition, Pageable pageable);

Expand Down
Loading

0 comments on commit 283acb7

Please sign in to comment.