commit multiple instances and email based account inquiry implemented

Nabeel-DG-BS
Raja Nabeel 2 years ago
parent ab7e7e3058
commit 41e16ec407

@ -0,0 +1,6 @@
package com.mfsys.uco.constants;
public interface UCOConstants {
String CMP_PHONE = "01";
String CMP_EMAIL = "02";
}

@ -10,7 +10,8 @@ import org.springframework.stereotype.Repository;
public interface CustomerProfileRepository extends JpaRepository<CustomerProfile, CustomerProfileId> { public interface CustomerProfileRepository extends JpaRepository<CustomerProfile, CustomerProfileId> {
@Query("SELECT c FROM BN_CS_MP_CUSTOMERPROFILE c WHERE c.porOrgacode =:porOrgacode and c.padAdrsmobphone = :phone") @Query("SELECT c FROM BN_CS_MP_CUSTOMERPROFILE c WHERE c.porOrgacode =:porOrgacode and c.padAdrsmobphone = :phone")
CustomerProfile findProfilesByMobilePhone(String porOrgacode, String phone); CustomerProfile findProfilesByMobilePhone(String porOrgacode, String phone);
@Query("SELECT c FROM BN_CS_MP_CUSTOMERPROFILE c WHERE c.porOrgacode =:porOrgacode and c.cmpEmail = :cmpEmail")
CustomerProfile findCustomerProfileByCmpEmailAndPorOrgacode(String porOrgacode, String cmpEmail);
@Query("SELECT c FROM BN_CS_MP_CUSTOMERPROFILE c WHERE c.porOrgacode =:porOrgacode and c.cmpEmail = :email") @Query("SELECT c FROM BN_CS_MP_CUSTOMERPROFILE c WHERE c.porOrgacode =:porOrgacode and c.cmpEmail = :email")
CustomerProfile findbyEmail(String porOrgacode, String email); CustomerProfile findbyEmail(String porOrgacode, String email);
} }

@ -1,6 +1,7 @@
package com.mfsys.uco.service; package com.mfsys.uco.service;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.mfsys.uco.constants.UCOConstants;
import com.mfsys.uco.constants.UCOURI; import com.mfsys.uco.constants.UCOURI;
import com.mfsys.uco.dto.AccountInquiryResponse; import com.mfsys.uco.dto.AccountInquiryResponse;
import com.mfsys.uco.dto.SignupStep3RequestModel; import com.mfsys.uco.dto.SignupStep3RequestModel;
@ -20,6 +21,7 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
@Service @Service
public class UcoAccountService { public class UcoAccountService {
@ -39,16 +41,19 @@ public class UcoAccountService {
} }
public AccountInquiryResponse fetchAccountTitile(String porOrgacode, String acntTypeCode, String acntTypeValue) { public AccountInquiryResponse fetchAccountTitile(String porOrgacode, String acntTypeCode, String acntTypeValue) {
if (acntTypeCode.equals("01")) { CustomerProfile customerProfile = new CustomerProfile();
CustomerProfile customerProfile = customerProfileRepository.findProfilesByMobilePhone(porOrgacode, acntTypeValue);
if (acntTypeCode.equals(UCOConstants.CMP_PHONE)) {
customerProfile = customerProfileRepository.findProfilesByMobilePhone(porOrgacode, acntTypeValue);
} else if (acntTypeCode.equals(UCOConstants.CMP_EMAIL)) {
customerProfile = customerProfileRepository.findCustomerProfileByCmpEmailAndPorOrgacode(porOrgacode, acntTypeValue);
}
if (Objects.isNull(customerProfile)) { if (Objects.isNull(customerProfile)) {
throw new AccountDoesntExistsException(); throw new AccountDoesntExistsException();
} }
UcoAccount ucoAccount = ucoAccountRepository.findUcoAccountByCmpCustcode(porOrgacode, customerProfile.getCmpCustcode()); UcoAccount ucoAccount = ucoAccountRepository.findUcoAccountByCmpCustcode(porOrgacode, customerProfile.getCmpCustcode());
return AccountInquiryResponse.builder().mbmBkmsnumber(ucoAccount.getId().getMbmBkmsnumber()).mbmBkmstitle(ucoAccount.getMbmBkmstitle()).build(); return AccountInquiryResponse.builder().mbmBkmsnumber(ucoAccount.getId().getMbmBkmsnumber()).mbmBkmstitle(ucoAccount.getMbmBkmstitle()).build();
} }
return null;
}
public Double fetchAccountBalance(String porOrgacode, String mbmBkmsNumber) { public Double fetchAccountBalance(String porOrgacode, String mbmBkmsNumber) {

Loading…
Cancel
Save