Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Iste 179 #826

Open
wants to merge 4 commits into
base: develop
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 @@ -38,4 +38,9 @@ public class AggregatedDemandDetailResponse {
private BigDecimal netDueWithPenalty;

private BigDecimal totalApplicablePenalty;

private long latestDemandCreatedTime;

private long latestDemandPenaltyCreatedtime;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<User> payers = null;
Expand Down Expand Up @@ -594,6 +597,46 @@ public AggregatedDemandDetailResponse getAllDemands(DemandCriteria demandCriteri
}).collect(Collectors.toList());
List<Map<Long, List<DemandDetail>>> demandDetailsList = new ArrayList<>();

List<Demand> demandsTogetDemandGeneratedDate= demands;

// Filter demands where demandDetails have taxHeadMasterCode as 10101
List<Demand> filteredDemands = demandsTogetDemandGeneratedDate.stream()
.filter(demand -> demand.getDemandDetails().stream()
.anyMatch(detail -> "10101".equals(detail.getTaxHeadMasterCode())))
.collect(Collectors.toList());

Collections.sort(filteredDemands, new Comparator<Demand>() {
@Override
public int compare(Demand d1, Demand d2) {
return Long.compare(d2.getTaxPeriodFrom(), d1.getTaxPeriodFrom());
}
});



if (!filteredDemands.isEmpty()) {
Demand latestDemand = filteredDemands.get(0);

Optional<DemandDetail> detail10101 = latestDemand.getDemandDetails().stream()
.filter(detail -> "10101".equals(detail.getTaxHeadMasterCode()))
.findFirst();

Optional<DemandDetail> 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 {
log.info("No demands found with taxHeadMasterCode 10101 or WS_TIME_PENALTY.");
}


for (Demand demand : demands) {
log.info("Inside demand");
Map<Long, List<DemandDetail>> demandMap = new HashMap<>();
Expand Down Expand Up @@ -748,7 +791,9 @@ public AggregatedDemandDetailResponse getAllDemands(DemandCriteria demandCriteri
.advanceAdjusted(advanceAdjusted)
.advanceAvailable(advanceAvailable)
.remainingAdvance(remainingAdvance)
.totalApplicablePenalty(totalApplicablePenalty).build();
.totalApplicablePenalty(totalApplicablePenalty)
.latestDemandCreatedTime(latestDemandCreatedTime)
.latestDemandPenaltyCreatedtime(latestDemandPenaltyCreatedtime).build();


return aggregatedDemandDetailResponse;
Expand Down