From 0bd460fec0cefa4ade5ef08d7440e9a44813b455 Mon Sep 17 00:00:00 2001 From: debasishchakraborty-egovt Date: Mon, 22 Jan 2024 17:54:36 +0530 Subject: [PATCH 01/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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/33] 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(); } From 7dc944966d537929f6ad04a671a3ab64e65fbf4c Mon Sep 17 00:00:00 2001 From: Debasish Chakraborty <117706910+debasishchakraborty-egovt@users.noreply.github.com> Date: Thu, 1 Feb 2024 18:28:34 +0530 Subject: [PATCH 26/33] Update WsQueryBuilder.java --- .../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 a9b335eea..df462936f 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(" 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(" 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.status ='ACTIVE' and d.businessservice='WS' and d.tenantid='"+criteria.getTenantId()+"') "); query.append(" GROUP BY taxperiodto "); return query.toString(); } From 21b54d7499d0a67e2c731825c638fe7169a833d7 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Thu, 1 Feb 2024 19:14:35 +0530 Subject: [PATCH 27/33] PFM-5473-frontend (#702) * PFM-5473 -frontend --- .../model/connection/water_connection.dart | 60 +++++++ .../model/reports/WaterConnectionCount.dart | 59 +++++++ .../bill_generation_details_provider.dart | 3 +- .../lib/providers/reports_provider.dart | 26 +++ .../lib/repository/reports_repo.dart | 33 ++++ .../screeens/generate_bill/generate_bill.dart | 3 + .../widgets/WaterConnectionCountWidget.dart | 159 ++++++++++++++++++ frontend/mgramseva/lib/services/urls.dart | 2 + .../utils/constants/i18_key_constants.dart | 5 + 9 files changed, 348 insertions(+), 2 deletions(-) create mode 100644 frontend/mgramseva/lib/model/reports/WaterConnectionCount.dart create mode 100644 frontend/mgramseva/lib/screeens/generate_bill/widgets/WaterConnectionCountWidget.dart diff --git a/frontend/mgramseva/lib/model/connection/water_connection.dart b/frontend/mgramseva/lib/model/connection/water_connection.dart index 37e2937b8..720e7333c 100644 --- a/frontend/mgramseva/lib/model/connection/water_connection.dart +++ b/frontend/mgramseva/lib/model/connection/water_connection.dart @@ -219,6 +219,66 @@ class WaterConnection { factory WaterConnection.fromJson(Map json) => _$WaterConnectionFromJson(json); Map toJson() => _$WaterConnectionToJson(this); + @override + bool operator ==(Object other) { + if (identical(this, other)) return true; + + return other is WaterConnection && + other.id == id && + other.connectionNo == connectionNo && + other.propertyId == propertyId && + other.applicationNo == applicationNo && + other.tenantId == tenantId && + other.action == action && + other.status == status && + other.meterInstallationDate == meterInstallationDate && + other.documents == documents && + other.proposedTaps == proposedTaps && + other.noOfTaps == noOfTaps && + other.arrears == arrears && + other.connectionType == connectionType && + other.oldConnectionNo == oldConnectionNo && + other.meterId == meterId && + other.propertyType == propertyType && + other.previousReadingDate == previousReadingDate && + other.previousReading == previousReading && + other.proposedPipeSize == proposedPipeSize && + other.connectionHolders == connectionHolders && + other.additionalDetails == additionalDetails && + other.processInstance == processInstance && + other.paymentType == paymentType && + other.penalty == penalty && + other.advance == advance; + } + + @override + int get hashCode { + return id.hashCode ^ + connectionNo.hashCode ^ + propertyId.hashCode ^ + applicationNo.hashCode ^ + tenantId.hashCode ^ + action.hashCode ^ + status.hashCode ^ + meterInstallationDate.hashCode ^ + documents.hashCode ^ + proposedTaps.hashCode ^ + noOfTaps.hashCode ^ + arrears.hashCode ^ + connectionType.hashCode ^ + oldConnectionNo.hashCode ^ + meterId.hashCode ^ + propertyType.hashCode ^ + previousReadingDate.hashCode ^ + previousReading.hashCode ^ + proposedPipeSize.hashCode ^ + connectionHolders.hashCode ^ + additionalDetails.hashCode ^ + processInstance.hashCode ^ + paymentType.hashCode ^ + penalty.hashCode ^ + advance.hashCode; + } } @JsonSerializable() diff --git a/frontend/mgramseva/lib/model/reports/WaterConnectionCount.dart b/frontend/mgramseva/lib/model/reports/WaterConnectionCount.dart new file mode 100644 index 000000000..30d77a4a9 --- /dev/null +++ b/frontend/mgramseva/lib/model/reports/WaterConnectionCount.dart @@ -0,0 +1,59 @@ +class WaterConnectionCount { + int? count; + int? taxperiodto; + + WaterConnectionCount({this.count, this.taxperiodto}); + + WaterConnectionCount.fromJson(Map json) { + count = json['count']??0; + taxperiodto = json['taxperiodto']??0; + } + + Map toJson() { + final Map data = new Map(); + data['count'] = this.count; + data['taxperiodto'] = this.taxperiodto; + return data; + } +} +class WaterConnectionCountResponse { + List? waterConnectionsDemandGenerated; + List? waterConnectionsDemandNotGenerated; + + WaterConnectionCountResponse( + {this.waterConnectionsDemandGenerated, + this.waterConnectionsDemandNotGenerated}); + + WaterConnectionCountResponse.fromJson(Map json) { + if (json['WaterConnectionsDemandGenerated'] != null) { + waterConnectionsDemandGenerated = []; + json['WaterConnectionsDemandGenerated'].forEach((v) { + waterConnectionsDemandGenerated! + .add(new WaterConnectionCount.fromJson(v)); + }); + } + if (json['WaterConnectionsDemandNotGenerated'] != null) { + waterConnectionsDemandNotGenerated = + []; + json['WaterConnectionsDemandNotGenerated'].forEach((v) { + waterConnectionsDemandNotGenerated! + .add(new WaterConnectionCount.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.waterConnectionsDemandGenerated != null) { + data['WaterConnectionsDemandGenerated'] = + this.waterConnectionsDemandGenerated!.map((v) => v.toJson()).toList(); + } + if (this.waterConnectionsDemandNotGenerated != null) { + data['WaterConnectionsDemandNotGenerated'] = this + .waterConnectionsDemandNotGenerated! + .map((v) => v.toJson()) + .toList(); + } + return data; + } +} \ No newline at end of file diff --git a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart index c9d5e3216..f6a82d062 100644 --- a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart +++ b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart @@ -371,8 +371,7 @@ class BillGenerationProvider with ChangeNotifier { children: [ Text('${ApplicationLocalizations.of(context).translate(i18.demandGenerate.ARE_YOU_SURE_TO_GENERATE_DEMAND_FOR)} "${ApplicationLocalizations.of(context).translate(billGenerateDetails.serviceType!)}" ${ApplicationLocalizations.of(context).translate(i18.demandGenerate.WITH_MINIMUM_CHARGE_OF)} : '), SizedBox(height: 10,), - SingleChildScrollView( - scrollDirection: Axis.horizontal, + FittedBox( child: DataTable( border: TableBorder.all( width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5))), columns: [ diff --git a/frontend/mgramseva/lib/providers/reports_provider.dart b/frontend/mgramseva/lib/providers/reports_provider.dart index bbc0480b1..395e5e86f 100644 --- a/frontend/mgramseva/lib/providers/reports_provider.dart +++ b/frontend/mgramseva/lib/providers/reports_provider.dart @@ -9,6 +9,7 @@ import 'package:syncfusion_flutter_xlsio/xlsio.dart'; import '../model/common/BillsTableData.dart'; import '../model/localization/language.dart'; import '../model/mdms/tax_period.dart'; +import '../model/reports/WaterConnectionCount.dart'; import '../model/reports/bill_report_data.dart'; import '../model/reports/collection_report_data.dart'; import '../model/reports/expense_bill_report_data.dart'; @@ -40,6 +41,7 @@ class ReportsProvider with ChangeNotifier { List? inactiveconsumers; List? expenseBillReportData; List? vendorReportData; + WaterConnectionCountResponse? waterConnectionCount; BillsTableData genericTableData = BillsTableData([], []); int limit = 10; int offset = 1; @@ -805,4 +807,28 @@ class ReportsProvider with ChangeNotifier { //Save and launch the file. await saveAndLaunchFile(bytes, '$title.xlsx'); } + Future getWaterConnectionsCount() async { + try { + var commonProvider = Provider.of( + navigatorKey.currentContext!, + listen: false); + Map params = { + 'tenantId': commonProvider.userDetails!.selectedtenant!.code, + }; + var response = await ReportsRepo().fetchWaterConnectionsCount(params); + if (response != null) { + waterConnectionCount = response; + streamController.add(response); + callNotifier(); + } else { + streamController.add('error'); + throw Exception('API Error'); + } + callNotifier(); + } catch (e, s) { + ErrorHandler().allExceptionsHandler(navigatorKey.currentContext!, e, s); + streamController.addError('error'); + callNotifier(); + } + } } diff --git a/frontend/mgramseva/lib/repository/reports_repo.dart b/frontend/mgramseva/lib/repository/reports_repo.dart index 4dc71a920..cc6559857 100644 --- a/frontend/mgramseva/lib/repository/reports_repo.dart +++ b/frontend/mgramseva/lib/repository/reports_repo.dart @@ -5,6 +5,7 @@ import 'package:mgramseva/services/base_service.dart'; import 'package:provider/provider.dart'; import '../model/reports/InactiveConsumerReportData.dart'; +import '../model/reports/WaterConnectionCount.dart'; import '../model/reports/bill_report_data.dart'; import '../model/reports/collection_report_data.dart'; import '../providers/common_provider.dart'; @@ -194,4 +195,36 @@ class ReportsRepo extends BaseService{ } return vendorReports; } + Future fetchWaterConnectionsCount(Map params, + [String? token]) async { + var commonProvider = Provider.of( + navigatorKey.currentContext!, + listen: false); + WaterConnectionCountResponse? waterConnectionResponse = WaterConnectionCountResponse(); + final requestInfo = RequestInfo( + APIConstants.API_MODULE_NAME, + APIConstants.API_VERSION, + APIConstants.API_TS, + '_get', + APIConstants.API_DID, + APIConstants.API_KEY, + APIConstants.API_MESSAGE_ID, + commonProvider.userDetails?.accessToken, + commonProvider.userDetails?.userRequest?.toJson()); + var res = await makeRequest( + url: Url.WATER_CONNECTION_COUNT, + queryParameters: params, + requestInfo: requestInfo, + body: {}, + method: RequestType.POST); + if (res != null ){ + try { + waterConnectionResponse = WaterConnectionCountResponse.fromJson(res); + } catch (e) { + print(e); + waterConnectionResponse = null; + } + } + return waterConnectionResponse; + } } \ No newline at end of file diff --git a/frontend/mgramseva/lib/screeens/generate_bill/generate_bill.dart b/frontend/mgramseva/lib/screeens/generate_bill/generate_bill.dart index b8260fa2a..98df601b6 100644 --- a/frontend/mgramseva/lib/screeens/generate_bill/generate_bill.dart +++ b/frontend/mgramseva/lib/screeens/generate_bill/generate_bill.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:mgramseva/providers/reports_provider.dart'; +import 'package:mgramseva/screeens/generate_bill/widgets/WaterConnectionCountWidget.dart'; import 'package:mgramseva/widgets/keyboard_focus_watcher.dart'; import 'package:mgramseva/model/bill/bill_generation_details/bill_generation_details.dart'; import 'package:mgramseva/model/connection/water_connection.dart'; @@ -78,6 +80,7 @@ class _GenerateBillState extends State { Provider.of(context, listen: false).clearBillYear(); Navigator.pop(context); },), + WaterConnectionCountWidget(), Container( width: MediaQuery.of(context).size.width, child: Card( diff --git a/frontend/mgramseva/lib/screeens/generate_bill/widgets/WaterConnectionCountWidget.dart b/frontend/mgramseva/lib/screeens/generate_bill/widgets/WaterConnectionCountWidget.dart new file mode 100644 index 000000000..8fc688c0c --- /dev/null +++ b/frontend/mgramseva/lib/screeens/generate_bill/widgets/WaterConnectionCountWidget.dart @@ -0,0 +1,159 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mgramseva/model/reports/WaterConnectionCount.dart'; +import 'package:mgramseva/providers/reports_provider.dart'; +import 'package:mgramseva/utils/constants/i18_key_constants.dart'; +import 'package:mgramseva/utils/date_formats.dart'; +import 'package:provider/provider.dart'; + +import '../../../utils/localization/application_localizations.dart'; +import '../../../widgets/label_text.dart'; + +class WaterConnectionCountWidget extends StatefulWidget { + @override + _WaterConnectionCountWidgetState createState() => + _WaterConnectionCountWidgetState(); +} + +class _WaterConnectionCountWidgetState + extends State { + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((_) => afterViewBuild()); + super.initState(); + } + afterViewBuild() { + Provider.of(context,listen: false) + ..getWaterConnectionsCount(); + } + @override + Widget build(BuildContext context) { + return Container( + width: MediaQuery.of(context).size.width, + child: Card( + child: Padding( + padding: const EdgeInsets.only(bottom: 20.0), + child: Column( + children: [ + LabelText( + '${"${ApplicationLocalizations.of(context).translate(i18.common.WS_REPORTS_WATER_CONNECTION_COUNT)}"}'), + LayoutBuilder(builder: (context, constraints) { + if (constraints.maxWidth > 760) { + return Container( + margin: + const EdgeInsets.only(top: 5.0, bottom: 5, right: 20, left: 20), + child: Consumer( + builder: (_, provider, child) { + return provider.waterConnectionCount==null?SizedBox():Container( + child: Column( + children: [ + provider.waterConnectionCount?.waterConnectionsDemandGenerated?.length==0?SizedBox():Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.centerLeft, + width: MediaQuery.of(context).size.width / 3, + padding: EdgeInsets.only(top: 18, bottom: 3), + child: Text("${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_GENERATED)}")), + Container( + width: MediaQuery.of(context).size.width / 2.5, + padding: EdgeInsets.only(top: 18, bottom: 3), + child:consumerCountTableMonthWise(provider.waterConnectionCount?.waterConnectionsDemandGenerated,constraints.maxWidth), + ) + ], + ), + SizedBox(height: 20,), + provider.waterConnectionCount?.waterConnectionsDemandNotGenerated?.length==0?SizedBox():Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.centerLeft, + width: MediaQuery.of(context).size.width / 3, + padding: EdgeInsets.only(top: 18, bottom: 3), + child: Text("${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_NOT_GENERATED)}")), + Container( + width: MediaQuery.of(context).size.width / 2.5, + padding: EdgeInsets.only(top: 18, bottom: 3), + child:consumerCountTableMonthWise(provider.waterConnectionCount?.waterConnectionsDemandNotGenerated,constraints.maxWidth), + ) + ], + ), + ], + ) + ); + }, + ), + ); + } + else{ + return Container( + margin: const EdgeInsets.only(top: 5.0, bottom: 5, right: 8, left: 8), + child: Consumer( + builder: (_, provider, child) { + return provider.waterConnectionCount==null?SizedBox():Container( + child: Column( + children: [ + provider.waterConnectionCount?.waterConnectionsDemandGenerated?.length==0?SizedBox():Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_GENERATED)}"), + SizedBox(height: 10,), + consumerCountTableMonthWise(provider.waterConnectionCount?.waterConnectionsDemandGenerated,constraints.maxWidth), + ], + ), + SizedBox(height: 20,), + provider.waterConnectionCount?.waterConnectionsDemandNotGenerated?.length==0?SizedBox():Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_NOT_GENERATED)}"), + SizedBox(height: 10,), + consumerCountTableMonthWise(provider.waterConnectionCount?.waterConnectionsDemandNotGenerated,constraints.maxWidth), + ], + ), + ], + ) + ); + }, + ), + ); + } + + } + ), + ], + ), + ), + ), + ); + } + Widget consumerCountTableMonthWise(List? waterConnectionCount,double width){ + if(width>760){ + return consumerCountTableMonthWiseWidget(waterConnectionCount); + }else{ + return + FittedBox( + child: consumerCountTableMonthWiseWidget(waterConnectionCount), + ); + } + + } + Widget consumerCountTableMonthWiseWidget(List? waterConnectionCount){ + return + DataTable( + border: TableBorder.all( + width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5))), + columns:[ + DataColumn(label: FittedBox(child: Text("${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_MONTH)}"))), + DataColumn(label: FittedBox(child: Text("${ApplicationLocalizations.of(context).translate(i18.common.CONSUMER_COUNT)}"))) + ], + rows: [ + ...?waterConnectionCount?.map((e) => DataRow( + cells: [ + DataCell(Text(DateFormats.getMonthAndYearFromDateTime(DateTime.fromMillisecondsSinceEpoch(e.taxperiodto!))),), + DataCell(Text(e.count.toString()),), + ], + )).toList(), + ], + ); + } +} diff --git a/frontend/mgramseva/lib/services/urls.dart b/frontend/mgramseva/lib/services/urls.dart index d99b7ae45..7a467755b 100644 --- a/frontend/mgramseva/lib/services/urls.dart +++ b/frontend/mgramseva/lib/services/urls.dart @@ -96,6 +96,8 @@ class Url { 'ws-services/wc/_inactiveConsumerReport'; static const String EXPENSE_BILL_REPORT= 'echallan-services/eChallan/v1/_expenseBillReport'; + static const String WATER_CONNECTION_COUNT= + 'ws-services/wc/_countWCbyDemandGenerationDate'; } diff --git a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart index 1b1573ec4..9132cbaf9 100644 --- a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart +++ b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart @@ -38,6 +38,11 @@ class Login { class Common { const Common(); String get CONTINUE => 'CORE_COMMON_CONTINUE'; + String get LAST_BILL_CYCLE_MONTH => 'LAST_BILL_CYCLE_MONTH'; + String get CONSUMER_COUNT => 'CONSUMER_COUNT'; + String get LAST_BILL_CYCLE_DEMAND_NOT_GENERATED => 'LAST_BILL_CYCLE_DEMAND_NOT_GENERATED'; + String get LAST_BILL_CYCLE_DEMAND_GENERATED => 'LAST_BILL_CYCLE_DEMAND_GENERATED'; + String get WS_REPORTS_WATER_CONNECTION_COUNT => 'WS_REPORTS_WATER_CONNECTION_COUNT'; String get NAME => 'CORE_COMMON_NAME'; String get CONTINUE_TO_LOGIN => 'CONTINUE_TO_LOGIN'; String get PHONE_NUMBER => 'CORE_COMMON_PHONE_NUMBER'; From 2260d60afafe640b739c0ccd62c78b871422607d Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Thu, 1 Feb 2024 19:35:38 +0530 Subject: [PATCH 28/33] PFM-5473 -frontend --- frontend/mgramseva/lib/widgets/select_field_builder.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/mgramseva/lib/widgets/select_field_builder.dart b/frontend/mgramseva/lib/widgets/select_field_builder.dart index 2945df97c..d7b74773d 100644 --- a/frontend/mgramseva/lib/widgets/select_field_builder.dart +++ b/frontend/mgramseva/lib/widgets/select_field_builder.dart @@ -124,6 +124,11 @@ class SelectFieldBuilderState extends State { items: widget.options, onChanged: widget.widget, enabled: !widget.readOnly!, + dropdownDecoratorProps: DropDownDecoratorProps( + baseStyle: TextStyle( + color: !widget.readOnly!?Theme.of(context).primaryColorDark:Colors.grey + ) + ), popupProps: PopupProps.menu( showSearchBox: widget.showSearchBox, fit: FlexFit.loose, From 0e724858bd1dbcd8af841aa1b25605dfc6fa99e0 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Thu, 1 Feb 2024 20:25:33 +0530 Subject: [PATCH 29/33] fixed date month localization --- frontend/mgramseva/lib/utils/date_formats.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/mgramseva/lib/utils/date_formats.dart b/frontend/mgramseva/lib/utils/date_formats.dart index 7007c13b1..ef1844984 100644 --- a/frontend/mgramseva/lib/utils/date_formats.dart +++ b/frontend/mgramseva/lib/utils/date_formats.dart @@ -119,7 +119,7 @@ class DateFormats { static String getMonthAndYearFromDateTime(DateTime date) { try { - return '${DateFormat.MMM().format(date)}-${DateFormat.y().format(date)}'; + return '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(Constants.MONTHS[date.month-1])}-${DateFormat.y().format(date)}'; } catch (e) { return ''; } From 90a9f88db2755bae4c8de2de9261360f0c5c36ee Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:31:45 +0530 Subject: [PATCH 30/33] implemented the collapsable table --- .../screeens/generate_bill/generate_bill.dart | 2 +- .../widgets/WaterConnectionCountWidget.dart | 159 ------------------ .../widgets/count_table_widget.dart | 92 ++++++++++ .../water_connection_count_widget.dart | 128 ++++++++++++++ .../utils/constants/i18_key_constants.dart | 1 + 5 files changed, 222 insertions(+), 160 deletions(-) delete mode 100644 frontend/mgramseva/lib/screeens/generate_bill/widgets/WaterConnectionCountWidget.dart create mode 100644 frontend/mgramseva/lib/screeens/generate_bill/widgets/count_table_widget.dart create mode 100644 frontend/mgramseva/lib/screeens/generate_bill/widgets/water_connection_count_widget.dart diff --git a/frontend/mgramseva/lib/screeens/generate_bill/generate_bill.dart b/frontend/mgramseva/lib/screeens/generate_bill/generate_bill.dart index 98df601b6..c3e31cc22 100644 --- a/frontend/mgramseva/lib/screeens/generate_bill/generate_bill.dart +++ b/frontend/mgramseva/lib/screeens/generate_bill/generate_bill.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:mgramseva/providers/reports_provider.dart'; -import 'package:mgramseva/screeens/generate_bill/widgets/WaterConnectionCountWidget.dart'; +import 'package:mgramseva/screeens/generate_bill/widgets/water_connection_count_widget.dart'; import 'package:mgramseva/widgets/keyboard_focus_watcher.dart'; import 'package:mgramseva/model/bill/bill_generation_details/bill_generation_details.dart'; import 'package:mgramseva/model/connection/water_connection.dart'; diff --git a/frontend/mgramseva/lib/screeens/generate_bill/widgets/WaterConnectionCountWidget.dart b/frontend/mgramseva/lib/screeens/generate_bill/widgets/WaterConnectionCountWidget.dart deleted file mode 100644 index 8fc688c0c..000000000 --- a/frontend/mgramseva/lib/screeens/generate_bill/widgets/WaterConnectionCountWidget.dart +++ /dev/null @@ -1,159 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:mgramseva/model/reports/WaterConnectionCount.dart'; -import 'package:mgramseva/providers/reports_provider.dart'; -import 'package:mgramseva/utils/constants/i18_key_constants.dart'; -import 'package:mgramseva/utils/date_formats.dart'; -import 'package:provider/provider.dart'; - -import '../../../utils/localization/application_localizations.dart'; -import '../../../widgets/label_text.dart'; - -class WaterConnectionCountWidget extends StatefulWidget { - @override - _WaterConnectionCountWidgetState createState() => - _WaterConnectionCountWidgetState(); -} - -class _WaterConnectionCountWidgetState - extends State { - @override - void initState() { - WidgetsBinding.instance.addPostFrameCallback((_) => afterViewBuild()); - super.initState(); - } - afterViewBuild() { - Provider.of(context,listen: false) - ..getWaterConnectionsCount(); - } - @override - Widget build(BuildContext context) { - return Container( - width: MediaQuery.of(context).size.width, - child: Card( - child: Padding( - padding: const EdgeInsets.only(bottom: 20.0), - child: Column( - children: [ - LabelText( - '${"${ApplicationLocalizations.of(context).translate(i18.common.WS_REPORTS_WATER_CONNECTION_COUNT)}"}'), - LayoutBuilder(builder: (context, constraints) { - if (constraints.maxWidth > 760) { - return Container( - margin: - const EdgeInsets.only(top: 5.0, bottom: 5, right: 20, left: 20), - child: Consumer( - builder: (_, provider, child) { - return provider.waterConnectionCount==null?SizedBox():Container( - child: Column( - children: [ - provider.waterConnectionCount?.waterConnectionsDemandGenerated?.length==0?SizedBox():Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - alignment: Alignment.centerLeft, - width: MediaQuery.of(context).size.width / 3, - padding: EdgeInsets.only(top: 18, bottom: 3), - child: Text("${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_GENERATED)}")), - Container( - width: MediaQuery.of(context).size.width / 2.5, - padding: EdgeInsets.only(top: 18, bottom: 3), - child:consumerCountTableMonthWise(provider.waterConnectionCount?.waterConnectionsDemandGenerated,constraints.maxWidth), - ) - ], - ), - SizedBox(height: 20,), - provider.waterConnectionCount?.waterConnectionsDemandNotGenerated?.length==0?SizedBox():Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - alignment: Alignment.centerLeft, - width: MediaQuery.of(context).size.width / 3, - padding: EdgeInsets.only(top: 18, bottom: 3), - child: Text("${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_NOT_GENERATED)}")), - Container( - width: MediaQuery.of(context).size.width / 2.5, - padding: EdgeInsets.only(top: 18, bottom: 3), - child:consumerCountTableMonthWise(provider.waterConnectionCount?.waterConnectionsDemandNotGenerated,constraints.maxWidth), - ) - ], - ), - ], - ) - ); - }, - ), - ); - } - else{ - return Container( - margin: const EdgeInsets.only(top: 5.0, bottom: 5, right: 8, left: 8), - child: Consumer( - builder: (_, provider, child) { - return provider.waterConnectionCount==null?SizedBox():Container( - child: Column( - children: [ - provider.waterConnectionCount?.waterConnectionsDemandGenerated?.length==0?SizedBox():Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_GENERATED)}"), - SizedBox(height: 10,), - consumerCountTableMonthWise(provider.waterConnectionCount?.waterConnectionsDemandGenerated,constraints.maxWidth), - ], - ), - SizedBox(height: 20,), - provider.waterConnectionCount?.waterConnectionsDemandNotGenerated?.length==0?SizedBox():Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text("${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_NOT_GENERATED)}"), - SizedBox(height: 10,), - consumerCountTableMonthWise(provider.waterConnectionCount?.waterConnectionsDemandNotGenerated,constraints.maxWidth), - ], - ), - ], - ) - ); - }, - ), - ); - } - - } - ), - ], - ), - ), - ), - ); - } - Widget consumerCountTableMonthWise(List? waterConnectionCount,double width){ - if(width>760){ - return consumerCountTableMonthWiseWidget(waterConnectionCount); - }else{ - return - FittedBox( - child: consumerCountTableMonthWiseWidget(waterConnectionCount), - ); - } - - } - Widget consumerCountTableMonthWiseWidget(List? waterConnectionCount){ - return - DataTable( - border: TableBorder.all( - width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5))), - columns:[ - DataColumn(label: FittedBox(child: Text("${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_MONTH)}"))), - DataColumn(label: FittedBox(child: Text("${ApplicationLocalizations.of(context).translate(i18.common.CONSUMER_COUNT)}"))) - ], - rows: [ - ...?waterConnectionCount?.map((e) => DataRow( - cells: [ - DataCell(Text(DateFormats.getMonthAndYearFromDateTime(DateTime.fromMillisecondsSinceEpoch(e.taxperiodto!))),), - DataCell(Text(e.count.toString()),), - ], - )).toList(), - ], - ); - } -} diff --git a/frontend/mgramseva/lib/screeens/generate_bill/widgets/count_table_widget.dart b/frontend/mgramseva/lib/screeens/generate_bill/widgets/count_table_widget.dart new file mode 100644 index 000000000..d00b0d065 --- /dev/null +++ b/frontend/mgramseva/lib/screeens/generate_bill/widgets/count_table_widget.dart @@ -0,0 +1,92 @@ +import 'package:flutter/material.dart'; +import 'package:mgramseva/model/reports/WaterConnectionCount.dart'; +import 'package:mgramseva/utils/constants/i18_key_constants.dart'; +import '../../../utils/date_formats.dart'; +import '../../../utils/localization/application_localizations.dart'; + +class CountTableWidget extends StatefulWidget { + final List? waterConnectionCount; + + const CountTableWidget({Key? key, this.waterConnectionCount}) + : super(key: key); + + @override + _CountTableWidgetState createState() => _CountTableWidgetState(); +} + +class _CountTableWidgetState extends State { + bool _isCollapsed = true; + + @override + Widget build(BuildContext context) { + final List? connectionCount = + widget.waterConnectionCount; + + return Container( + child: Column( + children: [ + LayoutBuilder( + builder: (context, constraints) { + if (constraints.maxWidth <= 760) { + return Container( + width: MediaQuery.of(context).size.width, + child: FittedBox( + child: _buildDataTable(connectionCount!), + ), + ); + } else { + return Container( + width: MediaQuery.of(context).size.width, + child: _buildDataTable(connectionCount!)); + } + }, + ), + if (connectionCount!.length >= 5) + Align( + alignment: Alignment.bottomRight, + child: TextButton( + onPressed: () { + setState(() { + _isCollapsed = !_isCollapsed; + }); + }, + child: Text(_isCollapsed + ? "${ApplicationLocalizations.of(context).translate(i18.common.VIEW_ALL)}" + : "${ApplicationLocalizations.of(context).translate(i18.common.COLLAPSE)}"), + ), + ), + ], + ), + ); + } + + Widget _buildDataTable(List connectionCount) { + return DataTable( + border: TableBorder.all( + width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5))), + columns: [ + DataColumn( + label: FittedBox( + child: Text( + "${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_MONTH)}"))), + DataColumn( + label: FittedBox( + child: Text( + "${ApplicationLocalizations.of(context).translate(i18.common.CONSUMER_COUNT)}"))) + ], + rows: _isCollapsed + ? connectionCount.take(5).map((e) => _buildDataRow(e)).toList() + : connectionCount.map((e) => _buildDataRow(e)).toList(), + ); + } + + DataRow _buildDataRow(WaterConnectionCount count) { + return DataRow( + cells: [ + DataCell(Text(DateFormats.getMonthAndYearFromDateTime( + DateTime.fromMillisecondsSinceEpoch(count.taxperiodto!)))), + DataCell(Text(count.count.toString())), + ], + ); + } +} diff --git a/frontend/mgramseva/lib/screeens/generate_bill/widgets/water_connection_count_widget.dart b/frontend/mgramseva/lib/screeens/generate_bill/widgets/water_connection_count_widget.dart new file mode 100644 index 000000000..4ad18b03c --- /dev/null +++ b/frontend/mgramseva/lib/screeens/generate_bill/widgets/water_connection_count_widget.dart @@ -0,0 +1,128 @@ +import 'package:flutter/material.dart'; +import 'package:mgramseva/model/reports/WaterConnectionCount.dart'; +import 'package:mgramseva/providers/reports_provider.dart'; +import 'package:mgramseva/utils/constants/i18_key_constants.dart'; +import 'package:provider/provider.dart'; + +import '../../../utils/localization/application_localizations.dart'; +import '../../../widgets/label_text.dart'; +import 'count_table_widget.dart'; + +class WaterConnectionCountWidget extends StatefulWidget { + @override + _WaterConnectionCountWidgetState createState() => + _WaterConnectionCountWidgetState(); +} + +class _WaterConnectionCountWidgetState + extends State { + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((_) => afterViewBuild()); + super.initState(); + } + + afterViewBuild() { + Provider.of(context, listen: false) + ..getWaterConnectionsCount(); + } + + @override + Widget build(BuildContext context) { + return Container( + width: MediaQuery.of(context).size.width, + child: Card( + child: Padding( + padding: const EdgeInsets.only(bottom: 20.0), + child: Container( + child: Column( + children: [ + LabelText( + '${"${ApplicationLocalizations.of(context).translate(i18.common.WS_REPORTS_WATER_CONNECTION_COUNT)}"}'), + Container( + margin: MediaQuery.of(context).size.width > 760 + ? EdgeInsets.only(top: 5.0, bottom: 5, right: 20, left: 20) + : EdgeInsets.only(top: 5.0, bottom: 5, right: 8, left: 8), + child: LayoutBuilder( + builder: (context, constraints) { + final provider = Provider.of(context); + final waterConnectionCount = provider.waterConnectionCount; + if (waterConnectionCount == null) { + return SizedBox(); + } + return Column( + children: [ + if (constraints.maxWidth > 760) + _buildDataTableRow( + context, + "${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_GENERATED)}", + waterConnectionCount + .waterConnectionsDemandGenerated, + ), + if (constraints.maxWidth <= 760) + _buildDataTableColumn( + context, + "${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_GENERATED)}", + waterConnectionCount + .waterConnectionsDemandGenerated, + ), + SizedBox(height: 20), + if (constraints.maxWidth > 760) + _buildDataTableRow( + context, + "${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_NOT_GENERATED)}", + waterConnectionCount + .waterConnectionsDemandNotGenerated, + ), + if (constraints.maxWidth <= 760) + _buildDataTableColumn( + context, + "${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_NOT_GENERATED)}", + waterConnectionCount + .waterConnectionsDemandNotGenerated, + ), + ], + ); + }, + ), + ), + ], + ), + ), + ), + ), + ); + } + + Widget _buildDataTableRow(BuildContext context, String title, + List? waterConnections) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.centerLeft, + width: MediaQuery.of(context).size.width / 3, + padding: EdgeInsets.only(top: 18, bottom: 3), + child: Text(title), + ), + Container( + width: MediaQuery.of(context).size.width / 2.5, + padding: EdgeInsets.only(top: 18, bottom: 3), + child: CountTableWidget(waterConnectionCount: waterConnections), + ), + ], + ); + } + + Widget _buildDataTableColumn(BuildContext context, String title, + List? waterConnections) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title), + SizedBox(height: 10), + CountTableWidget(waterConnectionCount: waterConnections), + ], + ); + } +} diff --git a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart index 9132cbaf9..1a6634757 100644 --- a/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart +++ b/frontend/mgramseva/lib/utils/constants/i18_key_constants.dart @@ -43,6 +43,7 @@ class Common { String get LAST_BILL_CYCLE_DEMAND_NOT_GENERATED => 'LAST_BILL_CYCLE_DEMAND_NOT_GENERATED'; String get LAST_BILL_CYCLE_DEMAND_GENERATED => 'LAST_BILL_CYCLE_DEMAND_GENERATED'; String get WS_REPORTS_WATER_CONNECTION_COUNT => 'WS_REPORTS_WATER_CONNECTION_COUNT'; + String get COLLAPSE => 'COLLAPSE'; String get NAME => 'CORE_COMMON_NAME'; String get CONTINUE_TO_LOGIN => 'CONTINUE_TO_LOGIN'; String get PHONE_NUMBER => 'CORE_COMMON_PHONE_NUMBER'; From d57dfac4df93c651cabe68958e9f2180dccac70c Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:46:15 +0530 Subject: [PATCH 31/33] implemented the collapsable table --- .../bill_generation_details_provider.dart | 3 +- .../widgets/count_table_widget.dart | 41 ++++++++++++++----- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart index f6a82d062..16dc0647e 100644 --- a/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart +++ b/frontend/mgramseva/lib/providers/bill_generation_details_provider.dart @@ -374,7 +374,8 @@ class BillGenerationProvider with ChangeNotifier { FittedBox( child: DataTable( border: TableBorder.all( - width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5))), columns: [ + width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5)), + color: Colors.grey,), columns: [ DataColumn( label: Text( "${ApplicationLocalizations.of(context).translate(i18.searchWaterConnection.CONNECTION_TYPE)}", diff --git a/frontend/mgramseva/lib/screeens/generate_bill/widgets/count_table_widget.dart b/frontend/mgramseva/lib/screeens/generate_bill/widgets/count_table_widget.dart index d00b0d065..c1be7e756 100644 --- a/frontend/mgramseva/lib/screeens/generate_bill/widgets/count_table_widget.dart +++ b/frontend/mgramseva/lib/screeens/generate_bill/widgets/count_table_widget.dart @@ -63,16 +63,26 @@ class _CountTableWidgetState extends State { Widget _buildDataTable(List connectionCount) { return DataTable( border: TableBorder.all( - width: 0.5, borderRadius: BorderRadius.all(Radius.circular(5))), + width: 0.5, + borderRadius: BorderRadius.all(Radius.circular(5)), + color: Colors.grey, // Set border color to grey + ),// Set heading row background color to grey + headingTextStyle: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), // Set heading text color to black and bold columns: [ DataColumn( - label: FittedBox( - child: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_MONTH)}"))), + label: FittedBox( + child: Text( + "${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_MONTH)}", + ), + ), + ), DataColumn( - label: FittedBox( - child: Text( - "${ApplicationLocalizations.of(context).translate(i18.common.CONSUMER_COUNT)}"))) + label: FittedBox( + child: Text( + "${ApplicationLocalizations.of(context).translate(i18.common.CONSUMER_COUNT)}", + ), + ), + ) ], rows: _isCollapsed ? connectionCount.take(5).map((e) => _buildDataRow(e)).toList() @@ -81,11 +91,22 @@ class _CountTableWidgetState extends State { } DataRow _buildDataRow(WaterConnectionCount count) { + final bool isEvenRow = widget.waterConnectionCount!.indexOf(count) % 2 == 0; + final Color? rowColor = isEvenRow ? Colors.grey[100] : Colors.white; // Set alternate row background color to grey + return DataRow( + color: MaterialStateColor.resolveWith((states) => rowColor!), // Apply alternate row background color cells: [ - DataCell(Text(DateFormats.getMonthAndYearFromDateTime( - DateTime.fromMillisecondsSinceEpoch(count.taxperiodto!)))), - DataCell(Text(count.count.toString())), + DataCell( + Text( + DateFormats.getMonthAndYearFromDateTime( + DateTime.fromMillisecondsSinceEpoch(count.taxperiodto!), + ), + ), + ), + DataCell( + Text(count.count.toString()), + ), ], ); } From 3b5809bb0a79277f7314fcaef4f72ff20df6a648 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:52:56 +0530 Subject: [PATCH 32/33] implemented the collapsable table --- .../water_connection_count_widget.dart | 38 ++++++++++++++++--- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/frontend/mgramseva/lib/screeens/generate_bill/widgets/water_connection_count_widget.dart b/frontend/mgramseva/lib/screeens/generate_bill/widgets/water_connection_count_widget.dart index 4ad18b03c..feb66b3a0 100644 --- a/frontend/mgramseva/lib/screeens/generate_bill/widgets/water_connection_count_widget.dart +++ b/frontend/mgramseva/lib/screeens/generate_bill/widgets/water_connection_count_widget.dart @@ -41,25 +41,39 @@ class _WaterConnectionCountWidgetState '${"${ApplicationLocalizations.of(context).translate(i18.common.WS_REPORTS_WATER_CONNECTION_COUNT)}"}'), Container( margin: MediaQuery.of(context).size.width > 760 - ? EdgeInsets.only(top: 5.0, bottom: 5, right: 20, left: 20) + ? EdgeInsets.only( + top: 5.0, bottom: 5, right: 20, left: 20) : EdgeInsets.only(top: 5.0, bottom: 5, right: 8, left: 8), child: LayoutBuilder( builder: (context, constraints) { final provider = Provider.of(context); - final waterConnectionCount = provider.waterConnectionCount; + final waterConnectionCount = + provider.waterConnectionCount; if (waterConnectionCount == null) { return SizedBox(); } return Column( children: [ - if (constraints.maxWidth > 760) + if (waterConnectionCount.waterConnectionsDemandGenerated != + null && + waterConnectionCount + .waterConnectionsDemandGenerated + ?.length != + 0 && + constraints.maxWidth > 760) _buildDataTableRow( context, "${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_GENERATED)}", waterConnectionCount .waterConnectionsDemandGenerated, ), - if (constraints.maxWidth <= 760) + if (waterConnectionCount.waterConnectionsDemandGenerated != + null && + waterConnectionCount + .waterConnectionsDemandGenerated + ?.length != + 0 && + constraints.maxWidth <= 760) _buildDataTableColumn( context, "${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_GENERATED)}", @@ -67,14 +81,26 @@ class _WaterConnectionCountWidgetState .waterConnectionsDemandGenerated, ), SizedBox(height: 20), - if (constraints.maxWidth > 760) + if (waterConnectionCount.waterConnectionsDemandNotGenerated != + null && + waterConnectionCount + .waterConnectionsDemandNotGenerated + ?.length != + 0 && + constraints.maxWidth > 760) _buildDataTableRow( context, "${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_NOT_GENERATED)}", waterConnectionCount .waterConnectionsDemandNotGenerated, ), - if (constraints.maxWidth <= 760) + if (waterConnectionCount.waterConnectionsDemandNotGenerated != + null && + waterConnectionCount + .waterConnectionsDemandNotGenerated + ?.length != + 0 && + constraints.maxWidth <= 760) _buildDataTableColumn( context, "${ApplicationLocalizations.of(context).translate(i18.common.LAST_BILL_CYCLE_DEMAND_NOT_GENERATED)}", From 98b6b8b145f93792c482aefdf63a65a4b7090285 Mon Sep 17 00:00:00 2001 From: Rahul Dev Garg <34365102+rahuldevgarg@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:55:21 +0530 Subject: [PATCH 33/33] implemented the collapsable table --- .../lib/screeens/generate_bill/widgets/count_table_widget.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/mgramseva/lib/screeens/generate_bill/widgets/count_table_widget.dart b/frontend/mgramseva/lib/screeens/generate_bill/widgets/count_table_widget.dart index c1be7e756..51587cbfd 100644 --- a/frontend/mgramseva/lib/screeens/generate_bill/widgets/count_table_widget.dart +++ b/frontend/mgramseva/lib/screeens/generate_bill/widgets/count_table_widget.dart @@ -41,7 +41,7 @@ class _CountTableWidgetState extends State { } }, ), - if (connectionCount!.length >= 5) + if (connectionCount!.length > 5) Align( alignment: Alignment.bottomRight, child: TextButton(