Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Taniya-eGov authored Aug 8, 2024
2 parents cc34a75 + 7a3e5a1 commit f6933a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,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 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 ";
Expand Down Expand Up @@ -772,7 +773,7 @@ private String addPaginationWrapperForPlaneSearch(String query, List<Object> pre

private String addOrderByClauseForPlaneSearch(SearchCriteria criteria) {
StringBuilder builder = new StringBuilder();
builder.append(" ORDER BY wc.appCreatedDate ");
builder.append(" ORDER BY conn.createdTime");
if (criteria.getSortOrder() == SearchCriteria.SortOrder.ASC)
builder.append(" ASC ");
else
Expand Down
31 changes: 3 additions & 28 deletions utilities/rollout-dashboard-cronjob-indexer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def getGPWSCHeirarchy():
try:
mdms_url = os.getenv('API_URL')
state_tenantid = os.getenv('TENANT_ID')
url=os.getenv('IFIX_DEP_ENTITY_URL')
mdms_requestData = {
"RequestInfo": {
"apiId": "mgramseva-common",
Expand Down Expand Up @@ -56,7 +57,7 @@ def getGPWSCHeirarchy():
if tenant.get('city') is not None and tenant.get('city').get('code') is not None:
teanant_data_Map.update({tenant.get('city').get('code'): tenant.get('code')})

url = 'https://mgramseva-dwss.punjab.gov.in/'
# url = 'https://mgramseva-dwss.punjab.gov.in/'
print(url)
requestData = {
"requestHeader": {
Expand Down Expand Up @@ -926,32 +927,6 @@ def createEntryForRolloutToElasticSearch(tenant, activeUsersCount, totalAdvance,
def process():
print("continue is the process")

try:
connection = getConnection()
cursor = connection.cursor()

print("cursor: ", cursor)

DROPPING_TABLE_QUERY = " drop table if exists roll_out_dashboard "
cursor.execute(DROPPING_TABLE_QUERY)

connection.commit()

createTableQuery = createTable()
cursor.execute(createTableQuery)

connection.commit()

print("table dropped")
except Exception as exception:
print("Exception occurred while connecting to the database")
print(exception)

finally:
if connection:
cursor.close()
connection.close()

tenants = getGPWSCHeirarchy()
for tenant in tenants:
print("Tenant:", tenant['tenantId'])
Expand Down Expand Up @@ -1071,4 +1046,4 @@ def createTable():


if __name__ == '__main__':
process()
process()
10 changes: 6 additions & 4 deletions utilities/rollout-dashboard-cronjob/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def getGPWSCHeirarchy():
try:
mdms_url = os.getenv('API_URL')
state_tenantid = os.getenv('TENANT_ID')
url=os.getenv('IFIX_DEP_ENTITY_URL')
mdms_requestData = {
"RequestInfo": {
"apiId": "mgramseva-common",
Expand Down Expand Up @@ -54,7 +55,7 @@ def getGPWSCHeirarchy():
if tenant.get('city') is not None and tenant.get('city').get('code') is not None:
teanant_data_Map.update({tenant.get('city').get('code'): tenant.get('code')})

url = 'https://mgramseva-dwss.punjab.gov.in/'

print(url)
requestData = {
"requestHeader": {
Expand Down Expand Up @@ -106,7 +107,7 @@ def getGPWSCHeirarchy():
print(formatedTenantId)
obj1 = {"tenantId": formatedTenantId, "zone": zone, "circle": circle,
"division": division, "subdivision": subdivision,
"section": section, "projectcode": tenantCode}
"section": section, "projectcode": tenantCode, "tenantName":tenantName}
dataList.append(obj1)
print("heirarchy collected")
return (dataList)
Expand Down Expand Up @@ -792,8 +793,8 @@ def createEntryForRollout(tenant,activeUsersCount,totalAdvance, totalPenalty,tot
createdTime = datetime.now(tz=tzInfo)
print("createdtime -->", createdTime)

postgres_insert_query = "INSERT INTO roll_out_dashboard (tenantid, projectcode, zone, circle, division, subdivision, section,active_users_count,total_advance,total_penalty,total_connections,active_connections, last_demand_gen_date, demand_generated_consumer_count,total_demand_amount,collection_till_date,last_collection_date,expense_count,count_of_electricity_expense_bills,no_of_paid_expense_bills,last_expense_txn_date,total_amount_of_expense_bills,total_amount_of_electricity_bills,total_amount_of_paid_expense_bills,date_range,createdtime) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
record_to_insert = (tenant['tenantId'], tenant['projectcode'], tenant['zone'], tenant['circle'], tenant['division'], tenant['subdivision'], tenant['section'],activeUsersCount,totalAdvance, totalPenalty,totalConsumerCount,consumerCount,lastDemandGenratedDate,noOfDemandRaised,totaldemAmount,collectionsMade,lastCollectionDate, expenseCount,countOfElectricityExpenseBills,noOfPaidExpenseBills, lastExpTrnsDate, totalAmountOfExpenseBills, totalAmountOfElectricityBills, totalAmountOfPaidExpenseBills,date, createdTime)
postgres_insert_query = "INSERT INTO roll_out_dashboard (tenantid, tenantName, projectcode, zone, circle, division, subdivision, section,active_users_count,total_advance,total_penalty,total_connections,active_connections, last_demand_gen_date, demand_generated_consumer_count,total_demand_amount,collection_till_date,last_collection_date,expense_count,count_of_electricity_expense_bills,no_of_paid_expense_bills,last_expense_txn_date,total_amount_of_expense_bills,total_amount_of_electricity_bills,total_amount_of_paid_expense_bills,date_range,createdtime) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
record_to_insert = (tenant['tenantId'],tenant['tenantName'], tenant['projectcode'], tenant['zone'], tenant['circle'], tenant['division'], tenant['subdivision'], tenant['section'],activeUsersCount,totalAdvance, totalPenalty,totalConsumerCount,consumerCount,lastDemandGenratedDate,noOfDemandRaised,totaldemAmount,collectionsMade,lastCollectionDate, expenseCount,countOfElectricityExpenseBills,noOfPaidExpenseBills, lastExpTrnsDate, totalAmountOfExpenseBills, totalAmountOfElectricityBills, totalAmountOfPaidExpenseBills,date, createdTime)
cursor.execute(postgres_insert_query, record_to_insert)

connection.commit()
Expand Down Expand Up @@ -893,6 +894,7 @@ def createTable():
CREATE_TABLE_QUERY = """create table roll_out_dashboard(
id SERIAL primary key,
tenantid varchar(250) NOT NULL,
tenantName varchar(500),
projectcode varchar(66),
zone varchar(250),
circle varchar(250),
Expand Down

0 comments on commit f6933a2

Please sign in to comment.