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

Added log line es pipeline #188

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public void listen(HashMap<String, Object> record, @Header(KafkaHeaders.RECEIVED
FiscalEventBulkRequest fiscalEventBulkRequest = objectMapper.convertValue(record, FiscalEventBulkRequest.class);

for(FiscalEvent fiscalEvent : fiscalEventBulkRequest.getFiscalEvent()) {
log.info("Fiscal Event request got "+fiscalEvent);
log.info("tenant id:"+fiscalEvent.getTenantId());
// 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(),
Expand All @@ -75,7 +77,7 @@ public void listen(HashMap<String, Object> record, @Header(KafkaHeaders.RECEIVED
fiscalDataEnrichmentService.enrichFiscalData(fiscalEvent);
fiscalDataEnrichmentService.enrichComputedFields(fiscalEvent,
tenantIdVsExpenditureTypeVsUuidsMap.get(fiscalEvent.getTenantId()));

log.info("Fiscal evennt before sending to index:"+fiscalEvent);
producer.push(indexFiscalEventsTopic, FiscalEventRequest.builder().fiscalEvent(fiscalEvent).build());
}
}catch(Exception e) {
Expand All @@ -93,17 +95,25 @@ private HashMap<String, HashSet<String>> loadExpenditureTypeVsUuidMap(String ten
expenditureTypeVsUuidsMap.put("Others", new HashSet<>());
expenditureTypeVsUuidsMap.put(electricityCoaHeadName, new HashSet<>());
expenditureTypeVsUuidsMap.put(operationsCoaHeadName, new HashSet<>());

log.info("expenditureTypeVsUuidsMap:" +expenditureTypeVsUuidsMap);
response.getChartOfAccounts().forEach(chartOfAccount -> {

if(expenditureTypeVsUuidsMap.containsKey(electricityCoaHeadName))
log.info("COA ID: "+chartOfAccount.getId()+" COA CODE:"+chartOfAccount.getCoaCode());
if(expenditureTypeVsUuidsMap.containsKey(electricityCoaHeadName)) {
log.info("Inside electricity Coa head");
expenditureTypeVsUuidsMap.get(electricityCoaHeadName).add(chartOfAccount.getId());
else if(expenditureTypeVsUuidsMap.containsKey(operationsCoaHeadName))
}
else if(expenditureTypeVsUuidsMap.containsKey(operationsCoaHeadName)) {
log.info("Inside Operation Coa head");
expenditureTypeVsUuidsMap.get(operationsCoaHeadName).add(chartOfAccount.getId());
else if(expenditureTypeVsUuidsMap.containsKey(salaryCoaHeadName))
}
else if(expenditureTypeVsUuidsMap.containsKey(salaryCoaHeadName)) {
log.info("Inside salary Coa head");
expenditureTypeVsUuidsMap.get(salaryCoaHeadName).add(chartOfAccount.getId());
else
}
else {
log.info("Inside Other Coa head");
expenditureTypeVsUuidsMap.get("Others").add(chartOfAccount.getId());
}

});
return expenditureTypeVsUuidsMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@ public void enrichComputedFields(FiscalEvent fiscalEvent, Map<String, HashSet<St
BigDecimal operationsHeadAmount = new BigDecimal(0);
BigDecimal salaryHeadAmount = new BigDecimal(0);
BigDecimal otherHeadAmount = new BigDecimal(0);
log.info("expenditureTypeVsUuidsMap in enrichComputedFields:"+expenditureTypeVsUuidsMap);

for(int i = 0; i < fiscalEvent.getAmountDetails().size(); i++) {
Amount amount = fiscalEvent.getAmountDetails().get(i);
log.info("Amount Details:"+amount);
log.info("Amount Coa:"+amount.getCoaId());
log.info("Amount :"+amount.getAmount());
if(expenditureTypeVsUuidsMap.get(electricityCoaHeadName).contains(amount.getCoaId()))
electricityHeadAmount = electricityHeadAmount.add(amount.getAmount());
else if(expenditureTypeVsUuidsMap.get(operationsCoaHeadName).contains(amount.getCoaId()))
Expand Down Expand Up @@ -152,6 +156,10 @@ else if(expenditureTypeVsUuidsMap.get(salaryCoaHeadName).contains(amount.getCoaI
}
computedFieldsMap.put("electricityExpenseNetAmount", electricityBillAmount);
}
if(!computedFieldsMap.isEmpty()) {
log.info("computedFieldsMap:" +computedFieldsMap);
}


fiscalEvent.setComputedFields(computedFieldsMap);
}
Expand Down