2022-04-20 10:38:36 +08:00
|
|
|
from Utils.ObjUtil import SpecObject
|
|
|
|
from Utils.ValidateUtil import ValidateAttr, Validate
|
|
|
|
|
|
|
|
|
|
|
|
class HeadInfo(SpecObject):
|
|
|
|
"""头部信息"""
|
|
|
|
name = ValidateAttr(field='name', type=str)
|
|
|
|
cid = ValidateAttr(field='cid', type=str)
|
|
|
|
email = ValidateAttr(field='email', type=str)
|
|
|
|
industry = ValidateAttr(field='industry', type=str)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"name": "企业名称",
|
|
|
|
"cid": "企业ID",
|
|
|
|
"email": "账户邮箱",
|
|
|
|
"industry": "所属行业",
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class UpdateTime(SpecObject):
|
|
|
|
"""更新时间"""
|
|
|
|
table_map = {
|
2022-04-20 11:08:22 +08:00
|
|
|
"财务数据": "基本财务数据",
|
2022-04-20 10:38:36 +08:00
|
|
|
"工商信息": "基本工商信息",
|
|
|
|
"经营风险": "经营风险分析",
|
|
|
|
"财务分析": "财务要素分析",
|
|
|
|
"综合信用分析": "综合信用分析",
|
|
|
|
"ESG评价分析": "ESG评价分析"
|
|
|
|
}
|
|
|
|
|
|
|
|
cid = ValidateAttr(field='cid', type=str, length=8)
|
|
|
|
table = ValidateAttr(field='table', type=str, in_list=list(table_map.keys()))
|
|
|
|
update_time = ValidateAttr(field='update_time', type=list)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"cid": "企业ID",
|
|
|
|
"table": "table",
|
|
|
|
"update_time": "update_time"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class BasicInfo(SpecObject):
|
|
|
|
class BusinessInfo(SpecObject):
|
|
|
|
"""基本工商信息"""
|
|
|
|
|
|
|
|
status = ValidateAttr(field="status", type=str, default=None)
|
|
|
|
legal_person = ValidateAttr(field="legal_person", type=str, default=None)
|
|
|
|
company_type = ValidateAttr(field="company_type", type=str, default=None)
|
|
|
|
taxpayer_id = ValidateAttr(field="taxpayer_id", type=str, default=None)
|
|
|
|
business_scope = ValidateAttr(field="business_scope", type=str, default=None)
|
|
|
|
registered_capital = ValidateAttr(field="registered_capital", type=str, default=None)
|
|
|
|
paid_capital = ValidateAttr(field="paid_capital", type=str, default=None)
|
|
|
|
registered_address = ValidateAttr(field="registered_address", type=str, default=None)
|
|
|
|
registration_authority = ValidateAttr(field="registration_authority", type=str, default=None)
|
|
|
|
industry = ValidateAttr(field="industry", type=str, default=None)
|
|
|
|
staff_size = ValidateAttr(field="staff_size", type=str, default=None)
|
|
|
|
people_insured_num = ValidateAttr(field="people_insured_num", type=int, default=None)
|
|
|
|
micro_company = ValidateAttr(field="micro_company", type=str, in_list=["是", "否"], default=None)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"status": "企业状态",
|
|
|
|
"legal_person": "法定代表人",
|
|
|
|
"company_type": "企业类型",
|
|
|
|
"taxpayer_id": "纳税人识别号",
|
|
|
|
"business_scope": "经营范围",
|
|
|
|
"registered_capital": "注册资本",
|
|
|
|
"paid_capital": "实缴资本",
|
|
|
|
"registered_address": "注册地址",
|
|
|
|
"registration_authority": "登记机关",
|
|
|
|
"industry": "行业",
|
|
|
|
"staff_size": "人员规模",
|
|
|
|
"people_insured_num": "参保人数",
|
|
|
|
"micro_company": "小微企业"
|
|
|
|
}
|
|
|
|
|
|
|
|
class ShareHolder(SpecObject):
|
|
|
|
"""股东信息"""
|
|
|
|
|
|
|
|
name = ValidateAttr(field='name', type=str)
|
|
|
|
share_holder_type = ValidateAttr(field='share_holder_type', type=str, default=None)
|
|
|
|
share_holding_ratio = ValidateAttr(field="share_holding_ratio", type=str, default=None)
|
|
|
|
subscription_amount = ValidateAttr(field="subscription_amount", type=str, default=None)
|
|
|
|
subscription_date = ValidateAttr(field="subscription_date", type=str, default=None)
|
|
|
|
paid_amount = ValidateAttr(field="paid_amount", type=list, default=[])
|
|
|
|
payment_method = ValidateAttr(field="payment_method", type=list, default=[])
|
|
|
|
payment_time = ValidateAttr(field="payment_time", type=list, default=[])
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"name": "股东",
|
|
|
|
"share_holder_type": "股东类型",
|
|
|
|
"share_holding_ratio": "持股比例",
|
|
|
|
"subscription_amount": "认缴金额",
|
|
|
|
"subscription_date": "认缴日期",
|
|
|
|
"paid_amount": "实缴金额",
|
|
|
|
"payment_method": "实缴方式",
|
|
|
|
"payment_time": "实缴时间"
|
|
|
|
}
|
|
|
|
|
|
|
|
class MainMember(SpecObject):
|
|
|
|
"""主要成员"""
|
|
|
|
|
|
|
|
name = ValidateAttr(field="name", type=str)
|
|
|
|
job_title = ValidateAttr(field="job_title", type=list, default=None)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"name": "姓名",
|
|
|
|
"job_title": "职务"
|
|
|
|
}
|
|
|
|
|
|
|
|
cid = ValidateAttr(field='cid', type=str, length=8)
|
|
|
|
update_time = ValidateAttr(field='update_time', func=Validate.time_format)
|
|
|
|
business_info = ValidateAttr(field="business_info", type=BusinessInfo)
|
|
|
|
share_holder = ValidateAttr(field='share_holder', instance_list=ShareHolder)
|
|
|
|
main_member = ValidateAttr(field='main_member', instance_list=MainMember)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"cid": "企业ID",
|
|
|
|
"update_time": "更新时间",
|
|
|
|
"business_info": "工商信息",
|
|
|
|
"share_holder": "股东信息",
|
|
|
|
"main_member": "主要成员"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class FinancialData(SpecObject):
|
|
|
|
"""财务数据"""
|
|
|
|
|
|
|
|
class BalanceSheet(SpecObject):
|
|
|
|
"""资产负债表"""
|
|
|
|
accounts_receivable = ValidateAttr(field='accounts_receivable', type=[int, float])
|
|
|
|
stock = ValidateAttr(field='stock', type=[int, float])
|
|
|
|
total_current_assets = ValidateAttr(field='total_current_assets', type=[int, float])
|
|
|
|
total_assets = ValidateAttr(field='total_assets', type=[int, float])
|
|
|
|
short_loan = ValidateAttr(field='short_loan', type=[int, float])
|
|
|
|
one_year_liabilities = ValidateAttr(field='one_year_liabilities', type=[int, float])
|
|
|
|
total_current_liabilities = ValidateAttr(field='total_current_liabilities', type=[int, float])
|
|
|
|
long_term_loan = ValidateAttr(field='long_term_loan', type=[int, float])
|
|
|
|
total_liabilities = ValidateAttr(field='total_liabilities', type=[int, float])
|
|
|
|
total_owners_equity = ValidateAttr(field='total_owners_equity', type=[int, float])
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
'accounts_receivable': '应收账款',
|
|
|
|
'stock': '存货',
|
|
|
|
'total_current_assets': '流动资产合计',
|
|
|
|
'total_assets': '资产总计',
|
|
|
|
'short_loan': '短期借款',
|
|
|
|
'one_year_liabilities': '一年内到期非流动负债',
|
|
|
|
'total_current_liabilities': '流动负债合计',
|
|
|
|
'long_term_loan': '长期借款',
|
|
|
|
'total_liabilities': '负债合计',
|
|
|
|
'total_owners_equity': '所有者权益合计'
|
|
|
|
}
|
|
|
|
|
|
|
|
class ProfitSheet(SpecObject):
|
|
|
|
"""利润表"""
|
|
|
|
operating_income = ValidateAttr(field='operating_income', type=[int, float])
|
|
|
|
operating_cost = ValidateAttr(field='operating_cost', type=[int, float])
|
|
|
|
total_profit = ValidateAttr(field='total_profit', type=[int, float])
|
|
|
|
net_profit = ValidateAttr(field='net_profit', type=[int, float])
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
'operating_income': '营业收入',
|
|
|
|
'operating_cost': '营业成本',
|
|
|
|
'total_profit': '利润总额',
|
|
|
|
'net_profit': '净利润'
|
|
|
|
}
|
|
|
|
|
|
|
|
class AppendixDataSheet(SpecObject):
|
|
|
|
"""补充数据表"""
|
|
|
|
rd_expenses = ValidateAttr(field='rd_expenses', type=[int, float])
|
|
|
|
interest_disbursement = ValidateAttr(field='interest_disbursement', type=[int, float])
|
|
|
|
interest_expense = ValidateAttr(field='interest_expense', type=[int, float])
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
'rd_expenses': '研发费用',
|
|
|
|
'interest_disbursement': '计入财务费的利息支出',
|
|
|
|
'interest_expense': '资本化利息支出'
|
|
|
|
}
|
|
|
|
|
|
|
|
class FinancialIndex(SpecObject):
|
|
|
|
"""财务指标"""
|
|
|
|
roe = ValidateAttr(field="roe", type=[int, float])
|
|
|
|
inventory_turnover = ValidateAttr(field="inventory_turnover", type=[int, float])
|
|
|
|
interest_multiple = ValidateAttr(field="interest_multiple", type=[int, float])
|
|
|
|
accounts_receivable_turnover = ValidateAttr(field="accounts_receivable_turnover", type=[int, float])
|
|
|
|
total_asset_turnover = ValidateAttr(field="total_asset_turnover", type=[int, float])
|
|
|
|
total_asset_growth_rate = ValidateAttr(field="total_asset_growth_rate", type=[int, float])
|
|
|
|
roa = ValidateAttr(field="roa", type=[int, float])
|
|
|
|
technology_investment_ratio = ValidateAttr(field="technology_investment_ratio", type=[int, float])
|
|
|
|
operating_growth_rate = ValidateAttr(field="operating_growth_rate", type=[int, float])
|
|
|
|
assets_and_liabilities = ValidateAttr(field="assets_and_liabilities", type=[int, float])
|
|
|
|
quick_ratio = ValidateAttr(field="quick_ratio", type=[int, float])
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"roe": "净资产收益率",
|
|
|
|
"inventory_turnover": "存货周转率",
|
|
|
|
"interest_multiple": "已获利息倍数",
|
|
|
|
"accounts_receivable_turnover": "应收账款周转率",
|
|
|
|
"total_asset_turnover": "总资产周转率",
|
|
|
|
"total_asset_growth_rate": "总资产增长率",
|
|
|
|
"roa": "总资产报酬率",
|
|
|
|
"technology_investment_ratio": "技术投入比率",
|
|
|
|
"operating_growth_rate": "营业增长率",
|
|
|
|
"assets_and_liabilities": "资产负债率",
|
|
|
|
"quick_ratio": "速动比率"
|
|
|
|
}
|
|
|
|
|
|
|
|
cid = ValidateAttr(field='cid', type=str, length=8)
|
|
|
|
report_date = ValidateAttr(field='report_date', func=Validate.date_format, default='')
|
|
|
|
balance_sheet = ValidateAttr(field="balance_sheet", type=BalanceSheet)
|
|
|
|
profit_sheet = ValidateAttr(field="profit_sheet", type=ProfitSheet)
|
|
|
|
appendix_data = ValidateAttr(field="appendix_data", type=AppendixDataSheet)
|
|
|
|
financial_index = ValidateAttr(field="financial_index", type=FinancialIndex)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"cid": "企业ID",
|
|
|
|
"report_date": "报告期",
|
|
|
|
"balance_sheet": "资产负债表",
|
|
|
|
"profit_sheet": "利润表",
|
|
|
|
"appendix_data": "补充数据表",
|
|
|
|
"financial_index": "财务指标"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class OperatingRisk(SpecObject):
|
|
|
|
"""经营风险"""
|
|
|
|
|
|
|
|
class InfluenceObj(SpecObject):
|
|
|
|
"""影响统计"""
|
|
|
|
name = ValidateAttr(field='name', type=str)
|
|
|
|
total = ValidateAttr(field='total', type=int)
|
|
|
|
influence = ValidateAttr(field='influence', type=str)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"name": "类型",
|
|
|
|
"total": "数量",
|
|
|
|
"influence": "影响"
|
|
|
|
}
|
|
|
|
|
|
|
|
class DetailObj(SpecObject):
|
|
|
|
"""详细统计"""
|
|
|
|
name = ValidateAttr(field='name', type=str)
|
|
|
|
total = ValidateAttr(field='total', type=int)
|
|
|
|
detail = ValidateAttr(field='detail', type=list)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"name": "类型",
|
|
|
|
"total": "数量",
|
|
|
|
"detail": "详情"
|
|
|
|
}
|
|
|
|
|
|
|
|
cid = ValidateAttr(field='cid', type=str, length=8, default=None)
|
|
|
|
update_time = ValidateAttr(field='update_time', func=Validate.time_format)
|
|
|
|
rid = ValidateAttr(field='rid', type=str, length=8, default='')
|
|
|
|
risk_level = ValidateAttr(field='risk_level', type=str, in_list=['高', '较高', '中等', '警示', '低'], default='')
|
|
|
|
risk_score = ValidateAttr(field='risk_score', type=[int, float], default='')
|
|
|
|
in_untrustworthy_list = ValidateAttr(field='in_untrustworthy_list', type=str, in_list=["是", "否"], default='')
|
|
|
|
compliance_risk = ValidateAttr(field='compliance_risk', instance_list=InfluenceObj)
|
|
|
|
operating_risk = ValidateAttr(field='operating_risk', instance_list=InfluenceObj)
|
|
|
|
peripheral_risk = ValidateAttr(field='peripheral_risk', instance_list=DetailObj)
|
|
|
|
change_records = ValidateAttr(field='change_records', instance_list=InfluenceObj)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"cid": "企业ID",
|
|
|
|
"update_time": "更新时间",
|
|
|
|
"rid": "评价ID",
|
|
|
|
"risk_level": "风险级别",
|
|
|
|
"risk_score": "风险分数",
|
|
|
|
"in_untrustworthy_list": "列入失信名单",
|
|
|
|
"compliance_risk": "合规风险统计",
|
|
|
|
"operating_risk": "经营风险统计",
|
|
|
|
"peripheral_risk": "周边风险统计",
|
|
|
|
"change_records": "变更记录统计"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class FinancialAnalysisIndex(SpecObject):
|
|
|
|
"""财务指标"""
|
|
|
|
profit_ability = ValidateAttr(field='profit_ability', type=[int, float, str])
|
|
|
|
asset_quality = ValidateAttr(field='asset_quality', type=[int, float, str])
|
|
|
|
debt_risk = ValidateAttr(field='debt_risk', type=[int, float, str])
|
|
|
|
business_growth = ValidateAttr(field='business_growth', type=[int, float, str])
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"profit_ability": "盈利能力",
|
|
|
|
"asset_quality": "资产质量",
|
|
|
|
"debt_risk": "债务风险",
|
|
|
|
"business_growth": "经营增长"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class FinancialAnalysisDetails(SpecObject):
|
|
|
|
"""指标详情"""
|
|
|
|
name = ValidateAttr(field='name', type=str)
|
|
|
|
value = ValidateAttr(field='value', type=str)
|
|
|
|
quality = ValidateAttr(field='quality', type=str)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"name": "指标",
|
|
|
|
"value": "数值",
|
|
|
|
"quality": "水平"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class FinancialAnalysis(SpecObject):
|
|
|
|
"""财务分析"""
|
|
|
|
|
|
|
|
class CompareToYears(SpecObject):
|
|
|
|
"""财务得分年度比较"""
|
|
|
|
year = ValidateAttr(field='year', type=str, func=Validate.date_format)
|
|
|
|
index = ValidateAttr(field='index', instance_list=FinancialAnalysisIndex)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"year": "年度",
|
|
|
|
"index": "指标"
|
|
|
|
}
|
|
|
|
|
|
|
|
class CompareToIndustry(SpecObject):
|
|
|
|
"""财务得分同行比较"""
|
|
|
|
company_score = ValidateAttr(field='company_score', type=FinancialAnalysisIndex)
|
|
|
|
average_score = ValidateAttr(field='average_score', type=FinancialAnalysisIndex)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"company_score": "公司水平",
|
|
|
|
"average_score": "平均水平"
|
|
|
|
}
|
|
|
|
|
|
|
|
cid = ValidateAttr(field='cid', type=str, length=8, default=None)
|
|
|
|
update_time = ValidateAttr(field='update_time', func=Validate.time_format)
|
|
|
|
rid = ValidateAttr(field='rid', type=str, length=8)
|
|
|
|
report_date = ValidateAttr(field='report_date', type=str, func=Validate.date_format)
|
|
|
|
compare_to_years = ValidateAttr(field='compare_to_years', type=CompareToYears)
|
|
|
|
compare_to_industry = ValidateAttr(field='compare_to_industry', type=CompareToIndustry)
|
|
|
|
delta_to_years = ValidateAttr(field='delta_to_years', type=FinancialAnalysisIndex)
|
|
|
|
delta_to_industry = ValidateAttr(field='delta_to_industry', type=FinancialAnalysisIndex)
|
|
|
|
index_details = ValidateAttr(field='index_details', instance_list=FinancialAnalysisDetails)
|
|
|
|
|
|
|
|
fields_map = {
|
|
|
|
"cid": "企业ID",
|
|
|
|
"update_time": "更新时间",
|
|
|
|
"rid": "评价ID",
|
|
|
|
"report_date": "财报期",
|
|
|
|
"compare_to_years": "财务得分年度比较",
|
|
|
|
"compare_to_industry": "财务得分同行比较",
|
|
|
|
"delta_to_years": "财务得分较去年变化",
|
|
|
|
"delta_to_industry": "财务得分较同行差异",
|
|
|
|
"index_details": "指标详情"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class CCRating(SpecObject):
|
|
|
|
"""综信评价分析"""
|
|
|
|
|
|
|
|
|
|
|
|
class ESGRating(SpecObject):
|
|
|
|
"""ESG评价分析"""
|
|
|
|
|
|
|
|
|
|
|
|
class CompanyIndexApi(SpecObject):
|
|
|
|
"""企业主页接口"""
|
|
|
|
|
|
|
|
def get_head_info(self):
|
|
|
|
"""头部信息"""
|
|
|
|
|
|
|
|
def get_update_time(self):
|
|
|
|
"""更新时间"""
|
|
|
|
|
|
|
|
def get_basic_info(self):
|
|
|
|
"""工商信息"""
|
|
|
|
|
|
|
|
def get_financial_data(self):
|
|
|
|
"""财务数据"""
|
|
|
|
|
|
|
|
def get_operating_risk(self):
|
|
|
|
"""经营风险"""
|
|
|
|
|
|
|
|
def get_financial_analysis(self):
|
|
|
|
"""财务分析"""
|
|
|
|
|
|
|
|
def get_cc_rating(self):
|
|
|
|
"""综合信用分析"""
|
|
|
|
|
|
|
|
def get_esg_rating(self):
|
|
|
|
"""ESG评价分析"""
|