- 删除旧事件:BillApprovedEvent, BillCreatedEvent, DeductionCompletedEvent, DetailAuditedEvent, DetailCreatedEvent, RecordMatchedEvent - 新增事件:BillAuditPassedEvent, DetailAuditPassedEvent - 保留事件:RecordImportedEvent - 更新监听器:AccountEventListener, BillEventListener, DetailEventListener - 清理代码中的旧事件引用和注释 优化原则:前端简单,后端健壮 事件流程:导入→匹配→生成明细→审核→扣款→生成账单→结算
65 lines
1.9 KiB
Python
65 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
检查数据库表结构
|
|
"""
|
|
import pymysql
|
|
|
|
def check_tables(host, port, user, password, database):
|
|
"""检查表是否存在及字段"""
|
|
try:
|
|
connection = pymysql.connect(
|
|
host=host,
|
|
port=port,
|
|
user=user,
|
|
password=password,
|
|
database=database,
|
|
charset='utf8mb4',
|
|
cursorclass=pymysql.cursors.DictCursor
|
|
)
|
|
|
|
print(f"✓ 连接数据库成功: {database}")
|
|
|
|
tables = [
|
|
'asset_parking',
|
|
'asset_customer',
|
|
'asset_vehicle_base',
|
|
'asset_vehicle_business',
|
|
'asset_contract'
|
|
]
|
|
|
|
with connection.cursor() as cursor:
|
|
for table in tables:
|
|
# 检查表是否存在
|
|
cursor.execute(f"SHOW TABLES LIKE '{table}'")
|
|
result = cursor.fetchone()
|
|
|
|
if result:
|
|
print(f"\n✓ 表 {table} 存在")
|
|
|
|
# 显示字段
|
|
cursor.execute(f"DESCRIBE {table}")
|
|
columns = cursor.fetchall()
|
|
print(f" 字段: {', '.join([col['Field'] for col in columns[:10]])}")
|
|
if len(columns) > 10:
|
|
print(f" ... 共 {len(columns)} 个字段")
|
|
else:
|
|
print(f"\n✗ 表 {table} 不存在")
|
|
|
|
connection.close()
|
|
|
|
except Exception as e:
|
|
print(f"✗ 错误: {e}")
|
|
|
|
if __name__ == '__main__':
|
|
DB_HOST = '47.103.115.36'
|
|
DB_PORT = 3306
|
|
DB_USER = 'root'
|
|
DB_PASSWORD = 'Passw0rd2026'
|
|
|
|
print("检查 oneos_asset 数据库:")
|
|
check_tables(DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, 'oneos_asset')
|
|
|
|
print("\n" + "="*60)
|
|
print("检查 oneos_energy 数据库:")
|
|
check_tables(DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, 'oneos_energy')
|