Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #720

Merged
merged 3 commits into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ public class WsQueryBuilder {
+ "eg_ws_connectionholder connectionholder ON connectionholder.connectionid = conn.id"
+ LEFT_OUTER_JOIN_STRING + "eg_ws_roadcuttinginfo roadcuttingInfo ON roadcuttingInfo.wsid = conn.id";

private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT ((select distinct d.taxperiodto as taxperiodto from egbs_demand_v1 d where d.status = 'ACTIVE' and d.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.taxperiodto desc limit 1)) as taxperiodto, count(*) as count" +
" FROM eg_ws_connection conn INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id and wc.connectiontype='Non_Metered'and conn.status='Active'";
private static final String WATER_CONNNECTION_BY_DEMANNDDATE = "SELECT ((select distinct d.taxperiodto as taxperiodto from egbs_demand_v1 d inner join egbs_demanddetail_v1 dd on dd.demandid = d.id ";
private static final String WATER_CONNNECTION_BY_DEMANNDDATE_CLAUSE = " and dd.taxheadcode='10101' and d.status = 'ACTIVE' and d.businessservice = 'WS' and d.consumercode = conn.connectionno order by d.taxperiodto desc limit 1))" +
" as taxperiodto, count(*) as count ";
private static final String WATER_CONNNECTION_BY_DEMANNDDATE_FROM =" FROM eg_ws_connection conn INNER JOIN eg_ws_service wc ON wc.connection_id = conn.id and wc.connectiontype='Non_Metered'and conn.status='Active' ";

private static final String WATER_CONNECTION_BY_PREVIOUSREADINNDATE = "select previousreadingdate as taxperiodto , count(*) as count from eg_ws_connection conn";

private static final String CONSUMERCODE_IN_DEMANDTABLE= "select consumercode from egbs_demand_v1 d";
private static final String CONSUMERCODE_IN_DEMANDTABLE= "select distinct consumercode from egbs_demand_v1 d inner join egbs_demanddetail_v1 dd on dd.demandid = d.id ";
private static final String PAGINATION_WRAPPER = "{} {orderby} {pagination}";

private static final String ORDER_BY_CLAUSE = " ORDER BY wc.appCreatedDate DESC";
Expand Down Expand Up @@ -715,6 +717,9 @@ public String getQueryForWCCountbyDemandDate(SearchCriteria criteria, List<Objec
if (criteria.isEmpty() || criteria.getTenantId().isEmpty())
return null;
StringBuilder query = new StringBuilder(WATER_CONNNECTION_BY_DEMANNDDATE);
query.append( "WHERE d.tenantid = '" +criteria.getTenantId()+"' " );
query.append(WATER_CONNNECTION_BY_DEMANNDDATE_CLAUSE);
query.append(WATER_CONNNECTION_BY_DEMANNDDATE_FROM);
applyFiltersForPlaneSearch(query,preparedStatement,criteria);
query.append(" GROUP BY taxperiodto ");
return query.toString();
Expand All @@ -725,7 +730,8 @@ 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.status ='ACTIVE' and 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 dd.taxheadcode='10101' and d.status ='ACTIVE' and d.businessservice='WS' and d.tenantid='"+criteria.getTenantId()+"') ");
query.append(" GROUP BY taxperiodto ");
return query.toString();
}
Expand Down
Loading