|
|
|
|
@ -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
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|