From 0bd460fec0cefa4ade5ef08d7440e9a44813b455 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Mon, 22 Jan 2024 17:54:36 +0530 Subject: [PATCH 01/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../repository/WaterDaoImpl.java | 39 +++++++++++++++++-- .../repository/builder/WsQueryBuilder.java | 27 +++++++++++++ .../rowmapper/WcbyDemandRowMapper.java | 27 +++++++++++++ .../waterconnection/service/WaterService.java | 5 +-- .../service/WaterServiceImpl.java | 7 ++++ .../web/controller/WaterController.java | 7 +++- ...WaterConnectionByDemandGenerationDate.java | 16 ++++++++ ...nectionByDemandGenerationDateResponse.java | 16 ++++++++ .../target/classes/application.properties | 14 ++++++- 9 files changed, 149 insertions(+), 9 deletions(-) create mode 100644 municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java create mode 100644 municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/WaterConnectionByDemandGenerationDate.java create mode 100644 municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/WaterConnectionByDemandGenerationDateResponse.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 9fbfdfd01..fce7dee01 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 @@ -2,7 +2,6 @@ import java.math.BigDecimal; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -12,7 +11,6 @@ import javax.validation.Valid; -import org.apache.commons.lang3.StringUtils; import org.egov.common.contract.request.RequestInfo; import org.egov.common.contract.request.Role; import org.egov.common.contract.request.User; @@ -67,6 +65,9 @@ public class WaterDaoImpl implements WaterDao { @Autowired private OpenWaterRowMapper openWaterRowMapper; + + @Autowired + private WcbyDemandRowMapper wcbyDemandRowMapper; @Autowired private ReportRowMapper reportRowMapper; @@ -159,7 +160,39 @@ public void updateWaterConnection(WaterConnectionRequest waterConnectionRequest, waterConnectionProducer.push(wsConfiguration.getWorkFlowUpdateTopic(), waterConnectionRequest); } } - + public WaterConnectionByDemandGenerationDateResponse getWaterConnectionByDemandDate (SearchCriteria criteria, RequestInfo requestInfo) { + + List waterConnectionByPreviousReadingDateList = new ArrayList<>(); + List waterConnectionByDemandGenerationDateList = new ArrayList<>(); + List combinedDataByDate = new ArrayList<>(); + List preparedStatement = new ArrayList<>(); + Map collectionDataCount = null; + List> countData = null; + Boolean flag = null; + Set consumerCodeSet = null; + + String query = wsQueryBuilder.getQueryForWCCountbyDemandDate(criteria, preparedStatement, requestInfo); + + if (query == null) + return null; + log.info("QUERY to get data 1"+query); + WaterConnectionByDemandGenerationDateResponse response = new WaterConnectionByDemandGenerationDateResponse(); + waterConnectionByDemandGenerationDateList = jdbcTemplate.query(query, preparedStatement.toArray(), wcbyDemandRowMapper); + combinedDataByDate.addAll(waterConnectionByDemandGenerationDateList); + + query = wsQueryBuilder.getQueryForWCCountForPreviousreadingdate(criteria, preparedStatement, requestInfo); + if (query == null) + return null; + log.info("QUERY to get data2"+query); + waterConnectionByPreviousReadingDateList = jdbcTemplate.query(query, preparedStatement.toArray(), wcbyDemandRowMapper); + combinedDataByDate.addAll(waterConnectionByPreviousReadingDateList); + + response.setWaterConnectionByDemandGenerationDates(combinedDataByDate); + log.info("Combined data",combinedDataByDate); + + return response; + } + /** * push object to create meter reading * 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 90915b808..9e952c92b 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 @@ -66,6 +66,13 @@ public class WsQueryBuilder { + "eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + LEFT_OUTER_JOIN_STRING + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; + private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT distinct((select d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.consumercode = conn.connectionno order by d.createdtime desc limit 1)) as taxperiodto, count(*) as count FROM eg_ws_connection conn " + + "INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id LEFT OUTER JOIN eg_ws_applicationdocument document ON document.wsid = conn.id LEFT OUTER JOIN eg_ws_plumberinfo plumber ON plumber.wsid = conn.id LEFT OUTER JOIN eg_ws_connectionholder connectionholder " + + "ON connectionholder.connectionid = conn.id LEFT OUTER JOIN eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id "; + + private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection"; + + private static final String CONSUMERCODE_IN_DEMANDTABLE= "select consumercode from egbs_demand_v1"; private static final String PAGINATION_WRAPPER = "{} {orderby} {pagination}"; private static final String ORDER_BY_CLAUSE = " ORDER BY wc.appCreatedDate DESC"; @@ -704,4 +711,24 @@ private String addOrderByClauseForPlaneSearch(SearchCriteria criteria) { return builder.toString(); } + public String getQueryForWCCountbyDemandDate(SearchCriteria criteria, List preparedStatement, + RequestInfo requestInfo) { + if (criteria.isEmpty() || criteria.getTenantId().isEmpty()) + return null; + StringBuilder query = new StringBuilder(WATER_CONNNECTION_BY_DEMANNDDATE); + applyFiltersForPlaneSearch(query,preparedStatement,criteria); + query.append(" GROUP BY taxperiodto "); + return query.toString(); + } + + public String getQueryForWCCountForPreviousreadingdate(SearchCriteria criteria, List preparedStatement, + RequestInfo requestInfo) { + if (criteria.isEmpty() || criteria.getTenantId().isEmpty()) + return null; + StringBuilder query = new StringBuilder(WATER_CONNECTION_BY_PREVIOUSREADINNDATE); + query.append(" WHERE tenantid='"+criteria.getTenantId()+"' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where tenantid='"+criteria.getTenantId()+"') group by previousreadingdate"); + query.append(" GROUP BY taxperiodto "); + return query.toString(); + } + } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java new file mode 100644 index 000000000..a9882527a --- /dev/null +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java @@ -0,0 +1,27 @@ +package org.egov.waterconnection.repository.rowmapper; + +import org.egov.waterconnection.web.models.WaterConnectionByDemandGenerationDate; +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 WcbyDemandRowMapper implements ResultSetExtractor> { + @Override + public List extractData(ResultSet rs) throws SQLException, DataAccessException { + List waterDemandGenerationDateResponseList = new ArrayList(); + WaterConnectionByDemandGenerationDate waterDemandGenerationDateResponse = new WaterConnectionByDemandGenerationDate(); + while (rs.next()) { + String taxperiodto = rs.getString("taxperiodto"); + if (!taxperiodto.isEmpty()) { + waterDemandGenerationDateResponse.setDate(Long.valueOf(taxperiodto)); + waterDemandGenerationDateResponse.setCount(Integer.valueOf(rs.getString("count"))); + } + waterDemandGenerationDateResponseList.add(waterDemandGenerationDateResponse); + } + return waterDemandGenerationDateResponseList; + } +} 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 ac3d91a67..0c72cd1f8 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 @@ -7,9 +7,7 @@ import org.egov.common.contract.request.RequestInfo; import org.egov.waterconnection.web.models.*; import org.egov.waterconnection.web.models.BillReportData; -import org.egov.waterconnection.web.models.BillReportResponse; import org.egov.waterconnection.web.models.CollectionReportData; -import org.egov.waterconnection.web.models.Feedback; import org.egov.waterconnection.web.models.FeedbackRequest; import org.egov.waterconnection.web.models.FeedbackSearchCriteria; @@ -30,7 +28,8 @@ public interface WaterService { List createWaterConnection(WaterConnectionRequest waterConnectionRequest); WaterConnectionResponse search(SearchCriteria criteria, RequestInfo requestInfo); - + + WaterConnectionByDemandGenerationDateResponse countWCbyDemandGennerationDate(SearchCriteria criteria, RequestInfo requestInfo); List updateWaterConnection(WaterConnectionRequest waterConnectionRequest); void submitFeedback( FeedbackRequest feedbackrequest); 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 2782ef0f1..704683d4b 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 @@ -201,6 +201,10 @@ public WaterConnectionResponse search(SearchCriteria criteria, RequestInfo reque return waterConnection; } + public WaterConnectionByDemandGenerationDateResponse countWCbyDemandGennerationDate(SearchCriteria criteria, RequestInfo requestInfo) { + return getWCbyDemandGennerationDate(criteria, requestInfo); + } + /** * * @param criteria WaterConnectionSearchCriteria contains search criteria on @@ -211,6 +215,9 @@ public WaterConnectionResponse search(SearchCriteria criteria, RequestInfo reque public WaterConnectionResponse getWaterConnectionsList(SearchCriteria criteria, RequestInfo requestInfo) { return waterDaoImpl.getWaterConnectionList(criteria, requestInfo); } + public WaterConnectionByDemandGenerationDateResponse getWCbyDemandGennerationDate(SearchCriteria criteria, RequestInfo requestInfo) { + return waterDaoImpl.getWaterConnectionByDemandDate(criteria, requestInfo); + } /** * 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 5a9e6be54..cd462ba50 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 @@ -41,7 +41,6 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; -import io.swagger.models.parameters.QueryParameter; import lombok.Builder; import lombok.Getter; import lombok.Setter; @@ -230,4 +229,10 @@ public ResponseEntity inactiveConsumerReport(@Va return new ResponseEntity<>(response,HttpStatus.OK); } + @RequestMapping(value = "/_countWCbyDemandGenerationDate", method = RequestMethod.POST) + public ResponseEntity countWCbyDemandGenerationDate(@Valid @RequestBody RequestInfoWrapper requestInfoWrapper, @Valid @ModelAttribute SearchCriteria criteria) { + WaterConnectionByDemandGenerationDateResponse response = waterService.countWCbyDemandGennerationDate(criteria, requestInfoWrapper.getRequestInfo()); + return new ResponseEntity<>(response, HttpStatus.OK); + } + } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/WaterConnectionByDemandGenerationDate.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/WaterConnectionByDemandGenerationDate.java new file mode 100644 index 000000000..d54b10281 --- /dev/null +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/WaterConnectionByDemandGenerationDate.java @@ -0,0 +1,16 @@ +package org.egov.waterconnection.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +@Setter +@Builder +public class WaterConnectionByDemandGenerationDate { + @JsonProperty("count") + Integer count; + @JsonProperty("taxperiodto") + private Long date; +} diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/WaterConnectionByDemandGenerationDateResponse.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/WaterConnectionByDemandGenerationDateResponse.java new file mode 100644 index 000000000..38fe5f7c8 --- /dev/null +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/WaterConnectionByDemandGenerationDateResponse.java @@ -0,0 +1,16 @@ +package org.egov.waterconnection.web.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import java.util.List; +@Getter +@NoArgsConstructor +@AllArgsConstructor +@Setter +@Builder +public class WaterConnectionByDemandGenerationDateResponse { + + @JsonProperty("WaterConnections") + List waterConnectionByDemandGenerationDates; +} diff --git a/municipal-services/ws-services/target/classes/application.properties b/municipal-services/ws-services/target/classes/application.properties index 919f28808..f9966a0a8 100644 --- a/municipal-services/ws-services/target/classes/application.properties +++ b/municipal-services/ws-services/target/classes/application.properties @@ -64,10 +64,11 @@ egov.waterservice.pagination.default.offset=0 egov.billing.service.host=http://billing-service:8080/ egov.demand.createendpoint=billing-service/demand/_create egov.demand.searchendpoint=billing-service/demand/_search +egov.demand.update.endpoint=billing-service/demand/_update ##----------------------------- FLYWAY CONFIGURATIONS ------------------------------# -spring.flyway.url=jdbc:postgresql://localhost:5432/rainmaker_new +spring.flyway.url=jdbc:postgresql://localhost:5432/egov_local_new1 spring.flyway.user=postgres spring.flyway.password=postgres spring.flyway.table=public_new_102 @@ -164,7 +165,7 @@ state.level.tenant.id=pb #feedback topic egov.ws.service.feedback=ws-service-feedback-save -egov.mgramseva.ui.path=https://mgramseva-qa.egov.org.in/ +egov.ui.path=https://mgramseva-qa.egov.org.in/ egov.url.shortner.host=http://localhost:8065/ @@ -190,5 +191,14 @@ egov.es.search.endpoint=/_search egov.waterservice.es.index=water-services egov.ws.search.name.fuziness=2 +egov.ws.search.tenantId.fuziness=2 egov.ws.search.mobileNo.fuziness=2 egov.ws.fuzzy.searh.is.wildcard=true + +#SMS config +sms.pending.collection.enabled: true +sms.todays.collection.enabled: true +sms.edit.water.connection.notification.enabled: true +sms.payment.notification.enabled: true +sms.feedback.notification.enabled: false +sms.workflow.enabled: true From cf445f3c67813f5d577f34e91ab3b3b3db91d3eb Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Mon, 22 Jan 2024 17:56:29 +0530 Subject: [PATCH 02/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../target/classes/application.properties | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/municipal-services/ws-services/target/classes/application.properties b/municipal-services/ws-services/target/classes/application.properties index f9966a0a8..919f28808 100644 --- a/municipal-services/ws-services/target/classes/application.properties +++ b/municipal-services/ws-services/target/classes/application.properties @@ -64,11 +64,10 @@ egov.waterservice.pagination.default.offset=0 egov.billing.service.host=http://billing-service:8080/ egov.demand.createendpoint=billing-service/demand/_create egov.demand.searchendpoint=billing-service/demand/_search -egov.demand.update.endpoint=billing-service/demand/_update ##----------------------------- FLYWAY CONFIGURATIONS ------------------------------# -spring.flyway.url=jdbc:postgresql://localhost:5432/egov_local_new1 +spring.flyway.url=jdbc:postgresql://localhost:5432/rainmaker_new spring.flyway.user=postgres spring.flyway.password=postgres spring.flyway.table=public_new_102 @@ -165,7 +164,7 @@ state.level.tenant.id=pb #feedback topic egov.ws.service.feedback=ws-service-feedback-save -egov.ui.path=https://mgramseva-qa.egov.org.in/ +egov.mgramseva.ui.path=https://mgramseva-qa.egov.org.in/ egov.url.shortner.host=http://localhost:8065/ @@ -191,14 +190,5 @@ egov.es.search.endpoint=/_search egov.waterservice.es.index=water-services egov.ws.search.name.fuziness=2 -egov.ws.search.tenantId.fuziness=2 egov.ws.search.mobileNo.fuziness=2 egov.ws.fuzzy.searh.is.wildcard=true - -#SMS config -sms.pending.collection.enabled: true -sms.todays.collection.enabled: true -sms.edit.water.connection.notification.enabled: true -sms.payment.notification.enabled: true -sms.feedback.notification.enabled: false -sms.workflow.enabled: true From bc924cc46a68c831a837f13c9263735a4428691a Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 10:06:02 +0530 Subject: [PATCH 03/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../repository/rowmapper/WcbyDemandRowMapper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java index a9882527a..f7c7cbd95 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java @@ -3,12 +3,13 @@ import org.egov.waterconnection.web.models.WaterConnectionByDemandGenerationDate; 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 WcbyDemandRowMapper implements ResultSetExtractor> { @Override public List extractData(ResultSet rs) throws SQLException, DataAccessException { From abeee243159de46315bcdffb823d330ea5890b97 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 11:00:13 +0530 Subject: [PATCH 04/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../repository/rowmapper/WcbyDemandRowMapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java index f7c7cbd95..fbee15576 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java @@ -16,10 +16,10 @@ public List extractData(ResultSet rs) thr List waterDemandGenerationDateResponseList = new ArrayList(); WaterConnectionByDemandGenerationDate waterDemandGenerationDateResponse = new WaterConnectionByDemandGenerationDate(); while (rs.next()) { - String taxperiodto = rs.getString("taxperiodto"); + String taxperiodto = String.valueOf(rs.getInt("taxperiodto")); if (!taxperiodto.isEmpty()) { waterDemandGenerationDateResponse.setDate(Long.valueOf(taxperiodto)); - waterDemandGenerationDateResponse.setCount(Integer.valueOf(rs.getString("count"))); + waterDemandGenerationDateResponse.setCount(Integer.valueOf(rs.getInt("count"))); } waterDemandGenerationDateResponseList.add(waterDemandGenerationDateResponse); } From 5f6e5a568ad69fa1b17f5393b286ab45a0da056d Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 11:17:56 +0530 Subject: [PATCH 05/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../waterconnection/repository/builder/WsQueryBuilder.java | 7 +++---- .../repository/rowmapper/WcbyDemandRowMapper.java | 1 + 2 files changed, 4 insertions(+), 4 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 9e952c92b..dc1ec1834 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 @@ -66,9 +66,8 @@ public class WsQueryBuilder { + "eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + LEFT_OUTER_JOIN_STRING + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; - private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT distinct((select d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.consumercode = conn.connectionno order by d.createdtime desc limit 1)) as taxperiodto, count(*) as count FROM eg_ws_connection conn " + - "INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id LEFT OUTER JOIN eg_ws_applicationdocument document ON document.wsid = conn.id LEFT OUTER JOIN eg_ws_plumberinfo plumber ON plumber.wsid = conn.id LEFT OUTER JOIN eg_ws_connectionholder connectionholder " + - "ON connectionholder.connectionid = conn.id LEFT OUTER JOIN eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id "; + private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT distinct((select d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.consumercode = conn.connectionno order by d.createdtime desc limit 1)) as taxperiodto, count(*) as count" + + " FROM eg_ws_connection conn INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id and conn.status='Active'"; private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection"; @@ -726,7 +725,7 @@ public String getQueryForWCCountForPreviousreadingdate(SearchCriteria criteria, if (criteria.isEmpty() || criteria.getTenantId().isEmpty()) return null; StringBuilder query = new StringBuilder(WATER_CONNECTION_BY_PREVIOUSREADINNDATE); - query.append(" WHERE tenantid='"+criteria.getTenantId()+"' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where tenantid='"+criteria.getTenantId()+"') group by previousreadingdate"); + query.append(" WHERE status='Active' AND tenantid='"+criteria.getTenantId()+"' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where tenantid='"+criteria.getTenantId()+"') group by previousreadingdate"); query.append(" GROUP BY taxperiodto "); return query.toString(); } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java index fbee15576..fb79ad99a 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java @@ -11,6 +11,7 @@ import java.util.List; @Component public class WcbyDemandRowMapper implements ResultSetExtractor> { + @Override public List extractData(ResultSet rs) throws SQLException, DataAccessException { List waterDemandGenerationDateResponseList = new ArrayList(); From 77035343b7522770cb2cc4e111e5c0b720a87f19 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 11:22:54 +0530 Subject: [PATCH 06/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../repository/rowmapper/WcbyDemandRowMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java index fb79ad99a..4141c970d 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java @@ -17,7 +17,7 @@ public List extractData(ResultSet rs) thr List waterDemandGenerationDateResponseList = new ArrayList(); WaterConnectionByDemandGenerationDate waterDemandGenerationDateResponse = new WaterConnectionByDemandGenerationDate(); while (rs.next()) { - String taxperiodto = String.valueOf(rs.getInt("taxperiodto")); + String taxperiodto = String.valueOf(rs.getLong("taxperiodto")); if (!taxperiodto.isEmpty()) { waterDemandGenerationDateResponse.setDate(Long.valueOf(taxperiodto)); waterDemandGenerationDateResponse.setCount(Integer.valueOf(rs.getInt("count"))); From b894fdf8bec5ca73be060b3967cfcb7da51fa171 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 11:25:01 +0530 Subject: [PATCH 07/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../repository/rowmapper/WcbyDemandRowMapper.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java index 4141c970d..1b1cde9cf 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java @@ -1,5 +1,6 @@ package org.egov.waterconnection.repository.rowmapper; +import lombok.extern.slf4j.Slf4j; import org.egov.waterconnection.web.models.WaterConnectionByDemandGenerationDate; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.ResultSetExtractor; @@ -10,6 +11,7 @@ import java.util.ArrayList; import java.util.List; @Component +@Slf4j public class WcbyDemandRowMapper implements ResultSetExtractor> { @Override @@ -17,6 +19,7 @@ public List extractData(ResultSet rs) thr List waterDemandGenerationDateResponseList = new ArrayList(); WaterConnectionByDemandGenerationDate waterDemandGenerationDateResponse = new WaterConnectionByDemandGenerationDate(); while (rs.next()) { + log.info("RESULT SET" + rs.toString()); String taxperiodto = String.valueOf(rs.getLong("taxperiodto")); if (!taxperiodto.isEmpty()) { waterDemandGenerationDateResponse.setDate(Long.valueOf(taxperiodto)); From db8d7f13cf57a5176ab0072ff4739b75ec3345d3 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 11:53:39 +0530 Subject: [PATCH 08/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../egov/waterconnection/repository/builder/WsQueryBuilder.java | 1 - 1 file changed, 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 dc1ec1834..b34b3f38e 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 @@ -726,7 +726,6 @@ public String getQueryForWCCountForPreviousreadingdate(SearchCriteria criteria, return null; StringBuilder query = new StringBuilder(WATER_CONNECTION_BY_PREVIOUSREADINNDATE); query.append(" WHERE status='Active' AND tenantid='"+criteria.getTenantId()+"' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where tenantid='"+criteria.getTenantId()+"') group by previousreadingdate"); - query.append(" GROUP BY taxperiodto "); return query.toString(); } From 958ee0ee48e73add91f5feac9fb926a7854fb9a3 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 12:46:54 +0530 Subject: [PATCH 09/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../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 b34b3f38e..3b3ae923a 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 @@ -725,7 +725,7 @@ public String getQueryForWCCountForPreviousreadingdate(SearchCriteria criteria, if (criteria.isEmpty() || criteria.getTenantId().isEmpty()) return null; StringBuilder query = new StringBuilder(WATER_CONNECTION_BY_PREVIOUSREADINNDATE); - query.append(" WHERE status='Active' AND tenantid='"+criteria.getTenantId()+"' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where tenantid='"+criteria.getTenantId()+"') group by previousreadingdate"); + query.append(" WHERE status='Active' AND tenantid='"+criteria.getTenantId()+"' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where tenantid='"+criteria.getTenantId()+"') group by previousreadingdate;"); return query.toString(); } From 8a94c8578d3918acbddb8e4b596893e00919e2b5 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 12:48:25 +0530 Subject: [PATCH 10/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../waterconnection/repository/builder/WsQueryBuilder.java | 3 ++- 1 file changed, 2 insertions(+), 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 3b3ae923a..23d7cc5d9 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 @@ -725,7 +725,8 @@ public String getQueryForWCCountForPreviousreadingdate(SearchCriteria criteria, if (criteria.isEmpty() || criteria.getTenantId().isEmpty()) return null; StringBuilder query = new StringBuilder(WATER_CONNECTION_BY_PREVIOUSREADINNDATE); - query.append(" WHERE status='Active' AND tenantid='"+criteria.getTenantId()+"' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where tenantid='"+criteria.getTenantId()+"') group by previousreadingdate;"); + query.append(" WHERE status='Active' AND tenantid='"+criteria.getTenantId()+"' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where tenantid='"+criteria.getTenantId()+"') "); + query.append(" GROUP BY taxperiodto "); return query.toString(); } From e7a2c5701d7f30ec40fc554207e3bf2b57e76197 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 12:51:04 +0530 Subject: [PATCH 11/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../java/org/egov/waterconnection/repository/WaterDaoImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 fce7dee01..1e615397f 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 @@ -179,7 +179,8 @@ public WaterConnectionByDemandGenerationDateResponse getWaterConnectionByDemandD WaterConnectionByDemandGenerationDateResponse response = new WaterConnectionByDemandGenerationDateResponse(); waterConnectionByDemandGenerationDateList = jdbcTemplate.query(query, preparedStatement.toArray(), wcbyDemandRowMapper); combinedDataByDate.addAll(waterConnectionByDemandGenerationDateList); - + log.info("combinedDataByDate:"+combinedDataByDate); + log.info("combinedDataByDate size:"+combinedDataByDate.size()); query = wsQueryBuilder.getQueryForWCCountForPreviousreadingdate(criteria, preparedStatement, requestInfo); if (query == null) return null; From b28933e99fc6aecb0e3352c812187043333617b1 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 13:17:21 +0530 Subject: [PATCH 12/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../repository/rowmapper/WcbyDemandRowMapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java index 1b1cde9cf..97d9ab952 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java @@ -17,11 +17,11 @@ public class WcbyDemandRowMapper implements ResultSetExtractor extractData(ResultSet rs) throws SQLException, DataAccessException { List waterDemandGenerationDateResponseList = new ArrayList(); - WaterConnectionByDemandGenerationDate waterDemandGenerationDateResponse = new WaterConnectionByDemandGenerationDate(); while (rs.next()) { - log.info("RESULT SET" + rs.toString()); + WaterConnectionByDemandGenerationDate waterDemandGenerationDateResponse = new WaterConnectionByDemandGenerationDate(); String taxperiodto = String.valueOf(rs.getLong("taxperiodto")); if (!taxperiodto.isEmpty()) { + log.info("taxperiodto"+taxperiodto); waterDemandGenerationDateResponse.setDate(Long.valueOf(taxperiodto)); waterDemandGenerationDateResponse.setCount(Integer.valueOf(rs.getInt("count"))); } From 300cff73806b62a0994dfe765fac0e405a9ddd09 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 13:21:08 +0530 Subject: [PATCH 13/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../waterconnection/repository/WaterDaoImpl.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 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 1e615397f..3fa05da21 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 @@ -165,28 +165,32 @@ public WaterConnectionByDemandGenerationDateResponse getWaterConnectionByDemandD List waterConnectionByPreviousReadingDateList = new ArrayList<>(); List waterConnectionByDemandGenerationDateList = new ArrayList<>(); List combinedDataByDate = new ArrayList<>(); + WaterConnectionByDemandGenerationDateResponse response = new WaterConnectionByDemandGenerationDateResponse(); List preparedStatement = new ArrayList<>(); Map collectionDataCount = null; List> countData = null; Boolean flag = null; Set consumerCodeSet = null; - - String query = wsQueryBuilder.getQueryForWCCountbyDemandDate(criteria, preparedStatement, requestInfo); + String query = wsQueryBuilder.getQueryForWCCountForPreviousreadingdate(criteria, preparedStatement, requestInfo); + if (query == null) + return null; + log.info("QUERY to get data2"+query); + waterConnectionByPreviousReadingDateList = jdbcTemplate.query(query, preparedStatement.toArray(), wcbyDemandRowMapper); + query = wsQueryBuilder.getQueryForWCCountbyDemandDate(criteria, preparedStatement, requestInfo); + combinedDataByDate.addAll(waterConnectionByPreviousReadingDateList); if (query == null) return null; log.info("QUERY to get data 1"+query); - WaterConnectionByDemandGenerationDateResponse response = new WaterConnectionByDemandGenerationDateResponse(); waterConnectionByDemandGenerationDateList = jdbcTemplate.query(query, preparedStatement.toArray(), wcbyDemandRowMapper); combinedDataByDate.addAll(waterConnectionByDemandGenerationDateList); log.info("combinedDataByDate:"+combinedDataByDate); log.info("combinedDataByDate size:"+combinedDataByDate.size()); - query = wsQueryBuilder.getQueryForWCCountForPreviousreadingdate(criteria, preparedStatement, requestInfo); + /*query = wsQueryBuilder.getQueryForWCCountForPreviousreadingdate(criteria, preparedStatement, requestInfo); if (query == null) return null; log.info("QUERY to get data2"+query); - waterConnectionByPreviousReadingDateList = jdbcTemplate.query(query, preparedStatement.toArray(), wcbyDemandRowMapper); - combinedDataByDate.addAll(waterConnectionByPreviousReadingDateList); + waterConnectionByPreviousReadingDateList = jdbcTemplate.query(query, preparedStatement.toArray(), wcbyDemandRowMapper);*/ response.setWaterConnectionByDemandGenerationDates(combinedDataByDate); log.info("Combined data",combinedDataByDate); From 2e8d9dfb591d495ee7434246cd7fcacbcf47c511 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 13:36:03 +0530 Subject: [PATCH 14/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../repository/rowmapper/WcbyDemandRowMapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java index 97d9ab952..39765df55 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java @@ -20,7 +20,7 @@ public List extractData(ResultSet rs) thr while (rs.next()) { WaterConnectionByDemandGenerationDate waterDemandGenerationDateResponse = new WaterConnectionByDemandGenerationDate(); String taxperiodto = String.valueOf(rs.getLong("taxperiodto")); - if (!taxperiodto.isEmpty()) { + if (!taxperiodto.isEmpty() && !taxperiodto.equalsIgnoreCase("0")) { log.info("taxperiodto"+taxperiodto); waterDemandGenerationDateResponse.setDate(Long.valueOf(taxperiodto)); waterDemandGenerationDateResponse.setCount(Integer.valueOf(rs.getInt("count"))); From c00aa32683b3e0dc02049f24ab6685c5cca53a0c Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 23 Jan 2024 14:02:28 +0530 Subject: [PATCH 15/25] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../waterconnection/repository/WaterDaoImpl.java | 16 ---------------- .../rowmapper/WcbyDemandRowMapper.java | 6 +++--- 2 files changed, 3 insertions(+), 19 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 3fa05da21..1ea3b8ee5 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 @@ -167,34 +167,18 @@ public WaterConnectionByDemandGenerationDateResponse getWaterConnectionByDemandD List combinedDataByDate = new ArrayList<>(); WaterConnectionByDemandGenerationDateResponse response = new WaterConnectionByDemandGenerationDateResponse(); List preparedStatement = new ArrayList<>(); - Map collectionDataCount = null; - List> countData = null; - Boolean flag = null; - Set consumerCodeSet = null; String query = wsQueryBuilder.getQueryForWCCountForPreviousreadingdate(criteria, preparedStatement, requestInfo); if (query == null) return null; - log.info("QUERY to get data2"+query); waterConnectionByPreviousReadingDateList = jdbcTemplate.query(query, preparedStatement.toArray(), wcbyDemandRowMapper); query = wsQueryBuilder.getQueryForWCCountbyDemandDate(criteria, preparedStatement, requestInfo); combinedDataByDate.addAll(waterConnectionByPreviousReadingDateList); if (query == null) return null; - log.info("QUERY to get data 1"+query); waterConnectionByDemandGenerationDateList = jdbcTemplate.query(query, preparedStatement.toArray(), wcbyDemandRowMapper); combinedDataByDate.addAll(waterConnectionByDemandGenerationDateList); - log.info("combinedDataByDate:"+combinedDataByDate); - log.info("combinedDataByDate size:"+combinedDataByDate.size()); - /*query = wsQueryBuilder.getQueryForWCCountForPreviousreadingdate(criteria, preparedStatement, requestInfo); - if (query == null) - return null; - log.info("QUERY to get data2"+query); - waterConnectionByPreviousReadingDateList = jdbcTemplate.query(query, preparedStatement.toArray(), wcbyDemandRowMapper);*/ - response.setWaterConnectionByDemandGenerationDates(combinedDataByDate); - log.info("Combined data",combinedDataByDate); - return response; } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java index 39765df55..c45544f94 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/repository/rowmapper/WcbyDemandRowMapper.java @@ -18,14 +18,14 @@ public class WcbyDemandRowMapper implements ResultSetExtractor extractData(ResultSet rs) throws SQLException, DataAccessException { List waterDemandGenerationDateResponseList = new ArrayList(); while (rs.next()) { - WaterConnectionByDemandGenerationDate waterDemandGenerationDateResponse = new WaterConnectionByDemandGenerationDate(); String taxperiodto = String.valueOf(rs.getLong("taxperiodto")); if (!taxperiodto.isEmpty() && !taxperiodto.equalsIgnoreCase("0")) { - log.info("taxperiodto"+taxperiodto); + WaterConnectionByDemandGenerationDate waterDemandGenerationDateResponse = new WaterConnectionByDemandGenerationDate(); waterDemandGenerationDateResponse.setDate(Long.valueOf(taxperiodto)); waterDemandGenerationDateResponse.setCount(Integer.valueOf(rs.getInt("count"))); + waterDemandGenerationDateResponseList.add(waterDemandGenerationDateResponse); } - waterDemandGenerationDateResponseList.add(waterDemandGenerationDateResponse); + } return waterDemandGenerationDateResponseList; } From 691055eedbe76874988c70cd6c711d0e94968f9f Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:39:39 +0530 Subject: [PATCH 16/25] PFM-5473 Query fix --- .../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 23d7cc5d9..fcf57fddd 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 @@ -66,7 +66,7 @@ public class WsQueryBuilder { + "eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + LEFT_OUTER_JOIN_STRING + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; - private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT distinct((select d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.consumercode = conn.connectionno order by d.createdtime desc limit 1)) as taxperiodto, count(*) as count" + + private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT distinct((select d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.status = 'Active' and a.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.createdtime desc limit 1)) as taxperiodto, count(*) as count" + " FROM eg_ws_connection conn INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id and conn.status='Active'"; private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection"; From e63b0a0aa08a97eba1c470c996fde290699855e7 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:41:41 +0530 Subject: [PATCH 17/25] PFM-5473 Query fix --- .../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 fcf57fddd..e53f6ecb9 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 @@ -66,7 +66,7 @@ public class WsQueryBuilder { + "eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + LEFT_OUTER_JOIN_STRING + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; - private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT distinct((select d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.status = 'Active' and a.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.createdtime desc limit 1)) as taxperiodto, count(*) as count" + + private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT distinct((select d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.status = 'ACTIVE' and a.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.createdtime desc limit 1)) as taxperiodto, count(*) as count" + " FROM eg_ws_connection conn INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id and conn.status='Active'"; private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection"; From 41e6060f6addc232dba6a047d22b14694cae66c3 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:51:26 +0530 Subject: [PATCH 18/25] PFM-5473 Query fix --- .../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 e53f6ecb9..01bad89b8 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 @@ -66,7 +66,7 @@ public class WsQueryBuilder { + "eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + LEFT_OUTER_JOIN_STRING + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; - private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT distinct((select d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.status = 'ACTIVE' and a.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.createdtime desc limit 1)) as taxperiodto, count(*) as count" + + private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT distinct((select d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.status = 'ACTIVE' and d.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.createdtime desc limit 1)) as taxperiodto, count(*) as count" + " FROM eg_ws_connection conn INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id and conn.status='Active'"; private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection"; From 07f241a29cbe68d184b30d1b59c39b4d406997a2 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Wed, 31 Jan 2024 15:56:39 +0530 Subject: [PATCH 19/25] PFM-5473 query change --- .../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 01bad89b8..0da48e43f 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 @@ -71,7 +71,7 @@ public class WsQueryBuilder { private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection"; - private static final String CONSUMERCODE_IN_DEMANDTABLE= "select consumercode from egbs_demand_v1"; + private static final String CONSUMERCODE_IN_DEMANDTABLE= "select consumercode from egbs_demand_v1 d where d.buisnessservice = 'WS'"; private static final String PAGINATION_WRAPPER = "{} {orderby} {pagination}"; private static final String ORDER_BY_CLAUSE = " ORDER BY wc.appCreatedDate DESC"; From aa40b81edcb9e1cfc71e2283e8e83ca6181b0abb Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:02:14 +0530 Subject: [PATCH 20/25] PFM-5473 contract change --- .../repository/WaterDaoImpl.java | 18 ++++++++---------- ...nnectionByDemandGenerationDateResponse.java | 4 +++- 2 files changed, 11 insertions(+), 11 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 1ea3b8ee5..c95a6aa18 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 @@ -164,21 +164,19 @@ public WaterConnectionByDemandGenerationDateResponse getWaterConnectionByDemandD List waterConnectionByPreviousReadingDateList = new ArrayList<>(); List waterConnectionByDemandGenerationDateList = new ArrayList<>(); - List combinedDataByDate = new ArrayList<>(); WaterConnectionByDemandGenerationDateResponse response = new WaterConnectionByDemandGenerationDateResponse(); List preparedStatement = new ArrayList<>(); - String query = wsQueryBuilder.getQueryForWCCountForPreviousreadingdate(criteria, preparedStatement, requestInfo); - if (query == null) + String query1 = wsQueryBuilder.getQueryForWCCountForPreviousreadingdate(criteria, preparedStatement, requestInfo); + if (query1 == null) return null; - waterConnectionByPreviousReadingDateList = jdbcTemplate.query(query, preparedStatement.toArray(), wcbyDemandRowMapper); - query = wsQueryBuilder.getQueryForWCCountbyDemandDate(criteria, preparedStatement, requestInfo); - combinedDataByDate.addAll(waterConnectionByPreviousReadingDateList); + waterConnectionByPreviousReadingDateList = jdbcTemplate.query(query1, preparedStatement.toArray(), wcbyDemandRowMapper); + String query2 = wsQueryBuilder.getQueryForWCCountbyDemandDate(criteria, preparedStatement, requestInfo); - if (query == null) + if (query2 == null) return null; - waterConnectionByDemandGenerationDateList = jdbcTemplate.query(query, preparedStatement.toArray(), wcbyDemandRowMapper); - combinedDataByDate.addAll(waterConnectionByDemandGenerationDateList); - response.setWaterConnectionByDemandGenerationDates(combinedDataByDate); + waterConnectionByDemandGenerationDateList = jdbcTemplate.query(query2, preparedStatement.toArray(), wcbyDemandRowMapper); + response.setWaterConnectionByDemandGenerationDates(waterConnectionByDemandGenerationDateList); + response.setWaterConnectionByDemandNotGeneratedDates(waterConnectionByPreviousReadingDateList); return response; } diff --git a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/WaterConnectionByDemandGenerationDateResponse.java b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/WaterConnectionByDemandGenerationDateResponse.java index 38fe5f7c8..9f661f603 100644 --- a/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/WaterConnectionByDemandGenerationDateResponse.java +++ b/municipal-services/ws-services/src/main/java/org/egov/waterconnection/web/models/WaterConnectionByDemandGenerationDateResponse.java @@ -11,6 +11,8 @@ @Builder public class WaterConnectionByDemandGenerationDateResponse { - @JsonProperty("WaterConnections") + @JsonProperty("WaterConnectionsDemandGenerated") List waterConnectionByDemandGenerationDates; + @JsonProperty("WaterConnectionsDemandNotGenerated") + List waterConnectionByDemandNotGeneratedDates; } From 351a687355422efd208ac00f88bd0596dd94a73b Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:33:41 +0530 Subject: [PATCH 21/25] PFM-5473 query fix --- .../waterconnection/repository/builder/WsQueryBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 0da48e43f..4755112ee 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 @@ -71,7 +71,7 @@ public class WsQueryBuilder { private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection"; - private static final String CONSUMERCODE_IN_DEMANDTABLE= "select consumercode from egbs_demand_v1 d where d.buisnessservice = 'WS'"; + private static final String CONSUMERCODE_IN_DEMANDTABLE= "select consumercode from egbs_demand_v1 d"; private static final String PAGINATION_WRAPPER = "{} {orderby} {pagination}"; private static final String ORDER_BY_CLAUSE = " ORDER BY wc.appCreatedDate DESC"; @@ -725,7 +725,7 @@ public String getQueryForWCCountForPreviousreadingdate(SearchCriteria criteria, if (criteria.isEmpty() || criteria.getTenantId().isEmpty()) return null; StringBuilder query = new StringBuilder(WATER_CONNECTION_BY_PREVIOUSREADINNDATE); - query.append(" WHERE status='Active' AND tenantid='"+criteria.getTenantId()+"' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where tenantid='"+criteria.getTenantId()+"') "); + query.append(" WHERE status='Active' AND tenantid='"+criteria.getTenantId()+"' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where d.businessservice='WS' and d.tenantid='"+criteria.getTenantId()+"') "); query.append(" GROUP BY taxperiodto "); return query.toString(); } From 6aa02f5dda391c8a1631f42277690f1468032121 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:50:14 +0530 Subject: [PATCH 22/25] WATER_CONNNECTION_BY_DEMANNDDATE --- .../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 4755112ee..c19ff7f3e 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 @@ -66,7 +66,7 @@ public class WsQueryBuilder { + "eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + LEFT_OUTER_JOIN_STRING + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; - private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT distinct((select d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.status = 'ACTIVE' and d.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.createdtime desc limit 1)) as taxperiodto, count(*) as count" + + private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT ((select distinct d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.status = 'ACTIVE' and d.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.createdtime desc limit 1)) as taxperiodto, count(*) as count" + " FROM eg_ws_connection conn INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id and conn.status='Active'"; private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection"; From 00668841997e2d0a86d3fe78d2449441e3c44573 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:09:10 +0530 Subject: [PATCH 23/25] query fix --- .../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 c19ff7f3e..f07e4b1b7 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 @@ -66,7 +66,7 @@ public class WsQueryBuilder { + "eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id" + LEFT_OUTER_JOIN_STRING + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; - private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT ((select distinct d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.status = 'ACTIVE' and d.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.createdtime desc limit 1)) as taxperiodto, count(*) as count" + + private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT ((select distinct d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.status = 'ACTIVE' and d.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.taxperiodto desc limit 1)) as taxperiodto, count(*) as count" + " FROM eg_ws_connection conn INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id and conn.status='Active'"; private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection"; From 169a0448c4bbba04624db7183c0cf2deba78bd7e Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:50:20 +0530 Subject: [PATCH 24/25] query fix --- .../waterconnection/repository/builder/WsQueryBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 f07e4b1b7..f148ee914 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 @@ -67,7 +67,7 @@ public class WsQueryBuilder { + LEFT_OUTER_JOIN_STRING + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT ((select distinct d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.status = 'ACTIVE' and d.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.taxperiodto desc limit 1)) as taxperiodto, count(*) as count" + - " FROM eg_ws_connection conn INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id and conn.status='Active'"; + " FROM eg_ws_connection conn INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id and connectiontype='Non_Metered'and conn.status='Active'"; private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection"; @@ -725,7 +725,7 @@ public String getQueryForWCCountForPreviousreadingdate(SearchCriteria criteria, if (criteria.isEmpty() || criteria.getTenantId().isEmpty()) return null; StringBuilder query = new StringBuilder(WATER_CONNECTION_BY_PREVIOUSREADINNDATE); - query.append(" WHERE status='Active' AND tenantid='"+criteria.getTenantId()+"' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where d.businessservice='WS' and d.tenantid='"+criteria.getTenantId()+"') "); + query.append(" WHERE status='Active' AND tenantid='"+criteria.getTenantId()+"' and connectiontype='Non_Metered' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where d.businessservice='WS' and d.tenantid='"+criteria.getTenantId()+"') "); query.append(" GROUP BY taxperiodto "); return query.toString(); } From 861c2e9e09bf2f5381eb3c73e6b20e649ecfcf19 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Wed, 31 Jan 2024 18:11:15 +0530 Subject: [PATCH 25/25] query fix --- .../waterconnection/repository/builder/WsQueryBuilder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 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 f148ee914..a9b335eea 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 @@ -67,9 +67,9 @@ public class WsQueryBuilder { + LEFT_OUTER_JOIN_STRING + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id"; private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT ((select distinct d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.status = 'ACTIVE' and d.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.taxperiodto desc limit 1)) as taxperiodto, count(*) as count" + - " FROM eg_ws_connection conn INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id and connectiontype='Non_Metered'and conn.status='Active'"; + " FROM eg_ws_connection conn INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id and wc.connectiontype='Non_Metered'and conn.status='Active'"; - private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection"; + private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection conn"; private static final String CONSUMERCODE_IN_DEMANDTABLE= "select consumercode from egbs_demand_v1 d"; private static final String PAGINATION_WRAPPER = "{} {orderby} {pagination}"; @@ -725,7 +725,7 @@ public String getQueryForWCCountForPreviousreadingdate(SearchCriteria criteria, if (criteria.isEmpty() || criteria.getTenantId().isEmpty()) return null; StringBuilder query = new StringBuilder(WATER_CONNECTION_BY_PREVIOUSREADINNDATE); - query.append(" WHERE status='Active' AND tenantid='"+criteria.getTenantId()+"' and connectiontype='Non_Metered' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where d.businessservice='WS' and d.tenantid='"+criteria.getTenantId()+"') "); + query.append(" INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id WHERE conn.status='Active' AND conn.tenantid='"+criteria.getTenantId()+"' and wc.connectiontype='Non_Metered' and connectionno NOT IN (" + CONSUMERCODE_IN_DEMANDTABLE+" where d.businessservice='WS' and d.tenantid='"+criteria.getTenantId()+"') "); query.append(" GROUP BY taxperiodto "); return query.toString(); }