Get All Pending Bussiness Deposit

Get All Pending Bussiness Deposit and Get Single Pending Bussiness Deposit
Wasi/BS-2242
Wasiullah Khan 1 week ago
parent 62393c761f
commit bf8fca0b7e

@ -28,4 +28,18 @@ public class PendingDepositApplicationsController {
@RequestHeader("Authorization") String token, @RequestHeader("SUS_USERCODE") String susUserCode) {
return pendingDepositApplicationsService.getInProcessIndividualDepositApplication(request, workFlowRefNum, token, susUserCode);
}
@PostMapping(AconnectURI.GET_BUSINESS_DEPOSIT_APPLICATIONS_URI)
public ResponseEntity<String> getBusinessPendingDeposits(@RequestBody InProcessApplicationsRequestDTO request,
@RequestHeader("Authorization") String token, @RequestHeader("SUS_USERCODE") String susUserCode) {
return pendingDepositApplicationsService.getBusinessPendingDepositApplications(request, token, susUserCode);
}
@PostMapping(AconnectURI.CHECK_SINGLE_BUSINESS_DEPOSIT_URI)
public ResponseEntity<String> getSingleBusinessPendingDeposit(
@RequestBody InProcessApplicationsRequestDTO request, @RequestParam("workFlowRefNum") Long workFlowRefNum,
@RequestHeader("Authorization") String token, @RequestHeader("SUS_USERCODE") String susUserCode) {
return pendingDepositApplicationsService.getSingleBusinessPendingDepositApplication(request, workFlowRefNum, token, susUserCode);
}
}

