From ca460ab025268b7c1106306b4bfa65678d85c525 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 3 Jul 2024 14:08:29 +0530 Subject: [PATCH 1/8] ISTE-224 created API for showing consumer whose demand has not been generated --- .../repository/WaterDaoImpl.java | 17 +++++++++++++ .../repository/builder/WsQueryBuilder.java | 7 ++++++ .../DemandNotGeneratedRowMapper.java | 25 +++++++++++++++++++ .../waterconnection/service/WaterService.java | 1 + .../service/WaterServiceImpl.java | 7 ++++++ .../web/controller/WaterController.java | 10 ++++++++ .../models/ConsumersDemandNotGenerated.java | 13 ++++++++++ .../ConsumersDemandNotGeneratedResponse.java | 16 ++++++++++++ 8 files changed, 96 insertions(+) create mode 100644 municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/DemandNotGeneratedRowMapper.java create mode 100644 municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/ConsumersDemandNotGenerated.java create mode 100644 municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/ConsumersDemandNotGeneratedResponse.java diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java index c95a6aa18..af218d64c 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java @@ -49,6 +49,9 @@ @Repository public class WaterDaoImpl implements WaterDao { + @Autowired + private DemandNotGeneratedRowMapper demandNotGeneratedRowMapper; + @Autowired private InactiveConsumerReportRowMapper inactiveConsumerReportRowMapper; @Autowired @@ -665,4 +668,18 @@ public List getInactiveConsumerReport(Long monthStar inactiveConsumerReportList=jdbcTemplate.query(inactive_consumer_query.toString(), preparedStatement.toArray(),inactiveConsumerReportRowMapper); return inactiveConsumerReportList; } + + public List getConsumersByPreviousMeterReading(String previousMeterReading, String tenantId) + { + StringBuilder query=new StringBuilder(wsQueryBuilder.DEMAND_NOT_GENERATED_QUERY); + + List preparedStatement=new ArrayList<>(); + preparedStatement.add(tenantId); + preparedStatement.add(previousMeterReading); + preparedStatement.add(tenantId); + + log.info("Query for consumer demand not generated "+ query +" prepared statement "+ preparedStatement); + List consumersDemandNotGeneratedList=jdbcTemplate.query(query.toString(),preparedStatement.toArray(),demandNotGeneratedRowMapper); + return consumersDemandNotGeneratedList; + } } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java index 1a6c8d9e1..adcd78a38 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java @@ -168,6 +168,13 @@ public class WsQueryBuilder { + " connectionno IN (SELECT distinct connectionno FROM eg_ws_connection WHERE status='Inactive' AND" + " lastmodifiedtime >= ? AND lastmodifiedtime <= ? AND tenantid=?) " + " order by connectionno,lastmodifiedtime desc"; + + public static final String DEMAND_NOT_GENERATED_QUERY="select conn.connectionno as connectionno from eg_ws_connection conn " + + "INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id WHERE conn.status='Active' " + + "AND conn.tenantid=? and wc.connectiontype='Non_Metered' and conn.previousmeterreading=? and connectionno NOT IN " + + "(select distinct consumercode from egbs_demand_v1 d inner join egbs_demanddetail_v1 dd on dd.demandid = d.id " + + "where dd.taxheadcode='10101' and d.status ='ACTIVE' and d.businessservice='WS' and " + + "d.tenantid=?) order by connectionno;"; /** * diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/DemandNotGeneratedRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/DemandNotGeneratedRowMapper.java new file mode 100644 index 000000000..d0be07e7a --- /dev/null +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/DemandNotGeneratedRowMapper.java @@ -0,0 +1,25 @@ +package org.egov.waterconnection.repository.rowmapper; + + +import org.egov.waterconnection.web.models.ConsumersDemandNotGenerated; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class DemandNotGeneratedRowMapper implements ResultSetExtractor> { + @Override + public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { + List consumersDemandNotGeneratedList=new ArrayList<>(); + while(resultSet.next()) + { + ConsumersDemandNotGenerated consumersDemandNotGenerated=new ConsumersDemandNotGenerated(); + consumersDemandNotGenerated.setConsumerCode(resultSet.getString("connectionno")); + consumersDemandNotGeneratedList.add(consumersDemandNotGenerated); + } + return consumersDemandNotGeneratedList; + } +} diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java index 0c72cd1f8..21191e23b 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java @@ -53,4 +53,5 @@ List collectionReport(String paymentStartDate, String paym List inactiveConsumerReport(String monthStartDate,String monthEndDate,String tenantId, @Valid Integer offset, @Valid Integer limit, RequestInfo requestInfo); + List getConsumersWithDemandNotGenerated(String previousMeterReading, String tenantId,RequestInfo requestInfo); } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java index 704683d4b..e5d51eb87 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java @@ -842,4 +842,11 @@ public List inactiveConsumerReport(String monthStart List inactiveConsumerReport=waterDaoImpl.getInactiveConsumerReport(monthStartDateTime,mothEndDateTime,tenantId,offset,limit); return inactiveConsumerReport; } + + @Override + public List getConsumersWithDemandNotGenerated(String previousMeterReading, String tenantId ,RequestInfo requestInfo) + { + List list=waterDaoImpl.getConsumersByPreviousMeterReading(previousMeterReading,tenantId); + return list; + } } \ No newline at end of file diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java index cd462ba50..18bbdc204 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java @@ -235,4 +235,14 @@ public ResponseEntity countWCbyDe return new ResponseEntity<>(response, HttpStatus.OK); } + @PostMapping("/consumers/demand-not-generated") + public ResponseEntity getConsumersWithDemandNotGenerated(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper,@RequestParam(value="previousMeterReading") String previousMeterReading,@RequestParam (value="tenantId") String tenantId) + { + List list= waterService.getConsumersWithDemandNotGenerated(previousMeterReading,tenantId,requestInfoWrapper.getRequestInfo()); + ConsumersDemandNotGeneratedResponse response=ConsumersDemandNotGeneratedResponse.builder(). + consumersDemandNotGenerated(list).responseInfo(responseInfoFactory. + createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(),true)).build(); + return new ResponseEntity<>(response,HttpStatus.OK); + } + } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/ConsumersDemandNotGenerated.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/ConsumersDemandNotGenerated.java new file mode 100644 index 000000000..95c8e8e0b --- /dev/null +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/ConsumersDemandNotGenerated.java @@ -0,0 +1,13 @@ +package org.egov.waterconnection.web.models; + + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@AllArgsConstructor +@NoArgsConstructor +@Data +public class ConsumersDemandNotGenerated { + private String consumerCode; +} diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/ConsumersDemandNotGeneratedResponse.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/ConsumersDemandNotGeneratedResponse.java new file mode 100644 index 000000000..d58acc901 --- /dev/null +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/ConsumersDemandNotGeneratedResponse.java @@ -0,0 +1,16 @@ +package org.egov.waterconnection.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Builder; +import org.egov.common.contract.response.ResponseInfo; + +import java.util.List; + +@Builder +public class ConsumersDemandNotGeneratedResponse { + @JsonProperty("responseInfo") + private ResponseInfo responseInfo; + + @JsonProperty("ConsumersDemandNotGenerated") + private List consumersDemandNotGenerated; +} From 3b3fb8f01d89a9bc0246c0fa5b8468c7a9c886cb Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 3 Jul 2024 15:01:39 +0530 Subject: [PATCH 2/8] ISTE-224 --- .../repository/builder/WsQueryBuilder.java | 2 +- .../egov/waterconnection/service/WaterService.java | 2 +- .../waterconnection/service/WaterServiceImpl.java | 11 +++++++++-- .../web/controller/WaterController.java | 11 +++++------ 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java index adcd78a38..76ddf926c 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java @@ -171,7 +171,7 @@ public class WsQueryBuilder { public static final String DEMAND_NOT_GENERATED_QUERY="select conn.connectionno as connectionno from eg_ws_connection conn " + "INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id WHERE conn.status='Active' " + - "AND conn.tenantid=? and wc.connectiontype='Non_Metered' and conn.previousmeterreading=? and connectionno NOT IN " + + "AND conn.tenantid=? and wc.connectiontype='Non_Metered' and conn.previousreadingdate=? and connectionno NOT IN " + "(select distinct consumercode from egbs_demand_v1 d inner join egbs_demanddetail_v1 dd on dd.demandid = d.id " + "where dd.taxheadcode='10101' and d.status ='ACTIVE' and d.businessservice='WS' and " + "d.tenantid=?) order by connectionno;"; diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java index 21191e23b..e4c9ed73b 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterService.java @@ -53,5 +53,5 @@ List collectionReport(String paymentStartDate, String paym List inactiveConsumerReport(String monthStartDate,String monthEndDate,String tenantId, @Valid Integer offset, @Valid Integer limit, RequestInfo requestInfo); - List getConsumersWithDemandNotGenerated(String previousMeterReading, String tenantId,RequestInfo requestInfo); + WaterConnectionResponse getConsumersWithDemandNotGenerated(String previousMeterReading, String tenantId,RequestInfo requestInfo); } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java index e5d51eb87..19440a9ec 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java @@ -844,9 +844,16 @@ public List inactiveConsumerReport(String monthStart } @Override - public List getConsumersWithDemandNotGenerated(String previousMeterReading, String tenantId ,RequestInfo requestInfo) + public WaterConnectionResponse getConsumersWithDemandNotGenerated(String previousMeterReading, String tenantId ,RequestInfo requestInfo) { List list=waterDaoImpl.getConsumersByPreviousMeterReading(previousMeterReading,tenantId); - return list; + Set connectionNo=new HashSet<>(); + for(ConsumersDemandNotGenerated connection:list) + { + connectionNo.add(connection.getConsumerCode()); + } + SearchCriteria criteria=SearchCriteria.builder().connectionNoSet(connectionNo).tenantId(tenantId).build(); + return search(criteria,requestInfo); +// return list; } } \ No newline at end of file diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java index 18bbdc204..f4da10f1f 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/controller/WaterController.java @@ -236,13 +236,12 @@ public ResponseEntity countWCbyDe } @PostMapping("/consumers/demand-not-generated") - public ResponseEntity getConsumersWithDemandNotGenerated(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper,@RequestParam(value="previousMeterReading") String previousMeterReading,@RequestParam (value="tenantId") String tenantId) + public ResponseEntity getConsumersWithDemandNotGenerated(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper,@RequestParam(value="previousMeterReading") String previousMeterReading,@RequestParam (value="tenantId") String tenantId) { - List list= waterService.getConsumersWithDemandNotGenerated(previousMeterReading,tenantId,requestInfoWrapper.getRequestInfo()); - ConsumersDemandNotGeneratedResponse response=ConsumersDemandNotGeneratedResponse.builder(). - consumersDemandNotGenerated(list).responseInfo(responseInfoFactory. - createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(),true)).build(); - return new ResponseEntity<>(response,HttpStatus.OK); + WaterConnectionResponse response= waterService.getConsumersWithDemandNotGenerated(previousMeterReading,tenantId,requestInfoWrapper.getRequestInfo()); + response.setResponseInfo( + responseInfoFactory.createResponseInfoFromRequestInfo(requestInfoWrapper.getRequestInfo(), true)); + return new ResponseEntity<>(response, HttpStatus.OK); } } From 79fb4bc997343e3f08defa95c0a3b5ca3c3ee3eb Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 3 Jul 2024 15:24:41 +0530 Subject: [PATCH 3/8] ISTE-224 --- .../egov/waterconnection/repository/builder/WsQueryBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java index 76ddf926c..cb71ad45e 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/builder/WsQueryBuilder.java @@ -169,7 +169,7 @@ public class WsQueryBuilder { + " lastmodifiedtime >= ? AND lastmodifiedtime <= ? AND tenantid=?) " + " order by connectionno,lastmodifiedtime desc"; - public static final String DEMAND_NOT_GENERATED_QUERY="select conn.connectionno as connectionno from eg_ws_connection conn " + + public static final String DEMAND_NOT_GENERATED_QUERY="select distinct conn.connectionno as connectionno from eg_ws_connection conn " + "INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id WHERE conn.status='Active' " + "AND conn.tenantid=? and wc.connectiontype='Non_Metered' and conn.previousreadingdate=? and connectionno NOT IN " + "(select distinct consumercode from egbs_demand_v1 d inner join egbs_demanddetail_v1 dd on dd.demandid = d.id " + From 02bfe5218467d5679bbb9351eec532c82fb182bc Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 3 Jul 2024 15:52:00 +0530 Subject: [PATCH 4/8] ISTE-224 --- .../ConsumersDemandNotGeneratedResponse.java | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/ConsumersDemandNotGeneratedResponse.java diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/ConsumersDemandNotGeneratedResponse.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/ConsumersDemandNotGeneratedResponse.java deleted file mode 100644 index d58acc901..000000000 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/ConsumersDemandNotGeneratedResponse.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.egov.waterconnection.web.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Builder; -import org.egov.common.contract.response.ResponseInfo; - -import java.util.List; - -@Builder -public class ConsumersDemandNotGeneratedResponse { - @JsonProperty("responseInfo") - private ResponseInfo responseInfo; - - @JsonProperty("ConsumersDemandNotGenerated") - private List consumersDemandNotGenerated; -} From c2a82c34d9b71a246b3272b310ef3bf5e4e658e0 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 3 Jul 2024 16:10:33 +0530 Subject: [PATCH 5/8] ISTE-224 --- .../repository/rowmapper/DemandNotGeneratedRowMapper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/DemandNotGeneratedRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/DemandNotGeneratedRowMapper.java index d0be07e7a..d42e53595 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/DemandNotGeneratedRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/DemandNotGeneratedRowMapper.java @@ -1,15 +1,16 @@ package org.egov.waterconnection.repository.rowmapper; - import org.egov.waterconnection.web.models.ConsumersDemandNotGenerated; 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.ArrayList; import java.util.List; +@Component public class DemandNotGeneratedRowMapper implements ResultSetExtractor> { @Override public List extractData(ResultSet resultSet) throws SQLException, DataAccessException { From 426654fbc720e8d8aa45d8aaf3d048d3d30e1bd5 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 3 Jul 2024 16:23:36 +0530 Subject: [PATCH 6/8] ISTE-224 --- .../java/org/egov/waterconnection/service/WaterServiceImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java index 19440a9ec..6284af925 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java @@ -854,6 +854,5 @@ public WaterConnectionResponse getConsumersWithDemandNotGenerated(String previou } SearchCriteria criteria=SearchCriteria.builder().connectionNoSet(connectionNo).tenantId(tenantId).build(); return search(criteria,requestInfo); -// return list; } } \ No newline at end of file From 87d102de92acccbe987da77a952ea0fd8917b188 Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 3 Jul 2024 16:50:29 +0530 Subject: [PATCH 7/8] ISTE-224 --- .../org/egov/waterconnection/repository/WaterDaoImpl.java | 2 +- .../egov/waterconnection/service/WaterServiceImpl.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java index af218d64c..84f89fff7 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/WaterDaoImpl.java @@ -669,7 +669,7 @@ public List getInactiveConsumerReport(Long monthStar return inactiveConsumerReportList; } - public List getConsumersByPreviousMeterReading(String previousMeterReading, String tenantId) + public List getConsumersByPreviousMeterReading(Long previousMeterReading, String tenantId) { StringBuilder query=new StringBuilder(wsQueryBuilder.DEMAND_NOT_GENERATED_QUERY); diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java index 6284af925..7d164b34f 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java @@ -846,7 +846,13 @@ public List inactiveConsumerReport(String monthStart @Override public WaterConnectionResponse getConsumersWithDemandNotGenerated(String previousMeterReading, String tenantId ,RequestInfo requestInfo) { - List list=waterDaoImpl.getConsumersByPreviousMeterReading(previousMeterReading,tenantId); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy"); + LocalDate readingDate = LocalDate.parse(previousMeterReading, formatter); + + Long previousReadingEpoch = LocalDateTime.of(readingDate.getYear(), readingDate.getMonth(), readingDate.getDayOfMonth(), 0, 0, 0) + .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + + List list=waterDaoImpl.getConsumersByPreviousMeterReading(previousReadingEpoch,tenantId); Set connectionNo=new HashSet<>(); for(ConsumersDemandNotGenerated connection:list) { From e9f412ffb767fc71a5855a3e3d4f5869d2e9cc5b Mon Sep 17 00:00:00 2001 From: Saloni-eGov Date: Wed, 3 Jul 2024 17:31:41 +0530 Subject: [PATCH 8/8] ISTE-224 --- .../waterconnection/service/WaterServiceImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java index 7d164b34f..ba0803984 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/service/WaterServiceImpl.java @@ -846,11 +846,12 @@ public List inactiveConsumerReport(String monthStart @Override public WaterConnectionResponse getConsumersWithDemandNotGenerated(String previousMeterReading, String tenantId ,RequestInfo requestInfo) { - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy"); - LocalDate readingDate = LocalDate.parse(previousMeterReading, formatter); - - Long previousReadingEpoch = LocalDateTime.of(readingDate.getYear(), readingDate.getMonth(), readingDate.getDayOfMonth(), 0, 0, 0) - .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + Long previousReadingEpoch; + try { + previousReadingEpoch = Long.parseLong(previousMeterReading); + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Invalid format for previousMeterReading. Expected a timestamp in milliseconds.", e); + } List list=waterDaoImpl.getConsumersByPreviousMeterReading(previousReadingEpoch,tenantId); Set connectionNo=new HashSet<>();