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 response for single Demand #194

Open
wants to merge 1 commit into
base: sw_calculator_yearly_disposal
Choose a base branch
from
Open
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 @@ -709,7 +709,7 @@ public void generateDemandForTenantId(String tenantId, RequestInfo requestInfo)
generateDemandForULB(billingMasterData, requestInfo, tenantId, taxPeriodFrom, taxPeriodTo);
}

public void SingleDemandGenerate(String tenantId, SingleDemand singledemand) {
public String SingleDemandGenerate(String tenantId, SingleDemand singledemand) {
singledemand.getRequestInfo().getUserInfo().setTenantId(tenantId);
Map<String, Object> billingMasterData = calculatorUtils.loadBillingFrequencyMasterDatas(singledemand, tenantId);
long taxPeriodFrom = billingMasterData.get("taxPeriodFrom") == null ? 0l
Expand All @@ -720,7 +720,7 @@ public void SingleDemandGenerate(String tenantId, SingleDemand singledemand) {
throw new CustomException("NO_BILLING_PERIODS","MDMS Billing Period does not available for tenant: "+ tenantId);
}

generateDemandForSingle(billingMasterData, singledemand, tenantId, taxPeriodFrom, taxPeriodTo);
return generateDemandForSingle(billingMasterData, singledemand, tenantId, taxPeriodFrom, taxPeriodTo);
}

/**
Expand Down Expand Up @@ -873,6 +873,7 @@ private boolean isValidBillingCycle(SewerageDetails detail, long taxPeriodFrom,
public String generateDemandForSingle(Map<String, Object> master, SingleDemand singleDemand, String tenantId,
Long taxPeriodFrom, Long taxPeriodTo) {
RequestInfo requestInfo=singleDemand.getRequestInfo();
String tempvariable="";
log.info("generateDemandForULB:: "+ tenantId+" taxPeriodFrom:: "+taxPeriodFrom+" taxPeriodTo "+taxPeriodTo);
try {
List<TaxPeriod> taxPeriods = calculatorUtils.getTaxPeriodsFromMDMS(requestInfo, tenantId);
Expand All @@ -894,6 +895,7 @@ public String generateDemandForSingle(Map<String, Object> master, SingleDemand s
log.info("Total Connections: {} and batch count: {}", connectionNos.size(), bulkSaveDemandCount);

if (connectionNos == null || connectionNos.size() <= 0) {
tempvariable=null;
throw new IllegalArgumentException("Demand not generated: No connections found");
}

Expand Down Expand Up @@ -979,6 +981,7 @@ public String generateDemandForSingle(Map<String, Object> master, SingleDemand s
connectionNosCount=0;

}
tempvariable=sewConnDetails.getConnectionNo();

}catch (Exception e) {
log.error("Exception occurred while generating demand for sewerage connectionno: "+sewConnDetails.getConnectionNo() + " tenantId: "+tenantId);
Expand All @@ -988,7 +991,7 @@ public String generateDemandForSingle(Map<String, Object> master, SingleDemand s
}catch (Exception e) {
log.error("Exception occurred while processing the demand generation for tenantId: "+tenantId);
}
return "Demand generated successfully";
return tempvariable;
}

private boolean isValidBillingCycles(SewerageDetails detail, long taxPeriodFrom, long taxPeriodTo,
Expand Down