@ -61,6 +61,45 @@ public class PendingDepositApplicationsService {
);
}
private Map<String, Object> businessDepositWorkflowFilter(InProcessApplicationsRequestDTO req) {
List<Object> workflowQueries = new ArrayList<>();
if (req.isIncludeRegistrationPending()) {
workflowQueries.add(Map.of(
"params", List.of(
param("workFlowStage", "BN_MS_OD_REGISTRATION", "text", "="),
param("applicationStatus", "Pending", "text", "=")
),
"operator", "$and"
));
}
if (req.isIncludeAuthorizationApproved()) {
workflowQueries.add(Map.of(
"params", List.of(
param("workFlowStage", "BN_MS_OD_AUTHORIZATION", "text", "="),
param("applicationStatus", "Approved", "text", "="),
param("postProcessCompleted", true, "boolean", "!=")
),
"operator", "$and"
));
}
workflowQueries.add(Map.of(
"params", List.of(
param("workFlowStage", "BN_MS_OD_REGISTRATION", "text", "="),
param("applicationStatus", "[\"Rejected\",\"Hold\"]", "text", "in")
),
"operator", "$and"
));
return Map.of(
"nestedQuery", workflowQueries,
"operator", "$or"
);
}
private LazyListRequestDTO buildLazyListPayload(InProcessApplicationsRequestDTO req) {
List<Object> rootQueries = new ArrayList<>();
@ -101,6 +140,49 @@ public class PendingDepositApplicationsService {
return dto;
}
private LazyListRequestDTO businessDepositBuildLazyListPayload(
InProcessApplicationsRequestDTO req) {
List<Object> rootQueries = new ArrayList<>();
rootQueries.add(Map.of(
"params", List.of(
param("POR_ORGACODE", req.getPorOrgacode(), "text", "="),
param("POR_ORGACODE_ENTRY", req.getPorOrgacode(), "text", "=")
),
"operator", "$or"
));
rootQueries.add(Map.of(
"params", List.of(
param("PLC_LOCACODE", "[\"" + req.getPlclocacode() + "\"]", "text", "in"),
param("PLC_LOCACODE_ENTRY", "[\"" + req.getPlclocacode() + "\"]", "text", "in")
),
"operator", "$or"
));
rootQueries.add(businessDepositWorkflowFilter(req));
LazyListRequestDTO dto = new LazyListRequestDTO();
dto.setCollection("BN_WF_OD_DEPOSITACCOUNT");
dto.setFilter(Map.of(
"nestedQuery", rootQueries,
"operator", "$and"
));
if (req.getLimit() != null) {
dto.setLimit(req.getLimit());
}
dto.setSortBy("{\"workFlowRefNum\":-1}");
dto.setIncludeFields(List.of(
"MBM_BKMSNUMBER", "DMP_PRODCODE", "CMP_CUSTCODE",
"MBM_BKMSTITLE", "workFlowRefNum",
"applicationStatus", "workFlowStage",
"workFlowLog", "postProcessCompleted",
"failureCause", "postProcessInProgress"
));
return dto;
}
public ResponseEntity<String> getInProcessDepositApplications(
InProcessApplicationsRequestDTO request, String token, String susUserCode) {
@ -124,6 +206,29 @@ public class PendingDepositApplicationsService {
);
}
public ResponseEntity<String> getBusinessPendingDepositApplications(
InProcessApplicationsRequestDTO request, String token, String susUserCode) {
String url = depositURI + "/deposit" + "/mongodb/lazylist";
LazyListRequestDTO payload = businessDepositBuildLazyListPayload(request);
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", token);
headers.set("POR_ORGACODE", request.getPorOrgacode());
headers.set("SUS_USERCODE", susUserCode);
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<LazyListRequestDTO> entity = new HttpEntity<>(payload, headers);
return restTemplate.exchange(
url,
HttpMethod.POST,
entity,
String.class
);
}
public ResponseEntity<String> getInProcessIndividualDepositApplication(
InProcessApplicationsRequestDTO req, Long workFlowRefNum, String token, String susUserCode) {
@ -162,4 +267,41 @@ public class PendingDepositApplicationsService {
);
}
public ResponseEntity<String> getSingleBusinessPendingDepositApplication(
InProcessApplicationsRequestDTO req, Long workFlowRefNum, String token, String susUserCode) {
String url = depositURI + "/deposit" + "/mongodb/lazylist";
LazyListRequestDTO dto = businessDepositBuildLazyListPayload(req);
Map<String, Object> individualFilter = Map.of(
"params", List.of(
param("workFlowRefNum", workFlowRefNum, "numeric", "=")
),"operator", "$and"
);
Map<String, Object> existingFilter = (Map<String, Object>) dto.getFilter();
List<Object> nestedQuery = new ArrayList<>((List<Object>) existingFilter.get("nestedQuery"));
nestedQuery.add(individualFilter);
dto.setFilter(Map.of("nestedQuery", nestedQuery, "operator", "$and"));
dto.setLimit(1);
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", token);
headers.set("POR_ORGACODE", req.getPorOrgacode());
headers.set("SUS_USERCODE", susUserCode);
headers.setContentType(MediaType.APPLICATION_JSON);
return restTemplate.exchange(
url,
HttpMethod.POST,
new HttpEntity<>(dto, headers),
String.class
);
}
}

@ -39,6 +39,8 @@ public interface AconnectURI {
String CHECK_INDIVIDUAL_DEPOSIT_APPLICATIONS_URI = DEPOSIT + INDIVIDUAL + "/inprocess";
String GET_BUSINESS_PENDING_APPLICATIONS_URI = CRM + BUSINESS + "/pending-workflow";
String CHECK_BUSINESS_APPLICATIONS_URI = CRM + BUSINESS + "/inprocess";
String GET_BUSINESS_DEPOSIT_APPLICATIONS_URI = DEPOSIT + BUSINESS + "/pending-workflow";
String CHECK_SINGLE_BUSINESS_DEPOSIT_URI = DEPOSIT + BUSINESS + "/inprocess";
String BUSINESS_CRM_CREATION_URI = CRM + BUSINESS + "/create";
String INDIVIDUAL_DEPOSIT_CREATION_URI = DEPOSIT + INDIVIDUAL + "/create";
String APPROVE_INDIVIDUAL_DEPOSIT_CREATION_URI = DEPOSIT + INDIVIDUAL + "/approval";

@ -19,6 +19,8 @@ public interface TokenBypassURI {
"/aconnect/crm/business/inprocess",
"/aconnect/deposit/inprocess",
"/aconnect/deposit/individual/inprocess",
"/aconnect/deposit/business/pending-workflow",
"/aconnect/deposit/business/inprocess",
"/aconnect/account/miscDetails",
"/deposit/account/miscDetails",
"/aconnect/account/getAccountDetails",

Loading…
Cancel
Save