From 740b06f7228ed117587d2a65f7b313173e074912 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Thu, 4 Jan 2024 13:40:13 +0530 Subject: [PATCH 01/20] PFM-4082 Echallan report --- .../repository/ChallanRepository.java | 40 ++++++++- .../builder/ChallanQueryBuilder.java | 10 ++- .../rowmapper/ExpenseBillReportRowMapper.java | 90 +++++++++++++++++++ .../egov/echallan/service/ChallanService.java | 16 +++- .../egov/echallan/service/UserService.java | 8 +- .../web/controllers/ChallanController.java | 27 +++--- .../web/models/ExpenseBillReportData.java | 56 ++++++++++++ .../web/models/ExpenseBillReportResponse.java | 20 +++++ 8 files changed, 252 insertions(+), 15 deletions(-) create mode 100644 municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java create mode 100644 municipal-services/echallan-services/src/main/java/org/egov/echallan/web/models/ExpenseBillReportData.java create mode 100644 municipal-services/echallan-services/src/main/java/org/egov/echallan/web/models/ExpenseBillReportResponse.java diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java index 1ab58fecd..c1e417ca9 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java @@ -24,8 +24,10 @@ import org.egov.echallan.producer.Producer; import org.egov.echallan.repository.builder.ChallanQueryBuilder; import org.egov.echallan.repository.rowmapper.ChallanRowMapper; +import org.egov.echallan.repository.rowmapper.ExpenseBillReportRowMapper; import org.egov.echallan.service.ChallanService; import org.egov.echallan.util.CommonUtils; +import org.egov.echallan.web.models.ExpenseBillReportData; import org.egov.echallan.web.models.collection.Bill; import org.egov.echallan.web.models.collection.PaymentDetail; import org.egov.echallan.web.models.collection.PaymentRequest; @@ -63,7 +65,9 @@ public class ChallanRepository { private ChallanQueryBuilder queryBuilder; private ChallanRowMapper rowMapper; - + + private ExpenseBillReportRowMapper expenseBillReportRowMapper; + private RestTemplate restTemplate; @Autowired @@ -484,4 +488,38 @@ public List fetchESIds(SearchCriteria criteria) { new SingleColumnRowMapper<>(String.class)); return ids; } + + public List getExpenseBillReport(Long monthStartDateTime, String tenantId, Integer offset, Integer limit) + { + StringBuilder expenseBillQuery =new StringBuilder(queryBuilder.EXPENSEBILLQUERY); + + List preparedStatement=new ArrayList<>(); + preparedStatement.add(tenantId); + preparedStatement.add(monthStartDateTime); + + Integer newLimit=config.getDefaultLimit(); + Integer newOffset=config.getDefaultOffset(); + + if(limit==null && offset==null) + newLimit=config.getMaxSearchLimit(); + if(limit!=null && limit<=config.getMaxSearchLimit()) + newLimit=limit; + if(limit!=null && limit>=config.getMaxSearchLimit()) + newLimit=config.getMaxSearchLimit(); + + if(offset!=null) + newOffset=offset; + + if(newLimit>0) + { + expenseBillQuery.append("offset ? limit ? ;"); + preparedStatement.add(newOffset); + preparedStatement.add(newLimit); + } + + log.info("Query of expense bill report " +expenseBillQuery.toString()+" prepared statement "+preparedStatement); + + List expenseBillReportDataList=jdbcTemplate.query(expenseBillQuery.toString(), preparedStatement.toArray(),expenseBillReportRowMapper); + return expenseBillReportDataList; + } } diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java index 465e12455..a33e77d83 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java @@ -85,8 +85,14 @@ public ChallanQueryBuilder(ChallanConfiguration config) { public static final String PENDINGEXPCOLLTILLDATE = "SELECT coalesce(SUM(DMDL.TAXAMOUNT - DMDL.COLLECTIONAMOUNT),0) FROM EGBS_DEMAND_V1 DMD INNER JOIN EGBS_DEMANDDETAIL_V1 DMDL ON DMD.ID=DMDL.DEMANDID AND DMD.TENANTID=DMDL.TENANTID INNER JOIN EG_ECHALLAN CH ON CH.referenceId=DMD.CONSUMERCODE AND DMD.TENANTID=CH.TENANTID WHERE DMD.BUSINESSSERVICE LIKE '%EXPENSE%' and DMD.status='ACTIVE' "; - - public String getChallanSearchQuery(SearchCriteria criteria, List preparedStmtList) { + public static final String EXPENSEBILLQUERY="SELECT challan.typeofexpense,vendor.name,challan.billdate," + + " challan.taxperiodfrom,challan.taxperiodto,challan.applicationstatus,challan.paiddate," + + " challan.filestoreid,challan.lastmodifiedtime,challan.lastmodifiedby from " + + " eg_echallan challan LEFT JOIN eg_vendor vendor on challan.vendor=vendor.id " + + " where challan.tenantid=? and vendor.status='ACTIVE' and " + + " challan.taxperiodfrom >=? order by challan.taxperiodfrom desc "; + + public String getChallanSearchQuery(SearchCriteria criteria, List preparedStmtList) { StringBuilder builder = new StringBuilder(QUERY); diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java new file mode 100644 index 000000000..a4a96cce1 --- /dev/null +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java @@ -0,0 +1,90 @@ +package org.egov.echallan.repository.rowmapper; + +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.egov.echallan.service.UserService; +import org.egov.echallan.web.models.ExpenseBillReportData; +import org.egov.echallan.web.models.ExpenseBillReportResponse; +import org.egov.echallan.web.models.user.User; +import org.egov.echallan.web.models.user.UserDetailResponse; +import org.egov.echallan.web.models.user.UserSearchRequest; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; +import org.springframework.stereotype.Component; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.*; + +@Component +@Slf4j +public class ExpenseBillReportRowMapper implements ResultSetExtractor> +{ + @Autowired + private ObjectMapper mapper; + + @Autowired + private UserService userService; + + @Override + public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { + + List expenseBillReportDataList=new ArrayList<>(); + + while(resultSet.next()) + { + ExpenseBillReportData expenseBillReportData=new ExpenseBillReportData(); + expenseBillReportData.setTypeOfExpense(resultSet.getString("typeofexpense")); + expenseBillReportData.setVendorName(resultSet.getString("name")); +// expenseBillReportData.setAmount(resultSet.getString("")); + expenseBillReportData.setBillDate(resultSet.getLong("billdate")); + expenseBillReportData.setTaxPeriodFrom(resultSet.getLong("taxperiodfrom")); + expenseBillReportData.setTaxPeriodTo(resultSet.getLong("taxperiodto")); + expenseBillReportData.setApplicationStatus(resultSet.getString("applicationstatus")); + expenseBillReportData.setPaidDate(resultSet.getLong("paiddate")); + if(resultSet.getString("filestoreid")!=null) + expenseBillReportData.setFilestoreid("Yes"); + else + expenseBillReportData.setFilestoreid("No"); + if(Objects.equals(resultSet.getString("applicationstatus"), "CANCELLED")) { + expenseBillReportData.setLastModifiedTime(resultSet.getLong("lastmodifiedtime")); + expenseBillReportData.setLastModifiedBy(resultSet.getString("lastmodifiedbyUuid")); + enrichExpenseHolderDetails(expenseBillReportData); + } + expenseBillReportDataList.add(expenseBillReportData); + } + +// if() +// { +// enrichExpenseHolderDetails(expenseBillReportDataList); +// } + return expenseBillReportDataList; + } + + private void enrichExpenseHolderDetails(ExpenseBillReportData expenseBillReportData) + { +// Set lastModifiedByUuid =new HashSet<>(); +// +// for(ExpenseBillReportData expenseBillReportData:expenseBillReportData) +// { +// lastModifiedByUuid.add(expenseBillReportData.getLastModifiedBy()); +// } + + UserSearchRequest userSearchRequest=new UserSearchRequest(); + userSearchRequest.setUuid(Collections.singletonList(expenseBillReportData.getLastModifiedByUuid())); + log.info(userSearchRequest.getUuid().toString()); + + UserDetailResponse userDetailResponse=userService.getUsers(userSearchRequest); + log.info(userDetailResponse.getUser().toString()); + + enrichConnectionHolderInfo(userDetailResponse,expenseBillReportData); + } + + private void enrichConnectionHolderInfo(UserDetailResponse userDetailResponse, ExpenseBillReportData expenseBillReportData) + { + User connectionHolderInfos= (User) userDetailResponse.getUser(); + log.info(connectionHolderInfos.toString()); + expenseBillReportData.setLastModifiedBy(connectionHolderInfos.getName()); + } +} diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/ChallanService.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/ChallanService.java index 21571c941..f6f1fb20f 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/ChallanService.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/ChallanService.java @@ -7,6 +7,7 @@ import java.time.Month; import java.time.YearMonth; import java.time.ZoneId; +import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; import java.util.*; @@ -27,6 +28,7 @@ import org.egov.echallan.util.CommonUtils; import org.egov.echallan.validator.ChallanValidator; import org.egov.echallan.web.models.ChallanCollectionData; +import org.egov.echallan.web.models.ExpenseBillReportData; import org.egov.echallan.web.models.ExpenseDashboard; import org.egov.echallan.web.models.user.UserDetailResponse; import org.springframework.beans.factory.annotation.Autowired; @@ -377,5 +379,17 @@ public List getChallansWithOwnerInfoForPlaneSearch(SearchCriteria crite challans = enrichmentService.enrichChallanSearch(challans,criteria,requestInfo); return challans; } - + + public List expenseBillReport(RequestInfo requestInfo, String monthstartDate, String tenantId, Integer offset, Integer limit) + { + DateTimeFormatter dtf=DateTimeFormatter.ofPattern("dd/MM/yyyy"); + LocalDate startDate=LocalDate.parse(monthstartDate,dtf); + + Long monthStartDateTime=LocalDateTime.of(startDate.getYear(),startDate.getMonth(),startDate.getDayOfMonth(), + 0,0,0).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + + List expenseBillReport=repository.getExpenseBillReport(monthStartDateTime,tenantId,offset,limit); + return expenseBillReport; + + } } diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/UserService.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/UserService.java index 74531e838..9950f3710 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/UserService.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/UserService.java @@ -253,5 +253,11 @@ public UserDetailResponse getUserById(RequestInfo requestInfo, String tenantId, StringBuilder uri = new StringBuilder(userHost).append(userSearchEndpoint); return userCall(userSearchRequest, uri); } - + + public UserDetailResponse getUsers(UserSearchRequest userSearchRequest) + { + StringBuilder uri = new StringBuilder(userHost).append(userSearchEndpoint); + UserDetailResponse userDetailResponse = userCall(userSearchRequest, uri); + return userDetailResponse; + } } diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/controllers/ChallanController.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/controllers/ChallanController.java index d18fb102f..c9a6f28cc 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/controllers/ChallanController.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/controllers/ChallanController.java @@ -20,19 +20,11 @@ import org.egov.echallan.service.ChallanService; import org.egov.echallan.service.SchedulerService; import org.egov.echallan.util.ResponseInfoFactory; -import org.egov.echallan.web.models.ChallanCollectionData; -import org.egov.echallan.web.models.ChallanCollectionDataResponse; -import org.egov.echallan.web.models.ExpenseDashboard; -import org.egov.echallan.web.models.ExpenseDashboardResponse; +import org.egov.echallan.web.models.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; @RestController @@ -171,5 +163,20 @@ public ResponseEntity updateCreateoPayment(@Valid @RequestBody return new ResponseEntity<>(response, HttpStatus.OK); } + @PostMapping("/_expenseBillReport") + public ResponseEntity expenseBillReport(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper, + @RequestParam("monthstartDate") String monthstartDate, + @RequestParam("tenantId") String tenantId, + @RequestParam("offset") Integer offset, + @RequestParam("limit") Integer limit) + { + List expenseBillReport=challanService.expenseBillReport(requestInfoWrapper.getRequestInfo(),monthstartDate,tenantId,offset,limit); + ExpenseBillReportResponse expenseBillReportResponse= + ExpenseBillReportResponse.builder().ExpenseBillReportData(expenseBillReport) + .responseInfo(responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), + true)) + .build(); + return new ResponseEntity<>(expenseBillReportResponse,HttpStatus.OK); + } } diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/models/ExpenseBillReportData.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/models/ExpenseBillReportData.java new file mode 100644 index 000000000..28777db1e --- /dev/null +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/models/ExpenseBillReportData.java @@ -0,0 +1,56 @@ +package org.egov.echallan.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.egov.echallan.model.Amount; +import org.hibernate.validator.constraints.SafeHtml; + +import java.util.List; + +@Builder +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class ExpenseBillReportData +{ + @JsonProperty("typeOfExpense") + private String typeOfExpense; + + @JsonProperty("vendorName") + private String vendorName; + + @JsonProperty("amount") + private List amount; + + @JsonProperty("billDate") + private Long billDate; + + @JsonProperty("taxPeriodFrom") + private Long taxPeriodFrom; + + @JsonProperty("taxPeriodTo") + private Long taxPeriodTo; + + @JsonProperty("applicationStatus") + private String applicationStatus; + + @JsonProperty("paidDate") + private Long paidDate; + + @JsonProperty("filestoreid") + @SafeHtml + private String filestoreid; + + @JsonProperty("lastModifiedTime") + private Long lastModifiedTime; + + @JsonProperty("lastModifiedByUuid") + private String lastModifiedByUuid; + + @JsonProperty("lastModifiedBy") + private String lastModifiedBy; + + @JsonProperty("tenantId") + private String tenantId; +} diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/models/ExpenseBillReportResponse.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/models/ExpenseBillReportResponse.java new file mode 100644 index 000000000..0d1a90711 --- /dev/null +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/models/ExpenseBillReportResponse.java @@ -0,0 +1,20 @@ +package org.egov.echallan.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import org.apache.coyote.RequestInfo; +import org.egov.common.contract.response.ResponseInfo; + +import java.util.List; + + +@Builder +public class ExpenseBillReportResponse { + + @JsonProperty("ExpenseBillReportData") + private List ExpenseBillReportData; + + @JsonProperty("responseInfo") + private ResponseInfo responseInfo = null; + +} From 7a84f718f742d18316ec1f03a036cfee829b9fe3 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 5 Jan 2024 11:49:40 +0530 Subject: [PATCH 02/20] PFM-4082 Echallan report --- .../repository/rowmapper/ExpenseBillReportRowMapper.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java index a4a96cce1..943e343de 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java @@ -42,7 +42,10 @@ public List extractData(ResultSet resultSet) throws SQLEx expenseBillReportData.setTaxPeriodFrom(resultSet.getLong("taxperiodfrom")); expenseBillReportData.setTaxPeriodTo(resultSet.getLong("taxperiodto")); expenseBillReportData.setApplicationStatus(resultSet.getString("applicationstatus")); + if(resultSet.getString("paiddate")!=null) expenseBillReportData.setPaidDate(resultSet.getLong("paiddate")); + else + expenseBillReportData.setPaidDate(0L); if(resultSet.getString("filestoreid")!=null) expenseBillReportData.setFilestoreid("Yes"); else From af3b4be0f76f10e1df6195be7bc1030e293d7448 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 5 Jan 2024 12:29:45 +0530 Subject: [PATCH 03/20] PFM-4082 Echallan report --- .../repository/rowmapper/ExpenseBillReportRowMapper.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java index 943e343de..90dd67deb 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java @@ -55,6 +55,11 @@ public List extractData(ResultSet resultSet) throws SQLEx expenseBillReportData.setLastModifiedBy(resultSet.getString("lastmodifiedbyUuid")); enrichExpenseHolderDetails(expenseBillReportData); } + else + { + expenseBillReportData.setLastModifiedTime(0L); + expenseBillReportData.setLastModifiedBy(null); + } expenseBillReportDataList.add(expenseBillReportData); } From 85314ac53fa24a5ee5015b22c106b85e75d6dd5d Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 5 Jan 2024 12:44:16 +0530 Subject: [PATCH 04/20] PFM-4082 Echallan report --- .../repository/rowmapper/ExpenseBillReportRowMapper.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java index 90dd67deb..bd61fec66 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java @@ -42,8 +42,11 @@ public List extractData(ResultSet resultSet) throws SQLEx expenseBillReportData.setTaxPeriodFrom(resultSet.getLong("taxperiodfrom")); expenseBillReportData.setTaxPeriodTo(resultSet.getLong("taxperiodto")); expenseBillReportData.setApplicationStatus(resultSet.getString("applicationstatus")); + + log.info("Before if condition"); + if(resultSet.getString("paiddate")!=null) - expenseBillReportData.setPaidDate(resultSet.getLong("paiddate")); + expenseBillReportData.setPaidDate(resultSet.getLong("paiddate")); else expenseBillReportData.setPaidDate(0L); if(resultSet.getString("filestoreid")!=null) @@ -60,6 +63,7 @@ public List extractData(ResultSet resultSet) throws SQLEx expenseBillReportData.setLastModifiedTime(0L); expenseBillReportData.setLastModifiedBy(null); } + log.info("after if condition"); expenseBillReportDataList.add(expenseBillReportData); } @@ -67,6 +71,7 @@ public List extractData(ResultSet resultSet) throws SQLEx // { // enrichExpenseHolderDetails(expenseBillReportDataList); // } + log.info("Before return"); return expenseBillReportDataList; } From 00d4159bcac4b6fa84ec550323816eb5168bd931 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 5 Jan 2024 13:00:12 +0530 Subject: [PATCH 05/20] PFM-4082 Echallan report --- .../java/org/egov/echallan/repository/ChallanRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java index c1e417ca9..77e718ea3 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java @@ -518,7 +518,7 @@ public List getExpenseBillReport(Long monthStartDateTime, } log.info("Query of expense bill report " +expenseBillQuery.toString()+" prepared statement "+preparedStatement); - + List expenseBillReportData=new ArrayList<>(); List expenseBillReportDataList=jdbcTemplate.query(expenseBillQuery.toString(), preparedStatement.toArray(),expenseBillReportRowMapper); return expenseBillReportDataList; } From 5cb49d50b289d9bdc388bafc07c9c2ca25779152 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 5 Jan 2024 14:48:48 +0530 Subject: [PATCH 06/20] PFM-4082 Echallan report --- .../java/org/egov/echallan/repository/ChallanRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java index 77e718ea3..9e93fbed4 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java @@ -518,8 +518,8 @@ public List getExpenseBillReport(Long monthStartDateTime, } log.info("Query of expense bill report " +expenseBillQuery.toString()+" prepared statement "+preparedStatement); - List expenseBillReportData=new ArrayList<>(); - List expenseBillReportDataList=jdbcTemplate.query(expenseBillQuery.toString(), preparedStatement.toArray(),expenseBillReportRowMapper); + List expenseBillReportDataList=new ArrayList<>(); + expenseBillReportDataList=jdbcTemplate.query(expenseBillQuery.toString(), preparedStatement.toArray(),expenseBillReportRowMapper); return expenseBillReportDataList; } } From 248ea2c3002300fa23ed69515e8fb5bc25b1266c Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 5 Jan 2024 15:04:40 +0530 Subject: [PATCH 07/20] PFM-4082 --- .../java/org/egov/echallan/repository/ChallanRepository.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java index 9e93fbed4..f6910e666 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java @@ -83,13 +83,14 @@ public class ChallanRepository { private ObjectMapper mapper; @Autowired public ChallanRepository(Producer producer, ChallanConfiguration config,ChallanQueryBuilder queryBuilder, - JdbcTemplate jdbcTemplate,ChallanRowMapper rowMapper,RestTemplate restTemplate) { + JdbcTemplate jdbcTemplate,ChallanRowMapper rowMapper,RestTemplate restTemplate, ExpenseBillReportRowMapper expenseBillReportRowMapper) { this.producer = producer; this.config = config; this.jdbcTemplate = jdbcTemplate; this.queryBuilder = queryBuilder ; this.rowMapper = rowMapper; this.restTemplate = restTemplate; + this.expenseBillReportRowMapper = expenseBillReportRowMapper; } From 0953ac72e60966658b3275ba8e42fe3aa9a44444 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 5 Jan 2024 15:25:58 +0530 Subject: [PATCH 08/20] PFM-4082 Echallan report --- .../egov/echallan/repository/builder/ChallanQueryBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java index a33e77d83..cfb850382 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java @@ -87,7 +87,7 @@ public ChallanQueryBuilder(ChallanConfiguration config) { public static final String EXPENSEBILLQUERY="SELECT challan.typeofexpense,vendor.name,challan.billdate," + " challan.taxperiodfrom,challan.taxperiodto,challan.applicationstatus,challan.paiddate," + - " challan.filestoreid,challan.lastmodifiedtime,challan.lastmodifiedby from " + + " challan.filestoreid,challan.lastmodifiedtime,challan.lastmodifiedby as lastmodifiedbyUuid from " + " eg_echallan challan LEFT JOIN eg_vendor vendor on challan.vendor=vendor.id " + " where challan.tenantid=? and vendor.status='ACTIVE' and " + " challan.taxperiodfrom >=? order by challan.taxperiodfrom desc "; From f046be913f23bc557f6d81835f194772d636f86d Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 5 Jan 2024 16:25:45 +0530 Subject: [PATCH 09/20] PFM-4082 echallan report --- .../repository/rowmapper/ExpenseBillReportRowMapper.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java index bd61fec66..3ac18c7b9 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; +import org.egov.echallan.model.UserInfo; import org.egov.echallan.service.UserService; import org.egov.echallan.web.models.ExpenseBillReportData; import org.egov.echallan.web.models.ExpenseBillReportResponse; @@ -96,8 +97,9 @@ private void enrichExpenseHolderDetails(ExpenseBillReportData expenseBillReportD private void enrichConnectionHolderInfo(UserDetailResponse userDetailResponse, ExpenseBillReportData expenseBillReportData) { - User connectionHolderInfos= (User) userDetailResponse.getUser(); + List connectionHolderInfos= userDetailResponse.getUser(); +// Map log.info(connectionHolderInfos.toString()); - expenseBillReportData.setLastModifiedBy(connectionHolderInfos.getName()); + expenseBillReportData.setLastModifiedBy(connectionHolderInfos.get(0).getUserName()); } } From fa100e437122f05fd5400cebea8bba2f1b20ecd8 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Fri, 5 Jan 2024 17:54:37 +0530 Subject: [PATCH 10/20] PFM-4082 echallan report --- .../rowmapper/ExpenseBillReportRowMapper.java | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java index 3ac18c7b9..7f5d779fa 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java @@ -56,7 +56,7 @@ public List extractData(ResultSet resultSet) throws SQLEx expenseBillReportData.setFilestoreid("No"); if(Objects.equals(resultSet.getString("applicationstatus"), "CANCELLED")) { expenseBillReportData.setLastModifiedTime(resultSet.getLong("lastmodifiedtime")); - expenseBillReportData.setLastModifiedBy(resultSet.getString("lastmodifiedbyUuid")); + expenseBillReportData.setLastModifiedByUuid(resultSet.getString("lastmodifiedbyUuid")); enrichExpenseHolderDetails(expenseBillReportData); } else @@ -68,29 +68,18 @@ public List extractData(ResultSet resultSet) throws SQLEx expenseBillReportDataList.add(expenseBillReportData); } -// if() -// { -// enrichExpenseHolderDetails(expenseBillReportDataList); -// } log.info("Before return"); return expenseBillReportDataList; } private void enrichExpenseHolderDetails(ExpenseBillReportData expenseBillReportData) { -// Set lastModifiedByUuid =new HashSet<>(); -// -// for(ExpenseBillReportData expenseBillReportData:expenseBillReportData) -// { -// lastModifiedByUuid.add(expenseBillReportData.getLastModifiedBy()); -// } - UserSearchRequest userSearchRequest=new UserSearchRequest(); userSearchRequest.setUuid(Collections.singletonList(expenseBillReportData.getLastModifiedByUuid())); - log.info(userSearchRequest.getUuid().toString()); + log.info("Uuid's for searching users"+userSearchRequest.getUuid().toString()); UserDetailResponse userDetailResponse=userService.getUsers(userSearchRequest); - log.info(userDetailResponse.getUser().toString()); + log.info("User after searching"+userDetailResponse.getUser().toString()); enrichConnectionHolderInfo(userDetailResponse,expenseBillReportData); } @@ -98,8 +87,10 @@ private void enrichExpenseHolderDetails(ExpenseBillReportData expenseBillReportD private void enrichConnectionHolderInfo(UserDetailResponse userDetailResponse, ExpenseBillReportData expenseBillReportData) { List connectionHolderInfos= userDetailResponse.getUser(); -// Map - log.info(connectionHolderInfos.toString()); + if (connectionHolderInfos.isEmpty()) { + return; + } + log.info("Users in enrichConnectionHolderInfo method"+connectionHolderInfos.toString()); expenseBillReportData.setLastModifiedBy(connectionHolderInfos.get(0).getUserName()); } } From 6f5cb5808bcfd7a4a59928937b7517ec7d84cbae Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Mon, 8 Jan 2024 22:39:14 +0530 Subject: [PATCH 11/20] PFM-4082 echallan report --- .../builder/ChallanQueryBuilder.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java index cfb850382..22978582a 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java @@ -85,12 +85,18 @@ public ChallanQueryBuilder(ChallanConfiguration config) { public static final String PENDINGEXPCOLLTILLDATE = "SELECT coalesce(SUM(DMDL.TAXAMOUNT - DMDL.COLLECTIONAMOUNT),0) FROM EGBS_DEMAND_V1 DMD INNER JOIN EGBS_DEMANDDETAIL_V1 DMDL ON DMD.ID=DMDL.DEMANDID AND DMD.TENANTID=DMDL.TENANTID INNER JOIN EG_ECHALLAN CH ON CH.referenceId=DMD.CONSUMERCODE AND DMD.TENANTID=CH.TENANTID WHERE DMD.BUSINESSSERVICE LIKE '%EXPENSE%' and DMD.status='ACTIVE' "; - public static final String EXPENSEBILLQUERY="SELECT challan.typeofexpense,vendor.name,challan.billdate," + - " challan.taxperiodfrom,challan.taxperiodto,challan.applicationstatus,challan.paiddate," + - " challan.filestoreid,challan.lastmodifiedtime,challan.lastmodifiedby as lastmodifiedbyUuid from " + - " eg_echallan challan LEFT JOIN eg_vendor vendor on challan.vendor=vendor.id " + - " where challan.tenantid=? and vendor.status='ACTIVE' and " + - " challan.taxperiodfrom >=? order by challan.taxperiodfrom desc "; + public static final String EXPENSEBILLQUERY="SELECT challan.typeofexpense,vendor.name,challan.billdate, " + + " challan.taxperiodfrom,challan.taxperiodto,challan.applicationstatus, " + + " challan.paiddate,challan.filestoreid,challan.lastmodifiedtime, " + + " challan.lastmodifiedby as lastmodifiedbyUuid,SUM(dd.taxamount) as total_taxamount " + + " FROM eg_echallan challan LEFT JOIN eg_vendor vendor ON challan.vendor = vendor.id " + + " LEFT JOIN egbs_demand_v1 d ON challan.challanno = d.consumercode " + + " LEFT JOIN egbs_demanddetail_v1 dd ON d.id = dd.demandid WHERE " + + " challan.tenantid = ? AND dd.tenantid = 'pb.aulakh' " + + " AND vendor.status = 'ACTIVE' AND challan.taxperiodfrom >= ? " + + " GROUP BY challan.typeofexpense,vendor.name,challan.billdate,challan.taxperiodfrom, " + + " challan.taxperiodto,challan.applicationstatus,challan.paiddate,challan.filestoreid, " + + " challan.lastmodifiedtime,challan.lastmodifiedby ORDER BY challan.taxperiodfrom DESC; "; public String getChallanSearchQuery(SearchCriteria criteria, List preparedStmtList) { From d5da256adbae1081d5bfb8a7b9482b5766275148 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 9 Jan 2024 13:41:36 +0530 Subject: [PATCH 12/20] PFM-4082 echallan report --- .../repository/rowmapper/ExpenseBillReportRowMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java index 7f5d779fa..588a0b305 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java @@ -91,6 +91,6 @@ private void enrichConnectionHolderInfo(UserDetailResponse userDetailResponse, E return; } log.info("Users in enrichConnectionHolderInfo method"+connectionHolderInfos.toString()); - expenseBillReportData.setLastModifiedBy(connectionHolderInfos.get(0).getUserName()); + expenseBillReportData.setLastModifiedBy(connectionHolderInfos.get(0).getName()); } } From 3c8e40bcee5458ad2482275f87588ea38341c3c0 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 9 Jan 2024 13:43:15 +0530 Subject: [PATCH 13/20] PFM-4082 echallan report --- .../egov/echallan/repository/builder/ChallanQueryBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java index 22978582a..6f47d406e 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java @@ -92,7 +92,7 @@ public ChallanQueryBuilder(ChallanConfiguration config) { " FROM eg_echallan challan LEFT JOIN eg_vendor vendor ON challan.vendor = vendor.id " + " LEFT JOIN egbs_demand_v1 d ON challan.challanno = d.consumercode " + " LEFT JOIN egbs_demanddetail_v1 dd ON d.id = dd.demandid WHERE " + - " challan.tenantid = ? AND dd.tenantid = 'pb.aulakh' " + + " challan.tenantid = ? AND dd.tenantid = ? " + " AND vendor.status = 'ACTIVE' AND challan.taxperiodfrom >= ? " + " GROUP BY challan.typeofexpense,vendor.name,challan.billdate,challan.taxperiodfrom, " + " challan.taxperiodto,challan.applicationstatus,challan.paiddate,challan.filestoreid, " + From ed227aedc3dddb60fd649b6c1facc451eb952d3f Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 9 Jan 2024 13:44:20 +0530 Subject: [PATCH 14/20] PFM-4082 echallan report --- .../java/org/egov/echallan/repository/ChallanRepository.java | 1 + 1 file changed, 1 insertion(+) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java index f6910e666..e1896111f 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java @@ -496,6 +496,7 @@ public List getExpenseBillReport(Long monthStartDateTime, List preparedStatement=new ArrayList<>(); preparedStatement.add(tenantId); + preparedStatement.add(tenantId); preparedStatement.add(monthStartDateTime); Integer newLimit=config.getDefaultLimit(); From 6a058a7980b1c81911dc9a209a779a769d421f3c Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 9 Jan 2024 14:25:32 +0530 Subject: [PATCH 15/20] PFM-4082 echallan report --- .../egov/echallan/repository/builder/ChallanQueryBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java index 6f47d406e..2c107080c 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java @@ -96,7 +96,7 @@ public ChallanQueryBuilder(ChallanConfiguration config) { " AND vendor.status = 'ACTIVE' AND challan.taxperiodfrom >= ? " + " GROUP BY challan.typeofexpense,vendor.name,challan.billdate,challan.taxperiodfrom, " + " challan.taxperiodto,challan.applicationstatus,challan.paiddate,challan.filestoreid, " + - " challan.lastmodifiedtime,challan.lastmodifiedby ORDER BY challan.taxperiodfrom DESC; "; + " challan.lastmodifiedtime,challan.lastmodifiedby ORDER BY challan.taxperiodfrom DESC "; public String getChallanSearchQuery(SearchCriteria criteria, List preparedStmtList) { From c220fd3f992cef35ad2efe76b21861448631b363 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 9 Jan 2024 14:46:07 +0530 Subject: [PATCH 16/20] PFM-4082 echallan report --- .../org/egov/echallan/web/models/ExpenseBillReportData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/models/ExpenseBillReportData.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/models/ExpenseBillReportData.java index 28777db1e..321a451a9 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/models/ExpenseBillReportData.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/models/ExpenseBillReportData.java @@ -21,7 +21,7 @@ public class ExpenseBillReportData private String vendorName; @JsonProperty("amount") - private List amount; + private Long amount; @JsonProperty("billDate") private Long billDate; From 8237b2e1198b8a0ff3c9adeebb65798a1307d694 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 9 Jan 2024 14:47:07 +0530 Subject: [PATCH 17/20] PFM-4082 echallan report --- .../repository/rowmapper/ExpenseBillReportRowMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java index 588a0b305..c66833b30 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java @@ -38,7 +38,7 @@ public List extractData(ResultSet resultSet) throws SQLEx ExpenseBillReportData expenseBillReportData=new ExpenseBillReportData(); expenseBillReportData.setTypeOfExpense(resultSet.getString("typeofexpense")); expenseBillReportData.setVendorName(resultSet.getString("name")); -// expenseBillReportData.setAmount(resultSet.getString("")); + expenseBillReportData.setAmount(resultSet.getLong("total_taxamount")); expenseBillReportData.setBillDate(resultSet.getLong("billdate")); expenseBillReportData.setTaxPeriodFrom(resultSet.getLong("taxperiodfrom")); expenseBillReportData.setTaxPeriodTo(resultSet.getLong("taxperiodto")); From d2425bb6fce46fc86d3a3a279d3c5b4e215330e8 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Tue, 9 Jan 2024 17:22:05 +0530 Subject: [PATCH 18/20] PFM-4082 echallan report --- .../repository/rowmapper/ExpenseBillReportRowMapper.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java index c66833b30..127dbad55 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/rowmapper/ExpenseBillReportRowMapper.java @@ -44,8 +44,6 @@ public List extractData(ResultSet resultSet) throws SQLEx expenseBillReportData.setTaxPeriodTo(resultSet.getLong("taxperiodto")); expenseBillReportData.setApplicationStatus(resultSet.getString("applicationstatus")); - log.info("Before if condition"); - if(resultSet.getString("paiddate")!=null) expenseBillReportData.setPaidDate(resultSet.getLong("paiddate")); else @@ -64,11 +62,8 @@ public List extractData(ResultSet resultSet) throws SQLEx expenseBillReportData.setLastModifiedTime(0L); expenseBillReportData.setLastModifiedBy(null); } - log.info("after if condition"); expenseBillReportDataList.add(expenseBillReportData); } - - log.info("Before return"); return expenseBillReportDataList; } From 36fd139be53a834895c95270fd31378327f4b721 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 10 Jan 2024 12:08:47 +0530 Subject: [PATCH 19/20] PFM-4082 echallan report --- .../egov/echallan/repository/ChallanRepository.java | 3 ++- .../repository/builder/ChallanQueryBuilder.java | 2 +- .../org/egov/echallan/service/ChallanService.java | 12 +++++------- .../echallan/web/controllers/ChallanController.java | 3 ++- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java index e1896111f..049eb49d6 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/ChallanRepository.java @@ -490,7 +490,7 @@ public List fetchESIds(SearchCriteria criteria) { return ids; } - public List getExpenseBillReport(Long monthStartDateTime, String tenantId, Integer offset, Integer limit) + public List getExpenseBillReport(Long monthStartDateTime, Long monthEndDateTime, String tenantId, Integer offset, Integer limit) { StringBuilder expenseBillQuery =new StringBuilder(queryBuilder.EXPENSEBILLQUERY); @@ -498,6 +498,7 @@ public List getExpenseBillReport(Long monthStartDateTime, preparedStatement.add(tenantId); preparedStatement.add(tenantId); preparedStatement.add(monthStartDateTime); + preparedStatement.add(monthEndDateTime); Integer newLimit=config.getDefaultLimit(); Integer newOffset=config.getDefaultOffset(); diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java index 2c107080c..b2b809253 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java @@ -93,7 +93,7 @@ public ChallanQueryBuilder(ChallanConfiguration config) { " LEFT JOIN egbs_demand_v1 d ON challan.challanno = d.consumercode " + " LEFT JOIN egbs_demanddetail_v1 dd ON d.id = dd.demandid WHERE " + " challan.tenantid = ? AND dd.tenantid = ? " + - " AND vendor.status = 'ACTIVE' AND challan.taxperiodfrom >= ? " + + " AND challan.createdtime >= ? AND challan.createdtime <= ?" + " GROUP BY challan.typeofexpense,vendor.name,challan.billdate,challan.taxperiodfrom, " + " challan.taxperiodto,challan.applicationstatus,challan.paiddate,challan.filestoreid, " + " challan.lastmodifiedtime,challan.lastmodifiedby ORDER BY challan.taxperiodfrom DESC "; diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/ChallanService.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/ChallanService.java index f6f1fb20f..a40c8f662 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/ChallanService.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/service/ChallanService.java @@ -2,11 +2,7 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.Month; -import java.time.YearMonth; -import java.time.ZoneId; +import java.time.*; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; import java.util.*; @@ -380,15 +376,17 @@ public List getChallansWithOwnerInfoForPlaneSearch(SearchCriteria crite return challans; } - public List expenseBillReport(RequestInfo requestInfo, String monthstartDate, String tenantId, Integer offset, Integer limit) + public List expenseBillReport(RequestInfo requestInfo, String monthstartDate,String monthendDate, String tenantId, Integer offset, Integer limit) { DateTimeFormatter dtf=DateTimeFormatter.ofPattern("dd/MM/yyyy"); LocalDate startDate=LocalDate.parse(monthstartDate,dtf); + LocalDate endDate=LocalDate.parse(monthendDate,dtf); Long monthStartDateTime=LocalDateTime.of(startDate.getYear(),startDate.getMonth(),startDate.getDayOfMonth(), 0,0,0).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + Long monthEndDateTime=LocalDateTime.of(endDate, LocalTime.MAX).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); - List expenseBillReport=repository.getExpenseBillReport(monthStartDateTime,tenantId,offset,limit); + List expenseBillReport=repository.getExpenseBillReport(monthStartDateTime,monthEndDateTime,tenantId,offset,limit); return expenseBillReport; } diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/controllers/ChallanController.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/controllers/ChallanController.java index c9a6f28cc..33471c13a 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/controllers/ChallanController.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/web/controllers/ChallanController.java @@ -166,11 +166,12 @@ public ResponseEntity updateCreateoPayment(@Valid @RequestBody @PostMapping("/_expenseBillReport") public ResponseEntity expenseBillReport(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper, @RequestParam("monthstartDate") String monthstartDate, + @RequestParam("monthendDate") String monthendDate, @RequestParam("tenantId") String tenantId, @RequestParam("offset") Integer offset, @RequestParam("limit") Integer limit) { - List expenseBillReport=challanService.expenseBillReport(requestInfoWrapper.getRequestInfo(),monthstartDate,tenantId,offset,limit); + List expenseBillReport=challanService.expenseBillReport(requestInfoWrapper.getRequestInfo(),monthstartDate,monthendDate,tenantId,offset,limit); ExpenseBillReportResponse expenseBillReportResponse= ExpenseBillReportResponse.builder().ExpenseBillReportData(expenseBillReport) .responseInfo(responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), From 0feeffb1532b12059f1a265aab18b729a470ed33 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 10 Jan 2024 12:59:02 +0530 Subject: [PATCH 20/20] PFM-4082 echallan report --- .../egov/echallan/repository/builder/ChallanQueryBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java index b2b809253..5b7e2ddc1 100644 --- a/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java +++ b/municipal-services/echallan-services/src/main/java/org/egov/echallan/repository/builder/ChallanQueryBuilder.java @@ -96,7 +96,7 @@ public ChallanQueryBuilder(ChallanConfiguration config) { " AND challan.createdtime >= ? AND challan.createdtime <= ?" + " GROUP BY challan.typeofexpense,vendor.name,challan.billdate,challan.taxperiodfrom, " + " challan.taxperiodto,challan.applicationstatus,challan.paiddate,challan.filestoreid, " + - " challan.lastmodifiedtime,challan.lastmodifiedby ORDER BY challan.taxperiodfrom DESC "; + " challan.lastmodifiedtime,challan.lastmodifiedby ORDER BY challan.createdtime DESC "; public String getChallanSearchQuery(SearchCriteria criteria, List preparedStmtList) {