|
|
|
|
@ -65,7 +65,42 @@ public class InProcessApplicationsService {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private LazyListRequestDTO buildLazyListPayload(InProcessApplicationsRequestDTO req) {
|
|
|
|
|
private Map<String, Object> businessBuildWorkflowFilter(InProcessApplicationsRequestDTO req) {
|
|
|
|
|
List<Object> workflowQueries = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
if (req.isIncludeRegistrationPending()) {
|
|
|
|
|
workflowQueries.add(Map.of(
|
|
|
|
|
"params", List.of(
|
|
|
|
|
param("workFlowStage", "BN_WF_BP_REGISTRATION", "text", "="),
|
|
|
|
|
param("applicationStatus", "Pending", "text", "=")
|
|
|
|
|
),
|
|
|
|
|
"operator", "$and"
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
if (req.isIncludeAuthorizationApproved()) {
|
|
|
|
|
workflowQueries.add(Map.of(
|
|
|
|
|
"params", List.of(
|
|
|
|
|
param("workFlowStage", "BN_WF_BP_AUTHORIZATION", "text", "="),
|
|
|
|
|
param("applicationStatus", "Approved", "text", "="),
|
|
|
|
|
param("postProcessCompleted", true, "boolean", "!=")
|
|
|
|
|
),
|
|
|
|
|
"operator", "$and"
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
workflowQueries.add(Map.of(
|
|
|
|
|
"params", List.of(
|
|
|
|
|
param("workFlowStage", "BN_WF_BP_REGISTRATION", "text", "="),
|
|
|
|
|
param("applicationStatus", "[\"Rejected\",\"Hold\"]", "text", "in")
|
|
|
|
|
),
|
|
|
|
|
"operator", "$and"
|
|
|
|
|
));
|
|
|
|
|
return Map.of(
|
|
|
|
|
"nestedQuery", workflowQueries,
|
|
|
|
|
"operator", "$or"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private LazyListRequestDTO indivdualBuildLazyListPayload(InProcessApplicationsRequestDTO req) {
|
|
|
|
|
|
|
|
|
|
List<Object> rootQueries = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
@ -106,12 +141,76 @@ public class InProcessApplicationsService {
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResponseEntity<String> getInProcessApplications(
|
|
|
|
|
private LazyListRequestDTO BusinessBuildLazyListPayload(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(businessBuildWorkflowFilter(req));
|
|
|
|
|
|
|
|
|
|
LazyListRequestDTO dto = new LazyListRequestDTO();
|
|
|
|
|
dto.setCollection("BN_WF_BP_BUSINESSPROFILE");
|
|
|
|
|
dto.setFilter(Map.of(
|
|
|
|
|
"nestedQuery", rootQueries,
|
|
|
|
|
"operator", "$and"
|
|
|
|
|
));
|
|
|
|
|
if (req.getLimit() != null) {
|
|
|
|
|
dto.setLimit(req.getLimit());
|
|
|
|
|
}
|
|
|
|
|
dto.setSortBy("{\"workFlowRefNum\":-1}");
|
|
|
|
|
dto.setIncludeFields(List.of(
|
|
|
|
|
"CMP_CUSTCODE", "CMP_COMPANYNAME", "workFlowRefNum", "applicationStatus", "workFlowStage",
|
|
|
|
|
"workFlowStage", "workFlowLog", "postProcessCompleted", "failureCause",
|
|
|
|
|
"postProcessInProgress"
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResponseEntity<String> getIndividualPendingCRM(
|
|
|
|
|
InProcessApplicationsRequestDTO request, String token, String susUserCode) {
|
|
|
|
|
|
|
|
|
|
String url = crmURI + "/crm" + "/mongodb/lazylist";
|
|
|
|
|
|
|
|
|
|
LazyListRequestDTO payload = indivdualBuildLazyListPayload(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> getBusinessPendingCRM(
|
|
|
|
|
InProcessApplicationsRequestDTO request, String token, String susUserCode) {
|
|
|
|
|
|
|
|
|
|
String url = crmURI + "/crm" + "/mongodb/lazylist";
|
|
|
|
|
|
|
|
|
|
LazyListRequestDTO payload = buildLazyListPayload(request);
|
|
|
|
|
LazyListRequestDTO payload = BusinessBuildLazyListPayload(request);
|
|
|
|
|
|
|
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
|
|
headers.set("Authorization", token);
|
|
|
|
|
|