Nabeel-DG-BS
Raja Nabeel 2 years ago
parent 82a020d409
commit 92b91f9628

@ -82,7 +82,7 @@ public class UserController {
}
@GetMapping(UCOURI.FETCH_ACCOUNT_INQUIRY)
public AccountInquiryResponse getAccountInquiry(
public List<AccountInquiryResponse> getAccountInquiry(
@RequestParam String acntTypeCode,
@RequestParam String acntTypeValue,
@RequestParam String porOrgacode,

@ -1,5 +1,7 @@
package com.mfsys.uco.dto;
import com.mfsys.comm.util.FieldNameLength;
import jakarta.persistence.Column;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -12,4 +14,8 @@ import lombok.NoArgsConstructor;
public class AccountInquiryResponse {
private String mbmBkmstitle;
private String mbmBkmsnumber;
private String pcrCurrcode;
private String pcrCurrdesc;
private String pcrCurrshort;
}

@ -14,4 +14,7 @@ import java.math.BigDecimal;
public class EvaluatedCurrencyReponse {
private String pcrCurrcode;
private double sgtGntramtfc;
private double serviceCharges;
private double targetPerEratrateact;
}

@ -38,5 +38,7 @@ public class UcoAccount {
private String pcrCurrdesc;
@Column(name = "PCR_CURRCODE", columnDefinition = FieldNameLength.PCR_CURRCODE)
private String pcrCurrcode;
@Column(name = "PCR_CURRSHORT", columnDefinition = FieldNameLength.PCR_CURRCODE)
private String pcrCurrshort;
}

@ -6,9 +6,11 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface UCOAccountRepository extends JpaRepository<UcoAccount, AccountId> {
@Query("SELECT c FROM BN_MS_UC_UCOACCOUNT c WHERE c.id.porOrgacode =:porOrgacode and c.cmpCustcode = :cmpCustcode")
UcoAccount findUcoAccountByCmpCustcode(String porOrgacode, String cmpCustcode);
List<UcoAccount> findUcoAccountByCmpCustcode(String porOrgacode, String cmpCustcode);
}

@ -148,8 +148,12 @@ public class TransactionService {
}
double convertedAmount = convertCurrency(baseCurrencyCode, targetCurrencyCode, sgtGntramtfc, exchangeRates);
return EvaluatedCurrencyReponse.builder().pcrCurrcode(targetCurrencyCode).sgtGntramtfc(convertedAmount).build();
return EvaluatedCurrencyReponse.builder()
.pcrCurrcode(targetCurrencyCode)
.sgtGntramtfc(convertedAmount)
.serviceCharges(0.0)
.targetPerEratrateact(targetCurrencyCode.equals("default")?(1/exchangeRates.get(baseCurrencyCode)):exchangeRates.get(targetCurrencyCode))
.build();
}
public double convertCurrency(String baseCurrencyCode, String targetCurrencyCode, double amount, Map<String, Double> exchangeRates) {

@ -40,7 +40,7 @@ public class UcoAccountService {
this.objectMapper = objectMapper;
}
public AccountInquiryResponse fetchAccountTitile(String porOrgacode, String acntTypeCode, String acntTypeValue) {
public List<AccountInquiryResponse> fetchAccountTitile(String porOrgacode, String acntTypeCode, String acntTypeValue) {
CustomerProfile customerProfile = new CustomerProfile();
if (acntTypeCode.equals(UCOConstants.CMP_PHONE)) {
@ -51,8 +51,17 @@ public class UcoAccountService {
if (Objects.isNull(customerProfile)) {
throw new AccountDoesntExistsException();
}
UcoAccount ucoAccount = ucoAccountRepository.findUcoAccountByCmpCustcode(porOrgacode, customerProfile.getCmpCustcode());
return AccountInquiryResponse.builder().mbmBkmsnumber(ucoAccount.getId().getMbmBkmsnumber()).mbmBkmstitle(ucoAccount.getMbmBkmstitle()).build();
List<UcoAccount> ucoAccountList= ucoAccountRepository.findUcoAccountByCmpCustcode(porOrgacode, customerProfile.getCmpCustcode());
List<AccountInquiryResponse> accountInquiryResponseList = new ArrayList<>();
ucoAccountList.stream().forEach(account ->{;
accountInquiryResponseList.add( AccountInquiryResponse.builder().mbmBkmsnumber(account.getId().getMbmBkmsnumber())
.mbmBkmstitle(account.getMbmBkmstitle())
.pcrCurrshort(account.getPcrCurrshort())
.pcrCurrcode(account.getPcrCurrcode())
.pcrCurrdesc(account.getPcrCurrdesc())
.build());
});
return accountInquiryResponseList;
}
@ -95,6 +104,7 @@ public class UcoAccountService {
.pcrCurrdesc(accountDetail.getPcrCurrdesc())
.cmpCustcode(accountDetail.getCmpCustcode())
.pcrCurrcode(accountDetail.getPcrCurrcode())
.pcrCurrshort(accountDetail.getPcrCurrshort())
.mbmBkmsclosed(accountDetail.isMbmBkmsclosed())
.mbmBkmsopendate(LocalDate.now())
.sgtLasttrandate(LocalDate.now())
@ -136,6 +146,7 @@ public void saveCustomerAccountDetails(String porOrgacode, String cmpCustcode,St
.pcrCurrdesc(k.getPcrCurrdesc())
.cmpCustcode(k.getCmpCustcode())
.pcrCurrcode(k.getPcrCurrcode())
.pcrCurrshort(k.getPcrCurrshort())
.mbmBkmsclosed(k.isMbmBkmsclosed())
.mbmBkmsopendate(LocalDate.now())
.sgtLasttrandate(LocalDate.now())

Loading…
Cancel
Save