Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pfm 4555 #189

Merged
merged 9 commits into from
Sep 13, 2023
Merged
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* @sathishp-eGov @rushang7-eGov @GhanshyamRawat-eGov
* @sathishp-eGov @pradeepkumarcm-egov @GhanshyamRawat-eGov
core/ @sathishp-eGov @GhanshyamRawat-eGov @rushang7-eGov
reference-adapter/ @sathishp-eGov @GhanshyamRawat-eGov @rushang7-eGov
domain-services/ @sathishp-eGov @GhanshyamRawat-eGov @rushang7-eGov
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public class IfixElasticSearchPipelineListener {
@Value("${coa.salary.head.name}")
private String salaryCoaHeadName;

@Value("#{${coa.map}}")
Map<String, HashSet<String>> coaMap;

private Map<String, Map<String, HashSet<String>>> tenantIdVsExpenditureTypeVsUuidsMap = new HashMap<>();

/**
Expand All @@ -65,17 +68,13 @@ public class IfixElasticSearchPipelineListener {
public void listen(HashMap<String, Object> record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) {
try {
FiscalEventBulkRequest fiscalEventBulkRequest = objectMapper.convertValue(record, FiscalEventBulkRequest.class);

for(FiscalEvent fiscalEvent : fiscalEventBulkRequest.getFiscalEvent()) {
// Enrich hierarchy map according to the tenantid encountered by this pipeline to avoid redundant network calls
if(!tenantIdVsExpenditureTypeVsUuidsMap.containsKey(fiscalEvent.getTenantId()))
tenantIdVsExpenditureTypeVsUuidsMap.put(fiscalEvent.getTenantId(),
loadExpenditureTypeVsUuidMap(fiscalEvent.getTenantId()));

tenantIdVsExpenditureTypeVsUuidsMap.put(fiscalEvent.getTenantId(), coaMap);
fiscalDataEnrichmentService.enrichFiscalData(fiscalEvent);
fiscalDataEnrichmentService.enrichComputedFields(fiscalEvent,
tenantIdVsExpenditureTypeVsUuidsMap.get(fiscalEvent.getTenantId()));

producer.push(indexFiscalEventsTopic, FiscalEventRequest.builder().fiscalEvent(fiscalEvent).build());
}
}catch(Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ else if(expenditureTypeVsUuidsMap.get(salaryCoaHeadName).contains(amount.getCoaI
}
computedFieldsMap.put("electricityExpenseNetAmount", electricityBillAmount);
}

fiscalEvent.setComputedFields(computedFieldsMap);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ ifix.coa.search.endpoint=ifix-master-data/chartOfAccount/v1/_search
# COA HEAD NAMES
coa.electricity.head.name=Eelctricity
coa.operations.head.name=O&M
coa.salary.head.name=Salary
coa.salary.head.name=Salaries
coa.map={\
'Salaries': {'4a267566-ff67-4caf-a4b7-fc0231d07c95'},\
'O&M':{'0c736aab-c214-4604-8565-fc903a835222'},\
'Eelctricity': {'6a2c3d2e-f3eb-483e-9e60-e613509f8453'}, \
'others':{'bac69e16-802b-4eef-aa67-e05ed1b4e422','d0c70cd5-77f5-486d-8bff-5526966bb293'}\
}