From d458ca6fa9a6750e09e5247457c78df6946ea622 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 18 Jun 2024 14:04:32 +0530 Subject: [PATCH 1/4] ISTE-179: Added chnages to get latest demand created date and penalty created date --- .../egov/demand/service/DemandService.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java index 49b795ca4..f63dc27b6 100644 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java +++ b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java @@ -594,6 +594,32 @@ public AggregatedDemandDetailResponse getAllDemands(DemandCriteria demandCriteri }).collect(Collectors.toList()); List>> demandDetailsList = new ArrayList<>(); + List demandsTogetDemandGeneratedDate= demands; + + // Filter demands where demandDetails have taxHeadMasterCode as 10101 + List filteredDemands = demandsTogetDemandGeneratedDate.stream() + .filter(demand -> demand.getDemandDetails().stream() + .anyMatch(detail -> "10101".equals(detail.getTaxHeadMasterCode()))) + .collect(Collectors.toList()); + + Collections.sort(demandsTogetDemandGeneratedDate, new Comparator() { + @Override + public int compare(Demand d1, Demand d2) { + return Long.compare(d2.getTaxPeriodFrom(), d1.getTaxPeriodFrom()); + } + }); + + + + if (!filteredDemands.isEmpty()) { + log.info("lastest demand:"+filteredDemands.get(0)); + long latestDemandCreatedTime = filteredDemands.get(0).getAuditDetails().getCreatedTime(); + System.out.println("CreatedTime: " + latestDemandCreatedTime); + } else { + System.out.println("No demands found with taxHeadMasterCode 10101."); + } + + for (Demand demand : demands) { log.info("Inside demand"); Map> demandMap = new HashMap<>(); From b0801ad4278f392ca29b03e006f48d97a7b59f54 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 18 Jun 2024 14:25:44 +0530 Subject: [PATCH 2/4] ISTE-179: Added chnages to get latest demand created date and penalty created date --- ....sql => V20221206104421__egbs_bill_alter_add_consumercode.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename business-services/billing-service/src/main/resources/db/migration/main/{V20221206104420__egbs_bill_alter_add_consumercode.sql => V20221206104421__egbs_bill_alter_add_consumercode.sql} (100%) diff --git a/business-services/billing-service/src/main/resources/db/migration/main/V20221206104420__egbs_bill_alter_add_consumercode.sql b/business-services/billing-service/src/main/resources/db/migration/main/V20221206104421__egbs_bill_alter_add_consumercode.sql similarity index 100% rename from business-services/billing-service/src/main/resources/db/migration/main/V20221206104420__egbs_bill_alter_add_consumercode.sql rename to business-services/billing-service/src/main/resources/db/migration/main/V20221206104421__egbs_bill_alter_add_consumercode.sql From 3d92f4378143f22dc11878b277996d88f64b4d94 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 18 Jun 2024 14:48:19 +0530 Subject: [PATCH 3/4] ISTE-179: Added chnages to get latest demand created date and penalty created date --- .../src/main/java/org/egov/demand/service/DemandService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java index f63dc27b6..eee0fe3f6 100644 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java +++ b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java @@ -602,7 +602,7 @@ public AggregatedDemandDetailResponse getAllDemands(DemandCriteria demandCriteri .anyMatch(detail -> "10101".equals(detail.getTaxHeadMasterCode()))) .collect(Collectors.toList()); - Collections.sort(demandsTogetDemandGeneratedDate, new Comparator() { + Collections.sort(filteredDemands, new Comparator() { @Override public int compare(Demand d1, Demand d2) { return Long.compare(d2.getTaxPeriodFrom(), d1.getTaxPeriodFrom()); From 6cf89a68c0fddd0ca4ffac2adb072664aa9bc34e Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 18 Jun 2024 15:25:40 +0530 Subject: [PATCH 4/4] ISTE-179: Added chnages to get latest demand created date and penalty created date --- .../model/AggregatedDemandDetailResponse.java | 5 ++++ .../egov/demand/service/DemandService.java | 29 +++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java b/business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java index 1feca1ce4..aa4fbe62e 100644 --- a/business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java +++ b/business-services/billing-service/src/main/java/org/egov/demand/model/AggregatedDemandDetailResponse.java @@ -38,4 +38,9 @@ public class AggregatedDemandDetailResponse { private BigDecimal netDueWithPenalty; private BigDecimal totalApplicablePenalty; + + private long latestDemandCreatedTime; + + private long latestDemandPenaltyCreatedtime; + } \ No newline at end of file diff --git a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java index eee0fe3f6..9628066e7 100644 --- a/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java +++ b/business-services/billing-service/src/main/java/org/egov/demand/service/DemandService.java @@ -547,6 +547,9 @@ public DemandHistory getDemandHistory(@Valid DemandCriteria demandCriteria, Requ public AggregatedDemandDetailResponse getAllDemands(DemandCriteria demandCriteria, RequestInfo requestInfo) { //demandValidatorV1.validateDemandCriteria(demandCriteria, requestInfo); + long latestDemandCreatedTime = 0l; + + long latestDemandPenaltyCreatedtime=0l; UserSearchRequest userSearchRequest = null; List payers = null; @@ -612,11 +615,25 @@ public int compare(Demand d1, Demand d2) { if (!filteredDemands.isEmpty()) { - log.info("lastest demand:"+filteredDemands.get(0)); - long latestDemandCreatedTime = filteredDemands.get(0).getAuditDetails().getCreatedTime(); - System.out.println("CreatedTime: " + latestDemandCreatedTime); + Demand latestDemand = filteredDemands.get(0); + + Optional detail10101 = latestDemand.getDemandDetails().stream() + .filter(detail -> "10101".equals(detail.getTaxHeadMasterCode())) + .findFirst(); + + Optional detailWSTimePenalty = latestDemand.getDemandDetails().stream() + .filter(detail -> "WS_TIME_PENALTY".equals(detail.getTaxHeadMasterCode())) + .findFirst(); + + if (detail10101.isPresent()) { + latestDemandCreatedTime = detail10101.get().getAuditDetails().getCreatedTime(); + } + + if (detailWSTimePenalty.isPresent()) { + latestDemandPenaltyCreatedtime = detailWSTimePenalty.get().getAuditDetails().getCreatedTime(); + } } else { - System.out.println("No demands found with taxHeadMasterCode 10101."); + log.info("No demands found with taxHeadMasterCode 10101 or WS_TIME_PENALTY."); } @@ -774,7 +791,9 @@ public int compare(Demand d1, Demand d2) { .advanceAdjusted(advanceAdjusted) .advanceAvailable(advanceAvailable) .remainingAdvance(remainingAdvance) - .totalApplicablePenalty(totalApplicablePenalty).build(); + .totalApplicablePenalty(totalApplicablePenalty) + .latestDemandCreatedTime(latestDemandCreatedTime) + .latestDemandPenaltyCreatedtime(latestDemandPenaltyCreatedtime).build(); return aggregatedDemandDetailResponse;