|
|
|
|
@ -58,16 +58,16 @@ public class UcoAccountService {
|
|
|
|
|
customerProfile = customerProfileRepository.findCustomerProfileByCmpEmailAndPorOrgacode(porOrgacode, acntTypeValue);
|
|
|
|
|
}
|
|
|
|
|
if (Objects.isNull(customerProfile)) {
|
|
|
|
|
throw new AccountDoesntExistsException();
|
|
|
|
|
throw new AccountDoesntExistsException();
|
|
|
|
|
}
|
|
|
|
|
List<UcoAccount> ucoAccountList= ucoAccountRepository.findUcoAccountByCmpCustcode(porOrgacode, customerProfile.getCmpCustcode());
|
|
|
|
|
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())
|
|
|
|
|
.pcrCurrshort(account.getPcrCurrshort())
|
|
|
|
|
.pcrCurrcode(account.getPcrCurrcode())
|
|
|
|
|
.pcrCurrdesc(account.getPcrCurrdesc())
|
|
|
|
|
.build());
|
|
|
|
|
});
|
|
|
|
|
return accountInquiryResponseList;
|
|
|
|
|
@ -191,39 +191,42 @@ public class UcoAccountService {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
String accountNumber = webClientDeposit.createUcoAccount(JsonToString(Map.of("payload",preparePayloadForAccount(customerProfile,addAccountRequestModel.getTitle()),
|
|
|
|
|
String accountNumber = webClientDeposit.createUcoAccount(JsonToString(Map.of("payload",preparePayloadForAccount(customerProfile,addAccountRequestModel.getTitle(), addAccountRequestModel.getDmpProdcode()),
|
|
|
|
|
"uniqueConstraints",List.of(List.of(String.valueOf(addAccountRequestModel.getDmpProdcode()))))),UCOURI.UCO_CUSTOMER_ACCOUNT,porOrgacode);
|
|
|
|
|
saveCustomerAccountDetails(porOrgacode,customerProfile.getCmpCustcode(),accountNumber);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void saveCustomerAccountDetails(String porOrgacode, String cmpCustcode,String accountNumber){
|
|
|
|
|
fetchdepositAccountFromCiihive(porOrgacode, cmpCustcode).stream().forEach(k -> {
|
|
|
|
|
if(k.getMbmBkmsnumber().equals(accountNumber)){
|
|
|
|
|
UcoAccount ucoAccount = UcoAccount.builder()
|
|
|
|
|
.id(new AccountId(k.getPorOrgacode(), k.getMbmBkmsnumber()))
|
|
|
|
|
.dmpProdcode(k.getDmpProdcode())
|
|
|
|
|
.mbmBkmstitle(k.getMbmBkmstitle())
|
|
|
|
|
.pcrCurrdesc(k.getPcrCurrdesc())
|
|
|
|
|
.cmpCustcode(k.getCmpCustcode())
|
|
|
|
|
.pcrCurrcode(k.getPcrCurrcode())
|
|
|
|
|
.pcrCurrshort(k.getPcrCurrshort())
|
|
|
|
|
.mbmBkmsclosed(k.isMbmBkmsclosed())
|
|
|
|
|
.mbmBkmsopendate(LocalDate.now())
|
|
|
|
|
.sgtLasttrandate(LocalDate.now())
|
|
|
|
|
.build();
|
|
|
|
|
ucoAccountRepository.save(ucoAccount);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
public String preparePayloadForAccount(CustomerProfile customerProfile,String title){
|
|
|
|
|
Map<String,Object> jsonMap = new HashMap<>();
|
|
|
|
|
public void saveCustomerAccountDetails(String porOrgacode, String cmpCustcode,String accountNumber){
|
|
|
|
|
fetchdepositAccountFromCiihive(porOrgacode, cmpCustcode).stream().forEach(k -> {
|
|
|
|
|
if(k.getMbmBkmsnumber().equals(accountNumber)){
|
|
|
|
|
UcoAccount ucoAccount = UcoAccount.builder()
|
|
|
|
|
.id(new AccountId(k.getPorOrgacode(), k.getMbmBkmsnumber()))
|
|
|
|
|
.dmpProdcode(k.getDmpProdcode())
|
|
|
|
|
.mbmBkmstitle(k.getMbmBkmstitle())
|
|
|
|
|
.pcrCurrdesc(k.getPcrCurrdesc())
|
|
|
|
|
.cmpCustcode(k.getCmpCustcode())
|
|
|
|
|
.pcrCurrcode(k.getPcrCurrcode())
|
|
|
|
|
.pcrCurrshort(k.getPcrCurrshort())
|
|
|
|
|
.mbmBkmsclosed(k.isMbmBkmsclosed())
|
|
|
|
|
.mbmBkmsopendate(LocalDate.now())
|
|
|
|
|
.sgtLasttrandate(LocalDate.now())
|
|
|
|
|
.build();
|
|
|
|
|
ucoAccountRepository.save(ucoAccount);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String preparePayloadForAccount(CustomerProfile customerProfile, String title, String dmpProdcode) {
|
|
|
|
|
System.out.println(customerProfile);
|
|
|
|
|
Map<String, Object> jsonMap = new HashMap<>();
|
|
|
|
|
jsonMap.put("SUS_USERCODE", "01");
|
|
|
|
|
jsonMap.put("CMP_CUSTCODE",customerProfile.getCmpCustcode());
|
|
|
|
|
jsonMap.put("CMP_CUSTCODE", customerProfile.getCmpCustcode());
|
|
|
|
|
jsonMap.put("CMP_FULLNAME", title);
|
|
|
|
|
jsonMap.put("PLC_LOCACODE", "2003");
|
|
|
|
|
jsonMap.put("PLC_LOCACODE", "0010");
|
|
|
|
|
jsonMap.put("workFlowStage", "BN_WF_CP_AUTHORIZATION");
|
|
|
|
|
jsonMap.put("PCT_CSTYCODE", "I");
|
|
|
|
|
jsonMap.put("POR_ORGACODE", customerProfile.getPorOrgacode());
|
|
|
|
|
jsonMap.put("DMP_PRODCODE", dmpProdcode);
|
|
|
|
|
List<Map<String, Object>> workFlowLog = new ArrayList<>();
|
|
|
|
|
Map<String, Object> logEntry = new HashMap<>();
|
|
|
|
|
logEntry.put("susUsercode", "01");
|
|
|
|
|
@ -249,9 +252,10 @@ public void saveCustomerAccountDetails(String porOrgacode, String cmpCustcode,St
|
|
|
|
|
Map<String, Object> createdDateMap = new HashMap<>();
|
|
|
|
|
createdDateMap.put("$date", new Date());
|
|
|
|
|
jsonMap.put("@_CREATEDATE", createdDateMap);
|
|
|
|
|
return JsonToString(jsonMap);
|
|
|
|
|
return JsonToString(jsonMap);
|
|
|
|
|
}
|
|
|
|
|
public String JsonToString(Object jsonMap){
|
|
|
|
|
|
|
|
|
|
public String JsonToString(Object jsonMap) {
|
|
|
|
|
try {
|
|
|
|
|
return this.objectMapper.writeValueAsString(jsonMap);
|
|
|
|
|
} catch (JsonProcessingException var3) {
|
|
|
|
|
|