39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
"""
|
|
手动同步 002273 报告
|
|
"""
|
|
import asyncio
|
|
import sys
|
|
sys.path.insert(0, ".")
|
|
|
|
from app.services.cninfo_crawler import cninfo_service
|
|
from app.database import AsyncSessionLocal, init_db
|
|
from app.models import Company
|
|
from sqlalchemy import select
|
|
|
|
async def sync_002273():
|
|
print("=" * 60)
|
|
print("手动同步 002273 (水晶光电) 报告")
|
|
print("=" * 60)
|
|
|
|
await init_db()
|
|
|
|
async with AsyncSessionLocal() as db:
|
|
# 查询公司
|
|
stmt = select(Company).where(Company.stock_code == "002273")
|
|
result = await db.execute(stmt)
|
|
company = result.scalar_one_or_none()
|
|
|
|
if not company:
|
|
print("✗ 未找到公司 002273")
|
|
return
|
|
|
|
print(f"开始同步: {company.company_name}")
|
|
|
|
# 执行同步
|
|
new_count = await cninfo_service.sync_company_reports(db, company)
|
|
|
|
print(f"\n✓ 同步完成,新增 {new_count} 份报告")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(sync_002273())
|