From 0123dd9c4f44fdc5116ac2614b547f6964f619d0 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Tue, 6 Feb 2024 16:34:00 +0530 Subject: [PATCH 1/2] PFM-5473: Added changes to get the count of tenantby last demand gennerated date --- .../waterconnection/repository/WaterDaoImpl.java | 1 + .../repository/builder/WsQueryBuilder.java | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 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 c95a6aa18..072530430 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 @@ -171,6 +171,7 @@ public WaterConnectionByDemandGenerationDateResponse getWaterConnectionByDemandD return null; waterConnectionByPreviousReadingDateList = jdbcTemplate.query(query1, preparedStatement.toArray(), wcbyDemandRowMapper); String query2 = wsQueryBuilder.getQueryForWCCountbyDemandDate(criteria, preparedStatement, requestInfo); + log.info(query2); if (query2 == null) return null; 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 df462936f..55153272f 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,12 +66,14 @@ 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.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 wc.connectiontype='Non_Metered'and conn.status='Active'"; + private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT ((select distinct d.taxperiodto as taxperiodto from egbs_demand_v1 d inner join egbs_demanddetail_v1 dd on dd.demandid = d.id "; + private static final String WATER_CONNNECTION_BY_DEMANNDDATE_CLAUSE = " and dd.taxheadcode='10101' and d.status = 'ACTIVE' and d.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.taxperiodto desc limit 1))" + + " as taxperiodto, count(*) as count "; + private static final String WATER_CONNNECTION_BY_DEMANNDDATE_FROM =" 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 conn"; - private static final String CONSUMERCODE_IN_DEMANDTABLE= "select consumercode from egbs_demand_v1 d"; + private static final String CONSUMERCODE_IN_DEMANDTABLE= "select distinct consumercode from egbs_demand_v1 d inner join egbs_demanddetail_v1 dd on dd.demandid = d.id "; private static final String PAGINATION_WRAPPER = "{} {orderby} {pagination}"; private static final String ORDER_BY_CLAUSE = " ORDER BY wc.appCreatedDate DESC"; @@ -715,6 +717,9 @@ public String getQueryForWCCountbyDemandDate(SearchCriteria criteria, List Date: Tue, 6 Feb 2024 17:10:53 +0530 Subject: [PATCH 2/2] Update WaterDaoImpl.java --- .../java/org/egov/waterconnection/repository/WaterDaoImpl.java | 1 - 1 file changed, 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 072530430..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 @@ -171,7 +171,6 @@ public WaterConnectionByDemandGenerationDateResponse getWaterConnectionByDemandD return null; waterConnectionByPreviousReadingDateList = jdbcTemplate.query(query1, preparedStatement.toArray(), wcbyDemandRowMapper); String query2 = wsQueryBuilder.getQueryForWCCountbyDemandDate(criteria, preparedStatement, requestInfo); - log.info(query2); if (query2 == null) return null;