update 企业数据
This commit is contained in:
parent
7cfa25503f
commit
933df21ef7
|
@ -29,6 +29,7 @@ class BasicBusinessInfoImpl(object):
|
|||
guarantee_distribution_list = list()
|
||||
|
||||
for sheet in work_book.sheets():
|
||||
basic = ExcelSheetParser(sheet=work_book.sheet_by_name('企业信息')).parse_sheet1()
|
||||
|
||||
if sheet.name == '企业信息':
|
||||
|
||||
|
@ -49,8 +50,8 @@ class BasicBusinessInfoImpl(object):
|
|||
['企业名称', '基本信息']
|
||||
)
|
||||
if not record:
|
||||
res = basic_info_api()
|
||||
if res.status_code == 200:
|
||||
res_ = basic_info_api()
|
||||
if res_.status_code == 200:
|
||||
record = DB_TYC.find_single_data(
|
||||
'公司背景',
|
||||
'基本信息',
|
||||
|
@ -59,14 +60,88 @@ class BasicBusinessInfoImpl(object):
|
|||
)
|
||||
return record
|
||||
|
||||
data = ExcelSheetParser(sheet=sheet).parse_sheet1()
|
||||
basic_data = get_basic(data['企业名称'])
|
||||
basic_data = get_basic(basic['企业名称'])
|
||||
basic_business_info.cid = new_cid
|
||||
basic_business_info.set_instance(data=data)
|
||||
basic['企业类型'] = basic_data['基本信息']['companyOrgType']
|
||||
basic['企业性质'] = '国有企业' if '国企' in basic_data['基本信息']['tags'] else '民营企业'
|
||||
basic['注册资本(万元)'] = basic['注册资本(万元)'] if basic['注册资本(万元)'] else float((basic_data['基本信息']['regCapital']).replace('万人民币', ''))
|
||||
basic['实缴资本(万元)'] = basic['实缴资本(万元)'] if basic['实缴资本(万元)'] else float((basic_data['基本信息']['actualCapital']).replace('万人民币', ''))
|
||||
basic['参保人数'] = int(basic['参保人数'])
|
||||
basic_business_info.set_instance(data=basic)
|
||||
|
||||
elif sheet.name == '高管股东信息':
|
||||
|
||||
def get_shareholders(name):
|
||||
# 获取tyc股东信息
|
||||
def basic_info_api():
|
||||
"""工商信息接口"""
|
||||
url = "http://api.fecribd.com/api/tyc/shareholders_info"
|
||||
headers = {'token': 'uzdq51N4!I0%HY4sCaQ!aeCSIDIVIdAM'}
|
||||
parameter = {"企业名称": name}
|
||||
res = requests.post(url=url, headers=headers, data=json.dumps(parameter))
|
||||
return res
|
||||
|
||||
basic_info = DB_TYC.find_single_data(
|
||||
'公司背景',
|
||||
'基本信息',
|
||||
{"企业名称": name},
|
||||
['基本信息']
|
||||
)
|
||||
share_list = list()
|
||||
if '上市' in basic_info['基本信息']['companyOrgType']:
|
||||
shareholder_info = DB_TYC.find_single_data(
|
||||
'公司背景',
|
||||
'十大股东',
|
||||
{"企业名称": name},
|
||||
['十大股东']
|
||||
)
|
||||
if not shareholder_info:
|
||||
res_ = basic_info_api()
|
||||
if res_.status_code == 200:
|
||||
shareholder_info = DB_TYC.find_single_data(
|
||||
'公司背景',
|
||||
'十大股东',
|
||||
{"企业名称": name},
|
||||
['十大股东']
|
||||
)
|
||||
# 遍历数据修改格式
|
||||
for share in shareholder_info['十大股东']['holderList']:
|
||||
share_dict = dict()
|
||||
share_dict['股东名称'] = share['name']
|
||||
share_dict['持股比例'] = share['proportion']
|
||||
share_dict['股东性质'] = '-'
|
||||
share_dict['持股数量(股)'] = share['holdingNum']
|
||||
share_list.append(share_dict)
|
||||
else:
|
||||
shareholder_info = DB_TYC.find_single_data(
|
||||
'公司背景',
|
||||
'企业股东',
|
||||
{"企业名称": name},
|
||||
['企业股东']
|
||||
)
|
||||
if not shareholder_info:
|
||||
res_ = basic_info_api()
|
||||
if res_.status_code == 200:
|
||||
shareholder_info = DB_TYC.find_single_data(
|
||||
'公司背景',
|
||||
'企业股东',
|
||||
{"企业名称": name},
|
||||
['企业股东']
|
||||
)
|
||||
# 遍历数据修改格式
|
||||
for share in shareholder_info['企业股东']['result']:
|
||||
share_dict = dict()
|
||||
share_dict['股东名称'] = share['name']
|
||||
share_dict['持股比例'] = share['capital'][0]['percent']
|
||||
share_dict['股东性质'] = '-'
|
||||
share_dict['持股数量(股)'] = share['capital'][0]['amomon']
|
||||
share_list.append(share_dict)
|
||||
return share_list
|
||||
|
||||
tyc_shareholders = get_shareholders(basic['企业名称'])
|
||||
executives, shareholders = ExcelSheetParser(sheet=sheet).parse_sheet2()
|
||||
|
||||
shareholders = shareholders if shareholders else tyc_shareholders
|
||||
basic_business_info.shareholder_information = list()
|
||||
basic_business_info.executive_information = list()
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class BasicBusinessInfo(SpecObject):
|
|||
name = ValidateAttr(field="name", type=str)
|
||||
ratio = ValidateAttr(field="ratio", type=str)
|
||||
nature = ValidateAttr(field="nature", type=str)
|
||||
quantity = ValidateAttr(field="quantity", type=int, default=None)
|
||||
quantity = ValidateAttr(field="quantity", type=[int, str], default=None)
|
||||
|
||||
fields_map = {
|
||||
"name": "股东名称",
|
||||
|
@ -39,10 +39,23 @@ class BasicBusinessInfo(SpecObject):
|
|||
"industry_experience": "行业经验"
|
||||
}
|
||||
|
||||
class EmployeeEducation(SpecObject):
|
||||
"""员工学历"""
|
||||
college_degree = ValidateAttr(feild='college_degree', type=int)
|
||||
bachelor_degree = ValidateAttr(feild='bachelor_degree', type=int)
|
||||
postgraduate_degree = ValidateAttr(feild='postgraduate_degree', type=int)
|
||||
|
||||
fields_map = {
|
||||
"college_degree": "大专及以下",
|
||||
"bachelor_degree": "本科",
|
||||
"postgraduate_degree": "研究生"
|
||||
}
|
||||
|
||||
cid = ValidateAttr(field="cid", type=str)
|
||||
company_name = ValidateAttr(field="company_name", type=str)
|
||||
enterprise_abbreviation = ValidateAttr(field="enterprise_abbreviation", type=str)
|
||||
type_of_enterprise = ValidateAttr(field="type_of_enterprise", type=str)
|
||||
nature_of_enterprise = ValidateAttr(field="nature_of_enterprise", type=str)
|
||||
warranty_type = ValidateAttr(field="warranty_type", type=str)
|
||||
unified_social_credit_code = ValidateAttr(field="unified_social_credit_code", type=str)
|
||||
organization_code = ValidateAttr(field="organization_code", type=str)
|
||||
|
@ -54,7 +67,7 @@ class BasicBusinessInfo(SpecObject):
|
|||
city = ValidateAttr(field="city", type=str)
|
||||
registered_address = ValidateAttr(field="registered_address", type=str)
|
||||
contact_address = ValidateAttr(field="contact_address", type=str)
|
||||
e_mail = ValidateAttr(field="e_mail", type=str)
|
||||
e_mail = ValidateAttr(field="e_mail", type=str, default=None)
|
||||
contact_number = ValidateAttr(field="contact_number", type=str, default=None)
|
||||
number_of_participants = ValidateAttr(field="number_of_participants", type=int)
|
||||
company_positioning = ValidateAttr(field="company_positioning", type=str, default=None)
|
||||
|
@ -62,12 +75,14 @@ class BasicBusinessInfo(SpecObject):
|
|||
the_actual_controller = ValidateAttr(field="the_actual_controller", type=str)
|
||||
shareholder_information = ValidateAttr(field="shareholder_information", instance_list=ShareholderInformation)
|
||||
executive_information = ValidateAttr(field="executive_information", instance_list=ExecutiveInformation)
|
||||
employee_education = ValidateAttr(field="employee_education", instance_list=EmployeeEducation)
|
||||
|
||||
fields_map = {
|
||||
"cid": "企业ID",
|
||||
"company_name": "企业名称",
|
||||
"enterprise_abbreviation": "企业简称",
|
||||
"type_of_enterprise": "企业类型",
|
||||
"nature_of_enterprise": "企业性质",
|
||||
"warranty_type": "担保类型",
|
||||
"unified_social_credit_code": "统一社会信用代码",
|
||||
"organization_code": "组织代码",
|
||||
|
@ -86,7 +101,8 @@ class BasicBusinessInfo(SpecObject):
|
|||
"legal_representative": "法定代表人",
|
||||
"the_actual_controller": "实际控制人",
|
||||
"shareholder_information": "股东信息",
|
||||
"executive_information": "高管信息"
|
||||
"executive_information": "高管信息",
|
||||
"employee_education": "员工学历",
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue