添加第三方接口及类型信息

This commit is contained in:
wcq 2023-03-27 10:28:31 +08:00
parent 88ecc52ad9
commit 9214fae8b0
4 changed files with 13 additions and 10 deletions

View File

@ -53,11 +53,14 @@ def auto_create_company(db: Session, req: Schemas.AutoCreateCompanyReq):
if not res: if not res:
raise HTTPException(detail="无公司名称数据", status_code=403) raise HTTPException(detail="无公司名称数据", status_code=403)
# 添加城投公司索引信息 # 添加城投公司索引信息
company_index_main = CompanyIndexMain(company_id=res.id, company_name=res.name) company_index_main = CompanyIndexMain(company_name=res.name)
db.add(company_index_main) db.add(company_index_main)
db.commit()
db.refresh(company_index_main)
company_id = company_index_main.company_id
# 添加城投工商信息 # 添加城投工商信息
if not db.query(CompanyBaseInfo).filter(CompanyBaseInfo.company_id == res.id).first(): if not db.query(CompanyBaseInfo).filter(CompanyBaseInfo.company_id == company_id).first():
company_base_info = CompanyBaseInfo(company_id=res.id, company_base_info = CompanyBaseInfo(company_id=company_id,
legal_person=res.legalPersonName, legal_person=res.legalPersonName,
reg_capital=res.regCapital, reg_capital=res.regCapital,
# paid_capital # paid_capital
@ -71,12 +74,12 @@ def auto_create_company(db: Session, req: Schemas.AutoCreateCompanyReq):
business_scope=res.businessScope business_scope=res.businessScope
) )
db.add(company_base_info) db.add(company_base_info)
# company_control=CompanyControl(company_id=res.id,name=res.legalPersonName) # company_control=CompanyControl(company_id=company_id,name=res.legalPersonName)
# 添加城投属性 # 添加城投属性
if not db.query(CompanyPlusProperty).filter(CompanyPlusProperty.company_id == res.id).first(): if not db.query(CompanyPlusProperty).filter(CompanyPlusProperty.company_id == company_id).first():
# city_item = db.query(AreaIndexMain).filter(name=res.city).first() # city_item = db.query(AreaIndexMain).filter(name=res.city).first()
# area_item = db.query(AreaIndexMain).filter(name=res.district).first() # area_item = db.query(AreaIndexMain).filter(name=res.district).first()
company_plus_property = CompanyPlusProperty(company_id=res.id, company_plus_property = CompanyPlusProperty(company_id=company_id,
# administrative_level # administrative_level
# background # background
# equity_relationship # equity_relationship
@ -90,8 +93,8 @@ def auto_create_company(db: Session, req: Schemas.AutoCreateCompanyReq):
# area=area_item.area_id if area_item else None # area=area_item.area_id if area_item else None
) )
db.add(company_plus_property) db.add(company_plus_property)
add_company_share_holder_from_api(db, res.id, company_name) add_company_share_holder_from_api(db, company_id, company_name)
add_company_control_from_api(db, res.id, company_name) add_company_control_from_api(db, company_id, company_name)
db.commit() db.commit()

View File

@ -10,7 +10,6 @@ class CompanyIndexMainInfo(BaseModel):
class CompanyIndexMainAddInfo(BaseModel): class CompanyIndexMainAddInfo(BaseModel):
company_id: int
company_name: str company_name: str

File diff suppressed because one or more lines are too long

1
static/area_name.json Normal file

File diff suppressed because one or more lines are too long