from Utils.ObjUtil import SpecObject from Utils.ValidateUtil import ValidateAttr, Validate class BasicBusinessInfo(SpecObject): """工商信息""" class ShareholderInformation(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) fields_map = { "name": "股东名称", "ratio": "持股比例", "nature": "股东性质", "quantity": "持股数量(股)" } class ExecutiveInformation(SpecObject): """高管信息""" name = ValidateAttr(field="name", type=str) position = ValidateAttr(field="position", type=str) education = ValidateAttr(field="education", type=str, default=None) birth_data = ValidateAttr(field="birth_data", type=str, default=None) political_status = ValidateAttr(field="political_status", type=str, default=None) industry_experience = ValidateAttr(field="industry_experience", type=[str, float, int], default=None) fields_map = { "name": "姓名", "position": "职务", "education": "学历", "birth_data": "出生日期", "political_status": "政治面貌", "industry_experience": "行业经验" } 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) 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) date_of_establishment = ValidateAttr(field="date_of_establishment", type=str) registered_capital = ValidateAttr(field="registered_capital", type=[float, int]) paid_in_capital = ValidateAttr(field="paid_in_capital", type=[float, int]) business_scope = ValidateAttr(field="business_scope", type=str) province = ValidateAttr(field="province", type=str) 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) contact_number = ValidateAttr(field="contact_number", type=str) number_of_participants = ValidateAttr(field="number_of_participants", type=int) company_positioning = ValidateAttr(field="company_positioning", type=str) legal_representative = ValidateAttr(field="legal_representative", type=str) 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) fields_map = { "cid": "企业ID", "company_name": "企业名称", "enterprise_abbreviation": "企业简称", "type_of_enterprise": "企业类型", "warranty_type": "担保类型", "unified_social_credit_code": "统一社会信用代码", "organization_code": "组织代码", "date_of_establishment": "成立日期", "registered_capital": "注册资本(万元)", "paid_in_capital": "实缴资本(万元)", "business_scope": "经营范围", "province": "所在省份", "city": "所在城市", "registered_address": "注册地址", "contact_address": "通信地址", "e_mail": "电子邮箱", "contact_number": "联系电话", "number_of_participants": "参保人数", "company_positioning": "公司定位", "legal_representative": "法定代表人", "the_actual_controller": "实际控制人", "shareholder_information": "股东信息", "executive_information": "高管信息" } class CompanyOverviewInfo(SpecObject): """公司概览信息""" cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) credit_rating = ValidateAttr(field="credit_rating", type=str) rating_date = ValidateAttr(field="rating_date", func=Validate.date_format) province_city = ValidateAttr(field="province_city", type=str) label = ValidateAttr(field="label", type=str) update_time = ValidateAttr(field="update_time", func=Validate.date_format) fields_map = { "cid": "企业ID", "company_name": "企业名称", "credit_rating": "信用评级", "rating_date": "评级日期", "province_city": "所属省市", "label": "公司标签", "update_time": "更新时间" } class FinancialData(SpecObject): """财务数据""" class BalanceSheet(SpecObject): """资产负债表""" money_funds = ValidateAttr(field="money_funds", type=[float, int], default=None) entrusted_loans = ValidateAttr(field="entrusted_loans", type=[float, int], default=None) other_receivables = ValidateAttr(field="other_receivables", type=[float, int], default=None) reimbursement_receivable = ValidateAttr(field="reimbursement_receivable", type=[float, int], default=None) total_current_assets = ValidateAttr(field="total_current_assets", type=[float, int], default=None) available_sale_financial_assets = ValidateAttr(field="available_sale_financial_assets", type=[float, int], default=None) long_term_equity_investment = ValidateAttr(field="long_term_equity_investment", type=[float, int], default=None) fixed_assets = ValidateAttr(field="fixed_assets", type=[float, int], default=None) foreclosed_assets = ValidateAttr(field="foreclosed_assets", type=[float, int], default=None) other_non_current_assets = ValidateAttr(field="other_non_current_assets", type=[float, int], default=None) total_non_current_assets = ValidateAttr(field="total_non_current_assets", type=[float, int], default=None) total_assets = ValidateAttr(field="total_assets", type=[float, int], default=None) short_term_borrowing = ValidateAttr(field="short_term_borrowing", type=[float, int], default=None) other_payables = ValidateAttr(field="other_payables", type=[float, int], default=None) total_current_liabilities = ValidateAttr(field="total_current_liabilities", type=[float, int], default=None) long_term_borrowing = ValidateAttr(field="long_term_borrowing", type=[float, int], default=None) interest_bearing_liabilities = ValidateAttr(field="interest_bearing_liabilities", type=[float, int], default=None) total_non_current_liabilities = ValidateAttr(field="total_non_current_liabilities", type=[float, int], default=None) total_liabilities = ValidateAttr(field="total_liabilities", type=[float, int], default=None) paid_capital = ValidateAttr(field="paid_capital", type=[float, int], default=None) capital_reserve = ValidateAttr(field="capital_reserve", type=[float, int], default=None) undistributed_profit = ValidateAttr(field="undistributed_profit", type=[float, int], default=None) total_Owner_equity = ValidateAttr(field="total_Owner_equity", type=[float, int], default=None) net_worth = ValidateAttr(field="net_worth", type=[float, int], default=None) fields_map = { "money_funds": "货币资金", "entrusted_loans": "委托贷款", "other_receivables": "其他应收款", "reimbursement_receivable": "应收代偿款", "total_current_assets": "流动资产合计", "available_sale_financial_assets": "可供出售金融资产", "long_term_equity_investment": "长期股权投资", "fixed_assets": "固定资产", "foreclosed_assets": "抵债资产", "other_non_current_assets": "其他非流动资产", "total_non_current_assets": "非流动资产合计", "total_assets": "资产总额", "short_term_borrowing": "短期借款", "other_payables": "其他应付款", "total_current_liabilities": "流动负债合计", "long_term_borrowing": "长期借款", "interest_bearing_liabilities": "有息负债", "total_non_current_liabilities": "非流动负债合计", "total_liabilities": "负债合计", "paid_capital": "实收资本", "capital_reserve": "资本公积", "undistributed_profit": "未分配利润", "total_Owner_equity": "所有者权益合计", "net_worth": "净资产" } class IncomeSheet(SpecObject): """利润表""" operating_income = ValidateAttr(field="operating_income", type=[float, int], default=None) guarantee_fee_income = ValidateAttr(field="guarantee_fee_income", type=[float, int], default=None) loan_interest_income = ValidateAttr(field="loan_interest_income", type=[float, int], default=None) investment_business_income = ValidateAttr(field="investment_business_income", type=[float, int], default=None) other_business_income = ValidateAttr(field="other_business_income", type=[float, int], default=None) main_business_cost = ValidateAttr(field="main_business_cost", type=[float, int], default=None) taxes_surcharges = ValidateAttr(field="taxes_surcharges", type=[float, int], default=None) operating_administrative_expenses = ValidateAttr(field="operating_administrative_expenses", type=[float, int], default=None) interest_income = ValidateAttr(field="interest_income", type=[float, int], default=None) interest_expense = ValidateAttr(field="interest_expense", type=[float, int], default=None) asset_impairment_loss = ValidateAttr(field="asset_impairment_loss", type=[float, int], default=None) investment_income = ValidateAttr(field="investment_income", type=[float, int], default=None) operating_profit = ValidateAttr(field="operating_profit", type=[float, int], default=None) other_income = ValidateAttr(field="other_income", type=[float, int], default=None) net_profit = ValidateAttr(field="net_profit", type=[float, int], default=None) fields_map = { "operating_income": "营业收入", "guarantee_fee_income": "担保费收入", "loan_interest_income": "委贷利息收入", "investment_business_income": "投资业务收入", "other_business_income": "其他业务收入", "main_business_cost": "主营业务成本", "taxes_surcharges": "税金及附加", "operating_administrative_expenses": "业务及管理费用", "interest_income": "利息收入", "interest_expense": "利息支出", "asset_impairment_loss": "资产减值损失", "investment_income": "投资收益", "operating_profit": "营业利润", "other_income": "其他收益", "net_profit": "净利润" } class AppendixSheet(SpecObject): """补充数据表""" current_compensation_amount = ValidateAttr(field="current_compensation_amount", type=[float, int], default=None) current_compensation_recycle_amount = ValidateAttr(field="current_compensation_recycle_amount", type=[float, int], default=None) guarantee_liability = ValidateAttr(field="guarantee_liability", type=[float, int], default=None) accumulated_compensation_amount = ValidateAttr(field="accumulated_compensation_amount", type=[float, int], default=None) cumulative_compensation_recovery_amount = ValidateAttr(field="cumulative_compensation_recovery_amount", type=[float, int], default=None) cumulative_amount = ValidateAttr(field="cumulative_amount", type=[float, int], default=None) largest_financing = ValidateAttr(field="largest_financing", type=[float, int], default=None) financing_guarantee_liabilities = ValidateAttr(field="financing_guarantee_liabilities", type=[float, int], default=None) financial_guarantee_responsibility_balance = ValidateAttr(field="financial_guarantee_responsibility_balance", type=[float, int], default=None) risk_weighted_assets = ValidateAttr(field="risk_weighted_assets", type=[float, int], default=None) guaranteed_risk_reserve_balance = ValidateAttr(field="guaranteed_risk_reserve_balance", type=[float, int], default=None) top_five_financing_guarantee_liabilities = ValidateAttr(field="top_five_financing_guarantee_liabilities", type=[float, int], default=None) maximum_enterprise_financing_guarantee = ValidateAttr(field="maximum_enterprise_financing_guarantee", type=[float, int], default=None) guarantee_compensation_reserve = ValidateAttr(field="guarantee_compensation_reserve", type=[float, int], default=None) unexpired_liability_reserve = ValidateAttr(field="unexpired_liability_reserve", type=[float, int], default=None) counter_guarantee_amount = ValidateAttr(field="counter_guarantee_amount", type=[float, int], default=None) bank_credit_limit = ValidateAttr(field="bank_credit_limit", type=[float, int], default=None) unused_credit_limit = ValidateAttr(field="unused_credit_limit", type=[float, int], default=None) number_cooperative_banks = ValidateAttr(field="number_cooperative_banks", type=[float, int], default=None) deposit_margin = ValidateAttr(field="deposit_margin", type=[float, int], default=None) save_margin = ValidateAttr(field="save_margin", type=[float, int], default=None) guaranteed_balance = ValidateAttr(field="guaranteed_balance", type=[float, int], default=None) current_guarantee_business_income = ValidateAttr(field="current_guarantee_business_income", type=[float, int], default=None) last_period_guarantee_business_income = ValidateAttr(field="last_period_guarantee_business_income", type=[float, int], default=None) one_assets = ValidateAttr(field="one_assets", type=[float, int], default=None) two_assets = ValidateAttr(field="two_assets", type=[float, int], default=None) three_assets = ValidateAttr(field="three_assets", type=[float, int], default=None) fields_map = { "current_compensation_amount": "当期代偿金额", "current_compensation_recycle_amount": "当期代偿回收金额", "guarantee_liability": "当期解除担保责任余额", "accumulated_compensation_amount": "近三年累计代偿金额", "cumulative_compensation_recovery_amount": "近三年累计代偿回收金额", "cumulative_amount": "近三年累计解除担保责任金额", "largest_financing": "最大单一行业融资担保责任余额", "financing_guarantee_liabilities": "当期新增融资担保责任余额", "financial_guarantee_responsibility_balance": "融资担保责任余额", "risk_weighted_assets": "风险加权资产", "guaranteed_risk_reserve_balance": "担保风险准备金余额", "top_five_financing_guarantee_liabilities": "前五大被担保企业融资担保责任余额", "maximum_enterprise_financing_guarantee": "最大被担保企业融资担保责任余额", "guarantee_compensation_reserve": "担保赔偿准备金", "unexpired_liability_reserve": "未到期责任准备金", "counter_guarantee_amount": "反担保金额", "bank_credit_limit": "银行授信额度", "unused_credit_limit": "授信未使用额度", "number_cooperative_banks": "合作银行数量", "deposit_margin": "存入保证金", "save_margin": "存出保证金", "guaranteed_balance": "担保在保余额", "current_guarantee_business_income": "当期担保业务收入", "last_period_guarantee_business_income": "上期担保业务收入", "one_assets": "I类资产", "two_assets": "II类资产", "three_assets": "III类资产" } class FinancialIndicator(SpecObject): """财务指标""" guaranteed_insured_balance_growth_rate = ValidateAttr(field="guaranteed_insured_balance_growth_rate", type=[float, int], default=None) guaranteed_revenue_growth_rate = ValidateAttr(field="guaranteed_revenue_growth_rate", type=[float, int], default=None) growth_rate_of_total_assets = ValidateAttr(field="growth_rate_of_total_assets", type=[float, int], default=None) cash_assets_ratio = ValidateAttr(field="cash_assets_ratio", type=[float, int], default=None) current_ratio = ValidateAttr(field="current_ratio", type=[float, int], default=None) compensation_reserve_ratio = ValidateAttr(field="compensation_reserve_ratio", type=[float, int], default=None) compensation_rate = ValidateAttr(field="compensation_rate", type=[float, int], default=None) risk_reserve_adequacy_ratio = ValidateAttr(field="risk_reserve_adequacy_ratio", type=[float, int], default=None) single_customer_concentration = ValidateAttr(field="single_customer_concentration", type=[float, int], default=None) current_guarantee_compensation_rate = ValidateAttr(field="current_guarantee_compensation_rate", type=[float, int], default=None) current_compensation_recovery_rate = ValidateAttr(field="current_compensation_recovery_rate", type=[float, int], default=None) financing_guarantee_magnification = ValidateAttr(field="financing_guarantee_magnification", type=[float, int], default=None) industry_concentration = ValidateAttr(field="industry_concentration", type=[float, int], default=None) return_total_assets = ValidateAttr(field="return_total_assets", type=[float, int], default=None) operating_margin = ValidateAttr(field="operating_margin", type=[float, int], default=None) roe = ValidateAttr(field="roe", type=[float, int], default=None) actual_asset_liability_ratio = ValidateAttr(field="actual_asset_liability_ratio", type=[float, int], default=None) capital_adequacy_ratio = ValidateAttr(field="capital_adequacy_ratio", type=[float, int], default=None) paid_capital = ValidateAttr(field="paid_capital", type=[float, int], default=None) guarantee_business_income = ValidateAttr(field="guarantee_business_income", type=[float, int], default=None) cumulative_guarantee_compensation_rate = ValidateAttr(field="cumulative_guarantee_compensation_rate", type=[float, int], default=None) cumulative_compensation_recovery_rate = ValidateAttr(field="cumulative_compensation_recovery_rate", type=[float, int], default=None) risk_coverage_ratio = ValidateAttr(field="risk_coverage_ratio", type=[float, int], default=None) cash_asset_compensation_rate = ValidateAttr(field="cash_asset_compensation_rate", type=[float, int], default=None) margin_ratio = ValidateAttr(field="margin_ratio", type=[float, int], default=None) proportion_investment_business_income = ValidateAttr(field="proportion_investment_business_income", type=[float, int], default=None) investment_income_growth_rate = ValidateAttr(field="investment_income_growth_rate", type=[float, int], default=None) one_proportion_class_assets = ValidateAttr(field="one_proportion_class_assets", type=[float, int], default=None) customer_concentration = ValidateAttr(field="customer_concentration", type=[float, int], default=None) proportion_income_guarantee_business = ValidateAttr(field="proportion_income_guarantee_business", type=[float, int], default=None) two_proportion_class_assets = ValidateAttr(field="two_proportion_class_assets", type=[float, int], default=None) three_proportion_class_assets = ValidateAttr(field="three_proportion_class_assets", type=[float, int], default=None) fields_map = { "guaranteed_insured_balance_growth_rate": "担保在保余额增长率(%)", "guaranteed_revenue_growth_rate": "担保收入增长率(%)", "growth_rate_of_total_assets": "资产总额增长率(%)", "cash_assets_ratio": "现金类资产比率(%)", "current_ratio": "流动比率(%)", "compensation_reserve_ratio": "代偿准备金比率(%)", "compensation_rate": "代偿保障率(%)", "risk_reserve_adequacy_ratio": "风险准备金充足率(%)", "single_customer_concentration": "单一客户集中度(%)", "current_guarantee_compensation_rate": "当期担保代偿率(%)", "current_compensation_recovery_rate": "当期代偿回收率(%)", "financing_guarantee_magnification": "融资担保放大倍数(倍)", "industry_concentration": "行业集中度(%)", "return_total_assets": "总资产收益率(%)", "operating_margin": "营业利润率(%)", "roe": "净资产收益率(%)", "actual_asset_liability_ratio": "实际资产负债率(%)", "capital_adequacy_ratio": "资本充足率(%)", "paid_capital": "实收资本(亿元)", "guarantee_business_income": "担保业务收入(万元)", "cumulative_guarantee_compensation_rate": "近三年累计担保代偿率(%)", "cumulative_compensation_recovery_rate": "近三年累计代偿回收率(%)", "risk_coverage_ratio": "风险覆盖率(%)", "cash_asset_compensation_rate": "现金类资产代偿保障率(%)", "margin_ratio": "保证金比率(%)", "proportion_investment_business_income": "投资业务收入占比(%)", "investment_income_growth_rate": "投资收益增长率(%)", "one_proportion_class_assets": "I类资产占比(%)", "customer_concentration": "客户集中度(%)", "proportion_income_guarantee_business": "担保业务收入占比(%)", "two_proportion_class_assets": "II类资产占比(%)", "three_proportion_class_assets": "III类资产占比(%)" } cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str, default=None) report_period = ValidateAttr(field="report_period", type=str, default=None) balance_sheet = ValidateAttr(field="balance_sheet", type=BalanceSheet, default=None) income_sheet = ValidateAttr(field="income_sheet", type=IncomeSheet, default=None) appendix_sheet = ValidateAttr(field="appendix_sheet", type=AppendixSheet, default=None) financial_indicator = ValidateAttr(field="financial_indicator", type=FinancialIndicator, default=None) fields_map = { "cid": "企业ID", "company_name": "企业名称", "report_period": "报告期", "balance_sheet": "资产负债表", "income_sheet": "利润表", "appendix_sheet": "补充数据表", "financial_indicator": "财务指标" } class CustomerInfo(SpecObject): """客户信息""" cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) report_period = ValidateAttr(field="report_period", type=str) client_name = ValidateAttr(field="client_name", type=str) guarantee_type = ValidateAttr(field="guarantee_type", type=str) balance_under_insurance = ValidateAttr(field="balance_under_insurance", type=[float, int]) financing_guarantee_balance = ValidateAttr(field="financing_guarantee_balance", type=[float, int]) guarantee_start_date = ValidateAttr(field="guarantee_start_date", func=Validate.date_format) guarantee_end_date = ValidateAttr(field="guarantee_end_date", func=Validate.date_format) fields_map = { "cid": "企业ID", "company_name": "企业名称", "report_period": "报告期", "client_name": "客户名称", "guarantee_type": "担保类型", "balance_under_insurance": "在保余额", "financing_guarantee_balance": "融资担保责任余额", "guarantee_start_date": "担保起始日", "guarantee_end_date": "担保截止日" } class RegionalDistribution(SpecObject): """区域分布""" cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) report_period = ValidateAttr(field="report_period", type=str) region = ValidateAttr(field="region", type=str) year_end_insured_balance = ValidateAttr(field="year_end_insured_balance", type=[float, int]) year_end_insured_liability_balance = ValidateAttr(field="year_end_insured_balance", type=[float, int]) insured_balance_newly_added = ValidateAttr(field="insured_balance_newly_added", type=[float, int]) insured_liability_newly_added = ValidateAttr(field="insured_liability_newly_added", type=[float, int]) fields_map = { "cid": "企业ID", "company_name": "企业名称", "report_period": "报告期", "region": "地区", "year_end_insured_balance": "年末在保余额", "year_end_insured_liability_balance": "年末在保责任余额", "insured_balance_newly_added": "当年新增在保余额", "insured_liability_newly_added": "当年新增在保责任余额" } class IndustryDistribution(SpecObject): """行业分布""" cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) report_period = ValidateAttr(field="report_period", type=str) industry = ValidateAttr(field="industry", type=str) year_end_insured_balance = ValidateAttr(field="year_end_insured_balance", type=[float, int]) year_end_insured_liability_balance = ValidateAttr(field="year_end_insured_balance", type=[float, int]) insured_balance_newly_added = ValidateAttr(field="insured_balance_newly_added", type=[float, int]) insured_liability_newly_added = ValidateAttr(field="insured_liability_newly_added", type=[float, int]) fields_map = { "cid": "企业ID", "company_name": "企业名称", "report_period": "报告期", "industry": "所属行业", "year_end_insured_balance": "年末在保余额", "year_end_insured_liability_balance": "年末在保责任余额", "insured_balance_newly_added": "当年新增在保余额", "insured_liability_newly_added": "当年新增在保责任余额" } class GuaranteedBalanceDistribution(SpecObject): """担保余额分布""" class GuaranteeBalance(SpecObject): """担保金额相关""" one_million = ValidateAttr(field="one_million", type=int) five_million = ValidateAttr(field="five_million", type=int) ten_million = ValidateAttr(field="ten_million", type=int) thirty_million = ValidateAttr(field="thirty_million", type=int) fifty_million = ValidateAttr(field="fifty_million", type=int) eighty_million = ValidateAttr(field="eighty_million", type=int) one_hundred_million = ValidateAttr(field="one_hundred_million", type=int) more_than_one_hundred_million = ValidateAttr(field="more_than_one_hundred_million", type=int) total = ValidateAttr(field="total", type=int) fields_map = { "one_million": "金额<=100w", "five_million": "100w<金额<=500w", "ten_million": "500w<金额<=1000w", "thirty_million": "1000w<金额<=3000w", "fifty_million": "3000w<金额<=5000w", "eighty_million": "5000w<金额<=8000w", "one_hundred_million": "8000w<金额<=10000w", "more_than_one_hundred_million": "金额>10000w", "total": "合计" } cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) report_period = ValidateAttr(field="report_period", type=str) guarantee_account = ValidateAttr(field="guaranteed_account", type=GuaranteeBalance) guarantee_number = ValidateAttr(field="guaranteed_number", type=GuaranteeBalance) guarantee_liability_balance = ValidateAttr(field="guarantee_liability_balance", type=GuaranteeBalance) fields_map = { "cid": "企业ID", "company_name": "企业名称", "report_period": "报告期", "guaranteed_account": "担保户数", "guaranteed_number": "担保笔数", "guarantee_liability_balance": "担保责任余额" } class RatingRecord(SpecObject): """评级记录""" cid = ValidateAttr(field="cid", type=str) company_name = ValidateAttr(field="company_name", type=str) rid = ValidateAttr(field="rid", type=str) level = ValidateAttr(field="level", type=str) rating_date = ValidateAttr(field="rating_date", func=Validate.date_format) rating_report = ValidateAttr(field="rating_report", type=str) fields_map = { "cid": "企业ID", "company_name": "企业名称", "rid": "评级ID", "level": "信用等级", "rating_date": "评级日期", "rating_report": "评级报告" }