美化表格
This commit is contained in:
@@ -8,7 +8,8 @@ from lib.sum_data_collector import (
|
||||
add_sum_data,
|
||||
update_sum_data,
|
||||
delete_sum_data,
|
||||
batch_delete_sum_data
|
||||
batch_delete_sum_data,
|
||||
get_monthly_charge_degree_total
|
||||
)
|
||||
from . import sum_data_bp
|
||||
|
||||
@@ -128,3 +129,26 @@ def batch_delete_sum_data_api():
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return jsonify({'success': False, 'message': str(e)}), 500
|
||||
|
||||
|
||||
@sum_data_bp.route('/sum-data/monthly-total', methods=['GET'])
|
||||
def monthly_charge_degree_total():
|
||||
"""获取指定配置当月充电电量累计(从sum_data表查询,对账后的数据)
|
||||
|
||||
参数:
|
||||
config_id: 配置ID(可选,不传则查所有配置总和)
|
||||
month: 月份,格式 YYYY-MM(可选,默认当月)
|
||||
"""
|
||||
try:
|
||||
config_id = request.args.get('config_id')
|
||||
month = request.args.get('month')
|
||||
|
||||
result = get_monthly_charge_degree_total(config_id, month)
|
||||
if result['success']:
|
||||
return jsonify(result)
|
||||
else:
|
||||
return jsonify(result), 400
|
||||
except Exception as e:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return jsonify({'success': False, 'message': str(e)}), 500
|
||||
|
||||
Reference in New Issue
Block a user