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> {
@Query("SELECT c FROM BN_CS_MP_CUSTOMERPROFILE c WHERE c.porOrgacode =:porOrgacode and c.padAdrsmobphone = :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")
CustomerProfile findbyEmail(String porOrgacode, String email);
}

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

Loading…
Cancel
Save