sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} where reference_type='{key_type}' GROUP BY reference_type, type ORDER BY reference_type"
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} where reference_type='{key_type}' GROUP BY reference_type, type ORDER BY reference_type"
ifnameandnotkey_type:
ifnameandnotkey_type:
...
@@ -89,7 +88,7 @@ class CalculationMonthlyBill(object):
...
@@ -89,7 +88,7 @@ class CalculationMonthlyBill(object):
ifnotnameandnotkey_type:
ifnotnameandnotkey_type:
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} GROUP BY reference_type, type ORDER BY reference_type"
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} GROUP BY reference_type, type ORDER BY reference_type"
sql=f"SELECT uuid,reference_type,order_number,order_id,type,cast(amount as decimal(20,6))/1000 as money,amount_type,create_time FROM {date} where order_id={error_list[0]}"
sql=f"SELECT uuid,reference_type,order_number,order_id,type,cast(amount as decimal(20,6))/1000 as money,amount_type,create_time FROM {date} where order_id={error_list[0]}"
...
@@ -155,7 +151,7 @@ class CalculationMonthlyDetails(object):
...
@@ -155,7 +151,7 @@ class CalculationMonthlyDetails(object):
sql=f"SELECT uuid,reference_type,order_number,order_id,type,cast(amount as decimal(20,6))/1000 as money,amount_type,create_time FROM {date} where order_id in({','.join(error_list)})"
sql=f"SELECT uuid,reference_type,order_number,order_id,type,cast(amount as decimal(20,6))/1000 as money,amount_type,create_time FROM {date} where order_id in({','.join(error_list)})"
iflen(error_list)==0:
iflen(error_list)==0:
return[]
return[]
result=LinkMysql(database).query_mysql(sql)
result=LinkMysql(env.DB_HISTORY).query_mysql(sql)
returnresult
returnresult
...
@@ -176,14 +172,12 @@ class MonthDataDerive(object):
...
@@ -176,14 +172,12 @@ class MonthDataDerive(object):
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} where reference_type='{key_type}' GROUP BY reference_type, type ORDER BY reference_type"
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} where reference_type='{key_type}' GROUP BY reference_type, type ORDER BY reference_type"
else:
else:
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} GROUP BY reference_type, type ORDER BY reference_type"
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} GROUP BY reference_type, type ORDER BY reference_type"
count_sql=f"select count(id) as num from finance_fix_log where {' and '.join(finance_filters)}"
returndata,count
data_sql=f"select id,type,money,unique_tag,amount_type,operator,create_time,remark from finance_fix_log where {' and '.join(finance_filters)} order by id DESC limit {(int(page) - 1) * size},{size}"
else:
count_sql=f"select count(id) as num from finance_fix_log"
data_sql=f"select id,type,money,unique_tag,amount_type,operator,create_time,remark from finance_fix_log order by id DESC limit {(int(page) - 1) * size},{size}"